Class WayPoint.Builder

java.lang.Object
io.jenetics.jpx.WayPoint.Builder
Enclosing class:
WayPoint

public static final class WayPoint.Builder extends Object
Builder for creating a way-point with different parameters.

Creating a WayPoint:

final WayPoint point = WayPoint.builder() .lat(48.2081743).lon(16.3738189).ele(160) .build();
See Also:
  • Method Details

    • lat

      public WayPoint.Builder lat(Latitude latitude)
      Set the latitude value of the way-point.
      Parameters:
      latitude - the new latitude value
      Returns:
      this Builder for method chaining
      Throws:
      NullPointerException - if the given value is null
    • lat

      public WayPoint.Builder lat(double degrees)
      Set the latitude value of the way-point.
      Parameters:
      degrees - the new latitude value
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given value is not within the range of [-90..90]
    • lat

      public Latitude lat()
      Return the current latitude value.
      Returns:
      the current latitude value
      Since:
      1.1
    • lon

      public WayPoint.Builder lon(Longitude longitude)
      Set the longitude value of the way-point.
      Parameters:
      longitude - the new longitude value
      Returns:
      this Builder for method chaining
      Throws:
      NullPointerException - if the given value is null
    • lon

      public WayPoint.Builder lon(double degrees)
      Set the longitude value of the way-point.
      Parameters:
      degrees - the new longitude value
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given value is not within the range of [-180..180]
    • lon

      public Longitude lon()
      Return the current longitude value.
      Returns:
      the current longitude value
      Since:
      1.1
    • ele

      public WayPoint.Builder ele(Length elevation)
      Set the elevation of the point.
      Parameters:
      elevation - the elevation of the point
      Returns:
      this Builder for method chaining
    • ele

      public WayPoint.Builder ele(double meters)
      Set the elevation (in meters) of the point.
      Parameters:
      meters - the elevation of the point, in meters
      Returns:
      this Builder for method chaining
    • ele

      public WayPoint.Builder ele(double elevation, Length.Unit unit)
      Set the elevation of the point.
      Parameters:
      elevation - the elevation of the point
      unit - the length unit
      Returns:
      this Builder for method chaining
    • ele

      public Optional<Length> ele()
      Return the current elevation value.
      Returns:
      the current elevation value
      Since:
      1.1
    • speed

      public WayPoint.Builder speed(Speed speed)
      Set the current GPS speed.
      Parameters:
      speed - the current GPS speed
      Returns:
      this Builder for method chaining
    • speed

      public WayPoint.Builder speed(double speed, Speed.Unit unit)
      Set the current GPS speed
      Parameters:
      speed - the current speed value
      unit - the speed unit
      Returns:
      this Builder for method chaining
    • speed

      public WayPoint.Builder speed(double meterPerSecond)
      Set the current GPS speed.
      Parameters:
      meterPerSecond - the current GPS speed in m/s
      Returns:
      this Builder for method chaining
    • speed

      public Optional<Speed> speed()
      Return the current speed value.
      Returns:
      the current speed value
      Since:
      1.1
    • time

      public WayPoint.Builder time(Instant instant)
      Set the creation/modification timestamp for the point.
      Parameters:
      instant - the instant of the way-point
      Returns:
      this Builder for method chaining
    • time

      public WayPoint.Builder time(long millis)
      Set the creation/modification timestamp for the point.
      Parameters:
      millis - the instant of the way-point
      Returns:
      this Builder for method chaining
    • time

      public Optional<Instant> time()
      Return the current time value.
      Returns:
      the current time value
    • magvar

      public WayPoint.Builder magvar(Degrees variation)
      Set the magnetic variation at the point.
      Parameters:
      variation - the magnetic variation
      Returns:
      this Builder for method chaining
    • magvar

      public WayPoint.Builder magvar(double degree)
      Set the magnetic variation at the point.
      Parameters:
      degree - the magnetic variation
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the give value is not within the range of [0..360]
    • magvar

      public Optional<Degrees> magvar()
      Return the current magnetic variation value.
      Returns:
      the current magnetic variation value
      Since:
      1.1
    • geoidheight

      Set the height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message.
      Parameters:
      height - the height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid
      Returns:
      this Builder for method chaining
    • geoidheight

      public WayPoint.Builder geoidheight(double meter)
      Set the height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message.
      Parameters:
      meter - the height (in meters) of geoid (mean sea level) above WGS84 earth ellipsoid
      Returns:
      this Builder for method chaining
    • geoidheight

      public WayPoint.Builder geoidheight(double length, Length.Unit unit)
      Set the height of geoid (mean sea level) above WGS84 earth ellipsoid. As defined in NMEA GGA message.
      Parameters:
      length - the height of geoid (mean sea level) above WGS84 earth ellipsoid
      unit - the length unit
      Returns:
      this Builder for method chaining
    • geoidheight

      Return the current height of geoid value.
      Returns:
      the current height of geoid value
      Since:
      1.1
    • name

      public WayPoint.Builder name(String name)
      Set the GPS name of the way-point. This field will be transferred to and from the GPS. GPX does not place restrictions on the length of this field or the characters contained in it. It is up to the receiving application to validate the field before sending it to the GPS.
      Parameters:
      name - the GPS name of the way-point
      Returns:
      this Builder for method chaining
    • name

      public Optional<String> name()
      Return the current name value.
      Returns:
      the current name value
      Since:
      1.1
    • cmt

      public WayPoint.Builder cmt(String comment)
      Set the GPS way-point comment.
      Parameters:
      comment - the GPS way-point comment.
      Returns:
      this Builder for method chaining
    • cmt

      public Optional<String> cmt()
      Return the current comment value.
      Returns:
      the current comment value
      Since:
      1.1
    • desc

      public WayPoint.Builder desc(String description)
      Set the GPS way-point description.
      Parameters:
      description - the GPS way-point description.
      Returns:
      this Builder for method chaining
    • desc

      public Optional<String> desc()
      Return the current description value.
      Returns:
      the current description value
      Since:
      1.1
    • src

      public WayPoint.Builder src(String source)
      Set the GPS way-point source.
      Parameters:
      source - the GPS way-point source.
      Returns:
      this Builder for method chaining
    • src

      public Optional<String> src()
      Return the current source value.
      Returns:
      the current source value
      Since:
      1.1
    • links

      public WayPoint.Builder links(List<Link> links)
      Set the links to additional information about the way-point. The link list may be null.
      Parameters:
      links - the links to additional information about the way-point
      Returns:
      this Builder for method chaining
      Throws:
      NullPointerException - if one of the links in the list is null
    • addLink

      public WayPoint.Builder addLink(Link link)
      Set the links to external information about the way-point.
      Parameters:
      link - the links to external information about the way-point.
      Returns:
      this Builder for method chaining
    • addLink

      Set the links to external information about the way-point.
      Parameters:
      href - the links to external information about the way-point.
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given href is not a valid URL
    • links

      public List<Link> links()
      Return the current links. The returned link list is mutable.
      Returns:
      the current links
      Since:
      1.1
    • sym

      public WayPoint.Builder sym(String symbol)
      Set the text of GPS symbol name. For interchange with other programs, use the exact spelling of the symbol as displayed on the GPS. If the GPS abbreviates words, spell them out.
      Parameters:
      symbol - the text of GPS symbol name
      Returns:
      this Builder for method chaining
    • sym

      public Optional<String> sym()
      Return the current symbol value.
      Returns:
      the current symbol value
      Since:
      1.1
    • type

      public WayPoint.Builder type(String type)
      Set the type (classification) of the way-point.
      Parameters:
      type - the type (classification) of the way-point
      Returns:
      this Builder for method chaining
    • type

      public Optional<String> type()
      Return the current type value.
      Returns:
      the current type value
      Since:
      1.1
    • fix

      public WayPoint.Builder fix(Fix fix)
      Set the type of GPX fix.
      Parameters:
      fix - the type of GPX fix
      Returns:
      this Builder for method chaining
    • fix

      public WayPoint.Builder fix(String fix)
      Set the type of GPX fix.
      Parameters:
      fix - the type of GPX fix
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the fix value is not one of the following values: [none, 2d, 3d, dgps, pps]
    • fix

      public Optional<Fix> fix()
      Return the current GPX fix value.
      Returns:
      the current GPX fix value
      Since:
      1.1
    • sat

      public WayPoint.Builder sat(UInt sat)
      Set the number of satellites used to calculate the GPX fix.
      Parameters:
      sat - the number of satellites used to calculate the GPX fix
      Returns:
      this Builder for method chaining
    • sat

      public WayPoint.Builder sat(int sat)
      Set the number of satellites used to calculate the GPX fix.
      Parameters:
      sat - the number of satellites used to calculate the GPX fix
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given value is smaller than zero
    • sat

      public Optional<UInt> sat()
      Return the current number of satelites.
      Returns:
      the current number of satelites
      Since:
      1.1
    • hdop

      public WayPoint.Builder hdop(Double hdop)
      Set the horizontal dilution of precision.
      Parameters:
      hdop - the horizontal dilution of precision
      Returns:
      this Builder for method chaining
    • hdop

      public Optional<Double> hdop()
      Return the current horizontal dilution.
      Returns:
      the current horizontal dilution
      Since:
      1.1
    • vdop

      public WayPoint.Builder vdop(Double vdop)
      Set the vertical dilution of precision.
      Parameters:
      vdop - the vertical dilution of precision
      Returns:
      this Builder for method chaining
    • vdop

      public Optional<Double> vdop()
      Return the current vertical dilution.
      Returns:
      the current vertical dilution
      Since:
      1.1
    • pdop

      public WayPoint.Builder pdop(Double pdop)
      Set the position dilution of precision.
      Parameters:
      pdop - the position dilution of precision
      Returns:
      this Builder for method chaining
    • pdop

      public Optional<Double> pdop()
      Return the current position dilution.
      Returns:
      the current position dilution
      Since:
      1.1
    • ageofdgpsdata

      Set the age since last DGPS update.
      Parameters:
      age - the age since last DGPS update
      Returns:
      this Builder for method chaining
    • ageofdgpsdata

      public WayPoint.Builder ageofdgpsdata(double seconds)
      Set the number of seconds since last DGPS update.
      Parameters:
      seconds - the age since last DGPS update
      Returns:
      this Builder for method chaining
    • ageofdgpsdata

      Return the current age since last DGPS update.
      Returns:
      the current age since last DGPS update
      Since:
      1.1
    • dgpsid

      Set the ID of DGPS station used in differential correction.
      Parameters:
      station - the ID of DGPS station used in differential correction
      Returns:
      this Builder for method chaining
    • dgpsid

      public WayPoint.Builder dgpsid(int station)
      Set the ID of DGPS station used in differential correction.
      Parameters:
      station - the ID of DGPS station used in differential correction
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the given station number is not in the range of [0..1023]
    • dgpsid

      Return the current the ID of DGPS station used in differential correction.
      Returns:
      the current the ID of DGPS station used in differential correction
      Since:
      1.1
    • course

      public WayPoint.Builder course(Degrees course)
      Set the the instantaneous course at the point.
      Parameters:
      course - the the instantaneous course at the point
      Returns:
      this Builder for method chaining
      Since:
      1.3
    • course

      public WayPoint.Builder course(double courseDegrees)
      Set the the instantaneous course at the point.
      Parameters:
      courseDegrees - the the instantaneous course at the point
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the give value is not within the range of [0..360]
      Since:
      1.3
    • course

      public Optional<Degrees> course()
      Return the instantaneous course at the point.
      Returns:
      the instantaneous course at the point.
      Since:
      1.3
    • extensions

      public WayPoint.Builder extensions(Document extensions)
      Sets the extensions object, which may be null. The root element of the extensions document must be extensions.
      <extensions> ... </extensions>
      Parameters:
      extensions - the document
      Returns:
      this Builder for method chaining
      Throws:
      IllegalArgumentException - if the root element is not the an extensions node
      Since:
      1.5
    • extensions

      Return the current extensions
      Returns:
      the extensions document
      Since:
      1.5
    • build

      public WayPoint build(Latitude latitude, Longitude longitude)
      Create a new way-point with the given latitude and longitude value.
      Parameters:
      latitude - the latitude of the way-point
      longitude - the longitude of the way-point
      Returns:
      a newly created way-point
    • build

      public WayPoint build(double latitude, double longitude)
      Create a new way-point with the given latitude and longitude value.
      Parameters:
      latitude - the latitude of the way-point
      longitude - the longitude of the way-point
      Returns:
      a newly created way-point
    • build

      public WayPoint build()
      Build a new way-point from the current builder state.
      Returns:
      a new way-point from the current builder state
      Throws:
      IllegalStateException - if the WayPoint.getLatitude() or WayPoint.getLongitude() is null or has not been set, respectively.