Пример #1
0
 public IASTNode getChildById(int id) {
   for (int i = 0; i < children.size(); i++) {
     IASTNode child = children.get(i);
     if (child.getId() == id) {
       return child;
     }
   }
   return null;
 }
Пример #2
0
 /** get specified type ancestor node */
 public ASTNode getAncestor(int id) {
   ASTNode ret = null;
   IASTNode pNode = parent;
   while (pNode != null) {
     if (pNode.getId() == id) {
       ret = (ASTNode) pNode;
       break;
     }
     pNode = pNode.getParent();
   }
   return ret;
 }
Пример #3
0
 public ASTNode(IASTNode p, int id) {
   parent = p;
   this.id = id;
   if (p != null) {
     p.addChild(this);
   }
 }
Пример #4
0
 public ScAcross_aspect(ASTNode node) {
   super(node);
   assert (node.getId() == ASTACROSS_ASPECT);
   int i;
   for (i = 0; i < node.getChildrenNum(); i++) {
     IASTNode c = node.getChild(i);
     int id = c.getId();
     switch (id) {
       case ASTIDENTIFIER_LIST:
         idlist = new ScIdentifier_list((ASTNode) c);
         break;
       case ASTTOLERANCE_ASPECT:
         tolerance_aspect = new ScTolerance_aspect((ASTNode) c);
         break;
       case ASTEXPRESSION:
         expression = new ScExpression((ASTNode) c);
         break;
       default:
         break;
     }
   }
 }