|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmassim.eismassim.Entity
public abstract class Entity
This represents an abstract entity. Basically an entity is a structure that represents a connection to the MASSim-Server. Thus is implements the official MASSim client-server communication protocol. Additionally we expect from subclasses of this class to implement methods that identify the type of the entity, and methods that map IILang tokens to XML and vice versa.
Field Summary | |
---|---|
protected java.util.Collection<eis.iilang.Percept> |
byePercepts
|
protected static javax.xml.parsers.DocumentBuilderFactory |
documentbuilderfactory
|
protected static EnvironmentInterface |
ei
|
protected java.util.AbstractQueue<java.util.Collection<eis.iilang.Percept>> |
perceptsQueue
|
protected java.util.Collection<eis.iilang.Percept> |
requestActionPercepts
|
protected java.util.Collection<eis.iilang.Percept> |
simEndPercepts
|
protected java.util.Collection<eis.iilang.Percept> |
simStartPercepts
|
protected static javax.xml.transform.TransformerFactory |
transformerfactory
|
Constructor Summary | |
---|---|
protected |
Entity()
Not supposed to be called by anyone else. |
Method Summary | |
---|---|
protected abstract org.w3c.dom.Document |
actionToXML(eis.iilang.Action action)
Maps an IILang-action to XML. |
static void |
activatePerceptQueue()
|
static void |
activateStatistics()
|
boolean |
authenticate(java.lang.String username,
java.lang.String password)
Sends an authentication-message to the server and waits for the reply. |
protected abstract java.util.Collection<eis.iilang.Percept> |
byeToIIL(org.w3c.dom.Document document)
Maps the bye-message (XML) to IILang. |
static Entity |
createEntity(java.lang.String name,
java.lang.String scenario,
java.lang.String host,
int port,
java.lang.String username,
java.lang.String password)
|
void |
enableIILang()
|
static void |
enableNotifications()
|
static void |
enableScheduling()
|
static void |
enableTimeAnnotations()
|
void |
enableXML()
|
void |
establishConnection()
Establishes a connection to the MASSim-Server. |
java.util.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. |
java.lang.String |
getName()
Yields the name of the entity. |
abstract java.lang.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(java.lang.Object obj)
|
org.w3c.dom.Document |
receiveDocument()
Receives a document |
protected abstract java.util.Collection<eis.iilang.Percept> |
requestActionToIIL(org.w3c.dom.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 java.util.Collection<eis.iilang.Percept> |
simEndToIIL(org.w3c.dom.Document document)
Maps the sim-end-message (XML) to IILang. |
protected abstract java.util.Collection<eis.iilang.Percept> |
simStartToIIL(org.w3c.dom.Document document)
Maps the sim-start-message (XML) to IILang. |
static java.lang.String |
XMLToString(org.w3c.dom.Node node)
Converts an XML-node to a simple string. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static EnvironmentInterface ei
protected static javax.xml.parsers.DocumentBuilderFactory documentbuilderfactory
protected static javax.xml.transform.TransformerFactory transformerfactory
protected java.util.Collection<eis.iilang.Percept> simStartPercepts
protected java.util.Collection<eis.iilang.Percept> requestActionPercepts
protected java.util.Collection<eis.iilang.Percept> simEndPercepts
protected java.util.Collection<eis.iilang.Percept> byePercepts
protected java.util.AbstractQueue<java.util.Collection<eis.iilang.Percept>> perceptsQueue
Constructor Detail |
---|
protected Entity()
Method Detail |
---|
public void enableXML()
public void enableIILang()
public java.lang.String getName()
public void establishConnection()
public boolean authenticate(java.lang.String username, java.lang.String password)
username
- the username of the cowboy.password
- the password of the cowboy.
public org.w3c.dom.Document receiveDocument() throws java.io.IOException
java.io.IOException
- is thrown if reception failed.protected void println(java.lang.Object obj)
public static Entity createEntity(java.lang.String name, java.lang.String scenario, java.lang.String host, int port, java.lang.String username, java.lang.String password)
public abstract java.lang.String getType()
public java.util.LinkedList<eis.iilang.Percept> getAllPercepts() throws eis.exceptions.PerceiveException
eis.exceptions.ActException
eis.exceptions.PerceiveException
protected abstract org.w3c.dom.Document actionToXML(eis.iilang.Action action)
action
-
protected abstract java.util.Collection<eis.iilang.Percept> simStartToIIL(org.w3c.dom.Document document)
document
-
protected abstract java.util.Collection<eis.iilang.Percept> requestActionToIIL(org.w3c.dom.Document document)
document
-
protected abstract java.util.Collection<eis.iilang.Percept> simEndToIIL(org.w3c.dom.Document document)
document
-
protected abstract java.util.Collection<eis.iilang.Percept> byeToIIL(org.w3c.dom.Document document)
document
-
public void run()
run
in interface java.lang.Runnable
public void performAction(eis.iilang.Action action) throws eis.exceptions.ActException
action
-
eis.exceptions.ActException
public static java.lang.String XMLToString(org.w3c.dom.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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |