From dcd3547448a632a81d83cce87165ecad057c7550 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 21 Apr 2011 18:37:12 +0000 Subject: List may actually work! --- java/com/xagasoft/gats/GatsList.java | 204 +++++++++++++++-------------------- 1 file changed, 87 insertions(+), 117 deletions(-) (limited to 'java/com/xagasoft/gats') diff --git a/java/com/xagasoft/gats/GatsList.java b/java/com/xagasoft/gats/GatsList.java index 304549e..7f04db6 100644 --- a/java/com/xagasoft/gats/GatsList.java +++ b/java/com/xagasoft/gats/GatsList.java @@ -17,180 +17,150 @@ public class GatsList extends GatsObject implements List { } - + public GatsList( Collection c ) + { + lValue = new LinkedList( c ); + } public int getType() { return GatsObject.LIST; } - public void read( InputStream is, char cType ) + public void read( InputStream is, char cType ) throws java.io.IOException { + for(;;) + { + GatsObject obj = GatsObject.read( is ); + if( obj == null ) + break; + add( obj ); + } } public void write( OutputStream os ) throws java.io.IOException { + os.write( (int)'l' ); + for( GatsObject obj : this ) + { + obj.write( os ); + } + os.write( (int)'e' ); } - - - public boolean add(GatsObject arg0) { - // TODO Auto-generated method stub - return false; + public boolean add( GatsObject arg0 ) + { + return lValue.add( arg0 ); } - - - public void add(int arg0, GatsObject arg1) { - // TODO Auto-generated method stub - + public void add( int arg0, GatsObject arg1 ) + { + lValue.add( arg0, arg1 ); } - - - public boolean addAll(Collection arg0) { - // TODO Auto-generated method stub - return false; + public boolean addAll( Collection arg0 ) + { + return lValue.addAll( arg0 ); } - - - public boolean addAll(int arg0, Collection arg1) { - // TODO Auto-generated method stub - return false; + public boolean addAll( int arg0, Collection arg1 ) + { + return lValue.addAll( arg0, arg1 ); } - - - public void clear() { - // TODO Auto-generated method stub - + public void clear() + { + lValue.clear(); } - - - public boolean contains(Object arg0) { - // TODO Auto-generated method stub - return false; + public boolean contains( Object arg0 ) + { + return lValue.contains( arg0 ); } - - - public boolean containsAll(Collection arg0) { - // TODO Auto-generated method stub - return false; + public boolean containsAll( Collection arg0 ) + { + return lValue.containsAll( arg0 ); } - - - public GatsObject get(int arg0) { - // TODO Auto-generated method stub - return null; + public GatsObject get( int arg0 ) + { + return lValue.get( arg0 ); } - - - public int indexOf(Object arg0) { - // TODO Auto-generated method stub - return 0; + public int indexOf( Object arg0 ) + { + return lValue.indexOf( arg0 ); } - - - public boolean isEmpty() { - // TODO Auto-generated method stub - return false; + public boolean isEmpty() + { + return lValue.isEmpty(); } - - - public Iterator iterator() { - // TODO Auto-generated method stub - return null; + public Iterator iterator() + { + return lValue.iterator(); } - - - public int lastIndexOf(Object arg0) { - // TODO Auto-generated method stub - return 0; + public int lastIndexOf( Object arg0 ) + { + return lValue.lastIndexOf( arg0 ); } - - - public ListIterator listIterator() { - // TODO Auto-generated method stub - return null; + public ListIterator listIterator() + { + return lValue.listIterator(); } - - - public ListIterator listIterator(int arg0) { - // TODO Auto-generated method stub - return null; + public ListIterator listIterator( int arg0 ) + { + return lValue.listIterator( arg0 ); } - - - public GatsObject remove(int arg0) { - // TODO Auto-generated method stub - return null; + public GatsObject remove( int arg0 ) + { + return lValue.remove( arg0 ); } - - - public boolean remove(Object arg0) { - // TODO Auto-generated method stub - return false; + public boolean remove( Object arg0 ) + { + return lValue.remove( arg0 ); } - - - public boolean removeAll(Collection arg0) { - // TODO Auto-generated method stub - return false; + public boolean removeAll( Collection arg0 ) + { + return lValue.removeAll( arg0 ); } - - - public boolean retainAll(Collection arg0) { - // TODO Auto-generated method stub - return false; + public boolean retainAll( Collection arg0 ) + { + return lValue.retainAll( arg0 ); } - - - public GatsObject set(int arg0, GatsObject arg1) { - // TODO Auto-generated method stub - return null; + public GatsObject set( int arg0, GatsObject arg1 ) + { + return lValue.set( arg0, arg1 ); } - - - public int size() { - // TODO Auto-generated method stub - return 0; + public int size() + { + return lValue.size(); } - - - public List subList(int arg0, int arg1) { - // TODO Auto-generated method stub - return null; + public List subList( int arg0, int arg1 ) + { + return new GatsList( lValue.subList( arg0, arg1 ) ); } - - - public Object[] toArray() { - // TODO Auto-generated method stub - return null; + public Object[] toArray() + { + return lValue.toArray(); } - - - public T[] toArray(T[] arg0) { - // TODO Auto-generated method stub - return null; + public T[] toArray( T[] arg0 ) + { + return lValue.toArray( arg0 ); } }; -- cgit v1.2.3