|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.udo.cs.ie.cowbots.arch.EnvironmentAdapter
edu.udo.cs.ie.cowbots.arch.MassimAdapter
public class MassimAdapter
Implementation of EnvionmentAdapter to connect the Cowbot MAS to Massim. It is used to receive perceptions from massim an convert them to literals used for the Cowbots beliefs, and to send the cowbots actions to massim so they can interact with the environment they 'live' in.
Field Summary | |
---|---|
private java.lang.String |
agName
|
(package private) java.util.logging.Logger |
log
|
private MassimAgent |
massimAgent
Instance of an MassimAgent, wich takes part in the massim simulation. |
private int |
worldTime
|
Fields inherited from class edu.udo.cs.ie.cowbots.arch.EnvironmentAdapter |
---|
envLock, hasNewPercepts, newEndPer, newEnvPer, newSimPer, owner |
Constructor Summary | |
---|---|
MassimAdapter(AgArch owner,
java.lang.String host,
java.lang.String username,
java.lang.String pass,
int port)
Creates a new instance of an massim adapter |
Method Summary | |
---|---|
void |
act(java.lang.String action)
Method so set the next action performed by the agent in the massim environment. |
private Literal |
addPerceptIdentificator(java.lang.String ident,
java.lang.String id)
|
private Literal |
addPerceptWithIDAndPosition(java.lang.String name,
int x,
int y,
java.lang.String step)
Utility functions for generating default 'ison' literals |
int |
getWorldTime()
|
void |
processMassimPercepts(org.w3c.dom.Element percepts)
Receives the perceptions from massim in xml format, and converts them to literals used for the Cowbots beliefs. |
void |
processMassimSimStart(org.w3c.dom.Element percepts)
Called when simulation starts, receives some information about the world size. |
void |
processSimulationEnd(org.w3c.dom.Element perception,
long currenttime)
|
Methods inherited from class edu.udo.cs.ie.cowbots.arch.EnvironmentAdapter |
---|
acquire, getPercepts, newEndOfSimulation, newPercepts, newSimulation, release |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private MassimAgent massimAgent
private java.lang.String agName
private int worldTime
java.util.logging.Logger log
Constructor Detail |
---|
public MassimAdapter(AgArch owner, java.lang.String host, java.lang.String username, java.lang.String pass, int port)
owner
- AgentArch, to wake up the reasoning cycle with
given new perceptionshost
- The host massim is running onusername
- The agents usernamepass
- The agents passwordport
- The port massim is listening toMethod Detail |
---|
public void processMassimPercepts(org.w3c.dom.Element percepts)
percepts
- XML Root Elementpublic void processMassimSimStart(org.w3c.dom.Element percepts)
percepts
- XML Root Elementprivate Literal addPerceptIdentificator(java.lang.String ident, java.lang.String id)
private Literal addPerceptWithIDAndPosition(java.lang.String name, int x, int y, java.lang.String step)
name
- x
- y
- step
-
public void act(java.lang.String action)
act
in class EnvironmentAdapter
action
- Action performed by the agent
Possible actions are: skip, north, south, east, west,
northwest, northeast, southwest, southeastpublic int getWorldTime()
getWorldTime
in class EnvironmentAdapter
public void processSimulationEnd(org.w3c.dom.Element perception, long currenttime)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |