Class Location
java.lang.Object
org.optaplanner.examples.common.domain.AbstractPersistable
org.optaplanner.examples.tsp.domain.location.Location
- Direct Known Subclasses:
AirLocation,RoadLocation
-
Field Summary
FieldsFields inherited from class org.optaplanner.examples.common.domain.AbstractPersistable
id -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondoublegetAirDistanceDoubleTo(Location location) doubleThe angle relative to the direction EAST.abstract longgetDistanceTo(Location location) The distance's unit of measurement depends on theTspSolution'sDistanceType.doubledoublegetName()voidsetLatitude(double latitude) voidsetLongitude(double longitude) voidtoString()Methods inherited from class org.optaplanner.examples.common.domain.AbstractPersistable
getId, setId
-
Field Details
-
name
-
latitude
protected double latitude -
longitude
protected double longitude
-
-
Constructor Details
-
Location
protected Location() -
Location
protected Location(long id) -
Location
protected Location(long id, double latitude, double longitude)
-
-
Method Details
-
getName
-
setName
-
getLatitude
public double getLatitude() -
setLatitude
public void setLatitude(double latitude) -
getLongitude
public double getLongitude() -
setLongitude
public void setLongitude(double longitude) -
getDistanceTo
The distance's unit of measurement depends on theTspSolution'sDistanceType. It can be in miles or km, but for most cases it's in the TSPLIB's unit of measurement.- Parameters:
location- never null- Returns:
- a positive number, the distance multiplied by 1000 to avoid floating point arithmetic rounding errors
-
getAirDistanceDoubleTo
-
getAngle
The angle relative to the direction EAST.- Parameters:
location- never null- Returns:
- in Cartesian coordinates
-
toString
- Overrides:
toStringin classAbstractPersistable
-