jfreerails.world.cargo
Class MutableCargoBundle
java.lang.Object
jfreerails.world.cargo.MutableCargoBundle
- All Implemented Interfaces:
- CargoBundle
public class MutableCargoBundle
- extends java.lang.Object
- implements CargoBundle
This CargoBundle implementation uses a java.util.SortedMap to
map quantities to cargo batches.
- Author:
- Luke
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
sortedMap
private final java.util.SortedMap<CargoBatch,java.lang.Integer> sortedMap
updateID
private int updateID
MutableCargoBundle
public MutableCargoBundle()
MutableCargoBundle
public MutableCargoBundle(ImmutableCargoBundle imcb)
addCargo
public void addCargo(CargoBatch cb,
int amount)
cargoBatchIterator
public java.util.Iterator<CargoBatch> cargoBatchIterator()
- Note, calling hasNext() or next() on the returned iterator throws a
ConcurrentModificationException if this CargoBundle has changed since the
iterator was aquired.
- Specified by:
cargoBatchIterator in interface CargoBundle
contains
public boolean contains(CargoBatch cb)
- Specified by:
contains in interface CargoBundle
equals
public boolean equals(java.lang.Object arg0)
- Overrides:
equals in class java.lang.Object
getAmount
public int getAmount(CargoBatch cb)
- Specified by:
getAmount in interface CargoBundle
getAmount
public int getAmount(int cargoType)
- Specified by:
getAmount in interface CargoBundle
hashCode
public int hashCode()
- Overrides:
hashCode in class java.lang.Object
setAmount
public void setAmount(CargoBatch cb,
int amount)
size
public int size()
- Specified by:
size in interface CargoBundle
toImmutableCargoBundle
public ImmutableCargoBundle toImmutableCargoBundle()
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object