Class Domain

java.lang.Object
edu.nps.moves.dis7.pdus.Domain

public class Domain extends Object
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
See Also:
  • Method Details

    • inst

      public static Domain inst(PlatformDomain d)
      Domain of interest
      Parameters:
      d - a PlatformDomain
      Returns:
      an Domain instance based on a PlatformDomain enum
    • inst

      public static Domain inst(MunitionDomain d)
      MunitionDomain instance of interest
      Parameters:
      d - a MunitionDomain
      Returns:
      an Domain instance based on a MunitionDomain enum
    • inst

      public static Domain inst(SupplyDomain d)
      SupplyDomain instance of interest
      Parameters:
      d - a SupplyDomain
      Returns:
      an Domain instance based on a SupplyDomain enum
    • getValue

      public int getValue()
      Get value for this Domain
      Returns:
      value
    • getDescription

      public String getDescription()
      Get description for this Domain
      Returns:
      description
    • getMarshalledSize

      public int getMarshalledSize()
      Returns size of this serialized (marshalled) object in bytes
      Returns:
      serialized size in bytes
      See Also:
    • marshal

      public void marshal(DataOutputStream dos)
      Marshall this instance to DataOutputStreem
      Parameters:
      dos - DataOutputStream
    • marshal

      public void marshal(ByteBuffer byteBuffer)
      Marshall this instance to byteBuffer
      Parameters:
      byteBuffer - The ByteBuffer at the position to begin writing
    • unmarshal

      public int unmarshal(DataInputStream dis)
      Deserializes an object from a DataInputStream.
      Parameters:
      dis - DataInputStream
      Returns:
      marshalled serialized size in bytes
      See Also:
    • unmarshal

      public int unmarshal(ByteBuffer byteBuffer)
      Deserializes an object from a ByteBuffer.
      Parameters:
      byteBuffer - The ByteBuffer at the position to begin writing
      Returns:
      marshalled serialized size in bytes
      See Also:
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • equalsImpl

      public boolean equalsImpl(Object obj)
      Compare all fields that contribute to the state, ignoring transient and static fields, for this and the supplied object
      Parameters:
      obj - the object to compare to
      Returns:
      true if the objects are equal, false otherwise.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object