csli.util.collections
Class CurrentList
java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractList
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
|
| Methods inherited from class java.util.AbstractList |
add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, removeRange, set, subList |
NONE
public static final int NONE
- See Also:
- Constant Field Values
CurrentList
public CurrentList()
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