Esempio n. 1
0
 static int getIndexInParent(Node node) {
   Node parent = node.jjtGetParent();
   for (int ii = 0; ii < parent.jjtGetNumChildren(); ii++) {
     if (parent.jjtGetChild(ii) == node) {
       return ii;
     }
   }
   throw new IllegalStateException();
 }
Esempio n. 2
0
 static Node getNext(Node node) {
   Node parent = node.jjtGetParent();
   int ii = getIndexInParent(node);
   return ii < parent.jjtGetNumChildren() - 1 ? parent.jjtGetChild(ii + 1) : null;
 }
Esempio n. 3
0
 static Node getPrev(Node node) {
   Node parent = node.jjtGetParent();
   int ii = getIndexInParent(node);
   return ii > 0 ? parent.jjtGetChild(ii - 1) : null;
 }
Esempio n. 4
0
 static Node getLastSibling(Node node) {
   Node parent = node.jjtGetParent();
   return parent.jjtGetChild(parent.jjtGetNumChildren() - 1);
 }
Esempio n. 5
0
 static Node getFirstSibling(Node node) {
   return node.jjtGetParent().jjtGetChild(0);
 }