|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectetomica.box.BoxListenerAdapter
etomica.atom.AtomLeafAgentManager
public class AtomLeafAgentManager
AtomAgentManager acts on behalf of client classes (an AgentSource) to manage agents for every leaf Atom in a box. When leaf atoms are added or removed from the box, the agents array (indexed by the atom's global index) is updated. The client can access and modify the agents via getAgent and setAgent.
| Nested Class Summary | |
|---|---|
static class |
AtomLeafAgentManager.AgentIterator
Iterator that loops over the agents, skipping null elements |
static interface |
AtomLeafAgentManager.AgentSource
Interface for an object that wants an agent associated with each Atom in a Box. |
| Field Summary | |
|---|---|
protected Object[] |
agents
|
protected AtomLeafAgentManager.AgentSource |
agentSource
|
protected IBox |
box
|
protected int |
reservoirSize
|
| Constructor Summary | |
|---|---|
AtomLeafAgentManager(AtomLeafAgentManager.AgentSource source,
IBox box)
|
|
| Method Summary | |
|---|---|
protected void |
addAgent(IAtom a)
Adds an agent for the given leaf atom to the agents array. |
protected void |
addAgent(IAtom a,
int index)
Adds an agent for the given leaf atom to the agents array at the given index. |
void |
boxAtomLeafIndexChanged(IBoxAtomIndexEvent e)
|
void |
boxGlobalAtomLeafIndexChanged(IBoxIndexEvent e)
|
void |
boxMoleculeAdded(IBoxMoleculeEvent e)
|
void |
boxMoleculeRemoved(IBoxMoleculeEvent e)
|
void |
dispose()
Notifies the AtomAgentManager it should disconnect itself as a listener. |
Object |
getAgent(IAtom a)
Returns the agent associated with the given IAtom. |
IBox |
getBox()
Convenience method to return the box the Manager is tracking. |
int |
getReservoirSize()
|
AtomLeafAgentManager.AgentIterator |
makeIterator()
Returns an iterator that returns each non-null agent |
void |
setAgent(IAtom a,
Object newAgent)
Sets the agent associated with the given atom to be the given agent. |
void |
setReservoirSize(int newReservoirSize)
Sets the size of the manager's "reservoir". |
protected void |
setupBox()
Sets the Box in which this AtomAgentManager will manage Atom agents. |
| Methods inherited from class etomica.box.BoxListenerAdapter |
|---|
boxAtomAdded, boxAtomRemoved, boxGlobalAtomIndexChanged, boxMoleculeIndexChanged, boxNeighborsUpdated, boxNumberMolecules |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final AtomLeafAgentManager.AgentSource agentSource
protected Object[] agents
protected final IBox box
protected int reservoirSize
| Constructor Detail |
|---|
public AtomLeafAgentManager(AtomLeafAgentManager.AgentSource source,
IBox box)
| Method Detail |
|---|
public void setReservoirSize(int newReservoirSize)
public int getReservoirSize()
public AtomLeafAgentManager.AgentIterator makeIterator()
public Object getAgent(IAtom a)
public void setAgent(IAtom a,
Object newAgent)
public IBox getBox()
public void dispose()
protected void setupBox()
public void boxMoleculeAdded(IBoxMoleculeEvent e)
boxMoleculeAdded in interface IBoxListenerboxMoleculeAdded in class BoxListenerAdapterpublic void boxMoleculeRemoved(IBoxMoleculeEvent e)
boxMoleculeRemoved in interface IBoxListenerboxMoleculeRemoved in class BoxListenerAdapterpublic void boxAtomLeafIndexChanged(IBoxAtomIndexEvent e)
boxAtomLeafIndexChanged in interface IBoxListenerboxAtomLeafIndexChanged in class BoxListenerAdapterpublic void boxGlobalAtomLeafIndexChanged(IBoxIndexEvent e)
boxGlobalAtomLeafIndexChanged in interface IBoxListenerboxGlobalAtomLeafIndexChanged in class BoxListenerAdapterprotected void addAgent(IAtom a)
protected void addAgent(IAtom a,
int index)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||