001: /* Generated By:JJTree: Do not edit this line. SimpleNode.java */
002:
003: package org.objectweb.speedo.query.ejb.parser;
004:
005: //Manually added
006: import java.util.ArrayList;
007:
008: //Manually added
009:
010: public class SimpleNode implements Node {
011: protected Node parent;
012: protected Node[] children;
013: protected int id;
014: protected EJBQL parser;
015: //Manually added
016: public ArrayList ops = new ArrayList(); //operators
017: public Object value = null;
018: public boolean distinct = false;
019: public boolean not = false;
020: public boolean third = false; //third operand of like and locate
021: public int eltnum = 0; //to count the number of string_literal in the in_expression
022: public boolean asc = true; //orderby clause
023: //End manually added
024:
025: public SimpleNode(int i) {
026: id = i;
027: }
028:
029: public SimpleNode(EJBQL p, int i) {
030: this (i);
031: parser = p;
032: }
033:
034: public void jjtOpen() {
035: }
036:
037: public void jjtClose() {
038: }
039:
040: public void jjtSetParent(Node n) {
041: parent = n;
042: }
043:
044: public Node jjtGetParent() {
045: return parent;
046: }
047:
048: public void jjtAddChild(Node n, int i) {
049: if (children == null) {
050: children = new Node[i + 1];
051: } else if (i >= children.length) {
052: Node c[] = new Node[i + 1];
053: System.arraycopy(children, 0, c, 0, children.length);
054: children = c;
055: }
056: children[i] = n;
057: }
058:
059: public Node jjtGetChild(int i) {
060: return children[i];
061: }
062:
063: public int jjtGetNumChildren() {
064: return (children == null) ? 0 : children.length;
065: }
066:
067: /** Accept the visitor. **/
068: public Object jjtAccept(EJBQLVisitor visitor, Object data) {
069: return visitor.visit(this , data);
070: }
071:
072: /** Accept the visitor. **/
073: public Object childrenAccept(EJBQLVisitor visitor, Object data) {
074: if (children != null) {
075: for (int i = 0; i < children.length; ++i) {
076: children[i].jjtAccept(visitor, data);
077: }
078: }
079: return data;
080: }
081:
082: /* You can override these two methods in subclasses of SimpleNode to
083: customize the way the node appears when the tree is dumped. If
084: your output uses more than one line you should override
085: toString(String), otherwise overriding toString() is probably all
086: you need to do. */
087:
088: public String toString() {
089: return EJBQLTreeConstants.jjtNodeName[id];
090: }
091:
092: public String toString(String prefix) {
093: return prefix + toString();
094: }
095:
096: /* Override this method if you want to customize how the node dumps
097: out its children. */
098:
099: public void dump(String prefix) {
100: System.out.println(toString(prefix));
101: if (children != null) {
102: for (int i = 0; i < children.length; ++i) {
103: SimpleNode n = (SimpleNode) children[i];
104: if (n != null) {
105: n.dump(prefix + " ");
106: }
107: }
108: }
109: }
110: }
|