@Override public P migrateAllFrom(RawListAccessor<?, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); addToEnd(n); } return returnAsParent; }
@CopyMethod static boolean isVariableDeclarationBased(For self) { return self.rawVariableDeclaration() != null && self.rawExpressionInits().isEmpty(); }
@Override public P migrateAllFrom(RawListAccessor<?, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); addToEnd(n); } return returnAsParent; }
@Override public P migrateAllFrom(RawListAccessor<?, ?> otherList) { while (!otherList.isEmpty()) { AbstractNode n = (AbstractNode) otherList.first(); otherList.remove(n); addToEnd(n); } return returnAsParent; }
@CopyMethod static boolean isVariableDeclarationBased(For self) { return self.rawVariableDeclaration() != null && self.rawExpressionInits().isEmpty(); }
@CopyMethod static boolean isVariableDeclarationBased(For self) { return self.rawVariableDeclaration() != null && self.rawExpressionInits().isEmpty(); }
@Override public boolean visitCompilationUnit(CompilationUnit node) { formatter.buildBlock(node); if (node.rawPackageDeclaration() != null) { visit(node.rawPackageDeclaration()); if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); } visitAll(node.rawImportDeclarations(), "", "", ""); if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); visitAll(node.rawTypeDeclarations(), "\n", "", ""); formatter.closeBlock(); return true; }
@Override public boolean visitCompilationUnit(CompilationUnit node) { formatter.buildBlock(node); if (node.rawPackageDeclaration() != null) { visit(node.rawPackageDeclaration()); if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); } visitAll(node.rawImportDeclarations(), "", "", ""); if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); visitAll(node.rawTypeDeclarations(), "\n", "", ""); formatter.closeBlock(); return true; }
@Override public boolean visitCompilationUnit(CompilationUnit node) { formatter.buildBlock(node); if (node.rawPackageDeclaration() != null) { visit(node.rawPackageDeclaration()); if (!node.rawTypeDeclarations().isEmpty() || !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); } visitAll(node.rawImportDeclarations(), "", "", ""); if (!node.rawTypeDeclarations().isEmpty() && !node.rawImportDeclarations().isEmpty()) formatter.verticalSpace(); visitAll(node.rawTypeDeclarations(), "\n", "", ""); formatter.closeBlock(); return true; }
public boolean typeIsAlsoLegalAsExpression(Node type) { if (!(type instanceof TypeReference)) return true; TypeReference tr = (TypeReference)type; if (tr.astArrayDimensions() > 0) return false; if (tr.isPrimitive() || tr.isVoid()) return false; for (Node part : tr.rawParts()) { if (part instanceof TypeReferencePart) { if (!((TypeReferencePart)part).rawTypeArguments().isEmpty()) return false; } } return true; } }
public boolean typeIsAlsoLegalAsExpression(Node type) { if (!(type instanceof TypeReference)) return true; TypeReference tr = (TypeReference)type; if (tr.astArrayDimensions() > 0) return false; if (tr.isPrimitive() || tr.isVoid()) return false; for (Node part : tr.rawParts()) { if (part instanceof TypeReferencePart) { if (!((TypeReferencePart)part).rawTypeArguments().isEmpty()) return false; } } return true; } }
public boolean typeIsAlsoLegalAsExpression(Node type) { if (!(type instanceof TypeReference)) return true; TypeReference tr = (TypeReference)type; if (tr.astArrayDimensions() > 0) return false; if (tr.isPrimitive() || tr.isVoid()) return false; for (Node part : tr.rawParts()) { if (part instanceof TypeReferencePart) { if (!((TypeReferencePart)part).rawTypeArguments().isEmpty()) return false; } } return true; } }
private void visitAll0(String relation, RawListAccessor<?, ?> nodes, String separator, String prefix, String suffix, boolean suppress) { if (nodes.isEmpty()) return; append(prefix); boolean first = true; for (Node n : nodes) { if (!first) { append(separator); } first = false; formatter.nameNextElement(relation); if (suppress) formatter.startSuppressBlock(); visit(n); if (suppress) formatter.endSuppressBlock(); } append(suffix); }
@Override public boolean visitTypeVariable(TypeVariable node) { formatter.buildInline(node); visit(node.astName()); if (!node.rawExtending().isEmpty()) { formatter.space(); formatter.keyword("extends"); visitAll(node.rawExtending(), " & ", " ", ""); } formatter.closeInline(); return true; }
@Override public boolean visitTypeVariable(TypeVariable node) { formatter.buildInline(node); visit(node.astName()); if (!node.rawExtending().isEmpty()) { formatter.space(); formatter.keyword("extends"); visitAll(node.rawExtending(), " & ", " ", ""); } formatter.closeInline(); return true; }
@Override public boolean visitTypeVariable(TypeVariable node) { formatter.buildInline(node); visit(node.astName()); if (!node.rawExtending().isEmpty()) { formatter.space(); formatter.keyword("extends"); visitAll(node.rawExtending(), " & ", " ", ""); } formatter.closeInline(); return true; }
@Override public boolean visitEnumTypeBody(EnumTypeBody node) { formatter.buildBlock(node); formatter.append("{"); formatter.buildBlock(null); visitAll("constant", node.rawConstants(), ",\n", "", ""); if (!node.rawMembers().isEmpty()) { formatter.append(";"); formatter.verticalSpace(); } visitAll(node.rawMembers(), "\n", "", ""); formatter.closeBlock(); formatter.append("}"); formatter.closeBlock(); return true; }