diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-01-16 02:31:34 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-01-16 02:31:34 +0000 |
commit | e3efaf2a9ad82deb1644ccab8c1469719a0c5b65 (patch) | |
tree | dc1b3f3c787dd5900e80aaeca1a46cd9696d230b /java/com/xagasoft/gats/GatsList.java | |
parent | 66f972a288916824d9001c1931bf4c5db1bed82b (diff) | |
download | libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.gz libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.bz2 libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.tar.xz libgats-e3efaf2a9ad82deb1644ccab8c1469719a0c5b65.zip |
Lots of documentation, an example program, and also some visibility cleanup.
Diffstat (limited to '')
-rw-r--r-- | java/com/xagasoft/gats/GatsList.java | 78 |
1 files changed, 42 insertions, 36 deletions
diff --git a/java/com/xagasoft/gats/GatsList.java b/java/com/xagasoft/gats/GatsList.java index 35b2a4c..27c4c11 100644 --- a/java/com/xagasoft/gats/GatsList.java +++ b/java/com/xagasoft/gats/GatsList.java | |||
@@ -10,6 +10,12 @@ import java.util.List; | |||
10 | import java.util.LinkedList; | 10 | import java.util.LinkedList; |
11 | import java.util.ListIterator; | 11 | import java.util.ListIterator; |
12 | 12 | ||
13 | /** | ||
14 | * Represents an ordered list of Gats objects. The order of the objects in the | ||
15 | * list is always preserved, unlike the values in a | ||
16 | * com.xagasoft.gats.GatsDictionary. This class implements all java List | ||
17 | * interface features, and is implemented internally as a LinkedList. | ||
18 | */ | ||
13 | public class GatsList extends GatsObject implements List<GatsObject> | 19 | public class GatsList extends GatsObject implements List<GatsObject> |
14 | { | 20 | { |
15 | private LinkedList<GatsObject> lValue = new LinkedList<GatsObject>(); | 21 | private LinkedList<GatsObject> lValue = new LinkedList<GatsObject>(); |
@@ -28,7 +34,7 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
28 | return GatsObject.LIST; | 34 | return GatsObject.LIST; |
29 | } | 35 | } |
30 | 36 | ||
31 | public void read( InputStream is, char cType ) throws java.io.IOException | 37 | void read( InputStream is, char cType ) throws java.io.IOException |
32 | { | 38 | { |
33 | for(;;) | 39 | for(;;) |
34 | { | 40 | { |
@@ -39,7 +45,7 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
39 | } | 45 | } |
40 | } | 46 | } |
41 | 47 | ||
42 | public void write( OutputStream os ) throws java.io.IOException | 48 | void write( OutputStream os ) throws java.io.IOException |
43 | { | 49 | { |
44 | os.write( (int)'l' ); | 50 | os.write( (int)'l' ); |
45 | for( GatsObject obj : this ) | 51 | for( GatsObject obj : this ) |
@@ -54,24 +60,24 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
54 | return lValue.toString(); | 60 | return lValue.toString(); |
55 | } | 61 | } |
56 | 62 | ||
57 | public boolean add( GatsObject arg0 ) | 63 | public boolean add( GatsObject value ) |
58 | { | 64 | { |
59 | return lValue.add( arg0 ); | 65 | return lValue.add( value ); |
60 | } | 66 | } |
61 | 67 | ||
62 | public void add( int arg0, GatsObject arg1 ) | 68 | public void add( int iPos, GatsObject value ) |
63 | { | 69 | { |
64 | lValue.add( arg0, arg1 ); | 70 | lValue.add( iPos, value ); |
65 | } | 71 | } |
66 | 72 | ||
67 | public boolean addAll( Collection<? extends GatsObject> arg0 ) | 73 | public boolean addAll( Collection<? extends GatsObject> src ) |
68 | { | 74 | { |
69 | return lValue.addAll( arg0 ); | 75 | return lValue.addAll( src ); |
70 | } | 76 | } |
71 | 77 | ||
72 | public boolean addAll( int arg0, Collection<? extends GatsObject> arg1 ) | 78 | public boolean addAll( int iPos, Collection<? extends GatsObject> src ) |
73 | { | 79 | { |
74 | return lValue.addAll( arg0, arg1 ); | 80 | return lValue.addAll( iPos, src ); |
75 | } | 81 | } |
76 | 82 | ||
77 | public void clear() | 83 | public void clear() |
@@ -79,24 +85,24 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
79 | lValue.clear(); | 85 | lValue.clear(); |
80 | } | 86 | } |
81 | 87 | ||
82 | public boolean contains( Object arg0 ) | 88 | public boolean contains( Object value ) |
83 | { | 89 | { |
84 | return lValue.contains( arg0 ); | 90 | return lValue.contains( value ); |
85 | } | 91 | } |
86 | 92 | ||
87 | public boolean containsAll( Collection<?> arg0 ) | 93 | public boolean containsAll( Collection<?> src ) |
88 | { | 94 | { |
89 | return lValue.containsAll( arg0 ); | 95 | return lValue.containsAll( src ); |
90 | } | 96 | } |
91 | 97 | ||
92 | public GatsObject get( int arg0 ) | 98 | public GatsObject get( int iPos ) |
93 | { | 99 | { |
94 | return lValue.get( arg0 ); | 100 | return lValue.get( iPos ); |
95 | } | 101 | } |
96 | 102 | ||
97 | public int indexOf( Object arg0 ) | 103 | public int indexOf( Object value ) |
98 | { | 104 | { |
99 | return lValue.indexOf( arg0 ); | 105 | return lValue.indexOf( value ); |
100 | } | 106 | } |
101 | 107 | ||
102 | public boolean isEmpty() | 108 | public boolean isEmpty() |
@@ -109,9 +115,9 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
109 | return lValue.iterator(); | 115 | return lValue.iterator(); |
110 | } | 116 | } |
111 | 117 | ||
112 | public int lastIndexOf( Object arg0 ) | 118 | public int lastIndexOf( Object value ) |
113 | { | 119 | { |
114 | return lValue.lastIndexOf( arg0 ); | 120 | return lValue.lastIndexOf( value ); |
115 | } | 121 | } |
116 | 122 | ||
117 | public ListIterator<GatsObject> listIterator() | 123 | public ListIterator<GatsObject> listIterator() |
@@ -119,34 +125,34 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
119 | return lValue.listIterator(); | 125 | return lValue.listIterator(); |
120 | } | 126 | } |
121 | 127 | ||
122 | public ListIterator<GatsObject> listIterator( int arg0 ) | 128 | public ListIterator<GatsObject> listIterator( int iPos ) |
123 | { | 129 | { |
124 | return lValue.listIterator( arg0 ); | 130 | return lValue.listIterator( iPos ); |
125 | } | 131 | } |
126 | 132 | ||
127 | public GatsObject remove( int arg0 ) | 133 | public GatsObject remove( int iPos ) |
128 | { | 134 | { |
129 | return lValue.remove( arg0 ); | 135 | return lValue.remove( iPos ); |
130 | } | 136 | } |
131 | 137 | ||
132 | public boolean remove( Object arg0 ) | 138 | public boolean remove( Object value ) |
133 | { | 139 | { |
134 | return lValue.remove( arg0 ); | 140 | return lValue.remove( value ); |
135 | } | 141 | } |
136 | 142 | ||
137 | public boolean removeAll( Collection<?> arg0 ) | 143 | public boolean removeAll( Collection<?> src ) |
138 | { | 144 | { |
139 | return lValue.removeAll( arg0 ); | 145 | return lValue.removeAll( src ); |
140 | } | 146 | } |
141 | 147 | ||
142 | public boolean retainAll( Collection<?> arg0 ) | 148 | public boolean retainAll( Collection<?> src ) |
143 | { | 149 | { |
144 | return lValue.retainAll( arg0 ); | 150 | return lValue.retainAll( src ); |
145 | } | 151 | } |
146 | 152 | ||
147 | public GatsObject set( int arg0, GatsObject arg1 ) | 153 | public GatsObject set( int iPos, GatsObject src ) |
148 | { | 154 | { |
149 | return lValue.set( arg0, arg1 ); | 155 | return lValue.set( iPos, src ); |
150 | } | 156 | } |
151 | 157 | ||
152 | public int size() | 158 | public int size() |
@@ -154,9 +160,9 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
154 | return lValue.size(); | 160 | return lValue.size(); |
155 | } | 161 | } |
156 | 162 | ||
157 | public List<GatsObject> subList( int arg0, int arg1 ) | 163 | public List<GatsObject> subList( int iBegin, int iEnd ) |
158 | { | 164 | { |
159 | return new GatsList( lValue.subList( arg0, arg1 ) ); | 165 | return new GatsList( lValue.subList( iBegin, iEnd ) ); |
160 | } | 166 | } |
161 | 167 | ||
162 | public Object[] toArray() | 168 | public Object[] toArray() |
@@ -164,9 +170,9 @@ public class GatsList extends GatsObject implements List<GatsObject> | |||
164 | return lValue.toArray(); | 170 | return lValue.toArray(); |
165 | } | 171 | } |
166 | 172 | ||
167 | public <T> T[] toArray( T[] arg0 ) | 173 | public <T> T[] toArray( T[] src ) |
168 | { | 174 | { |
169 | return lValue.toArray( arg0 ); | 175 | return lValue.toArray( src ); |
170 | } | 176 | } |
171 | }; | 177 | }; |
172 | 178 | ||