Class Speed

java.lang.Object
org.ka2ddo.yaac.osm.Speed

public class Speed extends Object
This class defines a compound object containing a speed value and the units of speed.
Author:
Andrew Pavlin, KA2DDO
  • Constructor Details

    • Speed

      public Speed(String value)
      Create a Speed object from the specified string
      Parameters:
      value - String to be interpreted as a speed value, possibly with appended units and prefixed country code
    • Speed

      public Speed(int speed, DistanceUnit unit)
      Create a Speed object for the specified magnitude and unit.
      Parameters:
      speed - int speed magnitude
      unit - DistanceUnit corresponding to the units-per-hour speed value
  • Method Details

    • getSpeed

      public int getSpeed()
      Get the speed in the specified unit.
      Returns:
      speed in the specified unit
      See Also:
    • getUnit

      public DistanceUnit getUnit()
      Get the DistanceUnit (interpreted as a speed unit in DistanceUnit per hour) for this Speed.
      Returns:
      DistanceUnit for measuring the speed
    • getIsoCountryCode

      public String getIsoCountryCode()
      Get the ISO country code (if any) associated with this Speed value.
      Returns:
      ISO country code String, or null if none specified
    • toString

      public String toString()
      Returns a string representation of the object.
      Overrides:
      toString in class Object
      Returns:
      a string representation of the object.