|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectrails.game.state.ArrayListState<E>
public class ArrayListState<E>
State class that wraps an ArrayList Generates according list moves Remark: Does not extend State or implements StateI do avoid additional overhead All state/move mechanisms already contained in Move objects For the future a simpler unified StateI would make things clearer TODO: Replace all stateful lists by this class and simplify according move objects
| Constructor Summary | |
|---|---|
ArrayListState(java.lang.String listName)
constructor for an empty list |
|
ArrayListState(java.lang.String listName,
java.util.Collection<E> collection)
constructor for a prefilled list |
|
| Method Summary | |
|---|---|
void |
add(E element)
|
void |
add(int index,
E element)
|
void |
clear()
|
boolean |
contains(E element)
|
E |
get(int index)
|
int |
indexOf(java.lang.Object o)
|
void |
move(E element,
int toIndex)
|
boolean |
remove(E element)
|
int |
size()
|
java.util.List<E> |
viewList()
returns unmodifiable view of list |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ArrayListState(java.lang.String listName)
name -
public ArrayListState(java.lang.String listName,
java.util.Collection<E> collection)
element - | Method Detail |
|---|
public void add(E element)
public void add(int index,
E element)
public boolean remove(E element)
public void move(E element,
int toIndex)
public boolean contains(E element)
public void clear()
public java.util.List<E> viewList()
public int size()
public int indexOf(java.lang.Object o)
public E get(int index)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||