|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.UnitManager
public class UnitManager
The UnitManager class contains and manages all units in virtual Mars. It has methods for getting information about units. It is also responsible for creating all units on its construction. There should be only one instance of this class and it should be constructed and owned by the virtual Mars object.
Field Summary | |
---|---|
static java.lang.String |
EQUIPMENT
|
static java.lang.String |
PERSON
|
static java.lang.String |
SETTLEMENT
|
static java.lang.String |
VEHICLE
|
Method Summary | |
---|---|
void |
addUnit(Unit unit)
Adds a unit to the unit manager if it doesn't already have it. |
void |
addUnitManagerListener(UnitManagerListener newListener)
Adds a unit manager listener |
Unit |
findUnit(java.lang.String name)
Finds a unit in the simulation that has the given name. |
void |
fireUnitManagerUpdate(java.lang.String eventType,
Unit unit)
Fire a unit update event. |
java.util.Collection<Equipment> |
getEquipment()
Get a collection of equipment. |
int |
getEquipmentNum()
Get the number of equipment. |
java.lang.String |
getNewName(java.lang.String unitType,
java.lang.String baseName,
java.lang.String gender)
Gets a new name for a unit. |
java.util.Collection<Person> |
getPeople()
Get people in virtual Mars |
int |
getPeopleNum()
Get number of people |
int |
getSettlementNum()
Get number of settlements |
java.util.Collection<Settlement> |
getSettlements()
Get settlements in vitual Mars |
int |
getUnitNum()
The total number of units |
java.util.Collection<Unit> |
getUnits()
Get all units in virtual Mars |
int |
getVehicleNum()
Get number of vehicles |
java.util.Collection<Vehicle> |
getVehicles()
Get vehicles in virtual Mars |
void |
removeUnitManagerListener(UnitManagerListener oldListener)
Removes a unit manager listener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String SETTLEMENT
public static final java.lang.String PERSON
public static final java.lang.String VEHICLE
public static final java.lang.String EQUIPMENT
Method Detail |
---|
public void addUnit(Unit unit)
unit
- new unit to add.public java.lang.String getNewName(java.lang.String unitType, java.lang.String baseName, java.lang.String gender)
unitType
- the type of unit.baseName
- the base name or null if none.gender
- the gender of the person or null if not a person.
java.lang.IllegalArgumentException
- if unitType is not valid.public int getSettlementNum()
public java.util.Collection<Settlement> getSettlements()
public int getVehicleNum()
public java.util.Collection<Vehicle> getVehicles()
public int getPeopleNum()
public java.util.Collection<Person> getPeople()
public int getEquipmentNum()
public java.util.Collection<Equipment> getEquipment()
public int getUnitNum()
public java.util.Collection<Unit> getUnits()
public final void addUnitManagerListener(UnitManagerListener newListener)
newListener
- the listener to add.public final void removeUnitManagerListener(UnitManagerListener oldListener)
oldListener
- the listener to remove.public final void fireUnitManagerUpdate(java.lang.String eventType, Unit unit)
eventType
- the event type.unit
- the unit causing the event.public Unit findUnit(java.lang.String name)
name
- the name to search for.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |