KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > sablecc > sablecc > syntax3 > node > AInternalStates


1 /* This file was generated by SableCC (http://www.sablecc.org/). */
2
3 package org.sablecc.sablecc.syntax3.node;
4
5 import java.util.*;
6 import org.sablecc.sablecc.syntax3.analysis.*;
7
8 @SuppressWarnings JavaDoc("nls")
9 public final class AInternalStates extends PInternalStates
10 {
11     private final LinkedList<PInternalState> _internalStates_ = new LinkedList<PInternalState>();
12     private PTransitions _transitions_;
13
14     public AInternalStates()
15     {
16         // Constructor
17
}
18
19     public AInternalStates(
20         @SuppressWarnings JavaDoc("hiding") List<PInternalState> _internalStates_,
21         @SuppressWarnings JavaDoc("hiding") PTransitions _transitions_)
22     {
23         // Constructor
24
setInternalStates(_internalStates_);
25
26         setTransitions(_transitions_);
27
28     }
29
30     @Override JavaDoc
31     public Object JavaDoc clone()
32     {
33         return new AInternalStates(
34             cloneList(this._internalStates_),
35             cloneNode(this._transitions_));
36     }
37
38     public void apply(Switch sw)
39     {
40         ((Analysis) sw).caseAInternalStates(this);
41     }
42
43     public LinkedList<PInternalState> getInternalStates()
44     {
45         return this._internalStates_;
46     }
47
48     public void setInternalStates(List<PInternalState> list)
49     {
50         this._internalStates_.clear();
51         this._internalStates_.addAll(list);
52         for(PInternalState e : list)
53         {
54             if(e.parent() != null)
55             {
56                 e.parent().removeChild(e);
57             }
58
59             e.parent(this);
60         }
61     }
62
63     public PTransitions getTransitions()
64     {
65         return this._transitions_;
66     }
67
68     public void setTransitions(PTransitions node)
69     {
70         if(this._transitions_ != null)
71         {
72             this._transitions_.parent(null);
73         }
74
75         if(node != null)
76         {
77             if(node.parent() != null)
78             {
79                 node.parent().removeChild(node);
80             }
81
82             node.parent(this);
83         }
84
85         this._transitions_ = node;
86     }
87
88     @Override JavaDoc
89     public String JavaDoc toString()
90     {
91         return ""
92             + toString(this._internalStates_)
93             + toString(this._transitions_);
94     }
95
96     @Override JavaDoc
97     void removeChild(@SuppressWarnings JavaDoc("unused") Node child)
98     {
99         // Remove child
100
if(this._internalStates_.remove(child))
101         {
102             return;
103         }
104
105         if(this._transitions_ == child)
106         {
107             this._transitions_ = null;
108             return;
109         }
110
111         throw new RuntimeException JavaDoc("Not a child.");
112     }
113
114     @Override JavaDoc
115     void replaceChild(@SuppressWarnings JavaDoc("unused") Node oldChild, @SuppressWarnings JavaDoc("unused") Node newChild)
116     {
117         // Replace child
118
for(ListIterator<PInternalState> i = this._internalStates_.listIterator(); i.hasNext();)
119         {
120             if(i.next() == oldChild)
121             {
122                 if(newChild != null)
123                 {
124                     i.set((PInternalState) newChild);
125                     newChild.parent(this);
126                     oldChild.parent(null);
127                     return;
128                 }
129
130                 i.remove();
131                 oldChild.parent(null);
132                 return;
133             }
134         }
135
136         if(this._transitions_ == oldChild)
137         {
138             setTransitions((PTransitions) newChild);
139             return;
140         }
141
142         throw new RuntimeException JavaDoc("Not a child.");
143     }
144 }
145
Popular Tags