Package repast.simphony.space.continuous
Interface ContinuousSpace<T>

 All Superinterfaces:
Projection<T>
 All Known Implementing Classes:
AbstractContinuousSpace
,ContextPhysics
,ContextSpace
,DefaultContinuousSpace
,DefaultPhysicsSpace
,Projected3DSpace
public interface ContinuousSpace<T> extends Projection<T>
An ndimensional continuous space.


Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ContinuousAdder<T>
getAdder()
Gets the adder used by this space to add new objects.Dimensions
getDimensions()
Gets the dimensions of the space.double[]
getDisplacement(NdPoint point1, NdPoint point2)
Returns the displacement between the NdPoints point1 and point2.double
getDistance(NdPoint point1, NdPoint point2)
Returns the distance between the NdPoints point1 and point2, taking into account the space's topology.double
getDistanceSq(NdPoint point1, NdPoint point2)
Returns the square of the distance between the NdPoints point1 and point2, taking into account the space's topology.NdPoint
getLocation(Object obj)
Gets the location of the specified object.T
getObjectAt(double... location)
Gets the object at the specified location.Iterable<T>
getObjects()
Gets all the object currently in the space.Iterable<T>
getObjectsAt(double... location)
Gets all the objects at the specified location.PointTranslator
getPointTranslator()
Retrieves the rule being used for controlling what happens at or beyond the borders of the space.T
getRandomObjectAt(double... location)
Gets a random object from among those at the specified location.boolean
isPeriodic()
True if this space is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.NdPoint
moveByDisplacement(T object, double... displacement)
Moves the specified object from its current location by the specified amount.NdPoint
moveByVector(T object, double distance, double... anglesInRadians)
Moves the specifed object the specified distance from its current position along the specified angle.boolean
moveTo(T object, double... newLocation)
Moves the specified object from its current location into the new location.void
setAdder(ContinuousAdder<T> adder)
Sets the adder used by this space to add new objects.void
setPointTranslator(PointTranslator rule)
Sets the rule to use for controlling what happens at or beyond the borders of the space.int
size()
Gets the number of objects currently in the space.
Methods inherited from interface repast.simphony.space.projection.Projection
addProjectionListener, evaluate, getName, getProjectionListeners, removeProjectionListener




Method Detail

getDimensions
Dimensions getDimensions()
Gets the dimensions of the space. Returns:
 the dimensions of the space.

setAdder
void setAdder(ContinuousAdder<T> adder)
Sets the adder used by this space to add new objects. Parameters:
adder
 the adder

getAdder
ContinuousAdder<T> getAdder()
Gets the adder used by this space to add new objects. Returns:
 the adder used by this space to add new objects.

moveTo
boolean moveTo(T object, double... newLocation)
Moves the specified object from its current location into the new location. The object must previously have been introduced into the space. Objects are introduced into the space by adding them to the context of which this space is a projection. Parameters:
object
newLocation
 Returns:
 true if the move was successful, otherwise false.
 Throws:
SpatialException
 if the object is not already in the space or if the number of dimensions in the location does not agree with the number in the space.

getLocation
NdPoint getLocation(Object obj)
Gets the location of the specified object. Parameters:
obj
 Returns:
 the location of the specified object or null if the object is not in the space.

size
int size()
Gets the number of objects currently in the space. This does NOT include any objects that may have been added, but have NOT been moved to a space location. Returns:
 the number of objects currently in the space. This does NOT include any objects that may have been added, but have NOT been moved to a space location.

getPointTranslator
PointTranslator getPointTranslator()
Retrieves the rule being used for controlling what happens at or beyond the borders of the space. Returns:
 the rule for handling out of bounds coordinates

setPointTranslator
void setPointTranslator(PointTranslator rule)
Sets the rule to use for controlling what happens at or beyond the borders of the space. Parameters:
rule
 the rule for handling out of bounds coordinates

getObjects
Iterable<T> getObjects()
Gets all the object currently in the space. This does NOT include any objects that may have been added, but have NOT been moved to a space location. Returns:
 an iteratable over all the object currently in the space. This does NOT include any objects that may have been added, but have NOT been moved to a space location.

getObjectAt
T getObjectAt(double... location)
Gets the object at the specified location. Parameters:
location
 Returns:
 the object at the specified location.

getObjectsAt
Iterable<T> getObjectsAt(double... location)
Gets all the objects at the specified location. For a multi occupancy space this will be all the objects at that location. For a single occupancy space this will be the single object at that location. Parameters:
location
 Returns:
 the object at the specified location.

getRandomObjectAt
T getRandomObjectAt(double... location)
Gets a random object from among those at the specified location. If this is a single occupancy space this will return the single object at that location, if any. Parameters:
location
 Returns:
 the object at the specified location.

moveByDisplacement
NdPoint moveByDisplacement(T object, double... displacement)
Moves the specified object from its current location by the specified amount. For examplemoveByDisplacement(object, 3, 2, 1)
will move the object by 3 along the xaxis, 2 along the y and 1 along the z. The displacement argument can be less than the number of dimensions in the space. Parameters:
object
 the object to movedisplacement
 the amount to move the object Returns:
 the new location if the move was successful, otherwise null
 Throws:
SpatialException
 if the object is not already in the space or if the number of dimensions in the displacement greater than the number of grid dimensions.

moveByVector
NdPoint moveByVector(T object, double distance, double... anglesInRadians)
Moves the specifed object the specified distance from its current position along the specified angle. Parameters:
object
 the object to movedistance
 the distance to moveanglesInRadians
 the angle to move along Returns:
 the new location or null if the move is not successful
 Throws:
SpatialException
 if the object is not already in the space or if the number of angles is greater than the number of dimensions See Also:
Direction.EAST
,Direction.NORTH
,Direction.SOUTH
,Direction.WEST

isPeriodic
boolean isPeriodic()
True if this space is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false. Returns:
 true if this space is periodic, otherwise false.

getDistance
double getDistance(NdPoint point1, NdPoint point2)
Returns the distance between the NdPoints point1 and point2, taking into account the space's topology. Parameters:
point1
 the first pointpoint2
 the second point Returns:
 the distance between the two points

getDistanceSq
double getDistanceSq(NdPoint point1, NdPoint point2)
Returns the square of the distance between the NdPoints point1 and point2, taking into account the space's topology. Parameters:
point1
 the first pointpoint2
 the second point Returns:
 the square of the distance between the two points

getDisplacement
double[] getDisplacement(NdPoint point1, NdPoint point2)
Returns the displacement between the NdPoints point1 and point2. If the points do not have the same dimension then this returns null Parameters:
point1
 the first pointpoint2
 the second point Returns:
 the displacement between the NdPoints point1 and point2. If the points do not have the same dimension then this returns null

