org.micropsi.nodenet
Class AbstractNativeModuleImpl

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

public abstract class AbstractNativeModuleImpl
extends java.lang.Object

Implementations of this abstract class can be plugged into NativeModules and act as inner logic of some NetEntity. The main job for any implementation will be the calculation of a set of gates from a set of slots. You can wrap any logics into a AbstractNativeModuleImpl, as long you mind some constraints: First, NativeModules must be linkable with the net. So, every IO has to be done in doubles via Slots and Gates. Second, NativeModule implementations must stay within the net's heartbeat: Any calculation necessarily terminates within the current netstep. So, some calculation that takes more than one net cycle will have to use some sort of internal program counter.


Nested Class Summary
protected  class AbstractNativeModuleImpl.NetStepLogger
           
protected  class AbstractNativeModuleImpl.StructureModificator
           
protected  class AbstractNativeModuleImpl.UserInteraction
           
 
Field Summary
protected  InnerStateContainer innerstate
           
protected  AbstractNativeModuleImpl.NetStepLogger logger
           
protected  AbstractNativeModuleImpl.StructureModificator structure
           
protected  AbstractNativeModuleImpl.UserInteraction userinteraction
           
 
Constructor Summary
AbstractNativeModuleImpl()
           
 
Method Summary
abstract  void calculate(Slot[] slots, GateManipulator manipulator, long netstep)
          This method is called whenever the module needs to calculate it's gates.
 void destroy()
          Destroys the instance for less gc load
protected abstract  int[] getGateTypes()
          Returns the types of gates to create for the module.
protected  InnerStateContainer getInnerStates()
          Returns the innerstate object of the module
protected abstract  int[] getSlotTypes()
          Returns the types of slots to create for the module.
protected  void initialize(NetEntityManager manager, org.micropsi.nodenet.UserInteractionManager interaction, NativeModule module)
          Used by NativeModule to set the entity manager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

structure

protected AbstractNativeModuleImpl.StructureModificator structure

userinteraction

protected AbstractNativeModuleImpl.UserInteraction userinteraction

logger

protected AbstractNativeModuleImpl.NetStepLogger logger

innerstate

protected InnerStateContainer innerstate
Constructor Detail

AbstractNativeModuleImpl

public AbstractNativeModuleImpl()
Method Detail

getGateTypes

protected abstract int[] getGateTypes()
Returns the types of gates to create for the module. This method is the first to be called when the module is set up.

Returns:
int[] An array of types

getSlotTypes

protected abstract int[] getSlotTypes()
Returns the types of slots to create for the module. This method is the second to be called during module setup.

Returns:
int[]

initialize

protected final void initialize(NetEntityManager manager,
                                org.micropsi.nodenet.UserInteractionManager interaction,
                                NativeModule module)
Used by NativeModule to set the entity manager. THIS METHOD IS FOR INTERNAT USE ONLY. DO NOT CALL.

Parameters:
manager -

getInnerStates

protected InnerStateContainer getInnerStates()
Returns the innerstate object of the module

Returns:
InnerStateContainer

calculate

public abstract void calculate(Slot[] slots,
                               GateManipulator manipulator,
                               long netstep)
                        throws NetIntegrityException
This method is called whenever the module needs to calculate it's gates.

Parameters:
slots - The module's slots
manipulator - The manipulator to be used for changing the gates
Throws:
NetIntegrityException

destroy

public void destroy()
Destroys the instance for less gc load


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

.