Package edu.nps.moves.dis7.pdus
Class Domain
java.lang.Object
edu.nps.moves.dis7.pdus.Domain
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 TypeMethodDescriptionbooleanbooleanequalsImpl(Object obj)Compare all fields that contribute to the state, ignoring transient and static fields, forthisand the supplied objectintReturns size of this serialized (marshalled) object in bytesintgetValue()static Domaininst(MunitionDomain d)static Domaininst(PlatformDomain d)static Domaininst(SupplyDomain d)voidmarshal(DataOutputStream dos)voidmarshal(ByteBuffer byteBuffer)toString()intunmarshal(DataInputStream dis)Deserializes an object from a DataInputStream.intunmarshal(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, forthisand the supplied object- Parameters:
obj- the object to compare to- Returns:
- true if the objects are equal, false otherwise.
-