01: /*
02: * Copyright Aduna (http://www.aduna-software.com/) (c) 1997-2006.
03: *
04: * Licensed under the Aduna BSD-style license.
05: */
06: package org.openrdf.query.parser.serql.ast;
07:
08: /*
09: * All AST nodes must implement this interface. It provides basic machinery for
10: * constructing the parent and child relationships between nodes.
11: */
12:
13: public interface Node {
14:
15: /**
16: * This method is called after the node has been made the current node. It
17: * indicates that child nodes can now be added to it.
18: */
19: public void jjtOpen();
20:
21: /**
22: * This method is called after all the child nodes have been added.
23: */
24: public void jjtClose();
25:
26: /**
27: * This pair of methods are used to inform the node of its parent.
28: */
29: public void jjtSetParent(Node n);
30:
31: public Node jjtGetParent();
32:
33: /**
34: * This method tells the node to add its argument to the node's list of
35: * children.
36: */
37: public void jjtAddChild(Node n, int i);
38:
39: /**
40: * Adds the supplied node as the last child node to this node.
41: */
42: public void jjtAppendChild(Node n);
43:
44: /**
45: * Adds the supplied node as the <tt>i</tt>'th child node to this node.
46: */
47: public void jjtInsertChild(Node n, int i);
48:
49: /**
50: * Replaces a child node with a new node.
51: */
52: public void jjtReplaceChild(Node oldNode, Node newNode);
53:
54: /**
55: * This method returns a child node. The children are numbered from zero,
56: * left to right.
57: */
58: public Node jjtGetChild(int i);
59:
60: /** Return the number of children the node has. */
61: public int jjtGetNumChildren();
62:
63: /**
64: * Accept the visitor.
65: */
66: public Object jjtAccept(SyntaxTreeBuilderVisitor visitor,
67: Object data) throws VisitorException;
68: }
|