netwar.utils
Class LVector

java.lang.Object
  |
  +--netwar.utils.LVector
All Implemented Interfaces:
Vector

public class LVector
extends java.lang.Object
implements Vector

Linked list version of Vector

Author:
Kyle Kakligian

Field Summary
protected  netwar.utils.LVector.Node curr
           
 
Constructor Summary
LVector()
          Constructs an LVector.
LVector(int sz)
          Constructs an LVector.
 
Method Summary
 void append(java.lang.Object it)
          Insert an Object at the tail of the list.
 void clear()
          Remove all Objects from the list.
 java.lang.Object get()
          Gets the current Object's value.
 int getLength()
          Returns the number of Objects in the list.
 void go(int pos)
          Sets the current Object to the given index.
 void goFirst()
          Sets the current Object to the first one in the list.
 void goNext()
          Sets the current Object to the next one in the list.
 void goPrev()
          Sets the current Object to the previous one in the list.
 void insert(java.lang.Object it)
          Insert an Object at the current position.
 boolean isEmpty()
          Returns true if the current pointer is valid.
 boolean isInList()
          Returns true if the current pointer is valid.
 java.lang.Object remove()
          Removes and returns the current Object of the list.
 void resize(int sz)
          Resizes the internal stucture to hold at least the given numer of objects.
 void set(java.lang.Object it)
          Sets the current Object's value: a reference.
 void shrink()
          Resizes the internal stucture to use the least amount or memory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

curr

protected netwar.utils.LVector.Node curr
Constructor Detail

LVector

public LVector(int sz)
Constructs an LVector.
Parameters:
sz - The size of the new list.
See Also:
resize()

LVector

public LVector()
Constructs an LVector.
Method Detail

clear

public void clear()
Remove all Objects from the list.
Specified by:
clear in interface Vector

insert

public void insert(java.lang.Object it)
Insert an Object at the current position.
Specified by:
insert in interface Vector
Parameters:
it - Object to insert.

append

public void append(java.lang.Object it)
Insert an Object at the tail of the list.
Specified by:
append in interface Vector
Parameters:
it - Object to append.

remove

public java.lang.Object remove()
Removes and returns the current Object of the list.
Specified by:
remove in interface Vector
Returns:
Object just removed.

goFirst

public void goFirst()
Sets the current Object to the first one in the list.
Specified by:
goFirst in interface Vector

goNext

public void goNext()
Sets the current Object to the next one in the list.
Specified by:
goNext in interface Vector

goPrev

public void goPrev()
Sets the current Object to the previous one in the list.
Specified by:
goPrev in interface Vector

getLength

public int getLength()
Returns the number of Objects in the list.
Specified by:
getLength in interface Vector
Returns:
The number of Objects in the list.

go

public void go(int pos)
Sets the current Object to the given index.
Specified by:
go in interface Vector
Parameters:
pos - The index to move to.

set

public void set(java.lang.Object it)
Sets the current Object's value: a reference.
Specified by:
set in interface Vector
Parameters:
it - The reference to set this list entre to.

get

public java.lang.Object get()
Gets the current Object's value.
Specified by:
get in interface Vector
Returns:
The reference for the current Object. Note, you will probably need to cast.

isEmpty

public boolean isEmpty()
Returns true if the current pointer is valid.
Specified by:
isEmpty in interface Vector
Returns:
true if the current pointer points within the list.

isInList

public boolean isInList()
Returns true if the current pointer is valid.
Specified by:
isInList in interface Vector
Returns:
true if the current pointer points within the list.

resize

public void resize(int sz)
Resizes the internal stucture to hold at least the given numer of objects.
Specified by:
resize in interface Vector
Parameters:
sz - The minumum number of Objects to hold.

shrink

public void shrink()
Resizes the internal stucture to use the least amount or memory.
Specified by:
shrink in interface Vector