-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.Environment
,it.unibo.alchemist.model.interfaces.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. P
getOrigin()
-
Methods inherited from class it.unibo.alchemist.model.interfaces.EnvironmentWithObstacles
makePosition, moveNode
-
Methods inherited from class it.unibo.alchemist.model.interfaces.EuclideanEnvironment
addLayer, addNode, addTerminator, getDimensions, getDistanceBetweenNodes, getIncarnation, getLayer, getLayers, getLinkingRule, getNeighborhood, getNodeByID, getNodeCount, getNodes, getNodesWithinRange, getNodesWithinRange, getOffset, getPosition, getSimulation, getSize, getSizeInDistanceUnits, isTerminated, makePosition, moveNodeToPosition, removeNode, setLinkingRule, setSimulation
-
Methods inherited from class it.unibo.alchemist.model.interfaces.Environment
iterator
-
Methods inherited from class kotlin.collections.MutableIterable
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
-
intersectsObstacle
abstract Boolean intersectsObstacle(P start, P end)
- Parameters:
start
-start position
end
-end position
-
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
-
getObstacles
abstract List<W> getObstacles()
A list of all the obstacles in this environment.
-
-
-
-