Class AbstractEnvironment
-
- All Implemented Interfaces:
-
it.unibo.alchemist.model.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 public final ListSet<GlobalReaction<T>>
globalReactions
public final ListSet<Node<T>>
nodes
public transient Incarnation<T, P>
incarnation
public transient Simulation<T, P>
simulation
-
Method Summary
Modifier and Type Method Description ListSet<GlobalReaction<T>>
getGlobalReactions()
final ListSet<Node<T>>
getNodes()
final Incarnation<T, P>
getIncarnation()
final Simulation<T, P>
getSimulation()
final void
setSimulation(Simulation<T, P> simulation)
final void
addLayer(Molecule m, Layer<T, P> l)
void
addGlobalReaction(GlobalReaction<T> reaction)
void
removeGlobalReaction(GlobalReaction<T> reaction)
final boolean
addNode(Node<T> node, P p)
final void
addTerminator(Predicate<Environment<T, P>> terminator)
final void
forEach(Consumer<in Node<T>> action)
final double
getDistanceBetweenNodes(Node<T> n1, Node<T> n2)
final Optional<Layer<T, P>>
getLayer(Molecule m)
final ListSet<Layer<T, P>>
getLayers()
final LinkingRule<T, P>
getLinkingRule()
final void
setLinkingRule(LinkingRule<T, P> r)
final Neighborhood<T>
getNeighborhood(@Nonnull() Node<T> center)
final Node<T>
getNodeByID(int id)
final int
getNodeCount()
final ListSet<Node<T>>
getNodesWithinRange(Node<T> center, double range)
final ListSet<Node<T>>
getNodesWithinRange(P center, double range)
final P
getPosition(Node<T> node)
Array<double>
getSizeInDistanceUnits()
Override this method if units measuring distance do not match with units used for coordinates. final boolean
isTerminated()
final Iterator<Node<T>>
iterator()
final void
removeNode(@Nonnull() Node<T> node)
final Spliterator<Node<T>>
spliterator()
String
toString()
Not used internally. -
Methods inherited from class it.unibo.alchemist.model.Environment
getDimensions, getGlobalReactions, getIncarnation, 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
-
getGlobalReactions
ListSet<GlobalReaction<T>> getGlobalReactions()
-
getIncarnation
@Nonnull() final Incarnation<T, P> getIncarnation()
-
getSimulation
@Nonnull() final Simulation<T, P> getSimulation()
-
setSimulation
final void setSimulation(Simulation<T, P> simulation)
-
addGlobalReaction
void addGlobalReaction(GlobalReaction<T> reaction)
-
removeGlobalReaction
void removeGlobalReaction(GlobalReaction<T> reaction)
-
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)
-
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()
-
-
-
-