klaus.engine
Class EngineData

java.lang.Object
  extended by klaus.engine.EngineData

public class EngineData
extends Object

Saves the data for a chess engine

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

Field Summary
static int ENGINE_PROTOCOL_UCI
          UCI Engine (not supported up to now)
static int ENGINE_PROTOCOL_WINBOARD_XBOARD
          WinBoard / XBoard engine.
private  int engineType
          The engine's type / protocol
private  String executable
          The engine's command line, that is the path to an exe file (with settings?)
private  String name
           
static EngineData NO_ENGINE
          Shows that no engine was loaded.
private  HashMap<String,String> properties
          A hash map containing engine settings.
 
Constructor Summary
EngineData(int type, String cmdLine, String name)
          Create the data for a new engine.
 
Method Summary
 boolean amIDefault()
          Checks if this is the default engine
 Engine createEngine()
          Create an engine backend from this engine data
 String getDescription()
          Create a description of the engine, e. g. for the engine configuration view
 int getEngineType()
           
 String getExecutable()
           
 String getName()
           
 String getSetting(String key)
           
 HashMap<String,String> getSettings()
           
 void setEngineType(int engineType)
           
 void setExecutable(String executable)
           
 void setName(String name)
           
 void setSetting(String key, String value)
          Edit an engine setting
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NO_ENGINE

public static final EngineData NO_ENGINE
Shows that no engine was loaded.


executable

private String executable
The engine's command line, that is the path to an exe file (with settings?) on Windows or to a shwll script/binary on unixoid systems. Windows engines can be run on Linux etc. using "wine C:\\Program\ Files\\Your\\Engines\\name\\engine.exe" or something of that sort if wine is installed (Wine is available for MacOS X, Solaris/OpenSolaris, Linux and Net/FreeBSD, but *BSD does not support Java afaik).


name

private String name

engineType

private int engineType
The engine's type / protocol


ENGINE_PROTOCOL_UCI

public static final int ENGINE_PROTOCOL_UCI
UCI Engine (not supported up to now)

See Also:
Constant Field Values

ENGINE_PROTOCOL_WINBOARD_XBOARD

public static final int ENGINE_PROTOCOL_WINBOARD_XBOARD
WinBoard / XBoard engine. Winboard and XBoard are quite similar with the difference that a WinBoard engine is a Windows executable while a XBoard engine is a Linux/Solaris/... binary file. This is handled by Java so no differences have to be paid attention to.

See Also:
Constant Field Values

properties

private HashMap<String,String> properties
A hash map containing engine settings. As settings depend on engine in UCI mode, this has to be done in a hash map.

Constructor Detail

EngineData

public EngineData(int type,
                  String cmdLine,
                  String name)
Create the data for a new engine.

Parameters:
type - the engine's type/protocol (Winboard/Xboard/UCI???)
cmdLine - the engine's command line (e.g. /usr/bin/gnuchessx)
Method Detail

createEngine

public Engine createEngine()
                    throws IOException
Create an engine backend from this engine data

Returns:
the engine backend
Throws:
IOException - if the engine was not started due to an IO Exception

getDescription

public String getDescription()
Create a description of the engine, e. g. for the engine configuration view

Returns:
a short description of the engine

toString

public String toString()
Overrides:
toString in class Object

getEngineType

public int getEngineType()

getExecutable

public String getExecutable()

getName

public String getName()

setEngineType

public void setEngineType(int engineType)

setExecutable

public void setExecutable(String executable)

setName

public void setName(String name)

amIDefault

public boolean amIDefault()
Checks if this is the default engine

Returns:
true if this is the default engine, otherwise false

setSetting

public void setSetting(String key,
                       String value)
Edit an engine setting

Parameters:
key - the settings's key
value - the setting's value

getSetting

public String getSetting(String key)

getSettings

public HashMap<String,String> getSettings()