Class Route

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

public final class Route extends Object implements Iterable<WayPoint>, Serializable
Represents a route - an ordered list of way-points representing a series of turn points leading to a destination.

Create a new route via the builder:

final Route route = Route.builder() .name("Route 1") .description("Fancy mountain-bike tour.") .addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(160)) .addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(161)) .addPoint(p -> p.lat(48.2081743).lon(16.3738189).ele(162)))) .build();
Since:
1.0
Version:
1.5
See Also:
  • Method Details

    • getName

      public Optional<String> getName()
      Return the route name.
      Returns:
      the route name
    • getComment

      Return the GPS comment of the route.
      Returns:
      the GPS comment of the route
    • getDescription

      Return the Text description of route for user. Not sent to GPS.
      Returns:
      the Text description of route for user. Not sent to GPS
    • getSource

      Return the source of data. Included to give user some idea of reliability and accuracy of data.
      Returns:
      the source of data
    • getLinks

      public List<Link> getLinks()
      Return the links to external information about the route.
      Returns:
      the links to external information about the route
    • getNumber

      public Optional<UInt> getNumber()
      Return the GPS route number.
      Returns:
      the GPS route number
    • getType

      public Optional<String> getType()
      Return the type (classification) of the route.
      Returns:
      the type (classification) of the route
    • getPoints

      public List<WayPoint> getPoints()
      Return the sequence of route points.
      Returns:
      the sequence of route points
    • points

      public Stream<WayPoint> points()
      Return a stream of WayPoint objects this route contains.
      Returns:
      a stream of WayPoint objects this route contains
    • 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
    • iterator

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

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

      public boolean isEmpty()
      Return true if all route properties are null or empty.
      Returns:
      true if all route properties are null or empty
    • nonEmpty

      public boolean nonEmpty()
      Return true if not all route properties are null or empty.
      Returns:
      true if not all route properties are null or empty
      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 Route.Builder builder()
      Return a new Route builder object.
      Returns:
      a new Route builder object
    • of

      public static Route of(String name, String comment, String description, String source, List<Link> links, UInt number, String type, Document extensions, List<WayPoint> points)
      Create a new Route with the given parameters and way-points.
      Parameters:
      name - the GPS name of the route
      comment - the GPS comment of the route
      description - the Text description of route for user. Not sent to GPS.
      source - the source of data. Included to give user some idea of reliability and accuracy of data.
      links - the links to external information about the route
      number - the GPS route number
      type - the type (classification) of the route
      extensions - the extensions document
      points - the sequence of route points
      Returns:
      a new route object with the given parameters
      Since:
      1.5
    • of

      public static Route of(String name, String comment, String description, String source, List<Link> links, UInt number, String type, List<WayPoint> points)
      Create a new Route with the given parameters and way-points.
      Parameters:
      name - the GPS name of the route
      comment - the GPS comment of the route
      description - the Text description of route for user. Not sent to GPS.
      source - the source of data. Included to give user some idea of reliability and accuracy of data.
      links - the links to external information about the route
      number - the GPS route number
      type - the type (classification) of the route
      points - the sequence of route points
      Returns:
      a new route object with the given parameters
    • of

      public static Route of(String name, List<WayPoint> points)
      Create a new Route with the given parameters and way-points.
      Parameters:
      name - the GPS name of the route
      points - the sequence of route points
      Returns:
      a new route object with the given parameters
    • of

      public static Route of(List<WayPoint> points)
      Create a new Route with the given parameters and way-points.
      Parameters:
      points - the sequence of route points
      Returns:
      a new route object with the given parameters