org.micropsi.comp.world.objects
Class AbstractAgentObject

java.lang.Object
  extended byorg.micropsi.comp.world.objects.AbstractObjectPart
      extended byorg.micropsi.comp.world.objects.AbstractObject
          extended byorg.micropsi.comp.world.objects.AbstractCommonObject
              extended byorg.micropsi.comp.world.objects.AbstractAgentObject
All Implemented Interfaces:
AgentObjectIF, VisualFeatureIF, WorldMessageHandlerIF
Direct Known Subclasses:
BraitenbergVehicleAgentObject, OmnidriveVehicleAgentObject, SteamVehicleAgentObject

public abstract class AbstractAgentObject
extends AbstractCommonObject
implements AgentObjectIF


Field Summary
protected  java.util.Collection actionAnswers
           
 long actionsFailed
          Some statistics...
 long actionsSuccessful
          Some statistics...
 long timeOfBirth
           
protected  double visionRange
           
 double visitedHighX
          Some statistics...
 double visitedHighY
          Some statistics...
 double visitedLowX
          Some statistics...
 double visitedLowY
          Some statistics...
 
Fields inherited from class org.micropsi.comp.world.objects.AbstractCommonObject
damage, maxDamage
 
Fields inherited from class org.micropsi.comp.world.objects.AbstractObject
lastChange, moveVector, objectName, persistent, state, weight
 
Fields inherited from class org.micropsi.comp.world.objects.AbstractObjectPart
containingPart, id, objectClass, optionalProperties, orientationAngle, partHierarchyLevel, position, requiredProperties, sizeNumberFormat, subParts, world, xSize, ySize, zSize
 
Constructor Summary
AbstractAgentObject(org.w3c.dom.Element configData, Logger logger)
          Used to read agent object from world file Use initObjectParameters(), not constructor, to initialise member variables!
AbstractAgentObject(java.lang.String objectName, Position pos)
          Creates new agent object, sets objectClass to something usefull.
AbstractAgentObject(java.lang.String objectName, java.lang.String objectClass, Position pos)
          Creates new agent object Use initObjectParameters(), not constructor, to initialise member variables!
 
Method Summary
protected  void addActionAnswer(MActionResponse actionResp)
           
protected  void breakToPeaces(java.lang.String action)
           
 java.lang.String getAgentName()
           
abstract  MPerceptionResp getPerception()
           
 java.util.Collection getVisibleObjects()
          Method getVisibleObjects.
 double getVisionRange()
           
 void handleAction(MAction action)
          Executes actions in the world.
protected  void handleAction(MAction action, AbstractObjectPart targetObject)
          Called by handleAction(action) in order to execute the specified action (on the given object, if applicable) You should overwrite either this or handleAction(action)
 void init(World world)
           
protected  void initObjectParameters()
          Used to initialise member variables.
protected  void initProperties()
           
 void insertStatisticDataIn(MTreeNode node)
           
 void moveTo(Position newPosition)
           
 java.util.Collection returnActionAnswers()
           
 void setVisionRange(double visionRange)
           
 
Methods inherited from class org.micropsi.comp.world.objects.AbstractCommonObject
handleMessageAgentAction, setDamage, setMaxDamage, takeDamage
 
Methods inherited from class org.micropsi.comp.world.objects.AbstractObject
_remove, defaultState, getLastChange, getMoveVector, getObjectIdentification, getObjectName, getState, getState, getWeight, initObjectState, isPersistent, logChange, rotateBy, scaleBy, setMoveVector, setObjectName, setPosition, setSize, setState, setWeight, toMTreeNode, toString, toXMLElement, toXMLElement
 
