|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.micropsi.nodenet.NetEntity
The abstract ancestor of all net entities. An entity is basically a thing in
a MicroPSI net that can have links to other entities and can be linked by
entities. Incoming links are attached to Slots, outgoing links are
maintained by Gates. (Slots, Gates and Links are not entities
themselves, but part of entities.)
NetEntities are managed by the
NetEntityManager and produced by the NetEntityFactory.
NetEntityFactory,
NetEntityManager,
Gate,
Slot,
NetEntityTypesIF| Field Summary | |
protected NetEntityManager |
entityManager
|
protected java.util.ArrayList |
gates
|
protected java.util.ArrayList |
slots
|
| 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 |
NetEntity(java.lang.String id,
NetEntityManager manager)
Creates a new NetEntity, using the given id. |
| Method Summary | |
protected void |
addGate(Gate g)
Adds a gate to the entity. |
protected void |
addSlot(Slot s)
Adds a slot to the entity. |
protected abstract void |
calculateGates()
Calculates the gates. |
protected void |
changeParameter(int parameterType,
int subID,
java.lang.String newValue)
Changes a parameter of this entity or one of it's slots, gates or hidden implementation. |
void |
checkIntegrity()
Checks the integrity. |
protected void |
confirmNewActivation()
Confirms the current activations of the gates. |
protected Link |
createLinkTo(java.lang.String id,
int slot,
Gate from,
double weight,
double confidence)
Creates a new link. |
protected void |
createLinkTo(java.lang.String id,
int slot,
Gate from,
double weight,
double confidence,
double x,
double y,
double z,
int t)
Creates a new link. |
protected void |
deleteGate(int gateType)
Deletes a gate and all links originating from it. |
protected void |
deleteLink(int gate,
java.lang.String to,
int slot)
Deletes a link originating from this entity. |
protected void |
deleteSlot(int slotType)
Deletes a slot and all links attached to it. |
protected void |
destroy()
Frees as many references as possible to avoid too much gc activity |
java.lang.String |
getEntityName()
Returns the name of the entity, if the entity has a name. |
abstract int |
getEntityType()
Returns the type of the entity |
Link |
getFirstLinkAt(int gate)
Returns the first link of the given gate or null if there is no link at that gate. |
Gate |
getGate(int type)
Returns a gate of the entity. |
java.util.Iterator |
getGates()
Returns all gates of this entity. |
java.lang.String |
getID()
Returns the unique ID of the entity. |
Link |
getLastLinkAt(int gate)
Returns the last link of the given gate or null if there is no link at that gate. |
Link |
getLink(int gate,
int at)
Returns the n-th link of the given gate or null if there is no link at that gate |
int |
getNumberOfGates()
Returns the number of gates of this entity. |
int |
getNumberOfSlots()
Returns the number of slots. |
java.lang.String |
getParentID()
Returns the ID of the entity's parent entity |
Slot |
getSlot(int type)
Get the slot with the given type. |
java.util.Iterator |
getSlots()
Returns all slots of this entity. |
boolean |
hasName()
Returns true if the entity has a name. |
boolean |
isActive()
Checks if one of the gates is active |
protected void |
propagateActivation()
Propagates the activation of all active gates along all links attached to active gates, calculating new activation values and putting it into the linked slots. |
java.lang.String |
reportIntegrityStatus()
Returns a String with integrity-relevant information about the entity |
protected void |
setEntityName(java.lang.String name)
Sets the entity's name. |
protected void |
setParentID(java.lang.String parentID)
Sets the parent ID |
java.lang.String |
toString()
|
protected void |
unlinkCompletely()
This removes all incoming and outgoing links, leaving the entity completely alone. |
void |
updateDecayState()
Updates the decay state of all links attached to this entity. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
protected java.util.ArrayList gates
protected java.util.ArrayList slots
protected NetEntityManager entityManager
| Constructor Detail |
protected NetEntity(java.lang.String id,
NetEntityManager manager)
id - The id of the entitymanager - | Method Detail |
protected void setParentID(java.lang.String parentID)
public java.lang.String getParentID()
public java.lang.String getID()
public abstract int getEntityType()
NetEntityTypesIFpublic Gate getGate(int type)
type - The type of the gate to be retrieved.
Gatepublic int getNumberOfGates()
public java.util.Iterator getGates()
remove().
public java.util.Iterator getSlots()
remove().
public int getNumberOfSlots()
public Slot getSlot(int type)
type - the type of the slot to be retrieved.
protected void addGate(Gate g)
throws NetIntegrityException
g - the gate to be added
NetIntegrityException - if there is already a gate of the same type
protected void addSlot(Slot s)
throws NetIntegrityException
s - the slot to be added
NetIntegrityException - if there is already a slot of the same type
protected void deleteGate(int gateType)
throws NetIntegrityException
gateType - the type of the gate to be deleted
NetIntegrityException - if the gate has bad links
protected void deleteSlot(int slotType)
throws NetIntegrityException
slotType - the type of the slot that will be deleted
NetIntegrityException - if the slot has bad linkspublic boolean isActive()
protected void confirmNewActivation()
protected abstract void calculateGates()
throws NetIntegrityException
NetIntegrityException
protected void propagateActivation()
throws NetIntegrityException
NetIntegrityException - if there is a bad linkpublic Link getFirstLinkAt(int gate)
gate - the gate
java.lang.NullPointerException - if there is no such gatepublic Link getLastLinkAt(int gate)
gate - the gate
java.lang.NullPointerException - if there is no such gate
public Link getLink(int gate,
int at)
gate - the gateat - the index of the link
java.lang.NullPointerException - if there is no such gate
protected void createLinkTo(java.lang.String id,
int slot,
Gate from,
double weight,
double confidence,
double x,
double y,
double z,
int t)
throws NetIntegrityException
id - the NetEntity to be linked.slot - the type of the slot the linke shall be attached tofrom - the gate where the link originates fromweight - the initial weight of the linkconfidence - the initial confidence of the linkx - the X value of the linky - the Y value of the linkz - the Z value of the linkt - the T value of the link
NetIntegrityException - if the linked entity does not exist or has
no slot of the given type.Link,
LinkFactory
protected Link createLinkTo(java.lang.String id,
int slot,
Gate from,
double weight,
double confidence)
throws NetIntegrityException
id - the NetEntity to be linked.slot - the type of the slot the linke shall be attached tofrom - the gate where the link originates fromweight - the initial weight of the linkconfidence - the initial confidence of the link
NetIntegrityException - if the linked entity does not exist or has
no slot of the given type.Link,
LinkFactory
protected void deleteLink(int gate,
java.lang.String to,
int slot)
throws NetIntegrityException
gate - the type of the gate the link originates fromto - the linked entityslot - the linked entity's slot
NetIntegrityException - if the link is bad
java.lang.NullPointerException - if this entity doesn't have a gate of the
given type
protected void unlinkCompletely()
throws NetIntegrityException
NetIntegrityException - if there are any bad links attached to this
entity.
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()public java.lang.String getEntityName()
protected void setEntityName(java.lang.String name)
name - the entity's name.public boolean hasName()
protected void changeParameter(int parameterType,
int subID,
java.lang.String newValue)
throws NetIntegrityException
parameterType - 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 found
java.lang.NumberFormatException - if a conversion of the newValue had to be
done and failedNetParametersIF
public void updateDecayState()
throws NetIntegrityException
MicropsiException - if there is no such entity
NetIntegrityExceptionpublic java.lang.String toString()
protected void destroy()
|
(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 | |||||||||