jfreerails.world.cargo
Class ImmutableCargoBundle
java.lang.Object
jfreerails.world.cargo.ImmutableCargoBundle
- All Implemented Interfaces:
- java.io.Serializable, CargoBundle, FreerailsSerializable
public class ImmutableCargoBundle
- extends java.lang.Object
- implements CargoBundle, FreerailsSerializable
This class represents a bundle of cargo made up of quantities of cargo from
different CargoBatchs.
For example:
| Cargo Batch |
Quantity |
| passengers from (1, 5) created at 01:00 |
2 |
| passengers from (1, 5) created at 01:25 |
1 |
| coal from (4,10) created at 02:50 |
8 |
| mail from (6, 10) created at 04:45 |
10 |
- Author:
- Luke
- See Also:
- Serialized Form
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
EMPTY_BUNDLE
public static final ImmutableCargoBundle EMPTY_BUNDLE
serialVersionUID
private static final long serialVersionUID
- See Also:
- Constant Field Values
amounts
private final ImInts amounts
batches
private final ImList<CargoBatch> batches
ImmutableCargoBundle
private ImmutableCargoBundle()
ImmutableCargoBundle
public ImmutableCargoBundle(java.util.SortedMap<CargoBatch,java.lang.Integer> sortedMap)
equals
public static boolean equals(CargoBundle a,
CargoBundle b)
cargoBatchIterator
public java.util.Iterator<CargoBatch> cargoBatchIterator()
- Description copied from interface:
CargoBundle
- 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
size
public int size()
- Specified by:
size in interface CargoBundle
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object