|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectrescuecore.RescueObject
This is the base class for all objects in the simulation environment
Field Summary | |
protected int |
id
The kernel-assigned id |
Constructor Summary | |
protected |
RescueObject(int type)
Construct a new RescueObject of a given type |
Method Summary | |
void |
addPropertyListener(PropertyListener l)
Add a PropertyListener |
static RescueObject |
decode(java.io.DataInput in,
int timestamp)
Decode a new RescueObject from a buffer and update the pointer |
static RescueObject |
decode(int type,
int id,
java.io.DataInput in,
int timestamp)
Decode a new RescueObject from a buffer and update the pointer |
static RescueObject[] |
decodeObjects(java.io.DataInput in,
int timestamp)
Decode a set of objects from a buffer. |
boolean |
equals(java.lang.Object o)
|
protected void |
firePropertyChanged(int property,
int timestep)
|
int |
getID()
Get this objects id |
int |
getInternalType()
Get this objects internal type |
int |
getLastPropertyUpdate(int property)
Get the last time a property was updated |
protected java.lang.String |
getPropertiesString()
Get a String representation of all this object's properties |
Property |
getProperty(int property)
|
boolean |
getPropertyAsBoolean(int property)
|
int |
getPropertyAsInt(int property)
|
int[] |
getPropertyAsIntArray(int property)
|
java.lang.String |
getPropertyAsString(int property)
|
int |
getType()
Get this objects type |
int |
hashCode()
|
boolean |
isAmbulanceCenter()
Is this object an ambulance center? |
boolean |
isAmbulanceTeam()
Is this object an ambulance team? |
boolean |
isBuilding()
Is this object a building? |
boolean |
isCivilian()
Is this object a civilian? |
boolean |
isFireBrigade()
Is this object a fire brigade? |
boolean |
isFireStation()
Is this object a fire station? |
boolean |
isHumanoid()
Is this object a humanoid? |
boolean |
isNode()
Is this object a node? |
boolean |
isPoliceForce()
Is this object a police force? |
boolean |
isPoliceOffice()
Is this object a police office? |
boolean |
isPropertyValueKnown(int property)
Is the value of a particular property known or assumed? |
boolean |
isRefuge()
Is this object a refuge? |
boolean |
isRoad()
Is this object a road? |
boolean |
propertyExists(int property)
Get all property types known by this object |
void |
removePropertyListener(PropertyListener l)
Remove a PropertyListener |
java.lang.String |
toLongString()
|
java.lang.String |
toString()
|
static int |
typeToInternalType(int type)
Convert a robocup rescue type into an internal, bitwise type |
void |
update(java.io.DataInput in,
int timestamp)
Update properties of this object using Objects data from a buffer |
boolean |
updateProperty(int property,
int timestamp,
boolean newValue)
Update the value of a property |
boolean |
updateProperty(int property,
int timestamp,
int newValue)
Update the value of a property |
boolean |
updateProperty(int property,
int timestamp,
int[] newValue)
Update the value of a property |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
protected int id
Constructor Detail |
protected RescueObject(int type)
type
- The type of this objectRescueConstants.TYPE_CIVILIAN
,
RescueConstants.TYPE_FIRE_BRIGADE
,
RescueConstants.TYPE_AMBULANCE_TEAM
,
RescueConstants.TYPE_POLICE_FORCE
,
RescueConstants.TYPE_ROAD
,
RescueConstants.TYPE_NODE
,
RescueConstants.TYPE_RIVER
,
RescueConstants.TYPE_RIVER_NODE
,
RescueConstants.TYPE_BUILDING
,
RescueConstants.TYPE_REFUGE
,
RescueConstants.TYPE_FIRE_STATION
,
RescueConstants.TYPE_AMBULANCE_CENTER
,
RescueConstants.TYPE_POLICE_OFFICE
,
RescueConstants.TYPE_WORLD
,
RescueConstants.TYPE_CAR
Method Detail |
public int getType()
RescueConstants.TYPE_CIVILIAN
,
RescueConstants.TYPE_FIRE_BRIGADE
,
RescueConstants.TYPE_AMBULANCE_TEAM
,
RescueConstants.TYPE_POLICE_FORCE
,
RescueConstants.TYPE_ROAD
,
RescueConstants.TYPE_NODE
,
RescueConstants.TYPE_RIVER
,
RescueConstants.TYPE_RIVER_NODE
,
RescueConstants.TYPE_BUILDING
,
RescueConstants.TYPE_REFUGE
,
RescueConstants.TYPE_FIRE_STATION
,
RescueConstants.TYPE_AMBULANCE_CENTER
,
RescueConstants.TYPE_POLICE_OFFICE
,
RescueConstants.TYPE_WORLD
,
RescueConstants.TYPE_CAR
public int getInternalType()
RescueConstants.INTERNAL_TYPE_CIVILIAN
,
RescueConstants.INTERNAL_TYPE_FIRE_BRIGADE
,
RescueConstants.INTERNAL_TYPE_AMBULANCE_TEAM
,
RescueConstants.INTERNAL_TYPE_POLICE_FORCE
,
RescueConstants.INTERNAL_TYPE_CAR
,
RescueConstants.INTERNAL_TYPE_BUILDING
,
RescueConstants.INTERNAL_TYPE_REFUGE
,
RescueConstants.INTERNAL_TYPE_FIRE_STATION
,
RescueConstants.INTERNAL_TYPE_POLICE_OFFICE
,
RescueConstants.INTERNAL_TYPE_AMBULANCE_CENTER
,
RescueConstants.INTERNAL_TYPE_ROAD
,
RescueConstants.INTERNAL_TYPE_NODE
,
RescueConstants.INTERNAL_TYPE_RIVER
,
RescueConstants.INTERNAL_TYPE_RIVER_NODE
,
RescueConstants.INTERNAL_TYPE_WORLD
,
RescueConstants.INTERNAL_TYPE_ANY_BUILDING
,
RescueConstants.INTERNAL_TYPE_ANY_HUMANOID
public int getID()
public int hashCode()
public boolean equals(java.lang.Object o)
public void addPropertyListener(PropertyListener l)
l
- The listener that will be notified of changes to any properties in this objectpublic void removePropertyListener(PropertyListener l)
l
- The listener that will no longer be notified of changes to any properties in this objectprotected java.lang.String getPropertiesString()
public boolean propertyExists(int property)
RescueConstants.PROPERTY_NULL
,
RescueConstants.PROPERTY_START_TIME
,
RescueConstants.PROPERTY_LONGITUDE
,
RescueConstants.PROPERTY_LATITUDE
,
RescueConstants.PROPERTY_WIND_FORCE
,
RescueConstants.PROPERTY_WIND_DIRECTION
,
RescueConstants.PROPERTY_X
,
RescueConstants.PROPERTY_Y
,
RescueConstants.PROPERTY_DIRECTION
,
RescueConstants.PROPERTY_POSITION
,
RescueConstants.PROPERTY_POSITION_HISTORY
,
RescueConstants.PROPERTY_POSITION_EXTRA
,
RescueConstants.PROPERTY_STAMINA
,
RescueConstants.PROPERTY_HP
,
RescueConstants.PROPERTY_DAMAGE
,
RescueConstants.PROPERTY_BURIEDNESS
,
RescueConstants.PROPERTY_FLOORS
,
RescueConstants.PROPERTY_BUILDING_ATTRIBUTES
,
RescueConstants.PROPERTY_IGNITION
,
RescueConstants.PROPERTY_BROKENNESS
,
RescueConstants.PROPERTY_FIERYNESS
,
RescueConstants.PROPERTY_ENTRANCES
,
RescueConstants.PROPERTY_BUILDING_SHAPE_ID
,
RescueConstants.PROPERTY_BUILDING_CODE
,
RescueConstants.PROPERTY_BUILDING_AREA_GROUND
,
RescueConstants.PROPERTY_BUILDING_AREA_TOTAL
,
RescueConstants.PROPERTY_BUILDING_APEXES
,
RescueConstants.PROPERTY_WATER_QUANTITY
,
RescueConstants.PROPERTY_STRETCHED_LENGTH
,
RescueConstants.PROPERTY_HEAD
,
RescueConstants.PROPERTY_TAIL
,
RescueConstants.PROPERTY_LENGTH
,
RescueConstants.PROPERTY_ROAD_KIND
,
RescueConstants.PROPERTY_CARS_PASS_TO_HEAD
,
RescueConstants.PROPERTY_CARS_PASS_TO_TAIL
,
RescueConstants.PROPERTY_HUMANS_PASS_TO_HEAD
,
RescueConstants.PROPERTY_HUMANS_PASS_TO_TAIL
,
RescueConstants.PROPERTY_WIDTH
,
RescueConstants.PROPERTY_BLOCK
,
RescueConstants.PROPERTY_REPAIR_COST
,
RescueConstants.PROPERTY_MEDIAN_STRIP
,
RescueConstants.PROPERTY_LINES_TO_HEAD
,
RescueConstants.PROPERTY_LINES_TO_TAIL
,
RescueConstants.PROPERTY_WIDTH_FOR_WALKERS
,
RescueConstants.PROPERTY_EDGES
,
RescueConstants.PROPERTY_SIGNAL
,
RescueConstants.PROPERTY_SIGNAL_TIMING
,
RescueConstants.PROPERTY_SHORTCUT_TO_TURN
,
RescueConstants.PROPERTY_POCKET_TO_TURN_ACROSS
public Property getProperty(int property) throws UnknownPropertyException
UnknownPropertyException
public java.lang.String getPropertyAsString(int property) throws UnknownPropertyException
UnknownPropertyException
public int getPropertyAsInt(int property) throws UnknownPropertyException
UnknownPropertyException
public int[] getPropertyAsIntArray(int property) throws UnknownPropertyException
UnknownPropertyException
public boolean getPropertyAsBoolean(int property) throws UnknownPropertyException
UnknownPropertyException
public int getLastPropertyUpdate(int property) throws UnknownPropertyException
property
- The property we want
UnknownPropertyException
- if the property is unknownpublic boolean isPropertyValueKnown(int property) throws UnknownPropertyException
property
- The property we want
UnknownPropertyException
- if the property is unknownpublic boolean updateProperty(int property, int timestamp, int newValue) throws UnknownPropertyException
property
- The property to updatetimestamp
- The current time step. If this update is more recent than the current value of the property then the update will proceednewValue
- The new value of the property
UnknownPropertyException
- if the property is not recognisedpublic boolean updateProperty(int property, int timestamp, int[] newValue) throws UnknownPropertyException
property
- The property to updatetimestamp
- The current time step. If this update is more recent than the current value of the property then the update will proceednewValue
- The new value of the property
UnknownPropertyException
- if the property is not recognisedpublic boolean updateProperty(int property, int timestamp, boolean newValue) throws UnknownPropertyException
property
- The property to updatetimestamp
- The current time step. If this update is more recent than the current value of the property then the update will proceednewValue
- The new value of the property
UnknownPropertyException
- if the property is not recognisedpublic java.lang.String toString()
public java.lang.String toLongString()
public final void update(java.io.DataInput in, int timestamp) throws UnknownPropertyException, java.io.IOException
in
- A DataInput to read data fromtimestamp
- The timestamp of the update
java.io.IOException
- if something goes wrong
UnknownPropertyException
- if an unrecognised property shows uppublic static RescueObject decode(java.io.DataInput in, int timestamp) throws UnknownTypeException, UnknownPropertyException, java.io.IOException
in
- A DataInput to read data fromtimestamp
- The current simulation timestamp
UnknownTypeException
- if an unknown object type appears
UnknownPropertyException
- if an unknown property shows up
java.io.IOException
- if there is an IO problemRescueConstants.TYPE_NULL
public static RescueObject decode(int type, int id, java.io.DataInput in, int timestamp) throws UnknownTypeException, UnknownPropertyException, java.io.IOException
type
- The type of this objectid
- The id of this objectin
- A DataInput to read data fromtimestamp
- The current simulation timestamp
UnknownTypeException
- if an unknown object type appears
UnknownPropertyException
- if an unknown property shows up
java.io.IOException
- if there is an IO problemRescueConstants.TYPE_NULL
public static RescueObject[] decodeObjects(java.io.DataInput in, int timestamp) throws UnknownTypeException, UnknownPropertyException, java.io.IOException
in
- The DataInput to read data fromtimestamp
- The current simulation timestamp
UnknownTypeException
- if an unknown object type appears
UnknownPropertyException
- if an unknown property shows up
java.io.IOException
- if there is an IO problemRescueConstants.TYPE_NULL
public static int typeToInternalType(int type)
type
- The rescue type to convert
public boolean isBuilding()
public boolean isRefuge()
public boolean isFireStation()
public boolean isPoliceOffice()
public boolean isAmbulanceCenter()
public boolean isRoad()
public boolean isNode()
public boolean isCivilian()
public boolean isHumanoid()
public boolean isAmbulanceTeam()
public boolean isPoliceForce()
public boolean isFireBrigade()
protected void firePropertyChanged(int property, int timestep)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |