ASTNode clone0(AST target) { QualifiedType result = new QualifiedType(target); result.setSourceRange(getStartPosition(), getLength()); result.setQualifier((Type) ((ASTNode) getQualifier()).clone(target)); result.setName((SimpleName) ((ASTNode) getName()).clone(target)); return result; }
void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { // visit children in normal left to right reading order acceptChild(visitor, getQualifier()); if (this.ast.apiLevel >= AST.JLS8) { acceptChildren(visitor, this.annotations); } acceptChild(visitor, getName()); } visitor.endVisit(this); }
int treeSize() { return memSize() + (this.qualifier == null ? 0 : getQualifier().treeSize()) + (this.name == null ? 0 : getName().treeSize()); } }
/** * Creates and returns a new unparented qualified type node with * the given qualifier type and name. * * @param qualifier the qualifier type node * @param name the simple name being qualified * @return a new unparented qualified type node * @exception IllegalArgumentException if: * <ul> * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * </ul> * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 */ public QualifiedType newQualifiedType(Type qualifier, SimpleName name) { QualifiedType result = new QualifiedType(this); result.setQualifier(qualifier); result.setName(name); return result; }
@Override public void endVisit(QualifiedType node) { if (skipNode(node)) { return; } processSequential(node, node.getQualifier(), node.getName()); }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == QUALIFIER_PROPERTY) { if (get) { return getQualifier(); } else { setQualifier((Type) child); return null; } } if (property == NAME_PROPERTY) { if (get) { return getName(); } else { setName((SimpleName) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
/** * Returns whether the given node and the other object match. * <p> * The default implementation provided by this class tests whether the * other object is a node of the same type with structurally isomorphic * child subtrees. Subclasses may override this method as needed. * </p> * * @param node the node * @param other the other object, or <code>null</code> * @return <code>true</code> if the subtree matches, or * <code>false</code> if they do not match or the other object has a * different node type or is <code>null</code> * @since 3.1 */ public boolean match(QualifiedType node, Object other) { if (!(other instanceof QualifiedType)) { return false; } QualifiedType o = (QualifiedType) other; int level = node.getAST().apiLevel; return safeSubtreeMatch(node.getQualifier(), o.getQualifier()) && (level >= AST.JLS8_INTERNAL ? safeSubtreeListMatch(node.annotations(), o.annotations()) : true) && safeSubtreeMatch(node.getName(), o.getName()); }
@Override public boolean visit(QualifiedType node) { addName(node.getName()); return false; }
void accept0(ASTVisitor visitor) { boolean visitChildren = visitor.visit(this); if (visitChildren) { // visit children in normal left to right reading order acceptChild(visitor, getQualifier()); acceptChild(visitor, getName()); } visitor.endVisit(this); }
simpleName.setSourceRange(start, end - start + 1); recordPendingNameScopeResolution(simpleName); QualifiedType qualifiedType = new QualifiedType(this.ast); qualifiedType.setQualifier(currentType); qualifiedType.setName(simpleName); start = currentType.getStartPosition(); end = simpleName.getStartPosition() + simpleName.getLength() - 1; qualifiedType.setSourceRange(start, end - start + 1); if (typeAnnotations != null && (annotations = typeAnnotations[i]) != null) { int nextPosition = annotateType(qualifiedType, annotations);
public boolean visit(QualifiedType qualifiedType) { Type left= qualifiedType.getQualifier(); if (left instanceof SimpleType) result[0]= (SimpleType)left; else left.accept(this); return false; } };
/** * Returns the name part of this qualified type. * * @return the name being qualified */ public SimpleName getName() { if (this.name == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.name == null) { preLazyInit(); this.name = new SimpleName(this.ast); postLazyInit(this.name, NAME_PROPERTY); } } } return this.name; }
public void endVisit(QualifiedType node) { if (skipNode(node)) return; processSequential(node, node.getQualifier(), node.getName()); }
final ASTNode internalGetSetChildProperty(ChildPropertyDescriptor property, boolean get, ASTNode child) { if (property == QUALIFIER_PROPERTY) { if (get) { return getQualifier(); } else { setQualifier((Type) child); return null; } } if (property == NAME_PROPERTY) { if (get) { return getName(); } else { setName((SimpleName) child); return null; } } // allow default implementation to flag the error return super.internalGetSetChildProperty(property, get, child); }
/** * Returns whether the given node and the other object match. * <p> * The default implementation provided by this class tests whether the * other object is a node of the same type with structurally isomorphic * child subtrees. Subclasses may override this method as needed. * </p> * * @param node the node * @param other the other object, or <code>null</code> * @return <code>true</code> if the subtree matches, or * <code>false</code> if they do not match or the other object has a * different node type or is <code>null</code> * @since 3.1 */ public boolean match(QualifiedType node, Object other) { if (!(other instanceof QualifiedType)) { return false; } QualifiedType o = (QualifiedType) other; int level = node.getAST().apiLevel; return safeSubtreeMatch(node.getQualifier(), o.getQualifier()) && (level >= AST.JLS8 ? safeSubtreeListMatch(node.annotations(), o.annotations()) : true) && safeSubtreeMatch(node.getName(), o.getName()); }
@Override public boolean visit(QualifiedType node) { buffer.append(node.getName().getIdentifier()); return false; } @Override
/** * Creates and returns a new unparented qualified type node with * the given qualifier type and name. * * @param qualifier the qualifier type node * @param name the simple name being qualified * @return a new unparented qualified type node * @exception IllegalArgumentException if: * <ul> * <li>the node belongs to a different AST</li> * <li>the node already has a parent</li> * </ul> * @exception UnsupportedOperationException if this operation is used in * a JLS2 AST * @since 3.1 */ public QualifiedType newQualifiedType(Type qualifier, SimpleName name) { QualifiedType result = new QualifiedType(this); result.setQualifier(qualifier); result.setName(name); return result; }
simpleName.setSourceRange(start, end - start + 1); recordPendingNameScopeResolution(simpleName); QualifiedType qualifiedType = new QualifiedType(this.ast); qualifiedType.setQualifier(currentType); qualifiedType.setName(simpleName); start = currentType.getStartPosition(); end = simpleName.getStartPosition() + simpleName.getLength() - 1; qualifiedType.setSourceRange(start, end - start + 1); if (typeAnnotations != null && (annotations = typeAnnotations[i]) != null) { int nextPosition = annotateType(qualifiedType, annotations);
@Override public boolean visit(QualifiedType node) { doVisitNode(node.getQualifier()); visitAnnotations(node); return false; }
/** * Returns the name part of this qualified type. * * @return the name being qualified */ public SimpleName getName() { if (this.name == null) { // lazy init must be thread-safe for readers synchronized (this) { if (this.name == null) { preLazyInit(); this.name = new SimpleName(this.ast); postLazyInit(this.name, NAME_PROPERTY); } } } return this.name; }