csli.util.collections
Class CurrentList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList
          extended by csli.util.collections.CurrentList
All Implemented Interfaces:
Serializable, Iterable, Collection, List

public class CurrentList
extends AbstractList
implements Serializable

List with a notion of the current object.

Author:
Danilo Mirkovic
See Also:
Serialized Form

Field Summary
static int NONE
           
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
CurrentList()
           
 
Method Summary
 void add(int index, Object element)
           
 boolean atEnd()
           
 void decrement()
           
 Object get(int index)
           
 Object getCurrent()
           
 int getCurrentIndex()
           
 void increment()
           
 Object remove(int index)
           
 void setCurrent(Object o)
           
 void setCurrentIndex(int index)
          Set the index of the current item.
 int size()
           
 String toString()
           
 
Methods inherited from class java.util.AbstractList
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Field Detail

NONE

public static final int NONE
See Also:
Constant Field Values
Constructor Detail

CurrentList

public CurrentList()
Method Detail

setCurrent

public void setCurrent(Object o)

setCurrentIndex

public void setCurrentIndex(int index)
Set the index of the current item. Set it to NONE (-1) to indicate no item is selected.

Parameters:
index -

getCurrentIndex

public int getCurrentIndex()
Returns:
index of the current item, -1 (NONE) if none.

atEnd

public boolean atEnd()

increment

public void increment()

decrement

public void decrement()

getCurrent

public Object getCurrent()
Returns:
the item at current index, null if no items are current

get

public Object get(int index)
Specified by:
get in interface List
Specified by:
get in class AbstractList

size

public int size()
Specified by:
size in interface Collection
Specified by:
size in interface List
Specified by:
size in class AbstractCollection

add

public void add(int index,
                Object element)
Specified by:
add in interface List
Overrides:
add in class AbstractList

remove

public Object remove(int index)
Specified by:
remove in interface List
Overrides:
remove in class AbstractList

toString

public String toString()
Overrides:
toString in class AbstractCollection