1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package gov.nasa.pds.tools.label;
17
18 import java.util.Collection;
19 import java.util.Iterator;
20 import java.util.List;
21 import java.util.ArrayList;
22 import java.util.ListIterator;
23
24 /***
25 * This class implements the List interface to hide its backing.
26 * It is a ordered set of {@link Value}. A sequence can appear on
27 * the right hand side of an {@link AttributeStatement}.
28 * @author pramirez
29 * @version $Revision: 2606 $
30 *
31 */
32 public class Sequence implements List, Value {
33 private List values;
34
35 /***
36 * Constructs an empty sequence of values.
37 */
38 public Sequence() {
39 values = new ArrayList();
40 }
41
42 /***
43 * Constructs a sequence with the ordered value
44 * @param values to load into sequence
45 */
46 public Sequence(List values) {
47 this.values = new ArrayList(values);
48 }
49
50
51
52
53 public boolean containsAll(Collection values) {
54 return this.values.containsAll(values);
55 }
56
57
58
59
60 public boolean addAll(Collection values) {
61 return this.values.addAll(values);
62 }
63
64
65
66
67 public boolean addAll(int index, Collection values) {
68 return this.values.addAll(index, values);
69 }
70
71
72
73
74 public boolean removeAll(Collection values) {
75 return this.values.removeAll(values);
76 }
77
78
79
80
81 public boolean retainAll(Collection values) {
82 return this.values.retainAll(values);
83 }
84
85
86
87
88 public void clear() {
89 values.clear();
90 }
91
92
93
94
95 public Value getValue(int index) {
96 return (Value) values.get(index);
97 }
98
99
100
101
102 public Value set(int index, Value value) {
103 return (Value) values.set(index, value);
104 }
105
106
107
108
109 public Scalar removeScalar(int index) {
110 return (Scalar) values.remove(index);
111 }
112
113
114
115
116 public ListIterator listIterator() {
117 return values.listIterator();
118 }
119
120
121
122
123 public ListIterator listIterator(int index) {
124 return values.listIterator(index);
125 }
126
127
128
129
130 public List subList(int fromIndex, int toIndex) {
131 return values.subList(fromIndex, toIndex);
132 }
133
134
135
136
137 public boolean contains(Object object) {
138 return values.contains(object);
139 }
140
141
142
143
144 public Object[] toArray(Object[] objects) {
145 return values.toArray(objects);
146 }
147
148
149
150
151 public boolean add(Object object) {
152 return values.add(object);
153 }
154
155
156
157
158 public boolean remove(Object object) {
159 return values.remove(object);
160 }
161
162
163
164
165 public Object set(int index, Object object) {
166 return values.set(index, object);
167 }
168
169
170
171
172 public void add(int index, Object object) {
173 values.add(index, object);
174 }
175
176
177
178
179 public int indexOf(Object object) {
180 return values.indexOf(object);
181 }
182
183
184
185
186 public int lastIndexOf(Object object) {
187 return values.lastIndexOf(object);
188 }
189
190
191
192
193 public Object[] toArray() {
194 return values.toArray();
195 }
196
197
198
199
200 public Object get(int index) {
201 return values.get(index);
202 }
203
204
205
206
207 public Object remove(int index) {
208 return values.remove(index);
209 }
210
211
212
213
214
215 public int size() {
216 return values.size();
217 }
218
219
220
221
222
223 public boolean isEmpty() {
224 return values.isEmpty();
225 }
226
227
228
229
230
231 public Iterator iterator() {
232 return values.iterator();
233 }
234 }