Examples of ClassElement


Examples of com.google.dart.engine.element.ClassElement

   * @return {@code true} if and only if a hint code is generated on the passed node
   * @see HintCode#OVERRIDE_EQUALS_BUT_NOT_HASH_CODE
   */
  @SuppressWarnings("unused")
  private boolean checkForOverrideEqualsButNotHashCode(ClassDeclaration node) {
    ClassElement classElement = node.getElement();
    if (classElement == null) {
      return false;
    }
    MethodElement equalsOperatorMethodElement = classElement.getMethod(TokenType.EQ_EQ.getLexeme());
    if (equalsOperatorMethodElement != null) {
      PropertyAccessorElement hashCodeElement = classElement.getGetter(HASHCODE_GETTER_NAME);
      if (hashCodeElement == null) {
        errorReporter.reportErrorForNode(
            HintCode.OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
            node.getName(),
            classElement.getDisplayName());
        return true;
      }
    }
    return false;
  }
View Full Code Here

Examples of com.google.dart.engine.element.ClassElement

   * @see #computeLongestInheritancePathToObject(Type)
   * @see #getLeastUpperBound(Type)
   */
  private static int computeLongestInheritancePathToObject(InterfaceType type, int depth,
      HashSet<ClassElement> visitedClasses) {
    ClassElement classElement = type.getElement();
    // Object case
    if (classElement.getSupertype() == null || visitedClasses.contains(classElement)) {
      return depth;
    }
    int longestPath = 1;
    try {
      visitedClasses.add(classElement);
      InterfaceType[] superinterfaces = classElement.getInterfaces();
      int pathLength;
      if (superinterfaces.length > 0) {
        // loop through each of the superinterfaces recursively calling this method and keeping track
        // of the longest path to return
        for (InterfaceType superinterface : superinterfaces) {
          pathLength = computeLongestInheritancePathToObject(
              superinterface,
              depth + 1,
              visitedClasses);
          if (pathLength > longestPath) {
            longestPath = pathLength;
          }
        }
      }
      // finally, perform this same check on the super type
      // TODO(brianwilkerson) Does this also need to add in the number of mixin classes?
      InterfaceType supertype = classElement.getSupertype();
      pathLength = computeLongestInheritancePathToObject(supertype, depth + 1, visitedClasses);
      if (pathLength > longestPath) {
        longestPath = pathLength;
      }
    } finally {
View Full Code Here

Examples of com.google.dart.engine.element.ClassElement

    return super.visitBinaryExpression(node);
  }

  @Override
  public Void visitClassDeclaration(ClassDeclaration node) {
    ClassElement element = node.getElement();
    enterScope(element);
    try {
      recordElementDefinition(element, IndexConstants.DEFINES_CLASS);
      {
        ExtendsClause extendsClause = node.getExtendsClause();
        if (extendsClause != null) {
          TypeName superclassNode = extendsClause.getSuperclass();
          recordSuperType(superclassNode, IndexConstants.IS_EXTENDED_BY);
        } else {
          InterfaceType superType = element.getSupertype();
          if (superType != null) {
            ClassElement objectElement = superType.getElement();
            recordRelationship(
                objectElement,
                IndexConstants.IS_EXTENDED_BY,
                createLocationFromOffset(node.getName().getOffset(), 0));
          }
View Full Code Here

Examples of com.google.dart.engine.element.ClassElement

    }
  }

  @Override
  public Void visitClassTypeAlias(ClassTypeAlias node) {
    ClassElement element = node.getElement();
    enterScope(element);
    try {
      recordElementDefinition(element, IndexConstants.DEFINES_CLASS_ALIAS);
      {
        TypeName superclassNode = node.getSuperclass();
View Full Code Here

Examples of org.openide.src.ClassElement

     SourceCookie sourcecookie = (SourceCookie)dataobject.getCookie(SourceCookie.class);
     if(sourcecookie == null)
        {
          // when can this option raise up     
        }  
     ClassElement aclasselement[] = sourcecookie.getSource().getClasses();
     try
       {
          if(aclasselement == null || aclasselement.length == 0)
            {
             // what should we do, if the template does not contain a class
            }else
                { //we have to aquire the innner class
                  original_outerclass = (ClassElement) aclasselement[0].clone();
                  customized_outerclass = (ClassElement) aclasselement[0].clone();
                  ClassElement classelement[] = original_outerclass.getClasses() ;
                  ClassElement classelement1[] = customized_outerclass.getClasses() ;
                  original_innerclass = classelement[0];
                  customized_innerclass = classelement1[0];
                  //now we have the all the classes
               
       } catch(Exception e){}
View Full Code Here

Examples of org.tinyuml.draw.ClassElement

   * Tests the creation of an Association.
   */
  public void testCreateAssociation() {
    mockElementFactory.expects(atLeastOnce()).method("create").
      with(eq(ElementType.CLASS)).will(returnValue(clss));
    ClassElement class1 = factory.createClass();
    ClassElement class2 = factory.createClass();

    mockElementFactory.expects(atLeastOnce()).method("create").
      with(eq(ElementType.DEPENDENCY)).will(returnValue(assoc));

    Association conn = (Association) factory.createAssociation(class1, class2);
View Full Code Here

Examples of org.tinyuml.draw.ClassElement

   * Tests the creation of a note connection.
   */
  public void testCreateNoteConnection() {
    mockElementFactory.expects(atLeastOnce()).method("create").
      with(eq(ElementType.CLASS)).will(returnValue(clss));
    ClassElement clss = factory.createClass();
    NoteElement note = factory.createNote();
    NoteConnection conn = (NoteConnection)
      factory.createNoteConnection(clss, note);
    assertNull(conn.getModelElement());
    assertEquals(clss, conn.getNode0());
View Full Code Here

Examples of org.tinyuml.draw.ClassElement

  @Override
  protected void setUp() {
    mockMainCompartment.expects(once()).method("setParent");
    mockOpCompartment.expects(once()).method("setParent");
    mockMainCompartment.expects(once()).method("addLabel");
    mockedElement = new ClassElement(umlclass,
      (Compartment) mockMainCompartment.proxy(),
      (Compartment) mockOpCompartment.proxy());
  }
View Full Code Here

Examples of org.tinyuml.draw.ClassElement

    int shapeId = Integer.valueOf(attributes.getValue("id"));
    Node shape = null;

    NamedElement elem = elementMap.get(elementId);
    if (elem instanceof UmlClass) {
      shape = new ClassElement((UmlClass) elem);
    } else if (elem instanceof UmlPackage) {
      shape = diagram.getElementFactory().createPackage((UmlPackage) elem);
    } else if (elem instanceof UmlComponent) {
      shape = new ComponentElement((UmlComponent) elem);
    }
View Full Code Here

Examples of org.tinyuml.draw.ClassElement

    int shapeId = Integer.valueOf(attributes.getValue("id"));
    Node shape = null;

    NamedElement elem = elementMap.get(elementId);
    if (elem instanceof UmlClass) {
      shape = new ClassElement((UmlClass) elem);
    } else if (elem instanceof UmlPackage) {
      shape = diagram.getElementFactory().createPackage((UmlPackage) elem);
    } else if (elem instanceof UmlComponent) {
      shape = new ComponentElement((UmlComponent) elem);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.