Package org.ka2ddo.yaac.osm
Class Speed
java.lang.Object
org.ka2ddo.yaac.osm.Speed
This class defines a compound object containing a speed value and the units of speed.
- Author:
- Andrew Pavlin, KA2DDO
-
Constructor Summary
ConstructorDescriptionSpeed
(int speed, DistanceUnit unit) Create a Speed object for the specified magnitude and unit.Create a Speed object from the specified string -
Method Summary
Modifier and TypeMethodDescriptionGet the ISO country code (if any) associated with this Speed value.int
getSpeed()
Get the speed in the specified unit.getUnit()
Get the DistanceUnit (interpreted as a speed unit in DistanceUnit per hour) for this Speed.toString()
Returns a string representation of the object.
-
Constructor Details
-
Speed
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
Create a Speed object for the specified magnitude and unit.- Parameters:
speed
- int speed magnitudeunit
- 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
Get the DistanceUnit (interpreted as a speed unit in DistanceUnit per hour) for this Speed.- Returns:
- DistanceUnit for measuring the speed
-
getIsoCountryCode
Get the ISO country code (if any) associated with this Speed value.- Returns:
- ISO country code String, or null if none specified
-
toString
Returns a string representation of the object.
-