-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.interfaces.Environment,java.io.Serializable,java.lang.Iterable
public abstract class AbstractEnvironment<T, P extends Position<P>> implements Environment<T, P>
Very generic and basic implementation for an environment. Basically, only manages an internal set of nodes and their position.
-
-
Field Summary
Fields Modifier and Type Field Description private final ListSet<Node<T>>nodesprivate transient Simulation<T, P>simulation
-
Method Summary
Modifier and Type Method Description final ListSet<Node<T>>getNodes()final Simulation<T, P>getSimulation()final voidsetSimulation(Simulation<T, P> s)final voidaddLayer(Molecule m, Layer<T, P> l)final voidaddNode(Node<T> node, P p)final voidaddTerminator(Predicate<Environment<T, P>> terminator)final voidforEach(Consumer<out Object> action)final doublegetDistanceBetweenNodes(Node<T> n1, Node<T> n2)final Optional<Layer<T, P>>getLayer(Molecule m)final LinkingRule<T, P>getLinkingRule()final voidsetLinkingRule(LinkingRule<T, P> r)final Neighborhood<T>getNeighborhood(@Nonnull() Node<T> center)final Node<T>getNodeByID(int id)final intgetNodeCount()final ListSet<Node<T>>getNodesWithinRange(Node<T> center, double range)final ListSet<Node<T>>getNodesWithinRange(P center, double range)final PgetPosition(Node<T> node)This method should not get overridden in general. Array<double>getSizeInDistanceUnits()Override this method if units measuring distance do not match with units used for coordinates. final booleanisTerminated()final Iterator<Node<T>>iterator()final voidremoveNode(@Nonnull() Node<T> node)final Spliterator<Node<T>>spliterator()StringtoString()Not used internally. -
Methods inherited from class it.unibo.alchemist.model.interfaces.Environment
getDimensions, getIncarnation, getLayers, getNodes, getOffset, getSimulation, getSize, makePosition, moveNodeToPosition, setSimulation -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
getSimulation
final Simulation<T, P> getSimulation()
-
setSimulation
final void setSimulation(Simulation<T, P> s)
-
addTerminator
final void addTerminator(Predicate<Environment<T, P>> terminator)
-
getDistanceBetweenNodes
final double getDistanceBetweenNodes(Node<T> n1, Node<T> n2)
-
getLinkingRule
final LinkingRule<T, P> getLinkingRule()
-
setLinkingRule
final void setLinkingRule(LinkingRule<T, P> r)
-
getNeighborhood
final Neighborhood<T> getNeighborhood(@Nonnull() Node<T> center)
-
getNodeByID
final Node<T> getNodeByID(int id)
-
getNodeCount
final int getNodeCount()
-
getNodesWithinRange
final ListSet<Node<T>> getNodesWithinRange(Node<T> center, double range)
-
getNodesWithinRange
final ListSet<Node<T>> getNodesWithinRange(P center, double range)
-
getPosition
@Nonnull() final P getPosition(Node<T> node)
This method should not get overridden in general. However, if your
-
getSizeInDistanceUnits
Array<double> getSizeInDistanceUnits()
Override this method if units measuring distance do not match with units used for coordinates. For instance, if your space is non-Euclidean, or if you are using polar coordinates. A notable example is using geographical latitude-longitude as y-x coordinates and meters as distance measure.
-
isTerminated
final boolean isTerminated()
-
removeNode
final void removeNode(@Nonnull() Node<T> node)
-
spliterator
final Spliterator<Node<T>> spliterator()
-
-
-
-