示例#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();
 }
示例#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;
 }
示例#3
0
 static Node getPrev(Node node) {
   Node parent = node.jjtGetParent();
   int ii = getIndexInParent(node);
   return ii > 0 ? parent.jjtGetChild(ii - 1) : null;
 }
示例#4
0
 static Node getLastSibling(Node node) {
   Node parent = node.jjtGetParent();
   return parent.jjtGetChild(parent.jjtGetNumChildren() - 1);
 }
示例#5
0
 static Node getFirstSibling(Node node) {
   return node.jjtGetParent().jjtGetChild(0);
 }