BoxEventListener
public final class AtomLeafAgentManager<E> extends BoxEventListenerAdapter
Modifier and Type | Class | Description |
---|---|---|
static interface |
AtomLeafAgentManager.AgentSource<E> |
Interface for an object that wants an agent associated with each Atom in
a Box.
|
Constructor | Description |
---|---|
AtomLeafAgentManager(AtomLeafAgentManager.AgentSource<E> source,
Box box) |
|
AtomLeafAgentManager(java.util.function.Function<IAtom,? extends E> agentSource,
Box box) |
Modifier and Type | Method | Description |
---|---|---|
void |
boxAtomLeafIndexChanged(BoxAtomIndexEvent e) |
Called when an atom's global (leaf) index has changed.
|
void |
boxGlobalAtomLeafIndexChanged(BoxIndexEvent e) |
Called when the maximum leaf index in the box has changed.
|
void |
boxMoleculeAdded(BoxMoleculeEvent e) |
Called when a molecule is added to the box.
|
void |
boxMoleculeRemoved(BoxMoleculeEvent e) |
Called when a molecule is removed from the box.
|
void |
dispose() |
Notifies the AtomAgentManager it should disconnect itself as a listener and release all of its agents.
|
E |
getAgent(IAtom a) |
Returns the agent associated with the given IAtom.
|
IndexMap<E> |
getAgents() |
Get the agents map.
|
Box |
getBox() |
Convenience method to return the box the Manager is tracking.
|
void |
setAgent(IAtom a,
E newAgent) |
Sets the agent associated with the given atom to be the given agent.
|
boxMoleculeIndexChanged, boxNumberMolecules
protected final Box box
public AtomLeafAgentManager(java.util.function.Function<IAtom,? extends E> agentSource, Box box)
public AtomLeafAgentManager(AtomLeafAgentManager.AgentSource<E> source, Box box)
public IndexMap<E> getAgents()
public E getAgent(IAtom a)
public void setAgent(IAtom a, E newAgent)
public Box getBox()
public void dispose()
public void boxMoleculeAdded(BoxMoleculeEvent e)
BoxEventListener
boxMoleculeAdded
in interface BoxEventListener
boxMoleculeAdded
in class BoxEventListenerAdapter
e
- the event, which contains the added molecule and the box to
which it was added.public void boxMoleculeRemoved(BoxMoleculeEvent e)
BoxEventListener
boxMoleculeRemoved
in interface BoxEventListener
boxMoleculeRemoved
in class BoxEventListenerAdapter
e
- the event, which contains the removed molecule and the box from
which it was removed.public void boxGlobalAtomLeafIndexChanged(BoxIndexEvent e)
BoxEventListener
boxGlobalAtomLeafIndexChanged
in interface BoxEventListener
boxGlobalAtomLeafIndexChanged
in class BoxEventListenerAdapter
e
- the event, which contains the box and the new maximum global
indexpublic void boxAtomLeafIndexChanged(BoxAtomIndexEvent e)
BoxEventListener
boxAtomLeafIndexChanged
in interface BoxEventListener
boxAtomLeafIndexChanged
in class BoxEventListenerAdapter
e
- the event, which contains the box, the atom whose index changed
and the atom's old leaf index. The atom's new leaf index can
be obtained from the atom.