org.micropsi.nodenet
Class Slot

java.lang.Object
  extended byorg.micropsi.nodenet.Slot

public final class Slot
extends java.lang.Object

Slots are the endpoints of links. During activation propagation, slots collect the activation of the incoming links.

There isn't much magic to slots - they are basically a varible with the incoming activation and a list of incoming links to allow an entity to unlink itself.


Field Summary
protected  double activation
          The slot's activation.
 
Constructor Summary
protected Slot(int type, NetEntity center, NetEntityManager manager)
          Creates a new Slot.
 
Method Summary
protected  java.util.ArrayList accessIncomingLinks()
          Provides direct access to the list of incoming links.
protected  void attachIncomingLink(Link link)
          Attaches an incoming link.
protected  void destroy()
          Frees as many references as possible to avoid too much gc activity
protected  void detachIncomingLink(Link link)
          Detaches an incoming link.
 double getIncomingActivation()
          Returns the slot's activation.
 Link getIncomingLinkAt(int n)
          Returns the n-th link attached to the slot.
 java.util.Iterator getIncomingLinks()
          Retuns the instances of all incoming links.
 NetEntity getNetEntity()
          Returns the entity the slot belongs to.
 int getNumberOfIncomingLinks()
          Returns the number of links incoming at that gate.
 int getType()
          Returns the type of the slot.
 boolean hasIncomingLinks()
          Checks if this slot has incoming links
protected  void killActivation()
          Sets the slot's activation to zero.
protected  void putActivation(double act)
          Puts activation into the slot.
protected  void takeActivationGreaterThanZero(double act)
          Takes activation from the slot.
 java.lang.String toString()
           
protected  void unlinkCompletely()
          Unlinks the slot completely, that is: Kills all links that end at the slot.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

activation

protected double activation
The slot's activation.

Constructor Detail

Slot

protected Slot(int type,
               NetEntity center,
               NetEntityManager manager)
Creates a new Slot. Should only be called by implementations of NetEntity.

Parameters:
type - the type of the new slot
center - the NetEntity the Slot belongs to
manager - the entity manager
Method Detail

getType

public int getType()
Returns the type of the slot. Remember that there can only be one slot of a type at an entity.

Returns:
int the type
See Also:
SlotTypesIF

getNetEntity

public NetEntity getNetEntity()
Returns the entity the slot belongs to.

Returns:
NetEntity the entity

putActivation

protected void putActivation(double act)
Puts activation into the slot. Adds the activation value to the slot's value.

Parameters:
act - the value to be added to the slot's activation

takeActivationGreaterThanZero

protected void takeActivationGreaterThanZero(double act)
Takes activation from the slot. Decreases the slot's activation but only down to a minimum of zero.

Parameters:
act - the value to be substracted from the slot's activation

killActivation

protected void killActivation()
Sets the slot's activation to zero.


getIncomingActivation

public double getIncomingActivation()
Returns the slot's activation.

Returns:
double the slot's activation.

attachIncomingLink

protected void attachIncomingLink(Link link)
Attaches an incoming link. This method is low-level and does not check for net integrity nor does it ensure it. This method should only be called if the link contains this slot as its target.

Parameters:
link - the link to be added to the list of incoming links.

detachIncomingLink

protected void detachIncomingLink(Link link)
Detaches an incoming link. This method is low-level and does not care about net integrity. It should only be called if the link's instance is about to be dropped.

Parameters:
link - the link to be deleted from the list of incoming links.

getIncomingLinks

public java.util.Iterator getIncomingLinks()
Retuns the instances of all incoming links. Don't try remove(), you won't like the results.

Returns:
Iterator the links.

getIncomingLinkAt

public Link getIncomingLinkAt(int n)
Returns the n-th link attached to the slot.

Parameters:
n - the index of the link
Returns:
Link the n-th link or null if there is no such link.

hasIncomingLinks

public boolean hasIncomingLinks()
Checks if this slot has incoming links

Returns:
true if the slot has links

getNumberOfIncomingLinks

public int getNumberOfIncomingLinks()
Returns the number of links incoming at that gate.

Returns:
the number of links

accessIncomingLinks

protected java.util.ArrayList accessIncomingLinks()
Provides direct access to the list of incoming links. Know what you're doing when calling this. This is NOT a way to change the net's structure in any way!

Returns:
ArrayList the links

unlinkCompletely

protected void unlinkCompletely()
Unlinks the slot completely, that is: Kills all links that end at the slot. This method preserves the net's integrity and removes the links from the linking gates also.


toString

public java.lang.String toString()
See Also:
Object.toString()

destroy

protected void destroy()
Frees as many references as possible to avoid too much gc activity


(c) by Micropsi Project: http://www.cognitive-agents.org

.