Class mil.navy.nps.dis.EntityID
java.lang.Object
|
+----mil.navy.nps.dis.PduElement
|
+----mil.navy.nps.dis.EntityID
- public class EntityID
- extends PduElement
- Version:
- 1.0
- Author:
- Don McGregor (http://www.stl.nps.navy.mil/~mcgredo)
- Location:
-
http://www.stl.nps.navy.mil/dis-java-vrml/mil/navy/nps/dis/EntityID.java
- Hierarchy Diagram:
- Summary:
- Each Entity in a given exercise executing on a DIS application shall be assigned
an Entity Identifier Record Unique to the exercise.
- Explanation:
- EntityID is a composite of several values that are commonly found together,
and that,when combined, uniquely identify an entity in a simulation.
It's used in a variety of PDUs, typically to identify a receving and a
sending entity. Since it uniquely identifies an entity in a virtual world,
it's a good candidate to act as a hash table key.
- Note:
- Note that I've "flattened" the Simulation Address Record, so that you instead
of the simulation address record , you will find the Site ID and the Application ID.
This is a questionnable move.
- History:
- 15Nov96 /Don McGregor /New
- 10Mar97 /Don McGregor /cleaned up for javadoc
- 16Apr97 /Don McGregor /PrintStream passed to printValues
- 12Aug97 /DonB /elaborated printValues
- 8Dec97 /Ronan Fauglas /changes for documentation templates + complements in documentation
- 11Dec97 /Ronan Fauglas /changes access methods names from "variable()" to "getVariable()"
- References:
- DIS Data Dictionary :
Entity Identifier Record
- DIS specification : IEEE 1278.1, 5.3.14
- See Also:
- ProtocolDataUnit, PduElement, mil.navy.nps.util.SerializationInterface
Constructor Summary
|
EntityID()
Default constructor--fills with zeros for all values.
|
EntityID(short pSiteID,
short pApplicationID,
short pEntityID)
Constructs a new Entity Identifier, with variables values passed in parameters.
|
EntityID(int pSiteID,
int pApplicationID,
int pEntityID)
Constructs a new Entity Identifier, with variables values passed in parameters.
|
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SHORT_HIGH_BYTE_MASK
public static final int SHORT_HIGH_BYTE_MASK
SHORT_LOW_BYTE_MASK
public static final int SHORT_LOW_BYTE_MASK
siteID
protected mil.navy.nps.util.UnsignedShort siteID
- Site the entity came from.
Each DIS Site has a unique Identifier. 0, 2^16-1 and 2^16-2 are reserved.
- Value:
- No site shall be assigned an ID containin all zero's, (2e16-1) or (2e16-2). The mechanism by which Site IDs
are assigned is outside the scope of this standard.
The simulation manager shall use the reserved site IDs to identify receivers
of Simulation Management PDUs. A site ID equal to zero shall mean no site;
this may be used to annotate a PDU log. A site ID equal to all ones (2e16-1) shall mean all sites;
this may be used to start all sites. An application ID equal to (2e16-2) shall have no meaning
but is reserved for consistency.
- References:
- DIS Data Dictionary:
Site Identifier Field
- DIS specification : IEEE 1278.1, 5.3.14.1.1
applicationID
protected mil.navy.nps.util.UnsignedShort applicationID
- Application at that site this came from.
Each DIS application has a unique Identifier on a given site. 0, 2^16-1 and 2^16-2 are reserved.
- Value:
- No simulation application shall be assigned an id containin
all zeros, (2e16-1), or (2e16-2). One or more simulation applications may reside
in a single host computer.
The mechanism by which application IDs are assigned is outside the scope of this standard.
The simulation manager shall use the reserved application IDs to identify receivers
of Simulation Management PDUs. An application ID equal to zero shall mean no application (NO_APPLIC).
An application ID equal to all ones (2e16-1) shall mean all applications (ALL_APPLIC); this may be used
to start all applications within a site. An application ID equal to (2e16-2) shall have no
meaning but is reserved for consistency.
- References:
- DIS Data Dictionary:
Application Identifier Field
- DIS specification : IEEE 1278.1, 5.3.14.1.2
entityID
protected mil.navy.nps.util.UnsignedShort entityID
- Entity within the current application.
Each Entity has a unique Identifier on a given site. 0, 2^16-1 and 2^16-2 are reserved.
- Value:
- This identifier is valid for the duration of the exercise; however, entity IDs shall be reused
when all possible entity IDs have been exhausted. No entity shall have an ID of zero, (2e16 -1)
or (2e16-2) (which is NO_ENTITY, ALL_ENTITIES or RQSRT_ASSIGN_ID). This number need not be registered or retained for future exercises.
- References:
- DIS Data Dictionary:
Entity Identity Field
- DIS specification : IEEE 1278.1, 5.3.14.2
EntityID
public EntityID()
- Default constructor--fills with zeros for all values.
EntityID
public EntityID(short pSiteID,
short pApplicationID,
short pEntityID)
- Constructs a new Entity Identifier, with variables values passed in parameters.
- Parameters:
pSiteID
- the Site Identifier
pApplicationID
- the Application Identifier for that site
pEntityID
- the Entity identifier for that application
EntityID
public EntityID(int pSiteID,
int pApplicationID,
int pEntityID)
- Constructs a new Entity Identifier, with variables values passed in parameters.
This is a convienence method for when you've got integers and don't want to
convert to shorts, or if you have unsigned shorts that are greater than
a signed short.
- Parameters:
pSiteID
- the Site Identifier
pApplicationID
- the Application Identifier for that site
pEntityID
- the Entity identifier for that application
clone
public java.lang.Object clone()
- Overrides:
- clone in class PduElement
serialize
public void serialize(java.io.DataOutputStream outputStream)
- Overrides:
- serialize in class PduElement
deSerialize
public void deSerialize(java.io.DataInputStream inputStream)
- Overrides:
- deSerialize in class PduElement
length
public int length()
- Overrides:
- length in class PduElement
printValues
public void printValues(int indentLevel,
java.io.PrintStream printStream)
- Overrides:
- printValues in class PduElement
hashCode
public int hashCode()
- This provides a hash code for the object.
A Hash code is a handy way to uniquely identify entities.
- The problem:
There's a problem with the core API, since there are 48 bits of information in the object,
but the hash code has only 32 bits to put things in. So we have to hash on some subset
of the data available.
- The solution:
The solution right now is to ignore the application ID when generating the hash code.
Furthermore, the entity ID is in the upper 16 bits, while the site ID is in the lower 16 bits.
The idea is that this will help spread out the hash code a bit more, since there are probably
many more entities than sites, and putting the part with more information
in the MSB helps spread things out. This helps prevent collisions, which improves
performance.
- Returns:
- a hash code value for this object
- Overrides:
- hashCode in class java.lang.Object
equals
public boolean equals(java.lang.Object obj)
- Makes a "numeric equality" test.
- Parameters:
obj
- the object want to be compared with this object.
- Returns:
- yes if the object in parameter is of the same type and
if the numerical values of both objects are equal.
- Overrides:
- equals in class java.lang.Object
getSiteID
public mil.navy.nps.util.UnsignedShort getSiteID()
setSiteID
public void setSiteID(mil.navy.nps.util.UnsignedShort pSiteID)
setSiteID
public void setSiteID(int pSiteID)
getApplicationID
public mil.navy.nps.util.UnsignedShort getApplicationID()
setApplicationID
public void setApplicationID(mil.navy.nps.util.UnsignedShort pApplicationID)
setApplicationID
public void setApplicationID(int pApplicationID)
getEntityID
public mil.navy.nps.util.UnsignedShort getEntityID()
setEntityID
public void setEntityID(mil.navy.nps.util.UnsignedShort pEntityID)
setEntityID
public void setEntityID(int pEntityID)