@Override public P addAfter(Node ref, T... node) { return raw.addAfter(ref, node); }
@Override public P addBefore(Node ref, T... node) { return raw.addBefore(ref, node); }
public Node createPackageDeclaration(List<Node> annotations, Node head, List<Node> tail) { PackageDeclaration decl = new PackageDeclaration(); if (annotations != null) for (Node n : annotations) if (n != null) decl.rawAnnotations().addToEnd(n); if (head != null) decl.rawParts().addToEnd(head); if (tail != null) for (Node n : tail) if (n != null) decl.rawParts().addToEnd(n); return posify(decl); }
public Node createEnumBody(Node head, List<Node> tail, Node typeBody) { EnumTypeBody body = new EnumTypeBody(); if (head != null) body.rawConstants().addToEnd(head); if (tail != null) for (Node n : tail) body.rawConstants().addToEnd(n); if (typeBody instanceof TypeBody) { body.rawMembers().migrateAllFrom(((TypeBody)typeBody).rawMembers()); } return posify(body); }
Node updateNode = toTree(upd.getExpression()); setConversionPositionInfo(updateNode, "exec", getPosition(upd)); f.rawUpdates().addToEnd(updateNode); Block tmp = new Block(); fillList(initializers, tmp.rawContents(), FlagKey.VARDEF_IS_DEFINITION); Node varDecl = tmp.rawContents().first(); if (varDecl != null) varDecl.unparent(); f.rawVariableDeclaration(varDecl); Node initNode = toTree(((JCExpressionStatement) init).getExpression()); setConversionPositionInfo(initNode, "exec", getPosition(init)); f.rawExpressionInits().addToEnd(initNode); } else { f.rawExpressionInits().addToEnd(toTree(init));
@Override public P addToStart(T... node) { return raw.addToStart(node); }
@Override public T last() { Node r = raw.last(); if (!tClass.isInstance(r)) return null; return tClass.cast(r); }
@Override public T first() { Node r = raw.first(); if (!tClass.isInstance(r)) return null; return tClass.cast(r); }
@Override public void remove(Node source) throws NoSuchElementException { if (source == null) throw new NullPointerException(); if (source.getParent() != parent) throw new NoSuchElementException(listName + " is not the parent of: " + source); if (!raw.remove(source)) { throw new NoSuchElementException(listName + " does not contain: " + source); } }
public Node setArrayDimensionsOfType(Node value, List<String> bracketPairs) { //TODO test a public int foo() [] {} method declaration. int arrayDims = bracketPairs == null ? 0 : bracketPairs.size(); if (arrayDims == 0) return value; TypeReference ref = new TypeReference().astArrayDimensions(arrayDims); if (value instanceof TypeReference) { TypeReference orig = (TypeReference)value; ref.astWildcard(orig.astWildcard()); ref.rawParts().migrateAllFrom(orig.rawParts()); } return posify(ref); }
@Override public boolean contains(Node source) { return raw.contains(source); }
public Node createEnumBody(Node head, List<Node> tail, Node typeBody) { EnumTypeBody body = new EnumTypeBody(); if (head != null) body.rawConstants().addToEnd(head); if (tail != null) for (Node n : tail) body.rawConstants().addToEnd(n); if (typeBody instanceof TypeBody) { body.rawMembers().migrateAllFrom(((TypeBody)typeBody).rawMembers()); } return posify(body); }
Node updateNode = toTree(upd.getExpression()); setConversionPositionInfo(updateNode, "exec", getPosition(upd)); f.rawUpdates().addToEnd(updateNode); Block tmp = new Block(); fillList(initializers, tmp.rawContents(), FlagKey.VARDEF_IS_DEFINITION); Node varDecl = tmp.rawContents().first(); if (varDecl != null) varDecl.unparent(); f.rawVariableDeclaration(varDecl); Node initNode = toTree(((JCExpressionStatement) init).getExpression()); setConversionPositionInfo(initNode, "exec", getPosition(init)); f.rawExpressionInits().addToEnd(initNode); } else { f.rawExpressionInits().addToEnd(toTree(init));
@Override public P addToStart(T... node) { return raw.addToStart(node); }