org.knowceans.util
Class ItemList<E>

java.lang.Object
  extended by org.knowceans.util.ItemList<E>
All Implemented Interfaces:
java.io.Serializable

public class ItemList<E>
extends java.lang.Object
implements java.io.Serializable

ItemList represents a circular list of items that can be browsed with next and prev commands in jsp pages (eg, result sets). The list ensures uniqueness of its elements with the conservative strategy of the SetVector class. This allows to control the list via its element values. E.g., in a result set with paging, if links such as [first, back, forward, last] in a web page are used, the item associated with the new page can be directly found via this element.

Author:
heinrich
See Also:
Serialized Form

Constructor Summary
ItemList()
           
ItemList(java.util.Collection<? extends E> c)
           
ItemList(int initialCapacity)
           
ItemList(int initialCapacity, int capacityIncrement)
           
 
Method Summary
 E getCurr()
           
 SetVector<E> getData()
          get the data vector
 E getFirst()
           
 E getLast()
           
 E getNext()
           
 E getPrev()
           
 int getSize()
          the size of the data vector
 int getState()
          get the state of the list
 E goFirst()
           
 E goLast()
           
 E goNext()
           
 E goPrev()
           
 void setData(SetVector<E> data)
          set the data vector
 void setState(int newstate)
          sets the state of the list, if the state is larger than the size, it is set to zero
 int setStateByValue(E newvalue)
          set the new state of the variable
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ItemList

public ItemList()

ItemList

public ItemList(java.util.Collection<? extends E> c)
Parameters:
c -

ItemList

public ItemList(int initialCapacity,
                int capacityIncrement)
Parameters:
initialCapacity -
capacityIncrement -

ItemList

public ItemList(int initialCapacity)
Parameters:
initialCapacity -
Method Detail

getState

public final int getState()
get the state of the list

Returns:

setState

public final void setState(int newstate)
sets the state of the list, if the state is larger than the size, it is set to zero

Parameters:
newstate -

setStateByValue

public final int setStateByValue(E newvalue)
set the new state of the variable

Parameters:
newvalue -
Returns:
the state

getNext

public E getNext()
Returns:
the next item or the first one or null for zero size

goNext

public E goNext()
Returns:
the next item or the first one or null for zero size

getCurr

public E getCurr()
Returns:
the current item or null for zero size

getPrev

public E getPrev()
Returns:
the previous item or the last one or null for zero size

goPrev

public E goPrev()
Returns:
the previous item or the last one or null for zero size

getLast

public E getLast()
Returns:
the last item or null for zero size

goLast

public E goLast()
Returns:
the last item or null for zero size

getFirst

public E getFirst()
Returns:
the first item or null for zero size

goFirst

public E goFirst()
Returns:
the first item or null for zero size

getSize

public int getSize()
the size of the data vector

Returns:

getData

public final SetVector<E> getData()
get the data vector

Returns:

setData

public final void setData(SetVector<E> data)
set the data vector

Parameters:
data -