protected AstNode() { if (isNull()) { freeze(); } }
public final <T extends AstNode> void insertChildAfter(final AstNode previousSibling, final T child, final Role<T> role) { insertChildBefore( previousSibling == null || previousSibling.isNull() ? _firstChild : previousSibling._nextSibling, child, role ); }
public final <T extends AstNode> void insertChildAfter(final AstNode previousSibling, final T child, final Role<T> role) { insertChildBefore( previousSibling == null || previousSibling.isNull() ? _firstChild : previousSibling._nextSibling, child, role ); }
protected AstNode() { if (isNull()) { freeze(); } }
protected AstNode() { if (isNull()) { freeze(); } }
public final <T extends AstNode> void insertChildAfter(final AstNode previousSibling, final T child, final Role<T> role) { insertChildBefore( previousSibling == null || previousSibling.isNull() ? _firstChild : previousSibling._nextSibling, child, role ); }
String debugToString() { if (isNull()) { return "Null"; } final String text = StringUtilities.trimRight(getText())/*.replace("\t", "").replace("\n", " ")*/; return text.length() > 1000 ? text.substring(0, 97) + "..." : text; }
String debugToString() { if (isNull()) { return "Null"; } final String text = StringUtilities.trimRight(getText())/*.replace("\t", "").replace("\n", " ")*/; return text.length() > 1000 ? text.substring(0, 97) + "..." : text; }
String debugToString() { if (isNull()) { return "Null"; } final String text = StringUtilities.trimRight(getText())/*.replace("\t", "").replace("\n", " ")*/; return text.length() > 1000 ? text.substring(0, 97) + "..." : text; }
public final <T extends AstNode> void addChild(final T child, final Role<? extends T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
public final <T extends AstNode> void addChild(final T child, final Role<T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
public final <T extends AstNode> void addChild(final T child, final Role<T> role) { VerifyArgument.notNull(role, "role"); if (child == null || child.isNull()) { return; } verifyNotFrozen(); if (((AstNode)child)._parent != null) { throw new IllegalArgumentException("Node belongs to another tree."); } if (child.isFrozen()) { throw new IllegalArgumentException("Cannot add a frozen node."); } addChildUnsafe(child, role); }
public String getText(final JavaFormattingOptions options) { if (isNull()) { return StringUtilities.EMPTY; } final ITextOutput output = new PlainTextOutput(); final JavaOutputVisitor visitor = new JavaOutputVisitor(output, DecompilerSettings.javaDefaults()); acceptVisitor(visitor, null); return output.toString(); }
protected final <T extends AstNode> void setChildByRole(final Role<T> role, final T newChild) { final T oldChild = getChildByRole(role); if (oldChild.isNull()) { addChild(newChild, role); } else { oldChild.replaceWith(newChild); } }
public String getText(final JavaFormattingOptions options) { if (isNull()) { return StringUtilities.EMPTY; } final ITextOutput output = new PlainTextOutput(); final JavaOutputVisitor visitor = new JavaOutputVisitor(output, DecompilerSettings.javaDefaults()); acceptVisitor(visitor, null); return output.toString(); }
protected final <T extends AstNode> void setChildByRole(final Role<T> role, final T newChild) { final T oldChild = getChildByRole(role); if (oldChild.isNull()) { addChild(newChild, role); } else { oldChild.replaceWith(newChild); } }
protected final <T extends AstNode> void setChildByRole(final Role<T> role, final T newChild) { final T oldChild = getChildByRole(role); if (oldChild.isNull()) { addChild(newChild, role); } else { oldChild.replaceWith(newChild); } }
public String getText(final JavaFormattingOptions options) { if (isNull()) { return StringUtilities.EMPTY; } final ITextOutput output = new PlainTextOutput(); final JavaOutputVisitor visitor = new JavaOutputVisitor(output, DecompilerSettings.javaDefaults()); acceptVisitor(visitor, null); return output.toString(); }
private static boolean isStaticContext(final AstNode node) { for (AstNode n = node; n != null && !n.isNull(); n = n.getParent()) { if (n instanceof MethodDeclaration) { final MethodDefinition method = n.getUserData(Keys.METHOD_DEFINITION); if (method != null) { return method.isStatic(); } } if (n instanceof TypeDeclaration) { final TypeDefinition type = n.getUserData(Keys.TYPE_DEFINITION); if (type != null) { return type.isStatic(); } } } return false; }
protected Object resolveName(final AstNode location, final String name, final NameResolveMode mode) { if (location == null || location.isNull() || name == null) { return null; } final NameResolveResult result; if (mode == NameResolveMode.TYPE) { result = JavaNameResolver.resolveAsType(name, location); } else { result = JavaNameResolver.resolve(name, location); } if (result.hasMatch() && !result.isAmbiguous()) { return first(result.getCandidates()); } return null; } }