|
1 |
| package edu.rice.cs.javalanglevels.tree; |
|
2 |
| |
|
3 |
| import edu.rice.cs.javalanglevels.SourceInfo; |
|
4 |
| |
|
5 |
| |
|
6 |
| |
|
7 |
| |
|
8 |
| |
|
9 |
| |
|
10 |
| public class ModifiersAndVisibility extends JExpression { |
|
11 |
| private final String[] _modifiers; |
|
12 |
| |
|
13 |
| |
|
14 |
| |
|
15 |
| |
|
16 |
| |
|
17 |
2020632
| public ModifiersAndVisibility(SourceInfo in_sourceInfo, String[] in_modifiers) {
|
|
18 |
2020632
| super(in_sourceInfo);
|
|
19 |
| |
|
20 |
2020632
| if (in_modifiers == null) {
|
|
21 |
0
| throw new java.lang.IllegalArgumentException("Parameter 'modifiers' to the ModifiersAndVisibility constructor was null. This class may not have null field values.");
|
|
22 |
| } |
|
23 |
2020632
| _modifiers = in_modifiers;
|
|
24 |
| } |
|
25 |
| |
|
26 |
564764
| final public String[] getModifiers() { return _modifiers; }
|
|
27 |
| |
|
28 |
1072
| public <RetType> RetType visit(JExpressionIFVisitor<RetType> visitor) { return visitor.forModifiersAndVisibility(this); }
|
|
29 |
0
| public void visit(JExpressionIFVisitor_void visitor) { visitor.forModifiersAndVisibility(this); }
|
|
30 |
| |
|
31 |
| |
|
32 |
| |
|
33 |
| |
|
34 |
| |
|
35 |
1
| public java.lang.String toString() {
|
|
36 |
1
| java.io.StringWriter w = new java.io.StringWriter();
|
|
37 |
1
| output(w);
|
|
38 |
1
| return w.toString();
|
|
39 |
| } |
|
40 |
| |
|
41 |
| |
|
42 |
| |
|
43 |
| |
|
44 |
1
| public void output(java.io.Writer writer) {
|
|
45 |
1
| outputHelp(new TabPrintWriter(writer, 2));
|
|
46 |
| } |
|
47 |
| |
|
48 |
196
| public void outputHelp(TabPrintWriter writer) {
|
|
49 |
196
| writer.print("ModifiersAndVisibility" + ":");
|
|
50 |
196
| writer.indent();
|
|
51 |
| |
|
52 |
196
| writer.startLine("");
|
|
53 |
196
| writer.print("sourceInfo = ");
|
|
54 |
196
| SourceInfo temp_sourceInfo = getSourceInfo();
|
|
55 |
196
| if (temp_sourceInfo == null) {
|
|
56 |
0
| writer.print("null");
|
|
57 |
| } else { |
|
58 |
196
| writer.print(temp_sourceInfo);
|
|
59 |
| } |
|
60 |
| |
|
61 |
196
| writer.startLine("");
|
|
62 |
196
| writer.print("modifiers = ");
|
|
63 |
196
| writer.print("{");
|
|
64 |
196
| writer.indent();
|
|
65 |
196
| for (int i = 0; i < getModifiers().length; i++) {
|
|
66 |
77
| String temp_modifiers = getModifiers()[i];
|
|
67 |
77
| writer.startLine("#" + i + ": ");
|
|
68 |
77
| if (temp_modifiers == null) {
|
|
69 |
0
| writer.print("null");
|
|
70 |
| } else { |
|
71 |
77
| writer.print(temp_modifiers);
|
|
72 |
| } |
|
73 |
| } |
|
74 |
196
| writer.unindent();
|
|
75 |
196
| if (getModifiers().length > 0) {
|
|
76 |
71
| writer.startLine("");
|
|
77 |
| } |
|
78 |
196
| writer.print("}");
|
|
79 |
196
| writer.unindent();
|
|
80 |
| } |
|
81 |
| |
|
82 |
| |
|
83 |
| |
|
84 |
| |
|
85 |
| |
|
86 |
| |
|
87 |
142586
| public boolean equals(java.lang.Object obj) {
|
|
88 |
0
| if (obj == null) return false;
|
|
89 |
142586
| if ((obj.getClass() != this.getClass()) || (obj.hashCode() != this.hashCode())) {
|
|
90 |
52506
| return false;
|
|
91 |
| } else { |
|
92 |
90080
| ModifiersAndVisibility casted = (ModifiersAndVisibility) obj;
|
|
93 |
0
| if (this.getModifiers().length != casted.getModifiers().length) return false;
|
|
94 |
0
| for (int i = 0; i < getModifiers().length; i++) if (! (getModifiers()[i] == casted.getModifiers()[i])) return false;
|
|
95 |
90080
| return true;
|
|
96 |
| } |
|
97 |
| } |
|
98 |
| |
|
99 |
| |
|
100 |
| |
|
101 |
| |
|
102 |
| |
|
103 |
| |
|
104 |
| |
|
105 |
78882
| protected int generateHashCode() {
|
|
106 |
78882
| int code = getClass().hashCode();
|
|
107 |
78882
| code ^= 0;
|
|
108 |
32721
| for (int i = 0; i < getModifiers().length; i++) code ^= getModifiers()[i].hashCode();
|
|
109 |
78882
| return code;
|
|
110 |
| } |
|
111 |
| } |