edu.udo.cs.ie.cowbots.arch
Class EnvironmentAdapter

Package class diagram package EnvironmentAdapter
java.lang.Object
  extended by edu.udo.cs.ie.cowbots.arch.EnvironmentAdapter
Direct Known Subclasses:
MassimAdapter

public abstract class EnvironmentAdapter
extends java.lang.Object

adapter to connect the cowbot architecture with an environment. new perceptions are stored in a first-in first-out queue. the adatper should also manage the connection to an environment in case of disconnects, etc.


Field Summary
protected  java.util.concurrent.locks.ReentrantLock envLock
           
protected  boolean hasNewPercepts
           
protected  java.util.List<Literal> newEndPer
           
protected  java.util.List<Literal> newEnvPer
           
protected  java.util.List<Literal> newSimPer
           
protected  AgArch owner
           
 
Constructor Summary
EnvironmentAdapter(AgArch owner)
           
 
Method Summary
 void acquire()
          aquires access to environment adapter for the calling thread. the thread might be blocked until the percepts can be aquired.
(package private) abstract  void act(java.lang.String action)
          send an action to the environment
 java.util.List<Literal> getPercepts()
          returns the agent's perceptions as a list of literals. might return null if no new perception are available.
abstract  int getWorldTime()
           
 void newEndOfSimulation(java.util.List<Literal> perEnd)
          this method is called whenever new end of simulation data are avail.
 void newPercepts(java.util.List<Literal> per)
          this method is called when new environmental percepts are available.
 void newSimulation(java.util.List<Literal> perSim)
          this method queues information about a new simulation (a new environment the agent competes in). an agent should always setup
 void release()
          releases access lock hold by the caller. has to be called whenever a caller acquired the environmental adapter for data update or retrieval.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

owner

protected AgArch owner

newSimPer

protected java.util.List<Literal> newSimPer

newEndPer

protected java.util.List<Literal> newEndPer

newEnvPer

protected java.util.List<Literal> newEnvPer

envLock

protected java.util.concurrent.locks.ReentrantLock envLock

hasNewPercepts

protected boolean hasNewPercepts
Constructor Detail

EnvironmentAdapter

public EnvironmentAdapter(AgArch owner)
Method Detail

getWorldTime

public abstract int getWorldTime()

getPercepts

public java.util.List<Literal> getPercepts()
returns the agent's perceptions as a list of literals. might return null if no new perception are available.

Returns:
list of perception literals

acquire

public void acquire()
aquires access to environment adapter for the calling thread. the thread might be blocked until the percepts can be aquired.


release

public void release()
releases access lock hold by the caller. has to be called whenever a caller acquired the environmental adapter for data update or retrieval.


act

abstract void act(java.lang.String action)
send an action to the environment

Parameters:
action -

newPercepts

public void newPercepts(java.util.List<Literal> per)
this method is called when new environmental percepts are available.

Parameters:
per - list of new perceptions

newSimulation

public void newSimulation(java.util.List<Literal> perSim)
this method queues information about a new simulation (a new environment the agent competes in). an agent should always setup

Parameters:
perSim - data block for simulation start

newEndOfSimulation

public void newEndOfSimulation(java.util.List<Literal> perEnd)
this method is called whenever new end of simulation data are avail.

Parameters:
perEnd - data block for simulation end