/** * Return the depth of the node in the parse tree. The depth is ZERO (0) if * the node does not have a parent. * * @param node * The node. * @return The depth of that node. */ final protected int depth(Node node) { int i = 0; while ((node = node.jjtGetParent()) != null) { i++; } return i; }
/** * Return the depth of the node in the parse tree. The depth is ZERO (0) if * the node does not have a parent. * * @param node * The node. * @return The depth of that node. */ final protected int depth(Node node) { int i = 0; while ((node = node.jjtGetParent()) != null) { i++; } return i; }
private Node getParentContainer(Node node) { if (node instanceof ASTOperationContainer || node == null) { return node; } return getParentContainer(node.jjtGetParent()); }
private Node getParentContainer(Node node) { if (node instanceof ASTOperationContainer || node == null) { return node; } return getParentContainer(node.jjtGetParent()); }
/** * @param x the node to be tested * @return true if provide node is ASTConstruct or has ASTConstruct in any of transitive parents. */ private boolean isInConstructClause(Node x) { if (x == null) { return false; } else if (x instanceof ASTConstruct) { return true; } else { return isInConstructClause(x.jjtGetParent()); } }
/** * @param x the node to be tested * @return true if provide node is ASTConstruct or has ASTConstruct in any of transitive parents. */ private boolean isInConstructClause(Node x) { if (x == null) { return false; } else if (x instanceof ASTConstruct) { return true; } else { return isInConstructClause(x.jjtGetParent()); } }
/** * Returns the enclosing ASTGraphGraphPattern ancestor-or-self for the * given node, or null if none exists. * * @param node node at which to start lookup * @return first enclosing {@link ASTGraphGraphPattern} ancestor, if any, * null otherwise */ protected ASTGraphGraphPattern firstASTGraphGraphAncestor(Node node) { if (node==null) return null; if (node instanceof ASTGraphGraphPattern) return (ASTGraphGraphPattern)node; return firstASTGraphGraphAncestor(node.jjtGetParent()); } }
/** * Returns the enclosing ASTGraphGraphPattern ancestor-or-self for the * given node, or null if none exists. * * @param node node at which to start lookup * @return first enclosing {@link ASTGraphGraphPattern} ancestor, if any, * null otherwise */ protected ASTGraphGraphPattern firstASTGraphGraphAncestor(Node node) { if (node==null) return null; if (node instanceof ASTGraphGraphPattern) return (ASTGraphGraphPattern)node; return firstASTGraphGraphAncestor(node.jjtGetParent()); } }