org.micropsi.comp.agent.micropsi
Class MicroPsiAgent

java.lang.Object
  extended byorg.micropsi.comp.agent.micropsi.MicroPsiAgent
All Implemented Interfaces:
AgentIF, PhysicalStateListenerIF, java.lang.Runnable

public class MicroPsiAgent
extends java.lang.Object
implements AgentIF, PhysicalStateListenerIF


Field Summary
protected  java.lang.String currentAgentStateID
           
protected  DebugDataSource debugSource
           
protected  org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaDataTarget hTarget
           
protected  MicroPSICore micropsi
           
protected  int netDelayMs
           
protected  org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaResetDataTarget rTarget
           
protected  AgentScriptingManager scriptingManager
           
protected  AgentFrameworkComponent tecLayer
           
protected  org.micropsi.comp.agent.micropsi.MicroPsiAgent.UnzoomDataTarget unzoomTarget
           
protected  org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaDataTarget vTarget
           
protected  org.micropsi.comp.agent.micropsi.MicroPsiAgent.ZoomDataTarget zoomTarget
           
 
Constructor Summary
MicroPsiAgent()
           
 
Method Summary
 void die(java.lang.String reason)
           
 void endCycle(long cyclecounter)
           
 int getAgentType()
           
 java.lang.String getCurrentAgentState()
          Returns the current agent's satet
 int getCycleDelay()
          Returns the agent controller thread's current delay.
 NetFacadeIF getNet()
           
 Situation getSituation()
          Returns the current situation object.
 ConsoleQuestionTypeIF[] initialize(AgentFrameworkComponent teclayer, java.lang.String configroot, ConfigurationReaderIF reader)
           
 boolean isAlive()
           
 boolean isAnyZoomFlagSet()
           
 void receiveCycleSignal(long cyclecounter, int state)
           
 void registerAdditionalQuestionType(ConsoleQuestionTypeIF q)
           
 void reset()
          Resets the agent.
 void resetZoomFlags()
           
 void run()
           
 void saveState(java.lang.String newstate)
          Saves this agent as a new state with the given name
 void setCurrentAgentState(java.lang.String newState)
          Loads the agent's state
 void setCycleDelay(int newDelay)
          Sets the controller thread's delay (in ms)
 void startCycle(long cyclecounter)
           
 void stopEverything()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

micropsi

protected MicroPSICore micropsi

currentAgentStateID

protected java.lang.String currentAgentStateID

tecLayer

protected AgentFrameworkComponent tecLayer

scriptingManager

protected AgentScriptingManager scriptingManager

debugSource

protected DebugDataSource debugSource

hTarget

protected org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaDataTarget hTarget

vTarget

protected org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaDataTarget vTarget

rTarget

protected org.micropsi.comp.agent.micropsi.MicroPsiAgent.FoveaResetDataTarget rTarget

zoomTarget

protected org.micropsi.comp.agent.micropsi.MicroPsiAgent.ZoomDataTarget zoomTarget

unzoomTarget

protected org.micropsi.comp.agent.micropsi.MicroPsiAgent.UnzoomDataTarget unzoomTarget

netDelayMs

protected int netDelayMs
Constructor Detail

MicroPsiAgent

public MicroPsiAgent()
Method Detail

initialize

public ConsoleQuestionTypeIF[] initialize(AgentFrameworkComponent teclayer,
                                          java.lang.String configroot,
                                          ConfigurationReaderIF reader)
                                   throws MicropsiException
Specified by:
initialize in interface AgentIF
Throws:
MicropsiException

registerAdditionalQuestionType

public void registerAdditionalQuestionType(ConsoleQuestionTypeIF q)

reset

public void reset()
           throws MicropsiException
Resets the agent. This means that:
- The world adapters will be reset - The initial net state will be loaded - Situation parameters will be reset

Throws:
MicropsiException

getNet

public NetFacadeIF getNet()

startCycle

public void startCycle(long cyclecounter)
Specified by:
startCycle in interface AgentIF

receiveCycleSignal

public void receiveCycleSignal(long cyclecounter,
                               int state)
Specified by:
receiveCycleSignal in interface AgentIF

endCycle

public void endCycle(long cyclecounter)
Specified by:
endCycle in interface AgentIF

stopEverything

public void stopEverything()
                    throws MicropsiException
Specified by:
stopEverything in interface AgentIF
Throws:
MicropsiException

run

public void run()
Specified by:
run in interface java.lang.Runnable

isAlive

public boolean isAlive()
Specified by:
isAlive in interface AgentIF

getAgentType

public int getAgentType()
Specified by:
getAgentType in interface AgentIF

die

public void die(java.lang.String reason)
Specified by:
die in interface PhysicalStateListenerIF

saveState

public void saveState(java.lang.String newstate)
               throws MicropsiException,
                      java.io.IOException
Saves this agent as a new state with the given name

Parameters:
newstate - the state's name
Throws:
MicropsiException
java.io.IOException

setCurrentAgentState

public void setCurrentAgentState(java.lang.String newState)
                          throws MicropsiException
Loads the agent's state

Parameters:
newState -
Throws:
MicropsiException

getCurrentAgentState

public java.lang.String getCurrentAgentState()
Returns the current agent's satet

Returns:

getSituation

public Situation getSituation()
Returns the current situation object. Do NEVER, EVER hold the instance returned by this method, or you'll be out of sync with the world as soon as the agent gets renamed. If you need situations somewhere, pass the agent object and call getSituation() each time you need the situation!

Returns:
the current situation object

getCycleDelay

public int getCycleDelay()
Returns the agent controller thread's current delay.

Returns:
the current delay in ms

setCycleDelay

public void setCycleDelay(int newDelay)
Sets the controller thread's delay (in ms)

Parameters:
newDelay - the new delay between two cycles

resetZoomFlags

public void resetZoomFlags()

isAnyZoomFlagSet

public boolean isAnyZoomFlagSet()
Returns:

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

.