nl.tudelft.goal.EIS2Java.handlers
Class AbstractPerceptHandler

Package class diagram package AbstractPerceptHandler
java.lang.Object
  extended by nl.tudelft.goal.EIS2Java.handlers.PerceptHandler
      extended by nl.tudelft.goal.EIS2Java.handlers.AbstractPerceptHandler
Direct Known Subclasses:
AllPerceptPerceptHandler, DefaultPerceptHandler

public abstract class AbstractPerceptHandler
extends PerceptHandler


Field Summary
protected  Object entity
          The entity associated with this handler.
protected  Map<Method,List<Object>> previousPercepts
          map of previous percepts that we got for each method.
 
Constructor Summary
AbstractPerceptHandler(Object entity)
           
 
Method Summary
protected  List<eis.iilang.Percept> translatePercepts(Method method, List<Object> perceptObjects)
          Translates the percept objects and applies filtering as described by AsPercept.filter().
protected  List<Object> unpackPerceptObject(Method method, Object perceptObject)
          Depending on AsPercept.multiplePercepts() a perceptObject is either a collection that contains multiple percept objects or a single percept.
 
Methods inherited from class nl.tudelft.goal.EIS2Java.handlers.PerceptHandler
getAllPercepts
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

entity

protected final Object entity
The entity associated with this handler.


previousPercepts

protected final Map<Method,List<Object>> previousPercepts
map of previous percepts that we got for each method.

Constructor Detail

AbstractPerceptHandler

public AbstractPerceptHandler(Object entity)
Method Detail

translatePercepts

protected final List<eis.iilang.Percept> translatePercepts(Method method,
                                                           List<Object> perceptObjects)
                                                    throws eis.exceptions.PerceiveException
Translates the percept objects and applies filtering as described by AsPercept.filter().

Parameters:
entity - the entity which produced the percepts
method - the method which produced the percepts
perceptObjects - the generated percept objects.
Returns:
Throws:
eis.exceptions.PerceiveException

unpackPerceptObject

protected final List<Object> unpackPerceptObject(Method method,
                                                 Object perceptObject)
                                          throws eis.exceptions.PerceiveException
Depending on AsPercept.multiplePercepts() a perceptObject is either a collection that contains multiple percept objects or a single percept. This method unpacks either case into a list of percept objects.

Parameters:
method - that generated the percept object
perceptObject - the perceptObject generated by the method.
Returns:
a unpacked version of the percept object
Throws:
eis.exceptions.PerceiveException


Copyright © 2012 AMIS research group, Faculty of Mathematics and Physics, Charles University in Prague, Czech Republic. All Rights Reserved.