|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmil.navy.nps.dis.PduElement
mil.navy.nps.dis.ProtocolDataUnit
mil.navy.nps.dis.CollisionPdu
Report collision between entities.
As with other PDUs, it knows how to serialize and deserialize itself from the wire. It also knows how to clone itself, and knows how to calculate its size when sent to the wire.
EntityStatePdu
,
PduElement
,
ProtocolDataUnit
,
SerializationInterface
,
CollisionTypeField
Field Summary | |
protected EntityID |
collidingEntityID
Colliding Entity ID - This field shall identify the entity that has collided with the issuing entity. |
protected UnsignedByte |
collisionType
Collision Type - This field shall identify the type of collision. |
protected EventID |
eventID
Event ID - this field shall contain an identification generated by the issuing simulation application to associate related collision events. |
protected EntityID |
issuingEntityID
Issuing Entity ID - This field shall identify the entity that is issueing the Pdu |
protected EntityCoordinate |
location
Location - [m,m,m] This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. |
protected float |
mass
Mass - [kg] this field shall contain the mass of the issuing entity. |
static int |
sizeOf
Constant value- [bytes] size of an collision PDU without headder. |
protected LinearVelocity |
velocity
Velocity - [m/s] This field shall contain the velocity of the issuing entity (at the time the collision is detected). |
Fields inherited from class mil.navy.nps.dis.ProtocolDataUnit |
DEBUG, exerciseID, pduType, protocolFamily, protocolVersion, timeReceived, timestamp |
Constructor Summary | |
CollisionPdu()
Default constructor--fills with zeros for all values. |
Method Summary | |
java.lang.Object |
clone()
Makes deep copies of all the instance variables, so we don't have two objects pointing to the same data. |
void |
deSerialize(java.io.DataInputStream inputStream)
Deserialize our data from the input stream. |
EntityID |
getCollidingEntityID()
Returns the ID of the colliding entity. |
UnsignedByte |
getCollisionType()
Returns the type of the collision. |
EventID |
getEventID()
Returns the ID of the event. |
EntityID |
getIssuingEntityID()
Returns the ID of the issuing entity. |
LinearVelocity |
getLinearVelocity()
Returns the linear velocity (safe deep copy). |
EntityCoordinate |
getLocation()
Returns location of the colliding entity (safe deep copy). |
float |
getMass()
Returns the mass of the colliding entity |
int |
length()
returns the size of the class (return sizeOf) |
java.lang.String |
pduName()
returns new String("Collision PDU"). |
void |
printValues(int indentLevel,
java.io.PrintStream printStream)
Prints the valules of the PDU fields. |
void |
serialize(java.io.DataOutputStream outputStream)
Serialize our data out to the stream. |
void |
setCollidingEntityID(EntityID pCollidingEntityID)
Sets the ID of the colliding entity. |
void |
setCollisionType(UnsignedByte pCollisionType)
Sets the type of the collision. |
void |
setEventID(EventID pEventID)
Sets the ID of the event. |
void |
setIssuingEntityID(EntityID pIssuingEntityID)
Sets the ID of the issuing entity. |
void |
setLinearVelocity(float x,
float y,
float z)
Sets the linear velocity given each of the xyz velocities |
void |
setLinearVelocity(LinearVelocity pLinearVelocity)
Sets the linear velocity given a lienar velocity |
void |
setLocation(EntityCoordinate pLocation)
Sets location of the colliding entity. |
void |
setLocation(float x,
float y,
float z)
Sets location of the colliding entity given (x,y,z). |
void |
setMass(float pMass)
Sets the mass of the colliding entity |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected EntityID issuingEntityID
protected EntityID collidingEntityID
protected EventID eventID
protected UnsignedByte collisionType
protected LinearVelocity velocity
protected float mass
protected EntityCoordinate location
public static final int sizeOf
sizeOf = 60 bytes
Constructor Detail |
public CollisionPdu()
Method Detail |
public java.lang.Object clone()
PduElement
clone
in class ProtocolDataUnit
public void serialize(java.io.DataOutputStream outputStream)
PduElement
super.Serialize()
to make sure
the superclasse's data is serialized out. The order
in which instance variables are serialized is significant. They must
be serialized in the same order they appear in the DIS
spec.
Prints out some information during execution if debugging flag is set.
serialize
in interface SerializationInterface
serialize
in class ProtocolDataUnit
java.lang.RuntimeException
- when IO error occurs.public void deSerialize(java.io.DataInputStream inputStream)
PduElement
super.deSerialize
to make sure
the superclass's data are properly affected. The order
in which instance variables are serialized is significant. They must
be deSerialized in the same order as they have been serialized as specified by the DIS spec.
deSerialize
in interface SerializationInterface
deSerialize
in class ProtocolDataUnit
java.lang.RuntimeException
- when IO error occurs.public int length()
length
in class ProtocolDataUnit
public java.lang.String pduName()
pduName
in class ProtocolDataUnit
String
public void printValues(int indentLevel, java.io.PrintStream printStream)
printValues
in class ProtocolDataUnit
public EntityID getIssuingEntityID()
public void setIssuingEntityID(EntityID pIssuingEntityID)
public EntityID getCollidingEntityID()
public void setCollidingEntityID(EntityID pCollidingEntityID)
public EventID getEventID()
public void setEventID(EventID pEventID)
public UnsignedByte getCollisionType()
public void setCollisionType(UnsignedByte pCollisionType)
public LinearVelocity getLinearVelocity()
public void setLinearVelocity(LinearVelocity pLinearVelocity)
public void setLinearVelocity(float x, float y, float z)
public float getMass()
public void setMass(float pMass)
public EntityCoordinate getLocation()
public void setLocation(EntityCoordinate pLocation)
public void setLocation(float x, float y, float z)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |