|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mars_sim.msp.simulation.Unit
public abstract class Unit
The Unit class is the abstract parent class to all units in the Simulation. Units include people, vehicles and settlements. This class provides data members and methods common to all units.
Field Summary | |
---|---|
static java.lang.String |
CONTAINER_UNIT_EVENT
|
static java.lang.String |
DESCRIPTION_EVENT
|
static java.lang.String |
LOCATION_EVENT
|
static java.lang.String |
MASS_EVENT
|
static java.lang.String |
NAME_EVENT
|
Constructor Summary | |
---|---|
Unit(java.lang.String name,
Coordinates location)
Constructor |
Method Summary | |
---|---|
void |
addUnitListener(UnitListener newListener)
Adds a unit listener |
void |
fireUnitUpdate(java.lang.String updateType)
Fire a unit update event. |
void |
fireUnitUpdate(java.lang.String updateType,
java.lang.Object target)
Fire a unit update event. |
double |
getBaseMass()
Gets the base mass of the unit. |
Unit |
getContainerUnit()
Gets the unit's container unit. |
Coordinates |
getCoordinates()
Gets the unit's location |
java.lang.String |
getDescription()
Gets the unit's description |
Inventory |
getInventory()
Gets the unit's inventory |
double |
getMass()
Gets the unit's mass including inventory mass. |
java.lang.String |
getName()
Gets the unit's name |
Unit |
getTopContainerUnit()
Gets the topmost container unit that owns this unit. |
UnitManager |
getUnitManager()
Gets the unit's UnitManager |
void |
removeUnitListener(UnitListener oldListener)
Removes a unit listener |
protected void |
setBaseMass(double baseMass)
Sets the unit's base mass. |
void |
setContainerUnit(Unit containerUnit)
Sets the unit's container unit. |
void |
setCoordinates(Coordinates newLocation)
Sets unit's location coordinates |
protected void |
setDescription(java.lang.String description)
Sets the unit's description. |
void |
setName(java.lang.String name)
Sets the unit's name |
void |
timePassing(double time)
Time passing for unit. |
java.lang.String |
toString()
String representation of this Unit. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String NAME_EVENT
public static final java.lang.String DESCRIPTION_EVENT
public static final java.lang.String MASS_EVENT
public static final java.lang.String LOCATION_EVENT
public static final java.lang.String CONTAINER_UNIT_EVENT
Constructor Detail |
---|
public Unit(java.lang.String name, Coordinates location)
name
- the name of the unitlocation
- the unit's locationMethod Detail |
---|
public UnitManager getUnitManager()
public java.lang.String getName()
public final void setName(java.lang.String name)
name
- new namepublic java.lang.String getDescription()
protected final void setDescription(java.lang.String description)
description
- new description.public Coordinates getCoordinates()
public void setCoordinates(Coordinates newLocation)
newLocation
- the new location of the unitpublic void timePassing(double time) throws java.lang.Exception
time
- the amount of time passing (in millisols)
java.lang.Exception
- if error during time passing.public Inventory getInventory()
public Unit getContainerUnit()
public Unit getTopContainerUnit()
public void setContainerUnit(Unit containerUnit)
containerUnit
- the unit to contain this unit.public double getMass() throws java.lang.Exception
java.lang.Exception
- if error getting the mass.protected final void setBaseMass(double baseMass)
baseMass
- mass (kg)public double getBaseMass()
public java.lang.String toString()
toString
in class java.lang.Object
public final void addUnitListener(UnitListener newListener)
newListener
- the listener to add.public final void removeUnitListener(UnitListener oldListener)
oldListener
- the listener to remove.public final void fireUnitUpdate(java.lang.String updateType)
updateType
- the update type.public final void fireUnitUpdate(java.lang.String updateType, java.lang.Object target)
updateType
- the update type.target
- the event target object or null if none.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |