Package org.ka2ddo.opentrac
Class OpenTracElement
java.lang.Object
org.ka2ddo.opentrac.OpenTracElement
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
OpenTracByte
,OpenTracByteArray
,OpenTracCountryCode
,OpenTracCourseSpeed
,OpenTracDouble
,OpenTracEntity
,OpenTracFloat
,OpenTracGpsQuality
,OpenTracNull
,OpenTracPathTrace
,OpenTracPosition
,OpenTracRadioCapabilities
,OpenTracShort
,OpenTracString
,OpenTracTimestamp
,OpenTracWeatherObs
This class is the generic parent of the different data types of OpenTRAC
element data. Subclasses of this class should be implemented for each value
data type (byte, short, float, string, etc.).
- Author:
- Andrew Pavlin, KA2DDO
- See Also:
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionabstract int
computeBody
(byte[] buf, int offset) Append this element to a message bufferabstract boolean
equalsElement
(OpenTracElement other) Test if this OpenTracElement has the same type and value as another OpenTracElement.int
getId()
Get the element ID for this element.abstract int
length()
Return the number of bytes needed to encode this element.toString()
Returns a string representation of the object.abstract String
Get the string representation of the value of this element.
-
Field Details
-
id
public int id
-
-
Constructor Details
-
OpenTracElement
public OpenTracElement()
-
-
Method Details
-
getId
public int getId()Get the element ID for this element.- Returns:
- element ID
-
valueString
Get the string representation of the value of this element.- Returns:
- value string
-
toString
Returns a string representation of the object. -
computeBody
public abstract int computeBody(byte[] buf, int offset) Append this element to a message buffer- Parameters:
buf
- byte array to add the element tooffset
- starting index to store the element- Returns:
- index after the end of the stored element
-
length
public abstract int length()Return the number of bytes needed to encode this element.- Returns:
- byte count needed to hold this element
-
equalsElement
Test if this OpenTracElement has the same type and value as another OpenTracElement.- Parameters:
other
- OpenTracElement to compare against this element- Returns:
- boolean true if elements are of the same type, class, and value
-