netwar.utils
Interface Vector

All Known Implementing Classes:
LVector

public interface Vector

Vector ADT, interface.

Author:
Kyle Kakligian

Method Summary
 void append(java.lang.Object item)
          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 item)
          Insert an Object at the current position.
 boolean isEmpty()
          Returns whether or not the list is empty.
 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 val)
          Sets the current Object's value: a reference.
 void shrink()
          Resizes the internal stucture to use the least amount or memory.
 

Method Detail

clear

public void clear()
Remove all Objects from the list.

insert

public void insert(java.lang.Object item)
Insert an Object at the current position.
Parameters:
item - Object to add.

append

public void append(java.lang.Object item)
Insert an Object at the tail of the list.
Parameters:
item - Object to append.

remove

public java.lang.Object remove()
Removes and returns the current Object of the list.
Returns:
Object just removed.

goFirst

public void goFirst()
Sets the current Object to the first one in the list.

goNext

public void goNext()
Sets the current Object to the next one in the list.

goPrev

public void goPrev()
Sets the current Object to the previous one in the list.

getLength

public int getLength()
Returns the number of Objects in the list.
Returns:
The number of Objects in the list.

go

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

set

public void set(java.lang.Object val)
Sets the current Object's value: a reference.
Parameters:
val - The reference to set this list entre to.

get

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

isEmpty

public boolean isEmpty()
Returns whether or not the list is empty.
Returns:
true if a null list.

isInList

public boolean isInList()
Returns true if the current pointer is valid.
Returns:
true if the current pointer points within the list.

shrink

public void shrink()
Resizes the internal stucture to use the least amount or memory.

resize

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