Package jsl.modeling.elements.spatial
Class Euclidean2DPlane
- java.lang.Object
-
- jsl.modeling.elements.spatial.SpatialModel
-
- jsl.modeling.elements.spatial.Euclidean2DPlane
-
- All Implemented Interfaces:
ObservableIfc
,GetNameIfc
,IdentityIfc
public class Euclidean2DPlane extends SpatialModel
-
-
Field Summary
-
Fields inherited from class jsl.modeling.elements.spatial.SpatialModel
ADDED_ELEMENT, myDefaultPositionPrecision, myElements, REMOVED_ELEMENT, UPDATED_POSITION
-
-
Constructor Summary
Constructors Constructor Description Euclidean2DPlane()
Euclidean2DPlane(java.lang.String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
comparePositions(CoordinateIfc coordinate1, CoordinateIfc coordinate2)
Returns true if the first coordinate is the same as second coordinate within the underlying spatial model.double
distance(CoordinateIfc fromCoordinate, CoordinateIfc toCoordinate)
Computes the distance between the two supplied coordinatesCoordinateIfc
getCoordinate(double x1, double x2, double x3)
Creates a valid coordinate for this spatial model This method should check whether the coordinate can be represented spatially within this spatial model.CoordinateIfc
getDefaultCoordinate()
Returns a default set of coordinates to be used to initialize the location of spatial elements if necessary.boolean
isValid(CoordinateIfc coordinate)
Checks to see if the supplied coordinate is physically valid within the spatial model.-
Methods inherited from class jsl.modeling.elements.spatial.SpatialModel
addObserver, addSpatialElement, checkForSpatialElementRemoved, checkSpatialElementAdded, checkSpatialElementPositionChanged, comparePositions, contains, contains, countObservers, deleteObserver, deleteObservers, distance, getCoordinate, getDefaultPositionPrecision, getId, getModel, getName, getObserverState, getUpdatingSpatialElement, isValid, notifyObservers, removeSpatialElement, setDefaultPositionPrecision, setModel, setName, setObserverState, setUpdatingElement, updatePosition, updatePosition_
-
-
-
-
Method Detail
-
getDefaultCoordinate
public CoordinateIfc getDefaultCoordinate()
Description copied from class:SpatialModel
Returns a default set of coordinates to be used to initialize the location of spatial elements if necessary.- Specified by:
getDefaultCoordinate
in classSpatialModel
- Returns:
-
getCoordinate
public CoordinateIfc getCoordinate(double x1, double x2, double x3)
Description copied from class:SpatialModel
Creates a valid coordinate for this spatial model This method should check whether the coordinate can be represented spatially within this spatial model. If not, an IllegalArgumentException should be thrown- Specified by:
getCoordinate
in classSpatialModel
- Returns:
-
isValid
public boolean isValid(CoordinateIfc coordinate)
Description copied from class:SpatialModel
Checks to see if the supplied coordinate is physically valid within the spatial model. This depends on the underlying spatial representation. This method should check whether the coordinate can be represented spatially within this spatial model. If so, this method should return true.- Specified by:
isValid
in classSpatialModel
- Returns:
-
distance
public double distance(CoordinateIfc fromCoordinate, CoordinateIfc toCoordinate)
Description copied from class:SpatialModel
Computes the distance between the two supplied coordinates- Specified by:
distance
in classSpatialModel
- Returns:
-
comparePositions
public boolean comparePositions(CoordinateIfc coordinate1, CoordinateIfc coordinate2)
Description copied from class:SpatialModel
Returns true if the first coordinate is the same as second coordinate within the underlying spatial model. This is not object reference equality, but rather whether or not the positions within the underlying spatial model can be considered spatially (equivalent). Requirement: The coordinates must be valid within the spatial model. If they are not valid within same spatial model, then this method should return false.- Specified by:
comparePositions
in classSpatialModel
- Returns:
-
-