SimpleNode.java
3.43 KB
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
/*
* Decompiled with CFR 0_118.
*/
package com.adobe.forms.formcalc;
import com.adobe.forms.formcalc.CalcTransParser;
import com.adobe.forms.formcalc.CalcTransParserTreeConstants;
import com.adobe.forms.formcalc.CalcTransParserVisitor;
import com.adobe.forms.formcalc.Node;
import com.adobe.forms.formcalc.Token;
public class SimpleNode
implements Node {
protected Node parent;
protected Node[] children;
protected int id;
protected Object value;
protected CalcTransParser parser;
protected String image;
protected Token begin;
protected Token end;
private String literal = null;
public SimpleNode(int i) {
this.id = i;
}
public SimpleNode(CalcTransParser p, int i) {
this(i);
this.parser = p;
}
@Override
public void jjtOpen() {
}
@Override
public void jjtClose() {
}
@Override
public void jjtSetParent(Node n) {
this.parent = n;
}
@Override
public Node jjtGetParent() {
return this.parent;
}
@Override
public void jjtAddChild(Node n, int i) {
if (this.children == null) {
this.children = new Node[i + 1];
} else if (i >= this.children.length) {
Node[] c = new Node[i + 1];
System.arraycopy(this.children, 0, c, 0, this.children.length);
this.children = c;
}
this.children[i] = n;
}
@Override
public Node jjtGetChild(int i) {
return this.children[i];
}
@Override
public int jjtGetNumChildren() {
return this.children == null ? 0 : this.children.length;
}
public void jjtSetValue(Object value) {
this.value = value;
}
public Object jjtGetValue() {
return this.value;
}
@Override
public Object jjtAccept(CalcTransParserVisitor visitor, Object data) {
return visitor.visit(this, data);
}
public Object childrenAccept(CalcTransParserVisitor visitor, Object data) {
if (this.children != null) {
for (int i = 0; i < this.children.length; ++i) {
this.children[i].jjtAccept(visitor, data);
}
}
return data;
}
public String toString() {
return CalcTransParserTreeConstants.jjtNodeName[this.id];
}
public String toString(String prefix) {
return prefix + this.toString();
}
public String getImage() {
return this.image;
}
public void setImage(String image) {
this.image = image;
}
public Token getBeginToken() {
return this.begin;
}
public Token getEndToken() {
return this.end;
}
public void setFirstToken(Token t) {
this.begin = t;
}
public void setLastToken(Token t) {
this.end = t;
}
public String getLiteral() {
if (this.literal == null) {
StringBuilder sb = new StringBuilder();
Token t = this.getBeginToken();
Token endToken = this.getEndToken();
boolean loop = true;
while (loop) {
if (t.image != null) {
sb.append(t.image);
}
loop = t != endToken;
t = t.next;
}
this.literal = sb.toString();
if (this.literal.indexOf(91) != -1) {
this.literal = "'" + this.literal.replaceAll("\\'", "\\\\'") + "'";
}
}
return this.literal;
}
}