elge.agent
Class Situation

java.lang.Object
  |
  +--java.util.Dictionary
        |
        +--java.util.Hashtable
              |
              +--elge.agent.Situation
All Implemented Interfaces:
Cloneable, Map, Serializable

public class Situation
extends Hashtable

Situation is a simple subclass of Hashtable. It provides some functionality for very common things, that should be included in it.

Situation is used as naswer object when agents comunicate. Any agent should put some results to the situation under the keys he understand's. If the ask agent understands them too, he can get it from it.

Author:
Pavol Žibrita
See Also:
Serialized Form

Constructor Summary
Situation()
          Creates a new instance of Situation
 
Method Summary
 boolean getBooleanResult()
          Very common thing is that an agent puts a yes/no answer into the situation.
 int getLifeTick()
          Very common method used to get the actual tick (it's like a time for agent). if it is present.
 void setBooleanResult(boolean res)
          Sets the result as a pair of World.RESULT -> Boolean
 void setLifeTick(int tick)
          Sets the tick in the situaion.
 
Methods inherited from class java.util.Hashtable
clear, clone, contains, containsKey, containsValue, elements, entrySet, equals, get, hashCode, isEmpty, keys, keySet, put, putAll, rehash, remove, size, toString, values
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Situation

public Situation()
Creates a new instance of Situation

Method Detail

getLifeTick

public int getLifeTick()
Very common method used to get the actual tick (it's like a time for agent). if it is present. Returns 0, if the tick is not present.

Returns:
return the actual tick or 0 if it is not present in situaion.

setLifeTick

public void setLifeTick(int tick)
Sets the tick in the situaion.

Parameters:
tick - the actual tick to set.

getBooleanResult

public boolean getBooleanResult()
Very common thing is that an agent puts a yes/no answer into the situation. This method gets the value of it.

Returns:
If a boolean result is presented, it returns it, or false if it is not. (Note, that false result can mean that the agent answered no, or that there was no answer).

setBooleanResult

public void setBooleanResult(boolean res)
Sets the result as a pair of World.RESULT -> Boolean