Package edu.nps.moves.dis7
Class CollisionPdu
java.lang.Object
edu.nps.moves.dis7.Pdu
edu.nps.moves.dis7.PduBase
edu.nps.moves.dis7.EntityInformationFamilyPdu
edu.nps.moves.dis7.CollisionPdu
- All Implemented Interfaces:
edu.nps.moves.dis7.Marshaller
,java.io.Serializable
public class CollisionPdu extends EntityInformationFamilyPdu implements java.io.Serializable
7.2.3 Collisions between entities shall be communicated by issuing a Collision PDU. See 5.3.3.
IEEE Std 1278.1-2012, IEEE Standard for Distributed Interactive Simulation—Application Protocols
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description protected EntityID
collidingEntityID
This field shall identify the entity that has collided with the issuing entity (see 5.3.3.4).protected CollisionType
collisionType
This field shall identify the type of collision.protected EventIdentifier
eventID
This field shall contain an identification generated by the issuing simulation application to associate related collision events.protected EntityID
issuingEntityID
This field shall identify the entity that is issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28).protected Vector3Float
location
This field shall specify the location of the collision with respect to the entity with which the issuing entity collided.protected float
mass
This field shall contain the mass of the issuing entity, and shall be represented by a 32-bit floating point number representing kilograms.protected byte
pad
some paddingprotected Vector3Float
velocity
This field shall contain the velocity (at the time the collision is detected) of the issuing entity.Fields inherited from class edu.nps.moves.dis7.Pdu
exerciseID, length, pduType, protocolFamily, protocolVersion, timestamp
-
Constructor Summary
Constructors Constructor Description CollisionPdu()
Constructor -
Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object obj)
boolean
equalsImpl(java.lang.Object obj)
Compare all fields that contribute to the state, ignoring transient and static fields, forthis
and the supplied objectEntityID
getCollidingEntityID()
Getter forcollidingEntityID
CollisionType
getCollisionType()
Getter forcollisionType
EventIdentifier
getEventID()
Getter foreventID
EntityID
getIssuingEntityID()
Getter forissuingEntityID
Vector3Float
getLocation()
Getter forlocation
int
getMarshalledSize()
Returns the size of this serialized object in bytesfloat
getMass()
Getter formass
byte
getPad()
Getter forpad
Vector3Float
getVelocity()
Getter forvelocity
void
marshal(java.io.DataOutputStream dos)
Serializes an object to a DataOutputStream.void
marshal(java.nio.ByteBuffer buff)
Packs an object into the ByteBuffer.CollisionPdu
setCollidingEntityID(EntityID pCollidingEntityID)
Setter forcollidingEntityID
CollisionPdu
setCollisionType(CollisionType pCollisionType)
Setter forcollisionType
CollisionPdu
setEventID(EventIdentifier pEventID)
Setter foreventID
CollisionPdu
setIssuingEntityID(EntityID pIssuingEntityID)
Setter forissuingEntityID
CollisionPdu
setLocation(Vector3Float pLocation)
Setter forlocation
CollisionPdu
setMass(float pMass)
Setter formass
CollisionPdu
setPad(byte pPad)
Setter forpad
CollisionPdu
setVelocity(Vector3Float pVelocity)
Setter forvelocity
java.lang.String
toString()
int
unmarshal(java.io.DataInputStream dis)
Unserializes an object from a DataInputStream.int
unmarshal(java.nio.ByteBuffer buff)
Unpacks a Pdu from the underlying data.Methods inherited from class edu.nps.moves.dis7.PduBase
getPadding, getPduStatus, setPadding, setPduStatus
Methods inherited from class edu.nps.moves.dis7.Pdu
getExerciseID, getLength, getPduType, getProtocolFamily, getProtocolVersion, getTimestamp, marshal, setExerciseID, setLength, setPduType, setProtocolFamily, setProtocolVersion, setTimestamp
-
Field Details
-
issuingEntityID
This field shall identify the entity that is issuing the PDU, and shall be represented by an Entity Identifier record (see 6.2.28). -
collidingEntityID
This field shall identify the entity that has collided with the issuing entity (see 5.3.3.4). This field shall be represented by an Entity Identifier record (see 6.2.28). -
eventID
This field shall contain an identification generated by the issuing simulation application to associate related collision events. This field shall be represented by an Event Identifier record (see 6.2.34). -
collisionType
This field shall identify the type of collision. The Collision Type field shall be represented by an 8-bit record of enumerations uid 189 -
pad
protected byte padsome padding -
velocity
This field shall contain the velocity (at the time the collision is detected) of the issuing entity. The velocity shall be represented in world coordinates. This field shall be represented by the Linear Velocity Vector record [see 6.2.95 item c)]. -
mass
protected float massThis field shall contain the mass of the issuing entity, and shall be represented by a 32-bit floating point number representing kilograms. -
location
This field shall specify the location of the collision with respect to the entity with which the issuing entity collided. The Location field shall be represented by an Entity Coordinate Vector record [see 6.2.95 item a)].
-
-
Constructor Details
-
CollisionPdu
public CollisionPdu()Constructor
-
-
Method Details
-
getMarshalledSize
public int getMarshalledSize()Returns the size of this serialized object in bytes- Specified by:
getMarshalledSize
in interfaceedu.nps.moves.dis7.Marshaller
- Overrides:
getMarshalledSize
in classEntityInformationFamilyPdu
-
setIssuingEntityID
Setter forissuingEntityID
-
getIssuingEntityID
Getter forissuingEntityID
-
setCollidingEntityID
Setter forcollidingEntityID
-
getCollidingEntityID
Getter forcollidingEntityID
-
setEventID
Setter foreventID
-
getEventID
Getter foreventID
-
setCollisionType
Setter forcollisionType
-
getCollisionType
Getter forcollisionType
-
setPad
Setter forpad
-
getPad
public byte getPad()Getter forpad
-
setVelocity
Setter forvelocity
-
getVelocity
Getter forvelocity
-
setMass
Setter formass
-
getMass
public float getMass()Getter formass
-
setLocation
Setter forlocation
-
getLocation
Getter forlocation
-
marshal
public void marshal(java.io.DataOutputStream dos) throws java.lang.ExceptionSerializes an object to a DataOutputStream.- Specified by:
marshal
in interfaceedu.nps.moves.dis7.Marshaller
- Overrides:
marshal
in classEntityInformationFamilyPdu
- Parameters:
dos
- the OutputStream- Throws:
java.lang.Exception
- if something goes wrong- See Also:
DataOutputStream
-
unmarshal
public int unmarshal(java.io.DataInputStream dis) throws java.lang.ExceptionUnserializes an object from a DataInputStream.- Specified by:
unmarshal
in interfaceedu.nps.moves.dis7.Marshaller
- Overrides:
unmarshal
in classEntityInformationFamilyPdu
- Parameters:
dis
- the InputStream- Returns:
- unmarshalled size
- Throws:
java.lang.Exception
- if something goes wrong- See Also:
DataInputStream
-
marshal
public void marshal(java.nio.ByteBuffer buff) throws java.lang.ExceptionPacks an object into the ByteBuffer.- Specified by:
marshal
in interfaceedu.nps.moves.dis7.Marshaller
- Overrides:
marshal
in classEntityInformationFamilyPdu
- Parameters:
buff
- The ByteBuffer at the position to begin writing- Throws:
java.nio.BufferOverflowException
- if buff is too smalljava.nio.ReadOnlyBufferException
- if buff is read onlyjava.lang.Exception
- ByteBuffer-generated exception- See Also:
ByteBuffer
-
unmarshal
public int unmarshal(java.nio.ByteBuffer buff) throws java.lang.ExceptionUnpacks a Pdu from the underlying data.- Specified by:
unmarshal
in interfaceedu.nps.moves.dis7.Marshaller
- Overrides:
unmarshal
in classEntityInformationFamilyPdu
- Parameters:
buff
- The ByteBuffer at the position to begin reading- Returns:
- marshalled size
- Throws:
java.nio.BufferUnderflowException
- if buff is too smalljava.lang.Exception
- ByteBuffer-generated exception- See Also:
ByteBuffer
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equals
in classEntityInformationFamilyPdu
-
equalsImpl
public boolean equalsImpl(java.lang.Object obj)Description copied from class:Pdu
Compare all fields that contribute to the state, ignoring transient and static fields, forthis
and the supplied object- Overrides:
equalsImpl
in classEntityInformationFamilyPdu
- Parameters:
obj
- the object to compare to- Returns:
- true if the objects are equal, false otherwise.
-
toString
public java.lang.String toString()- Overrides:
toString
in classEntityInformationFamilyPdu
-