org.optaplanner.examples.tsp.domain.location
Class Location
java.lang.Object
org.optaplanner.examples.common.domain.AbstractPersistable
org.optaplanner.examples.tsp.domain.location.Location
- All Implemented Interfaces:
- Serializable, Comparable<AbstractPersistable>
- Direct Known Subclasses:
- AirLocation, RoadLocation
public abstract class Location
- extends AbstractPersistable
- See Also:
- Serialized Form
Constructor Summary |
Location()
|
Location(long id,
double latitude,
double longitude)
|
name
protected String name
latitude
protected double latitude
longitude
protected double longitude
Location
public Location()
Location
public Location(long id,
double latitude,
double longitude)
getName
public String getName()
setName
public void setName(String name)
getLatitude
public double getLatitude()
setLatitude
public void setLatitude(double latitude)
getLongitude
public double getLongitude()
setLongitude
public void setLongitude(double longitude)
getDistance
public abstract long getDistance(Location location)
- The distance's unit of measurement depends on the
VehicleRoutingSolution
's DistanceType
.
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
getAirDistanceDouble
public double getAirDistanceDouble(Location location)
getAngle
public double getAngle(Location location)
- The angle relative to the direction EAST.
- Parameters:
location
- never null
- Returns:
- in Cartesian coordinates
toString
public String toString()
- Overrides:
toString
in class AbstractPersistable
Copyright © 2006-2015 JBoss by Red Hat. All Rights Reserved.