public void visitDepthFirst(Node node){ process(node); for (Node child : node.getChildrenNodes()){ visitDepthFirst(child); } }
public CompilationUnit(PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types) { setPackage(pakage); setImports(imports); setTypes(types); }
public boolean isPositionedBefore(int line, int column){ if (line==ABSOLUTE_END_LINE) return true; if (getEndLine()<line){ return true; } else if (getEndLine()==line){ return getEndColumn()<column; } else { return false; } } }
public boolean contains(Node other){ if (getBeginLine()>other.getBeginLine()) return false; if (getBeginLine()==other.getBeginLine() && getBeginColumn()>other.getBeginColumn()) return false; if (getEndLine()<other.getEndLine()) return false; if (getEndLine()==other.getEndLine() && getEndColumn()<other.getEndColumn()) return false; return true; }
public PackageDeclaration(int beginLine, int beginColumn, int endLine, int endColumn, List<AnnotationExpr> annotations, NameExpr name) { super(beginLine, beginColumn, endLine, endColumn); setAnnotations(annotations); setName(name); }
public static boolean areInOrder(Node a, Node b){ return (a.getBeginLine()<b.getBeginLine()) || (a.getBeginLine()==b.getBeginLine() && a.getBeginColumn()<b.getBeginColumn() ); } }
public TypeParameter(final int beginLine, final int beginColumn, final int endLine, final int endColumn, final String name, final List<ClassOrInterfaceType> typeBound) { super(beginLine, beginColumn, endLine, endColumn); setName(name); setTypeBound(typeBound); }
/** walks up the tree until reaching the CompilationUnit. */ private CompilationUnit getCompilationUnit(Node n) { Node unit = n; while (!(unit instanceof CompilationUnit) && unit != null) { unit = unit.getParentNode(); } return (CompilationUnit) unit; }
/** * Sets the list of imports of this compilation unit. The list is initially * <code>null</code>. * * @param imports * the list of imports */ public void setImports(List<ImportDeclaration> imports) { this.imports = imports; setAsParentNodeOf(this.imports); }
/** * @param annotations * the annotations to set */ public void setAnnotations(List<AnnotationExpr> annotations) { this.annotations = annotations; setAsParentNodeOf(this.annotations); }
protected void setAsParentNodeOf(Node childNode) { if(childNode != null){ childNode.setParentNode(this); } }
/** * Sets the list o types. * * @param typeBound * the typeBound to set */ public void setTypeBound(final List<ClassOrInterfaceType> typeBound) { this.typeBound = typeBound; setAsParentNodeOf(typeBound); }
protected <T extends Node> T cloneNodes(T _node, Object _arg) { if (_node == null) return null; Node r = _node.accept(this, _arg); if (r == null) return null; return (T) r; } }
public CompilationUnit(int beginLine, int beginColumn, int endLine, int endColumn, PackageDeclaration pakage, List<ImportDeclaration> imports, List<TypeDeclaration> types) { super(beginLine, beginColumn, endLine, endColumn); setPackage(pakage); setImports(imports); setTypes(types); }
public PackageDeclaration(List<AnnotationExpr> annotations, NameExpr name) { setAnnotations(annotations); setName(name); }
public boolean isPositionedAfter(int line, int column){ if (line==ABSOLUTE_BEGIN_LINE) return true; if (getBeginLine()>line){ return true; } else if (getBeginLine()==line){ return getBeginColumn()>column; } else { return false; } }
public TypeParameter(final String name, final List<ClassOrInterfaceType> typeBound) { setName(name); setTypeBound(typeBound); }
/** * Sets or clear the package declarations of this compilation unit. * * @param pakage * the pakage declaration to set or <code>null</code> to default * package */ public void setPackage(PackageDeclaration pakage) { this.pakage = pakage; setAsParentNodeOf(this.pakage); }
/** * Sets the name of this package declaration. * * @param name * the name to set */ public void setName(NameExpr name) { this.name = name; setAsParentNodeOf(this.name); }
/** * Sets the list of types declared in this compilation unit. * * @param types * the lis of types */ public void setTypes(List<TypeDeclaration> types) { this.types = types; setAsParentNodeOf(this.types); } }