|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgcspy.comm.CommandStream
gcspy.interpreter.Interpreter
gcspy.interpreter.client.ClientInterpreter
public class ClientInterpreter
The client interpreter
Nested Class Summary |
---|
Nested classes/interfaces inherited from class gcspy.interpreter.Interpreter |
---|
Interpreter.BootstrapParameters |
Field Summary |
---|
Fields inherited from class gcspy.interpreter.Interpreter |
---|
client, CONTROL_CMD, DEFAULT_MAX_LEN, EVENT_CMD, EVENT_COUNT_CMD, EVENT_FILTERS_CMD, eventCount, eventFilters, events, generalInfo, name, PAUSE_CMD, PAUSE_REQ_CMD, PLAY_ONE_CMD, RESTART_CMD, SHUTDOWN_CMD, SHUTDOWN_REQ_CMD, SPACE_CMD, SPACE_INFO_CMD, spaceNum, spaces, STREAM_CMD, SUMMARY_CMD |
Fields inherited from class gcspy.comm.CommandStream |
---|
cmds, FIRST_AVAILABLE_CMD, max, output |
Constructor Summary | |
---|---|
ClientInterpreter()
Create a new ClientInterpreter |
Method Summary | |
---|---|
void |
addEventListener(EventListener eventListener)
Add an event listener. |
void |
addPauseListener(PauseListener pauseListener)
Add a pause listener |
void |
addSpaceListener(SpaceListener spaceListener)
Add a space listener |
void |
callEventListeners(int eventID,
int elapsedTime,
int compensationTime)
Call the event listeners for an event We need synchronization because the add/remove calla modify the number of elements in the list, and the iterator might throw a concurrent modification exception. |
void |
callPauseListeners()
Tell all pause listeners to pause |
void |
callSpaceListeners(ClientSpace space)
Call the space listeners for a space |
void |
connectToServer(java.lang.String server,
int port,
boolean pauseAtStart)
Connect to the server |
void |
connectToServer(java.lang.String server,
int port,
boolean pauseAtStart,
int maxLen)
Connect to the server |
void |
enableEventListeners()
Enable the event listeners |
ClientSpace |
getClientSpace(int i)
Get a client space |
void |
mainLoop()
The main clinet interpretet loop. |
void |
removeEventListener(EventListener eventListener)
Remove an event listener We need synchronization because the remove call modifies the number of elements in the list, and iterators might throw a concurrent modification exception. |
void |
removeSpaceListener(EventListener spaceListener)
Remove a space listener |
void |
sendEventFilters()
Send the client's event filters |
void |
sendEventFilters(EventFilters eventFilters)
Send the event filters |
void |
sendPauseReq()
Send a pause request command |
void |
sendPlayOne()
Send a play one command |
void |
sendRestart()
Send a restart command |
void |
sendShutdownReq()
Send a shut down request command |
Methods inherited from class gcspy.interpreter.Interpreter |
---|
deserialise, deserialiseEverything, dump, dumpSpaces, getEventCount, getEventFilters, getEvents, getGeneralInfo, getName, getSpace, getSpaceNum, println, receiveBootInfo, sendBootInfo, sendSingleCommand, serialise, serialiseEverything, setEventCount, setGeneralInfo, setSpace, setupEventCount, setupEventFilters, setVerbose |
Methods inherited from class gcspy.comm.CommandStream |
---|
execute, finish, finish, getCmd, putCmd, putCmd, setBufferedOutput, start, start |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ClientInterpreter()
Method Detail |
---|
public ClientSpace getClientSpace(int i)
i
- the space's ID
public void addPauseListener(PauseListener pauseListener)
pauseListener
- The listenerpublic void callPauseListeners()
public void enableEventListeners()
public void addEventListener(EventListener eventListener)
eventListener
- the event listenerpublic void removeEventListener(EventListener eventListener)
eventListener
- the event listenerpublic void callEventListeners(int eventID, int elapsedTime, int compensationTime)
eventID
- The event's IDelapsedTime
- The elapsed timecompensationTime
- The compensation timepublic void addSpaceListener(SpaceListener spaceListener)
spaceListener
- the listener.public void removeSpaceListener(EventListener spaceListener)
spaceListener
- the listener.public void callSpaceListeners(ClientSpace space)
space
- The spacepublic void sendPauseReq() throws java.io.IOException
java.io.IOException
public void sendRestart() throws java.io.IOException
java.io.IOException
public void sendPlayOne() throws java.io.IOException
java.io.IOException
public void sendShutdownReq() throws java.io.IOException
java.io.IOException
public void sendEventFilters() throws java.io.IOException
java.io.IOException
public void sendEventFilters(EventFilters eventFilters) throws java.io.IOException
eventFilters
- The evnet filters to send
java.io.IOException
public void connectToServer(java.lang.String server, int port, boolean pauseAtStart) throws java.io.IOException
server
- The server's host nameport
- The port on which to connectpauseAtStart
- Whether the server should pause at the start
java.io.IOException
public void connectToServer(java.lang.String server, int port, boolean pauseAtStart, int maxLen) throws java.io.IOException
server
- The server's host nameport
- The port on which to connectpauseAtStart
- Whether the server should pause at the startmaxLen
- The maximum length of the communication buffers
java.io.IOException
public void mainLoop() throws java.io.IOException
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |