Package edu.nps.moves.dis7.pdus
Class ClockTime
java.lang.Object
edu.nps.moves.dis7.pdus.ClockTime
- All Implemented Interfaces:
Serializable
Time measurements that exceed one hour are represented by this record. The first field is the hours since the unix epoch (Jan 1 1970, used by most Unix systems and java) and the second field the timestamp units since the top of the hour. Section 6.2.14
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intHours in UTCprotected intTime past the hour -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanbooleanequalsImpl(Object obj) Compare all fields that contribute to the state, ignoring transient and static fields, forthisand the supplied objectintgetHour()Getter forhourintReturns size of this serialized (marshalled) object in bytesintGetter fortimePastHourinthashCode()voidmarshal(DataOutputStream dos) Serializes an object to a DataOutputStream.voidmarshal(ByteBuffer byteBuffer) Packs an object into the ByteBuffer.setHour(int pHour) Setter forhoursetTimePastHour(int pTimePastHour) Setter fortimePastHourtoString()intunmarshal(DataInputStream dis) Deserializes an object from a DataInputStream.intunmarshal(ByteBuffer byteBuffer) Unpacks a Pdu from the underlying data.
-
Field Details
-
hour
protected int hourHours in UTC -
timePastHour
protected int timePastHourTime past the hour
-
-
Constructor Details
-
ClockTime
public ClockTime()Constructor creates and configures a new instance object
-
-
Method Details
-
getMarshalledSize
public int getMarshalledSize()Returns size of this serialized (marshalled) object in bytes- Returns:
- serialized size in bytes
- See Also:
-
setHour
-
getHour
-
setTimePastHour
Setter fortimePastHour- Parameters:
pTimePastHour- new value of interest- Returns:
- same object to permit progressive setters
-
getTimePastHour
-
marshal
Serializes an object to a DataOutputStream.- Parameters:
dos- the OutputStream- Throws:
Exception- if something goes wrong- See Also:
-
unmarshal
Deserializes an object from a DataInputStream.- Parameters:
dis- the InputStream- Returns:
- marshalled serialized size in bytes
- Throws:
Exception- if something goes wrong- See Also:
-
marshal
Packs an object into the ByteBuffer.- Parameters:
byteBuffer- The ByteBuffer at the position to begin writing- Throws:
BufferOverflowException- if byteBuffer is too smallReadOnlyBufferException- if byteBuffer is read onlyException- ByteBuffer-generated exception- See Also:
-
unmarshal
Unpacks a Pdu from the underlying data.- Parameters:
byteBuffer- The ByteBuffer at the position to begin reading- Returns:
- marshalled serialized size in bytes
- Throws:
BufferUnderflowException- if byteBuffer is too smallException- ByteBuffer-generated exception- See Also:
-
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.
-
toString
-
hashCode
-