All Packages Class Hierarchy This Package Previous Next Index
Class mil.navy.nps.dis.EntityID
java.lang.Object
|
+----mil.navy.nps.dis.PduElement
|
+----mil.navy.nps.dis.EntityID
- public class EntityID
- extends PduElement
EntityID
EntityID is a composite of several values that are commonly found together,
and that,when combined, uniquely identify an entity in a simulation.
For a web-based reference, see
Note that I've "flattened" it a bit, by combining the simulation address
record together with the entity ID in one object, rather than using the
simulation address as its own object. This is a questionable move.
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.
HISTORY
15Nov96 DMcG New
10Mar97 DMcG cleaned up for javadoc
- Version:
- 1.0
- Author:
- Don McGregor ( http://www.stl.nps.navy.mil/~mcgredo)
- See Also:
- ProtocolDataUnit, PduElement, SerializationInterface
-
EntityID()
-
-
EntityID(short, short, short)
-
-
application()
-
-
clone()
-
-
deSerialize(DataInputStream)
-
-
entity()
-
-
equals(Object)
-
returns yes if the object is exactly equal to another object,
ie, contains the same values.
-
hashCode()
-
This provides a hash code for the object, since this is a handy way to
uniquely identify entities.
-
length()
-
-
printValues(int)
-
-
serialize(DataOutputStream)
-
-
setApplication(int)
-
-
setApplication(UnsignedShort)
-
-
setEntity(int)
-
-
setEntity(UnsignedShort)
-
-
setSite(int)
-
-
setSite(UnsignedShort)
-
-
site()
-
EntityID
public EntityID()
EntityID
public EntityID(short pSiteID,
short pApplicationID,
short pEntityID)
clone
public Object clone()
- Overrides:
- clone in class PduElement
serialize
public void serialize(DataOutputStream outputStream)
- Overrides:
- serialize in class PduElement
deSerialize
public void deSerialize(DataInputStream inputStream)
- Overrides:
- deSerialize in class PduElement
length
public int length()
- Overrides:
- length in class PduElement
printValues
public void printValues(int indentLevel)
- Overrides:
- printValues in class PduElement
hashCode
public int hashCode()
- This provides a hash code for the object, since this is a handy way to
uniquely identify entities. There's a problem, since there are 48 bits
of information in the object, but the hash code has only 32 bits to
put things in. 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.
- Overrides:
- hashCode in class Object
equals
public boolean equals(Object obj)
- returns yes if the object is exactly equal to another object,
ie, contains the same values.
- Overrides:
- equals in class Object
site
public UnsignedShort site()
setSite
public void setSite(UnsignedShort pSite)
setSite
public void setSite(int pSite)
application
public UnsignedShort application()
setApplication
public void setApplication(UnsignedShort pApplication)
setApplication
public void setApplication(int pApplication)
entity
public UnsignedShort entity()
setEntity
public void setEntity(UnsignedShort pEntity)
setEntity
public void setEntity(int pEntity)
All Packages Class Hierarchy This Package Previous Next Index