Package edu.nps.moves.dis7.pdus
Class Domain
java.lang.Object
edu.nps.moves.dis7.pdus.Domain
Which domain does this PDU belong to:
An example approximating a Java enum "superclass". Can't use an interface, because we need the two
static methods, which can't go into an interface
-
Method Summary
Modifier and TypeMethodDescriptionboolean
boolean
equalsImpl(Object obj)
Compare all fields that contribute to the state, ignoring transient and static fields, forthis
and the supplied objectint
Returns size of this serialized (marshalled) object in bytesint
getValue()
static Domain
inst(MunitionDomain d)
static Domain
inst(PlatformDomain d)
static Domain
inst(SupplyDomain d)
void
marshal(DataOutputStream dos)
void
marshal(ByteBuffer byteBuffer)
toString()
int
unmarshal(DataInputStream dis)
Deserializes an object from a DataInputStream.int
unmarshal(ByteBuffer byteBuffer)
Deserializes an object from a ByteBuffer.
-
Method Details
-
inst
- Parameters:
d
- a PlatformDomain- Returns:
- an Domain instance based on a PlatformDomain enum
-
inst
- Parameters:
d
- a MunitionDomain- Returns:
- an Domain instance based on a MunitionDomain enum
-
inst
- Parameters:
d
- a SupplyDomain- Returns:
- an Domain instance based on a SupplyDomain enum
-
getValue
public int getValue()- Returns:
- value
-
getDescription
- Returns:
- description
-
getMarshalledSize
public int getMarshalledSize()Returns size of this serialized (marshalled) object in bytes- Returns:
- serialized size in bytes
- See Also:
- https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
marshal
- Parameters:
dos
- DataOutputStream
-
marshal
- Parameters:
byteBuffer
- The ByteBuffer at the position to begin writing
-
unmarshal
Deserializes an object from a DataInputStream.- Parameters:
dis
- DataInputStream- Returns:
- marshalled serialized size in bytes
- See Also:
DataInputStream
, https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
unmarshal
Deserializes an object from a ByteBuffer.- Parameters:
byteBuffer
- The ByteBuffer at the position to begin writing- Returns:
- marshalled serialized size in bytes
- See Also:
- https://en.wikipedia.org/wiki/Marshalling_(computer_science)
-
toString
-
equals
-
equalsImpl
Compare all fields that contribute to the state, ignoring transient and static fields, forthis
and the supplied object- Parameters:
obj
- the object to compare to- Returns:
- true if the objects are equal, false otherwise.
-