summaryrefslogtreecommitdiff
path: root/trunk/users/metalab/AoI/plugins/CSGEvaluator/src/org/cheffo/jeplite/SimpleNode.java
blob: c47d533f96cb756ae90b18fe285c3aa38c4bb440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
package org.cheffo.jeplite;
import org.cheffo.jeplite.util.*;
public class SimpleNode {
  protected SimpleNode parent;
  protected SimpleNode[] children;
  protected int id;
  protected Parser parser;
  protected String name;

  public SimpleNode(int i) {
    id = i;
  }

  public SimpleNode(Parser p, int i) {
    this(i);
    parser = p;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getName() {
    return name;
  }

  public void jjtOpen() {
  }

  public void jjtClose() {
  }

  public final void jjtSetParent(SimpleNode n) { parent = n; }
  public final SimpleNode jjtGetParent() { return parent; }

  public void jjtAddChild(SimpleNode n, int i) {
    if (children == null) {
      children = new SimpleNode[i + 1];
    } else if (i >= children.length) {
      SimpleNode c[] = new SimpleNode[i + 1];
      System.arraycopy(children, 0, c, 0, children.length);
      children = c;
    }
    children[i] = n;
  }

  public final SimpleNode jjtGetChild(int i) {
    return children[i];
  }

  public final int jjtGetNumChildren() {
    return (children == null) ? 0 : children.length;
  }

  public Object jjtAccept(ParserVisitor visitor, Object data) {
    return visitor.visit(this, data);
  }

  public Object childrenAccept(ParserVisitor visitor, Object data) {
    if (children != null) {
      for (int i = 0; i < children.length; ++i) {
        children[i].jjtAccept(visitor, data);
      }
    }
    return data;
  }

  public String toString() { return ParserTreeConstants.jjtNodeName[id]; }

  public double getValue() throws ParseException
  {
    return 0;
  }

  public void getValue(DoubleStack stack) throws ParseException {
    stack.push(getValue());
  }
}