klaus.backend
Interface ChessBackend

All Known Implementing Classes:
AnalyzeBackend, NullBackend, OfflinePlayingBackend

public interface ChessBackend


Method Summary
 boolean addMove(Move move)
          Add a certain move to the backend.
 void addMoveListener(MoveListener listener)
          Add a move listener.
 void addResultListener(ResultListener listener)
           
 void fireMoveListeners(Move move)
           
 void fireResultListeners(Result result)
           
 long getBlackTime()
          Gives the remaining time for black [im milliseconds]
 Party getParty()
           
 Position getPosition()
           
 long getWhiteTime()
          Gives the remaining time for white [in milliseconds]
 boolean isGameRunning()
           
 void removeMoveListener(MoveListener listener)
          Remove a move listener
 void removeResultListener(ResultListener listener)
           
 void setActive()
          Set the backend active (let it accept new moves).
 void setInactive()
          Set the backend inactive (see #setActive for more information)
 void setPosition(Position position)
          Sets the backend position to the given position.
 void unload()
          Unload the backend, e. g. close file/database/process connections
 

Method Detail

setActive

void setActive()
Set the backend active (let it accept new moves). If the backend is inactive, the frontend will not accept any UI moves as input.


setInactive

void setInactive()
Set the backend inactive (see #setActive for more information)


addMove

boolean addMove(Move move)
Add a certain move to the backend. The backend has to react to this move. If the move is accepted, true is returned and the move can be displayed. If not, the interface should beep and/or show an error message.

Parameters:
move - the move that has been done by the user
Returns:
true if the move was accepted, else false

setPosition

void setPosition(Position position)
Sets the backend position to the given position. If the user takes back some moves, the position has to be reset manually using this method.

Parameters:
position - the given position

getPosition

Position getPosition()

getWhiteTime

long getWhiteTime()
Gives the remaining time for white [in milliseconds]

Returns:

getBlackTime

long getBlackTime()
Gives the remaining time for black [im milliseconds]

Returns:

getParty

Party getParty()

unload

void unload()
Unload the backend, e. g. close file/database/process connections


addMoveListener

void addMoveListener(MoveListener listener)
Add a move listener. Move listeners are fired everytime the backend does a move. Frontend moves are not handled.

Parameters:
listener -

removeMoveListener

void removeMoveListener(MoveListener listener)
Remove a move listener

Parameters:
listener -

fireResultListeners

void fireResultListeners(Result result)

addResultListener

void addResultListener(ResultListener listener)

removeResultListener

void removeResultListener(ResultListener listener)

fireMoveListeners

void fireMoveListeners(Move move)

isGameRunning

boolean isGameRunning()