chtdecoder.datastructures
Class AbstractCHTCodeList

java.lang.Object
  extended bychtdecoder.datastructures.AbstractCHTCodeList
All Implemented Interfaces:
CHTCodeList

public abstract class AbstractCHTCodeList
extends java.lang.Object
implements CHTCodeList

An abstract implementation of the CHTCodeList interface.

Version:
1.1, 09/14/04
Author:
John David Ratliff

Field Summary
protected  java.util.Vector vector
           
 
Constructor Summary
AbstractCHTCodeList()
           
 
Method Summary
 void add(CHTCode code)
          Adds a CHTCode to the end of this list.
static CHTCodeList createList()
          A factory method for creating CHTCodeList objects.
 CHTCode get(int index)
          Gets a CHTCode from this list.
 boolean isEmpty()
          Queries if this list is empty.
 CHTCodeIterator iterator()
          Gets an iterator for the elements in this list.
 CHTCode remove(int index)
          Removes a CHTCode from this list at position index.
 int size()
          Gets the size of this list (the element count).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

vector

protected java.util.Vector vector
Constructor Detail

AbstractCHTCodeList

public AbstractCHTCodeList()
Method Detail

createList

public static CHTCodeList createList()
A factory method for creating CHTCodeList objects.

Returns:
The new CHTCodeList object.

add

public void add(CHTCode code)
Adds a CHTCode to the end of this list.

Specified by:
add in interface CHTCodeList
Parameters:
code - the CHTCode to add.

remove

public CHTCode remove(int index)
               throws java.lang.ArrayIndexOutOfBoundsException
Removes a CHTCode from this list at position index.

Specified by:
remove in interface CHTCodeList
Parameters:
index - The position in the list to remove.
Returns:
The removed CHTCode object.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index in not valid (0 < index < size())

get

public CHTCode get(int index)
            throws java.lang.ArrayIndexOutOfBoundsException
Gets a CHTCode from this list.

Specified by:
get in interface CHTCodeList
Parameters:
index - The index of the CHTCode to get.
Returns:
The CHTCode.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the index in not valid (0 < index < size())

size

public int size()
Gets the size of this list (the element count).

Specified by:
size in interface CHTCodeList
Returns:
The number of elements in this list.

isEmpty

public boolean isEmpty()
Queries if this list is empty.

Specified by:
isEmpty in interface CHTCodeList
Returns:
true if this list is empty; false otherwise.

iterator

public CHTCodeIterator iterator()
Gets an iterator for the elements in this list.

Specified by:
iterator in interface CHTCodeList
Returns:
The CHTCodeIterator.