klaus.engine
Class WinBoardXBoardEngine

java.lang.Object
  extended by klaus.engine.Engine
      extended by klaus.engine.WinBoardXBoardEngine
All Implemented Interfaces:
Runnable

public class WinBoardXBoardEngine
extends Engine
implements Runnable

Connects to a WinBoard/XBoard engine.

Since:
2009-03-15 alpha2
Author:
Stephan Hillebrand

Field Summary
private  boolean cancel
           
private  Process connection
           
private  Thread engineThread
           
private  boolean inForceMode
           
private  BufferedReader input
           
private static char[] lines
           
private  PrintWriter output
           
private static char[] rows
           
private  boolean running
           
 
Fields inherited from class klaus.engine.Engine
debuggingListeners, moveListeners, party
 
Constructor Summary
WinBoardXBoardEngine(String commandLine)
           
 
Method Summary
 void cancel()
           
 void forceMove()
           
private  void handle(String message)
           
private  void resyncPosition()
           
 void run()
           
private  void sendmsg(String message)
           
private  void setForceMode(boolean mode)
           
 void setTimeModel(int timeInMinutes, int movesToNextPeriod, int increment)
          Set the time model, equivalent to XBoards "level" command.
 void startCalculation()
           
 void unload()
           
 
Methods inherited from class klaus.engine.Engine
addDebuggingListener, addMove, addMoveListener, clearDebuggingListeners, fireDebuggingListeners, fireMoveListeners, removeAllMoveListeners, removeDebuggingListener, removeMoveListener
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

connection

private Process connection

input

private BufferedReader input

output

private PrintWriter output

engineThread

private Thread engineThread

cancel

private boolean cancel

running

private boolean running

inForceMode

private boolean inForceMode

lines

private static final char[] lines

rows

private static final char[] rows
Constructor Detail

WinBoardXBoardEngine

public WinBoardXBoardEngine(String commandLine)
                     throws IOException
Throws:
IOException
Method Detail

handle

private void handle(String message)

run

public void run()
Specified by:
run in interface Runnable

resyncPosition

private void resyncPosition()

setForceMode

private void setForceMode(boolean mode)

sendmsg

private void sendmsg(String message)

startCalculation

public void startCalculation()
Specified by:
startCalculation in class Engine

cancel

public void cancel()
Specified by:
cancel in class Engine

unload

public void unload()
Specified by:
unload in class Engine

forceMove

public void forceMove()
Specified by:
forceMove in class Engine

setTimeModel

public void setTimeModel(int timeInMinutes,
                         int movesToNextPeriod,
                         int increment)
Description copied from class: Engine

Set the time model, equivalent to XBoards "level" command.

This method should be called in two situations:

Specified by:
setTimeModel in class Engine
Parameters:
timeInMinutes - the time for this period
movesToNextPeriod - the number of moves to the next period
increment - the increment per move (Fischer clock) (in seconds)