public abstract class Entity extends Object implements Runnable
Modifier and Type | Field and Description |
---|---|
protected Collection<eis.iilang.Percept> |
byePercepts |
protected static DocumentBuilderFactory |
documentbuilderfactory |
protected static EnvironmentInterface |
ei |
protected AbstractQueue<Collection<eis.iilang.Percept>> |
perceptsQueue |
protected Collection<eis.iilang.Percept> |
requestActionPercepts |
protected Collection<eis.iilang.Percept> |
simEndPercepts |
protected Collection<eis.iilang.Percept> |
simStartPercepts |
protected static TransformerFactory |
transformerfactory |
Modifier | Constructor and Description |
---|---|
protected |
Entity()
Not supposed to be called by anyone else.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Document |
actionToXML(eis.iilang.Action action)
Maps an IILang-action to XML.
|
static void |
activatePerceptQueue() |
static void |
activateStatistics() |
boolean |
authenticate(String username,
String password)
Sends an authentication-message to the server and waits for the reply.
|
protected abstract Collection<eis.iilang.Percept> |
byeToIIL(Document document)
Maps the bye-message (XML) to IILang.
|
static Entity |
createEntity(String name,
String scenario,
String host,
int port,
String username,
String password) |
void |
enableIILang() |
static void |
enableNotifications() |
static void |
enableScheduling() |
static void |
enableTimeAnnotations() |
void |
enableXML() |
void |
establishConnection()
Establishes a connection to the MASSim-Server.
|
LinkedList<eis.iilang.Percept> |
getAllPercepts()
Yields all percepts
or the first one in the queue, if queuing is activated
|
protected int |
getCurrentActionId()
Yields the current action-id.
|
String |
getName()
Yields the name of the entity.
|
abstract String |
getType()
Yields the type of the entity.
|
boolean |
isConnected()
Returns true if the entity is connected to the MASSim-server.
|
void |
performAction(eis.iilang.Action action)
Performs an action.
|
protected void |
println(Object obj) |
Document |
receiveDocument()
Receives a document
|
protected abstract Collection<eis.iilang.Percept> |
requestActionToIIL(Document document)
Maps the request-action-message (XML) to IILang.
|
void |
run() |
static void |
setEnvironmentInterface(EnvironmentInterface ei) |
void |
setStatistic(Statistic stats) |
static void |
setTimeout(int t) |
protected abstract Collection<eis.iilang.Percept> |
simEndToIIL(Document document)
Maps the sim-end-message (XML) to IILang.
|
protected abstract Collection<eis.iilang.Percept> |
simStartToIIL(Document document)
Maps the sim-start-message (XML) to IILang.
|
static String |
XMLToString(Node node)
Converts an XML-node to a simple string.
|
protected static EnvironmentInterface ei
protected static DocumentBuilderFactory documentbuilderfactory
protected static TransformerFactory transformerfactory
protected Collection<eis.iilang.Percept> simStartPercepts
protected Collection<eis.iilang.Percept> requestActionPercepts
protected Collection<eis.iilang.Percept> simEndPercepts
protected Collection<eis.iilang.Percept> byePercepts
protected AbstractQueue<Collection<eis.iilang.Percept>> perceptsQueue
protected Entity()
public void enableXML()
public void enableIILang()
public String getName()
public void establishConnection()
public boolean authenticate(String username, String password)
username
- the username of the cowboy.password
- the password of the cowboy.public Document receiveDocument() throws IOException
IOException
- is thrown if reception failed.protected void println(Object obj)
public static Entity createEntity(String name, String scenario, String host, int port, String username, String password)
public abstract String getType()
public LinkedList<eis.iilang.Percept> getAllPercepts() throws eis.exceptions.PerceiveException
eis.exceptions.ActException
eis.exceptions.PerceiveException
protected abstract Document actionToXML(eis.iilang.Action action)
action
- protected abstract Collection<eis.iilang.Percept> simStartToIIL(Document document)
document
- protected abstract Collection<eis.iilang.Percept> requestActionToIIL(Document document)
document
- protected abstract Collection<eis.iilang.Percept> simEndToIIL(Document document)
document
- protected abstract Collection<eis.iilang.Percept> byeToIIL(Document document)
document
- public void performAction(eis.iilang.Action action) throws eis.exceptions.ActException
action
- eis.exceptions.ActException
public static String XMLToString(Node node)
node
- protected int getCurrentActionId()
public boolean isConnected()
public static void enableScheduling()
public static void enableTimeAnnotations()
public static void enableNotifications()
public static void setEnvironmentInterface(EnvironmentInterface ei)
public static void setTimeout(int t)
public void setStatistic(Statistic stats)
public static void activateStatistics()
public static void activatePerceptQueue()
Copyright © 2013. All Rights Reserved.