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

public abstract class OpenTracElement extends Object implements Serializable
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

    Fields
    Modifier and Type
    Field
    Description
    int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    abstract int
    computeBody(byte[] buf, int offset)
    Append this element to a message buffer
    abstract boolean
    Test if this OpenTracElement has the same type and value as another OpenTracElement.
    int
    Get the element ID for this element.
    abstract int
    Return the number of bytes needed to encode this element.
    Returns a string representation of the object.
    abstract String
    Get the string representation of the value of this element.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • 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

      public abstract String valueString()
      Get the string representation of the value of this element.
      Returns:
      value string
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      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 to
      offset - 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

      public abstract boolean equalsElement(OpenTracElement other)
      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