|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.micropsi.nodenet.NetEntityManager
The NetEntityManager keeps record of all existing entities and their states,
allowing quick access to all nodes that are currently existing, have
recent changes, have been deleted recently, are currently active or are
marked "defiant". This is especially important for fast calculation of
activation propagation, as, using the NetEntityManager, not all entities have
to be regarded when doing the calculations but only those really involved.
Besides that, the NetEntityManager allows the observation of the whole net
and provides some net-wide services.
It is important to realise
that the NetEntityManager is the central management class of a net. Trying to
use more than one entity manager within one net would, if possible, be quite
pointless.
| Field Summary | |
protected long |
netstep
the current netstep. |
| Fields inherited from interface org.micropsi.nodenet.NetIntegrityIF |
BAD_KEY, BAD_LINK, BAD_OUTPUT_FUNCTION, BAD_SLOT, DUPLICATE_KEY, UNKNOWN_ENTITY, UNKNOWN_MODULE |
| Constructor Summary | |
protected |
NetEntityManager(Logger logger,
LocalNetFacade theFacade)
Creates a new NetEntityManager |
| Method Summary | |
protected java.util.Collection |
accessActiveEntitiesIDList()
Returns the (String) IDs of all active entities. |
protected java.util.Collection |
accessChangedEntitiesIDList()
Returns the (String) IDs of all changed entities |
protected java.util.Collection |
accessDefiantEntitiesIDList()
Returns the (String) IDs of all defiant entities. |
protected java.util.Collection |
accessDeletedEntitiesIDList()
Returns the (String) IDs of all deleted entities. |
protected java.util.HashMap |
accessEntityMap()
Returns the map of entities. |
protected java.util.Collection |
accessNewEntitiesIDList()
Returns the (String) IDs of all new entities. |
protected void |
addEntity(NetEntity entity)
Adds an entity to the net. |
protected void |
buildActiveEntitiesList()
Rebuilds the list of active entities |
protected void |
changeParameter(java.lang.String id,
int parameterType,
int subID,
java.lang.String newValue)
Changes a parameter of an entity or one of it's slots, gates or hidden implementation. |
void |
checkIntegrity()
Checks the integrity. |
protected void |
deleteEntity(NetEntity entity)
Deletes an entity, unlinking it and preparing the instance for garbage collection. |
protected void |
deleteEntity(java.lang.String id)
Deletes an entity, unlinking it and preparing the instance for garbage collection. |
protected void |
destroy()
Frees as many references as possible to avoid too much gc activity |
protected void |
emptyActiveEntityList()
Clear the list of active entities |
boolean |
entityExists(java.lang.String id)
Checks if there is an entity with the given ID |
java.util.Iterator |
getAllEntities()
Returns an Iterator with the instances of all NetEntities. |
protected LocalNetFacade |
getCorrespondingFacade()
Returns the LocalNetFacade of the net managed by this NetEntityManager. |
NetEntity |
getEntity(java.lang.String id)
Retrieves an entity. |
protected Logger |
getLogger()
Returns the net's log4j logger. |
long |
getNetstep()
Returns the current netstep |
protected long |
increaseNetStep()
Increase the net step. |
boolean |
isDefiant(java.lang.String id)
|
protected void |
notifyObservers()
Notify all observers of all changed, new and deleted entities and clear the list of new and deleted entities. |
protected void |
prepareLoad(int estimatedNumber)
Preapares this manager to load a given number of entities |
protected void |
registerObserver(NetObserverIF newObserver)
Register an observer for the whole net. |
protected void |
reportActiveEntity(java.lang.String id)
Report an entity that has active gates. |
protected void |
reportChangedEntity(java.lang.String id)
Report an entity that has changed it's inner state |
protected void |
reportDefiantEntity(java.lang.String id)
Mark an entity "defiant" |
protected void |
reportEndOfDefiance(java.lang.String id)
End the defiance of the entity. |
java.lang.String |
reportIntegrityStatus()
Returns a String with integrity-relevant information about the entity |
void |
reset()
Frees as many references as possible to avoid too much gc activity, but keeps the manager intact (for net reload); |
protected void |
unregisterObserver(NetObserverIF observer)
Unregister an observer. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected long netstep
| Constructor Detail |
protected NetEntityManager(Logger logger,
LocalNetFacade theFacade)
logger - The log4j logger to be used with this net.| Method Detail |
protected void prepareLoad(int estimatedNumber)
estimatedNumber - the estimated number of entities to be loadedprotected LocalNetFacade getCorrespondingFacade()
protected void addEntity(NetEntity entity)
throws NetIntegrityException
entity - the entity - pass all entities here right after creation!
NetIntegrityException - if there is already an entity in the net
with the same ID.
protected void deleteEntity(java.lang.String id)
throws NetIntegrityException
id - the ID of the entity to be deleted.
NetIntegrityException - if there is no such ID or one of the links
of the entity is bad.
protected void deleteEntity(NetEntity entity)
throws NetIntegrityException
entity - the entity to be deleted.
NetIntegrityException - if there is no such ID or one of the links
of the entity is bad.
public NetEntity getEntity(java.lang.String id)
throws NetIntegrityException
id - the ID of the entity
NetIntegrityException - if there is no such entityprotected void reportChangedEntity(java.lang.String id)
id - the ID of the entity.protected void reportActiveEntity(java.lang.String id)
id - the ID of the entity.protected void reportDefiantEntity(java.lang.String id)
id - the ID of the entityprotected void reportEndOfDefiance(java.lang.String id)
id - the ID of the entity.protected void emptyActiveEntityList()
protected java.util.HashMap accessEntityMap()
protected java.util.Collection accessActiveEntitiesIDList()
protected java.util.Collection accessChangedEntitiesIDList()
protected java.util.Collection accessNewEntitiesIDList()
protected java.util.Collection accessDeletedEntitiesIDList()
protected java.util.Collection accessDefiantEntitiesIDList()
public boolean isDefiant(java.lang.String id)
protected long increaseNetStep()
NetCyclepublic long getNetstep()
protected void registerObserver(NetObserverIF newObserver)
newObserver - the observer to be registeredprotected void unregisterObserver(NetObserverIF observer)
observer - the observer to be unregisteredprotected void notifyObservers()
public java.util.Iterator getAllEntities()
public boolean entityExists(java.lang.String id)
id - the id to be checked
public void checkIntegrity()
throws NetIntegrityException
NetIntegrityIF
checkIntegrity in interface NetIntegrityIFNetIntegrityException - if the implementation violates the net's
integrity.NetIntegrityIF.checkIntegrity()public java.lang.String reportIntegrityStatus()
NetIntegrityIF
reportIntegrityStatus in interface NetIntegrityIFNetIntegrityIF.reportIntegrityStatus()
protected void changeParameter(java.lang.String id,
int parameterType,
int subID,
java.lang.String newValue)
throws NetIntegrityException
id - the ID of the entity to be changedparameterType - the parameter to be changedsubID - the subid. Depending on the parameterType used, this can be
the type of a slot, a gate or the key of a parameter of a hidden
implementation (typically of a NativeModule)newValue - The new value as String
NetIntegrityException - if the slot or gate was not foundNetParametersIFprotected Logger getLogger()
protected void buildActiveEntitiesList()
protected void destroy()
public void reset()
|
(c) by Micropsi Project: http://www.cognitive-agents.org | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||