001: /*
002: * Author: Mike Atkinson
003: *
004: * This software has been developed under the copyleft
005: * rules of the GNU General Public License. Please
006: * consult the GNU General Public License for more
007: * details about use and distribution of this software.
008: */
009: package net.sourceforge.jrefactory.ast;
010:
011: import net.sourceforge.jrefactory.parser.JavaParserVisitor;
012:
013: /**
014: * All AST nodes must implement this interface. It provides basic machinery for constructing the parent and child
015: * relationships between nodes.
016: *
017: * @author Mike Atkinson
018: * @since jRefactory 2.9.0, created October 16, 2003
019: */
020: public interface Node {
021: /**
022: * Gets the beginLine attribute of the Node.
023: *
024: * @return The beginLine value
025: * @since v 1.0
026: */
027: int getBeginLine();
028:
029: /**
030: * Gets the beginColumn attribute of the Node.
031: *
032: * @return The beginColumn value
033: * @since v 1.0
034: */
035: int getBeginColumn();
036:
037: /**
038: * Gets the endLine attribute of the Node.
039: *
040: * @return The endLine value
041: * @since v 1.0
042: */
043: int getEndLine();
044:
045: /**
046: * Gets the endColumn attribute of the Node.
047: *
048: * @return The endColumn value
049: * @since v 1.0
050: */
051: int getEndColumn();
052:
053: /**
054: * This method is called after the node has been made the current node. It indicates that child nodes can now be
055: * added to it.
056: *
057: * @since v 1.0
058: */
059: void jjtOpen();
060:
061: /**
062: * This method is called after all the child nodes have been added.
063: *
064: * @since v 1.0
065: */
066: void jjtClose();
067:
068: /**
069: * This pair of methods are used to inform the node of its parent.
070: *
071: * @param parentNode Description of Parameter
072: * @since v 1.0
073: */
074: void jjtSetParent(Node parentNode);
075:
076: /**
077: * Description of the Method
078: *
079: * @return Description of the Returned Value
080: * @since v 1.0
081: */
082: Node jjtGetParent();
083:
084: /**
085: * This method tells the node to add its argument to the node's list of children.
086: *
087: * @param childNode Description of Parameter
088: * @param atIndex Description of Parameter
089: * @since v 1.0
090: */
091: void jjtAddChild(Node childNode, int atIndex);
092:
093: /**
094: * This method tells the node to add its argument to the node's list of children.<p>
095: *
096: * Same as jjtAddChild(n, 0);
097: *
098: * @param childNode Description of Parameter
099: * @since v 1.0
100: */
101: void jjtAddFirstChild(Node childNode);
102:
103: /**
104: * Description of the Method
105: *
106: * @param childNode Description of Parameter
107: * @param atIndex Description of Parameter
108: * @since v 1.0
109: */
110: void jjtInsertChild(Node childNode, int atIndex);
111:
112: /**
113: * Description of the Method
114: *
115: * @param atIndex Description of Parameter
116: * @since v 1.0
117: */
118: void jjtDeleteChild(int atIndex);
119:
120: /**
121: * This method returns a child node. The children are numbered from zero, left to right.
122: *
123: * @param atIndex Description of Parameter
124: * @return Description of the Returned Value
125: * @since v 1.0
126: */
127: Node jjtGetChild(int atIndex);
128:
129: /**
130: * This method returns a child node. The children are numbered from zero, left to right.<p>
131: *
132: * Same as jjtGetFirstChild();
133: *
134: * @return Description of the Returned Value
135: * @since v 1.0
136: */
137: Node jjtGetFirstChild();
138:
139: /**
140: * Return the number of children the node has.
141: *
142: * @return Description of the Returned Value
143: * @since v 1.0
144: */
145: int jjtGetNumChildren();
146:
147: /**
148: * Accept the visitor.
149: *
150: * @param visitor Description of Parameter
151: * @param data Description of Parameter
152: * @return Description of the Returned Value
153: * @since v 1.0
154: */
155: Object jjtAccept(JavaParserVisitor visitor, Object data);
156: }
|