Constructor and Description |
---|
GtpEngine(java.io.PrintStream log) |
Modifier and Type | Method and Description |
---|---|
void |
cmdKnownCommand(GtpCommand cmd) |
void |
cmdListCommands(GtpCommand cmd) |
void |
cmdName(GtpCommand cmd) |
void |
cmdProtocolVersion(GtpCommand cmd) |
void |
cmdQuit(GtpCommand cmd) |
void |
cmdUnknown(GtpCommand cmd) |
void |
cmdVersion(GtpCommand cmd) |
void |
handleCommand(GtpCommand cmd)
Handle command.
|
void |
interruptCommand()
Callback for interrupting commands.
|
protected boolean |
isInterrupted() |
boolean |
isRegistered(java.lang.String command) |
void |
log(java.lang.String line) |
void |
mainLoop(java.io.InputStream in,
java.io.OutputStream out)
Main command loop.
|
static GoPoint |
parsePointArgument(java.lang.String[] cmdArray,
int boardSize)
Utility function for parsing a point argument.
|
static PointList |
parsePointListArgument(java.lang.String[] cmdArray,
int boardSize)
Utility function for parsing an point list argument.
|
void |
printInvalidResponse(java.lang.String text)
Print invalid response directly to output stream.
|
void |
register(java.lang.String command,
GtpCallback callback)
Register new command.
|
void |
respond(boolean status,
boolean hasId,
int id,
java.lang.String response) |
void |
setName(java.lang.String name)
Set name for name command.
|
void |
setQuit()
Set quit flag for terminating command loop.
|
void |
setVersion(java.lang.String version)
Set version for version command.
|
void |
unregister(java.lang.String command) |
public void cmdKnownCommand(GtpCommand cmd) throws GtpError
GtpError
public void cmdListCommands(GtpCommand cmd) throws GtpError
GtpError
public void cmdName(GtpCommand cmd) throws GtpError
GtpError
public void cmdProtocolVersion(GtpCommand cmd) throws GtpError
GtpError
public void cmdQuit(GtpCommand cmd) throws GtpError
GtpError
public void cmdUnknown(GtpCommand cmd) throws GtpError
GtpError
public void cmdVersion(GtpCommand cmd) throws GtpError
GtpError
public void interruptCommand()
public void handleCommand(GtpCommand cmd) throws GtpError
GtpError
public boolean isRegistered(java.lang.String command)
public void log(java.lang.String line)
public void mainLoop(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public static GoPoint parsePointArgument(java.lang.String[] cmdArray, int boardSize) throws GtpError
cmdArray
- Command line split into words.boardSize
- Board size is needed for parsing the pointGtpError
public static PointList parsePointListArgument(java.lang.String[] cmdArray, int boardSize) throws GtpError
cmdArray
- Command line split into words.boardSize
- Board size is needed for parsing the pointsGtpError
public void printInvalidResponse(java.lang.String text)
text
- Text to print to output stream.
No newline will be appended.public final void register(java.lang.String command, GtpCallback callback)
public void respond(boolean status, boolean hasId, int id, java.lang.String response)
public void setQuit()
public void setName(java.lang.String name)
public void setVersion(java.lang.String version)
public final void unregister(java.lang.String command)
protected boolean isInterrupted()