1   
2   
3   
4   
5   
6   
7   
8   
9   
10  
11  
12  
13  
14  
15  
16  
17  
18  package org.apache.commons.jexl.parser;
19  
20  /***
21   * All AST nodes must implement this interface. It provides basic machinery for
22   * constructing the parent and child relationships between nodes.
23   */
24  public interface Node {
25  
26      /***
27       * This method is called after the node has been made the current node. It
28       * indicates that child nodes can now be added to it.
29       */
30       void jjtOpen();
31  
32      /***
33       * This method is called after all the child nodes have been added.
34       */
35       void jjtClose();
36  
37      /***
38       * This pair of methods are used to inform the node of its parent.
39       * @param n the parent node.
40       */
41       void jjtSetParent(Node n);
42  
43       /***
44        * Gets the parent node.
45        * @return the parent to this node.
46        */
47       Node jjtGetParent();
48  
49      /***
50       * This method tells the node to add its argument to the node's list of
51       * children.
52       * @param n the child node to add
53       * @param i the index to add it at.
54       */
55       void jjtAddChild(Node n, int i);
56  
57      /***
58       * This method returns a child node. The children are numbered from zero,
59       * left to right.
60       * @param i the index of the child to get.
61       * @return the child at the given index.
62       */
63       Node jjtGetChild(int i);
64  
65      /*** 
66       * Gets the number of children the node has.
67       * @return the number of children the node has. 
68       */
69       int jjtGetNumChildren();
70  
71      /***
72       *  Accept the visitor.
73       *  @param data arbitrary data.
74       *  @param visitor the visitor.
75       *  @return the result of the visit. 
76       */
77       Object jjtAccept(ParserVisitor visitor, Object data);
78  }