Methods inherited from class org.micropsi.comp.world.objects.AbstractObjectPart
_handleMessage, _setSize, addLowLevePartsTo, addOptionalProperty, addRequiredProperty, addSubPart, addSubPartRelative, addSubPartsToMTreeNode, createPropertyCollection, getContainingObject, getContainingPart, getDistinctSizes, getId, getLogger, getNextObjectId, getObjectClass, getOptionalProperties, getOrientationAngle, getPartHierarchyLevel, getPosition, getProperties, getSize, getXSize, getYSize, getZSize, handleMessage, hasSubParts, initSubobjects, isAlive, isHighLevelObject, isLowLevelPart, moveBy, originatorsMatchSubParts, originatorsMatchSubParts, removeSubPart, rotateToAngle, scaleBy, scaleSubpartsBy, setContainingPart, setDistinctSizes, setObjectClass, setPartHierarchyLevel, setProperties, setProperty, setRequiredProperties, setSize, triggerSubPartChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

visionRange

protected double visionRange

actionAnswers

protected java.util.Collection actionAnswers

actionsSuccessful

public long actionsSuccessful
Some statistics...


actionsFailed

public long actionsFailed
Some statistics...


timeOfBirth

public long timeOfBirth

visitedLowX

public double visitedLowX
Some statistics...


visitedHighX

public double visitedHighX
Some statistics...


visitedLowY

public double visitedLowY
Some statistics...


visitedHighY

public double visitedHighY
Some statistics...

Constructor Detail

AbstractAgentObject

public AbstractAgentObject(org.w3c.dom.Element configData,
                           Logger logger)
                    throws MicropsiException
Used to read agent object from world file Use initObjectParameters(), not constructor, to initialise member variables!

Parameters:
configData -
logger -
Throws:
MicropsiException

AbstractAgentObject

public AbstractAgentObject(java.lang.String objectName,
                           java.lang.String objectClass,
                           Position pos)
Creates new agent object Use initObjectParameters(), not constructor, to initialise member variables!

Parameters:
objectName -
objectClass -
pos -

AbstractAgentObject

public AbstractAgentObject(java.lang.String objectName,
                           Position pos)
Creates new agent object, sets objectClass to something usefull. This constructor is usually called by the framework. Use initObjectParameters(), not constructor, to initialise member variables!

Parameters:
objectName -
pos -
Method Detail

initObjectParameters

protected void initObjectParameters()
Used to initialise member variables. Should call super.initObjectParameters

Overrides:
initObjectParameters in class AbstractObject

initProperties

protected void initProperties()
Overrides:
initProperties in class AbstractCommonObject

getAgentName

public java.lang.String getAgentName()
Specified by:
getAgentName in interface AgentObjectIF

getPerception

public abstract MPerceptionResp getPerception()
Specified by:
getPerception in interface AgentObjectIF

getVisibleObjects

public java.util.Collection getVisibleObjects()
Method getVisibleObjects.


insertStatisticDataIn

public void insertStatisticDataIn(MTreeNode node)

handleAction

public void handleAction(MAction action)
Executes actions in the world. This implementation finds the target object reference if given, and calls handleAction(action, targetObject). You should overwrite either this or handleAction(action, targetObject)

Specified by:
handleAction in interface AgentObjectIF
Parameters:
action - - action that should be executed
Returns:
MActionResponse

handleAction

protected void handleAction(MAction action,
                            AbstractObjectPart targetObject)
Called by handleAction(action) in order to execute the specified action (on the given object, if applicable) You should overwrite either this or handleAction(action)

Parameters:
action -
targetObject - - null, if none was given
Returns:
MActionResponse

getVisionRange

public double getVisionRange()
Returns:
Returns the visionRange.

setVisionRange

public void setVisionRange(double visionRange)
Parameters:
visionRange - The visionRange to set.

addActionAnswer

protected void addActionAnswer(MActionResponse actionResp)
Parameters:
actionResp -

returnActionAnswers

public java.util.Collection returnActionAnswers()
Specified by:
returnActionAnswers in interface AgentObjectIF

breakToPeaces

protected void breakToPeaces(java.lang.String action)
Overrides:
breakToPeaces in class AbstractCommonObject
Parameters:
action -

moveTo

public void moveTo(Position newPosition)
Overrides:
moveTo in class AbstractObjectPart

init

public void init(World world)
Overrides:
init in class AbstractObject

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

.