Package eu.iv4xr.framework.mainConcepts
Class WorldEntity
java.lang.Object
eu.iv4xr.framework.mainConcepts.WorldEntity
- All Implemented Interfaces:
Serializable
- See Also:
- Serialized Form
-
Field Summary
Modifier and TypeFieldDescriptionboolean
If true then this entity is "dynamic", which means that its state may change at the runtime.Bounding box of this entity.A unique id identifying this entity.long
The last time the state of this entity is sampled, after which its state is always sampled to be the same as its current state (the start of stutter period towards the current state).The center position of this entity,long
Represent the last time the state of this entity is sampled.The type-name of the entity, e.g. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
assignTimeStamp(long ts)
Set the time-stamp of this Entity and its elements to the given time.boolean
getBooleanProperty(String propertyName)
int
getIntProperty(String propertyName)
Return a WorldEntity representing this entity's previous state, if that is tracked.getProperty(String propertyName)
getStringProperty(String propertyName)
boolean
True if this entity has no previous state, or if its state differs from its previous.int
hashCode()
The hashcode of this Entity.boolean
boolean
hasSameState(WorldEntity old)
Let e be non-null and represent the same entity as this entity (they have the same ID), but its state is possibly different than this entity.boolean
If true then this entity is a moving entity.void
This will link e as the previous state of this Entity.toString()
-
Field Details
-
id
A unique id identifying this entity. -
type
The type-name of the entity, e.g. "door". -
timestamp
public long timestampRepresent the last time the state of this entity is sampled. -
lastStutterTimestamp
public long lastStutterTimestampThe last time the state of this entity is sampled, after which its state is always sampled to be the same as its current state (the start of stutter period towards the current state). If the value is -1, if this time is not known. -
position
The center position of this entity, -
extent
Bounding box of this entity. -
velocity
-
dynamic
public final boolean dynamicIf true then this entity is "dynamic", which means that its state may change at the runtime. Note that an entity does not have to be moving (having velocity) to be dynamic. -
properties
-
elements
-
-
Constructor Details
-
WorldEntity
-
-
Method Details
-
hasSameState
Let e be non-null and represent the same entity as this entity (they have the same ID), but its state is possibly different than this entity. This method checks if both entity have the same state. Dynamic entity is assumed not to change state. Else this method first check the hash-value of both entities. If they are the same, this method performs deep comparison of position, velocity, properties, and sub-entities. This might be a bit expensive; override this method if a faster implementation is wanted. -
getProperty
-
getBooleanProperty
-
getStringProperty
-
getIntProperty
-
linkPreviousState
This will link e as the previous state of this Entity. The previous state of e is cleared to null (we only want to track the history of past state up to length 1). This method assume that e represents the same Entity as this Entity (e.g. they have the same id). -
getPreviousState
Return a WorldEntity representing this entity's previous state, if that is tracked. -
hasChangedState
public boolean hasChangedState()True if this entity has no previous state, or if its state differs from its previous. Note that we only track 1x previous state (so there is no longer chain of previous states). -
hasPreviousState
public boolean hasPreviousState() -
assignTimeStamp
public void assignTimeStamp(long ts)Set the time-stamp of this Entity and its elements to the given time. -
isMovingEntity
public boolean isMovingEntity()If true then this entity is a moving entity. This is defined as having a non-null velocity. Note that the entity may still have a zero velocity; but it will still be classified as "moving". -
hashCode
public int hashCode()The hashcode of this Entity. -
deepclone
- Throws:
IOException
ClassNotFoundException
-
toString
-