Package io.jenetics.jpx
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
- Author:
- Franz Wilhelmstötter
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
TrackSegment.Builder
Builder class for creating immutableTrackSegment
objects.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static TrackSegment.Builder
builder()
Create a new track-segment builder.boolean
equals(Object obj)
Optional<Document>
getExtensions()
Return the (cloned) extensions document.List<WayPoint>
getPoints()
Return the track-points of this segment.int
hashCode()
boolean
isEmpty()
Returntrue
ifthis
track-segment doesn't contain any track-point.Iterator<WayPoint>
iterator()
boolean
nonEmpty()
Returntrue
ifthis
track-segment contains at least one track-point.static TrackSegment
of(List<WayPoint> points)
Create a new track-segment with the given points.static TrackSegment
of(List<WayPoint> points, Document extensions)
Create a new track-segment with the given points.Stream<WayPoint>
points()
Return a stream ofWayPoint
objects this track-segments contains.TrackSegment.Builder
toBuilder()
Convert the immutable track-segment object into a mutable builder initialized with the current track-segment values.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
-
-
-
Method Detail
-
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 ofWayPoint
objects this track-segments contains.- Returns:
- a stream of
WayPoint
objects this track-segment contains
-
getExtensions
public Optional<Document> getExtensions()
Return the (cloned) extensions document. The root element of the returned document has the nameextensions
.<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
public TrackSegment.Builder 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()
Returntrue
ifthis
track-segment doesn't contain any track-point.- Returns:
true
ifthis
track-segment is empty,false
otherwise
-
nonEmpty
public boolean nonEmpty()
Returntrue
ifthis
track-segment contains at least one track-point.- Returns:
true
ifthis
track-segment is not empty,false
otherwise- Since:
- 1.1
-
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-segmentextensions
- the extensions document- Returns:
- a new track-segment with the given points
- Throws:
NullPointerException
- if the givenpoints
sequence isnull
- 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 givenpoints
sequence isnull
-
-