Class TrackSegment

java.lang.Object
io.jenetics.jpx.TrackSegment
All Implemented Interfaces:
Serializable, Iterable<WayPoint>

public final class TrackSegment extends Object implements Iterable<WayPoint>, Serializable
A Track Segment holds a list of Track Points which are logically connected in order. To represent a single GPS track where GPS reception was lost, or the GPS receiver was turned off, start a new Track Segment for each continuous span of track data.
Since:
1.0
Version:
1.5
See Also:
  • Method Details

    • getPoints

      public List<WayPoint> getPoints()
      Return the track-points of this segment.
      Returns:
      the track-points of this segment
    • points

      public Stream<WayPoint> points()
      Return a stream of WayPoint objects this track-segments contains.
      Returns:
      a stream of WayPoint objects this track-segment contains
    • iterator

      Specified by:
      iterator in interface Iterable<WayPoint>
    • getExtensions

      Return the (cloned) extensions document. The root element of the returned document has the name extensions.
      <extensions> ... </extensions>
      Returns:
      the extensions document
      Throws:
      DOMException - if the document could not be cloned, because of an erroneous XML configuration
      Since:
      1.5
    • toBuilder

      Convert the immutable track-segment object into a mutable builder initialized with the current track-segment values.
      Returns:
      a new track-segment builder initialized with the values of this track-segment
      Since:
      1.1
    • isEmpty

      public boolean isEmpty()
      Return true if this track-segment doesn't contain any track-point.
      Returns:
      true if this track-segment is empty, false otherwise
    • nonEmpty

      public boolean nonEmpty()
      Return true if this track-segment contains at least one track-point.
      Returns:
      true if this track-segment is not empty, false otherwise
      Since:
      1.1
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

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

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

      public static TrackSegment.Builder builder()
      Create a new track-segment builder.
      Returns:
      a new track-segment builder
    • of

      public static TrackSegment of(List<WayPoint> points, Document extensions)
      Create a new track-segment with the given points.
      Parameters:
      points - the points of the track-segment
      extensions - the extensions document
      Returns:
      a new track-segment with the given points
      Throws:
      NullPointerException - if the given points sequence is null
      Since:
      1.5
    • of

      public static TrackSegment of(List<WayPoint> points)
      Create a new track-segment with the given points.
      Parameters:
      points - the points of the track-segment
      Returns:
      a new track-segment with the given points
      Throws:
      NullPointerException - if the given points sequence is null