KickJava   Java API By Example, From Geeks To Geeks.

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


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 AInclusiveTokenCollection extends PTokenCollection
10 {
11     private final LinkedList<TIdentifier> _identifiers_ = new LinkedList<TIdentifier>();
12
13     public AInclusiveTokenCollection()
14     {
15         // Constructor
16
}
17
18     public AInclusiveTokenCollection(
19         @SuppressWarnings JavaDoc("hiding") List<TIdentifier> _identifiers_)
20     {
21         // Constructor
22
setIdentifiers(_identifiers_);
23
24     }
25
26     @Override JavaDoc
27     public Object JavaDoc clone()
28     {
29         return new AInclusiveTokenCollection(
30             cloneList(this._identifiers_));
31     }
32
33     public void apply(Switch sw)
34     {
35         ((Analysis) sw).caseAInclusiveTokenCollection(this);
36     }
37
38     public LinkedList<TIdentifier> getIdentifiers()
39     {
40         return this._identifiers_;
41     }
42
43     public void setIdentifiers(List<TIdentifier> list)
44     {
45         this._identifiers_.clear();
46         this._identifiers_.addAll(list);
47         for(TIdentifier e : list)
48         {
49             if(e.parent() != null)
50             {
51                 e.parent().removeChild(e);
52             }
53
54             e.parent(this);
55         }
56     }
57
58     @Override JavaDoc
59     public String JavaDoc toString()
60     {
61         return ""
62             + toString(this._identifiers_);
63     }
64
65     @Override JavaDoc
66     void removeChild(@SuppressWarnings JavaDoc("unused") Node child)
67     {
68         // Remove child
69
if(this._identifiers_.remove(child))
70         {
71             return;
72         }
73
74         throw new RuntimeException JavaDoc("Not a child.");
75     }
76
77     @Override JavaDoc
78     void replaceChild(@SuppressWarnings JavaDoc("unused") Node oldChild, @SuppressWarnings JavaDoc("unused") Node newChild)
79     {
80         // Replace child
81
for(ListIterator<TIdentifier> i = this._identifiers_.listIterator(); i.hasNext();)
82         {
83             if(i.next() == oldChild)
84             {
85                 if(newChild != null)
86                 {
87                     i.set((TIdentifier) newChild);
88                     newChild.parent(this);
89                     oldChild.parent(null);
90                     return;
91                 }
92
93                 i.remove();
94                 oldChild.parent(null);
95                 return;
96             }
97         }
98
99         throw new RuntimeException JavaDoc("Not a child.");
100     }
101 }
102
Popular Tags