/
Slice.java
76 lines (68 loc) · 2.32 KB
/
Slice.java
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
// Autogenerated AST node
package org.python.pydev.parser.jython.ast;
import org.python.pydev.parser.jython.SimpleNode;
public final class Slice extends sliceType {
public exprType lower;
public exprType upper;
public exprType step;
public Slice(exprType lower, exprType upper, exprType step) {
this.lower = lower;
this.upper = upper;
this.step = step;
}
public Slice(exprType lower, exprType upper, exprType step, SimpleNode parent) {
this(lower, upper, step);
this.beginLine = parent.beginLine;
this.beginColumn = parent.beginColumn;
}
public Slice createCopy() {
Slice temp = new Slice(lower!=null?(exprType)lower.createCopy():null,
upper!=null?(exprType)upper.createCopy():null, step!=null?(exprType)step.createCopy():null);
temp.beginLine = this.beginLine;
temp.beginColumn = this.beginColumn;
if(this.specialsBefore != null){
for(Object o:this.specialsBefore){
if(o instanceof commentType){
commentType commentType = (commentType) o;
temp.getSpecialsBefore().add(commentType.createCopy());
}
}
}
if(this.specialsAfter != null){
for(Object o:this.specialsAfter){
if(o instanceof commentType){
commentType commentType = (commentType) o;
temp.getSpecialsAfter().add(commentType.createCopy());
}
}
}
return temp;
}
public String toString() {
StringBuffer sb = new StringBuffer("Slice[");
sb.append("lower=");
sb.append(dumpThis(this.lower));
sb.append(", ");
sb.append("upper=");
sb.append(dumpThis(this.upper));
sb.append(", ");
sb.append("step=");
sb.append(dumpThis(this.step));
sb.append("]");
return sb.toString();
}
public Object accept(VisitorIF visitor) throws Exception {
return visitor.visitSlice(this);
}
public void traverse(VisitorIF visitor) throws Exception {
if (lower != null){
lower.accept(visitor);
}
if (upper != null){
upper.accept(visitor);
}
if (step != null){
step.accept(visitor);
}
}
}