|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object us.asciiroth.client.core.Bag<T>
T
- public class Bag<T extends Piece>
A collection of items or effects. A bag keeps track of the count of like items within the bag, and has logic for correctly adding and removing counts, rather than item instances.
Nested Class Summary | |
---|---|
static class |
Bag.Entry<T extends Piece>
An entry in the bag. |
Constructor Summary | |
---|---|
Bag()
Constructor. |
Method Summary | |
---|---|
void |
add(int index,
T piece)
Add an item to the bag at the indicated index. |
void |
add(T piece)
Add one count of an item to the bag. |
java.util.List<Bag.Entry<T>> |
asEntryList()
|
boolean |
contains(T piece)
Does this bag contain one or more of the indicated piece? |
Bag.Entry<T> |
findEntry(T piece)
|
T |
get(int index)
Get the item at the given index |
int |
getCount(T piece)
Get the current count for this item type. |
int |
getIndex(T piece)
Get the index of the entry for this item. |
boolean |
isEmpty()
Is the bag empty? |
T |
last()
Get the last item in this bag (and thus, the item that is visible when on the ground). |
void |
remove(T piece)
Remove one count of an item from the bag. |
int |
size()
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Bag()
Method Detail |
---|
public void add(int index, T piece)
index
- piece
- public void add(T piece)
piece
- public java.util.List<Bag.Entry<T>> asEntryList()
public boolean contains(T piece)
piece
-
public Bag.Entry<T> findEntry(T piece)
public T get(int index)
index
-
public int getCount(T piece)
piece
-
public int getIndex(T piece)
piece
-
public boolean isEmpty()
public T last()
public void remove(T piece)
piece
- public int size()
|
0.7 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
© 2009 Alx Dark