Package it.unibo.alchemist.model
Interface EnvironmentWithObstacles
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.Environment
,it.unibo.alchemist.model.EuclideanEnvironment
,java.io.Serializable
,kotlin.collections.Iterable
,kotlin.collections.MutableIterable
public interface EnvironmentWithObstacles<W extends Obstacle<P>, T extends Object, P extends Position<P>, Vector<P>> implements EuclideanEnvironment<T, P>
An environment with Obstacles.
-
-
Method Summary
Modifier and Type Method Description abstract Unit
addObstacle(W obstacle)
Adds an obstacle to this environment. abstract Boolean
removeObstacle(W obstacle)
Removes an obstacle from this environment. abstract Boolean
intersectsObstacle(P start, P end)
Checks whether there is at least an obstacle intersecting the line connecting start and end. abstract P
next(P current, P desired)
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. abstract List<W>
getObstacles()
A list of all the obstacles in this environment. -
Methods inherited from class it.unibo.alchemist.model.EuclideanEnvironment
getOrigin, makePosition, moveNode
-
Methods inherited from class it.unibo.alchemist.model.Environment
addGlobalReaction, addLayer, addNode, addTerminator, getDimensions, getDistanceBetweenNodes, getGlobalReactions, getIncarnation, getLayer, getLayers, getLinkingRule, getNeighborhood, getNodeByID, getNodeCount, getNodes, getNodesWithinRange, getNodesWithinRange, getOffset, getPosition, getSimulation, getSize, getSizeInDistanceUnits, isTerminated, makePosition, moveNodeToPosition, removeGlobalReaction, removeNode, setLinkingRule, setSimulation
-
Methods inherited from class kotlin.collections.MutableIterable
iterator
-
Methods inherited from class kotlin.collections.Iterable
forEach, spliterator
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
addObstacle
abstract Unit addObstacle(W obstacle)
Adds an obstacle to this environment.
- Parameters:
obstacle
-the obstacle to add
-
removeObstacle
abstract Boolean removeObstacle(W obstacle)
Removes an obstacle from this environment.
- Parameters:
obstacle
-the obstacle to remove
- Returns:
true if the obstacle has actually been removed
-
intersectsObstacle
abstract Boolean intersectsObstacle(P start, P end)
- Parameters:
start
-start position
end
-end position
- Returns:
true if the line connecting start and end touches an obstacle
-
next
abstract P next(P current, P desired)
This method must calculate the ABSOLUTE next allowed position given the current position and the position in which the node wants to move. For example, if your node is in position 2,3, wants to move to 3,4 but the next allowed position (because, e.g., of physical obstacles) is 2.5,3.5, the result must be a Position containing coordinates 2.5,3.5.
- Parameters:
current
-the current position
desired
-the desired position
- Returns:
the next allowed position, where the node can actually move. This position MUST be considered as a vector whose start point is current.
-
getObstacles
abstract List<W> getObstacles()
A list of all the obstacles in this environment.
-
-
-
-