blob: 84a9b31f9ff4296209f098a9f0de8613756b5c9e (
plain)
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
|
package com.xagasoft.gats;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Collection;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.ListIterator;
/**
* Represents an ordered list of Gats objects. The order of the objects in the
* list is always preserved, unlike the values in a
* com.xagasoft.gats.GatsDictionary. This class implements all java List
* interface features, and is implemented internally as a LinkedList.
*/
public class GatsList extends GatsObject implements List<GatsObject>
{
private LinkedList<GatsObject> lValue = new LinkedList<GatsObject>();
public GatsList()
{
}
public GatsList( Collection<? extends GatsObject> c )
{
lValue = new LinkedList<GatsObject>( c );
}
public int getType()
{
return GatsObject.LIST;
}
void read( InputStream is, char cType ) throws java.io.IOException
{
for(;;)
{
GatsObject obj = GatsObject.read( is );
if( obj == null )
break;
add( obj );
}
}
void write( OutputStream os ) throws java.io.IOException
{
os.write( (int)'l' );
for( GatsObject obj : this )
{
obj.write( os );
}
os.write( (int)'e' );
}
public String toString()
{
return lValue.toString();
}
public boolean add( GatsObject value )
{
return lValue.add( value );
}
public void add( int iPos, GatsObject value )
{
lValue.add( iPos, value );
}
public boolean addAll( Collection<? extends GatsObject> src )
{
return lValue.addAll( src );
}
public boolean addAll( int iPos, Collection<? extends GatsObject> src )
{
return lValue.addAll( iPos, src );
}
public void clear()
{
lValue.clear();
}
public boolean contains( Object value )
{
return lValue.contains( value );
}
public boolean containsAll( Collection<?> src )
{
return lValue.containsAll( src );
}
public GatsObject get( int iPos )
{
return lValue.get( iPos );
}
public int indexOf( Object value )
{
return lValue.indexOf( value );
}
public boolean isEmpty()
{
return lValue.isEmpty();
}
public Iterator<GatsObject> iterator()
{
return lValue.iterator();
}
public int lastIndexOf( Object value )
{
return lValue.lastIndexOf( value );
}
public ListIterator<GatsObject> listIterator()
{
return lValue.listIterator();
}
public ListIterator<GatsObject> listIterator( int iPos )
{
return lValue.listIterator( iPos );
}
public GatsObject remove( int iPos )
{
return lValue.remove( iPos );
}
public boolean remove( Object value )
{
return lValue.remove( value );
}
public boolean removeAll( Collection<?> src )
{
return lValue.removeAll( src );
}
public boolean retainAll( Collection<?> src )
{
return lValue.retainAll( src );
}
public GatsObject set( int iPos, GatsObject src )
{
return lValue.set( iPos, src );
}
public int size()
{
return lValue.size();
}
public List<GatsObject> subList( int iBegin, int iEnd )
{
return new GatsList( lValue.subList( iBegin, iEnd ) );
}
public Object[] toArray()
{
return lValue.toArray();
}
public <T> T[] toArray( T[] src )
{
return lValue.toArray( src );
}
};
|