Jadex 0.96

jadex.examples.puzzle
Class JackBoard

java.lang.Object
  extended by jadex.examples.puzzle.JackBoard
All Implemented Interfaces:
IBoard, Serializable

public class JackBoard
extends Object
implements IBoard, Serializable

The View Board represents the puzzle board and the pegs.

See Also:
Serialized Form

Field Summary
 SimplePropertyChangeSupport pcs
           
 
Fields inherited from interface jadex.examples.puzzle.IBoard
MOVE, TAKEBACK
 
Constructor Summary
JackBoard()
           
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 List getCurrentPosition()
          Get the current board position.
 Move getLastMove()
          Get all moves made so far.
 List getMoves()
          Get all moves made so far.
 Piece getPiece(Position pos)
          Get a piece for a location.
 List getPossibleMoves()
          Get possible moves.
 int getSize()
          Get the board size.
 boolean isFreePosition(Position pos)
          Test if a position is free.
 boolean isSolution()
          Test if it is a solution.
 boolean move(Move move)
          Do a move.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 boolean takeback()
          Takeback a move.
 boolean wasLastMoveWhite()
          Test if the last move was with a white piece.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

pcs

public SimplePropertyChangeSupport pcs
Constructor Detail

JackBoard

public JackBoard()
Method Detail

getPiece

public Piece getPiece(Position pos)
Get a piece for a location.

Specified by:
getPiece in interface IBoard

getPossibleMoves

public List getPossibleMoves()
Get possible moves.

Specified by:
getPossibleMoves in interface IBoard
Returns:
Get all possible move.

move

public boolean move(Move move)
Do a move.

Specified by:
move in interface IBoard
Parameters:
move - The move.

takeback

public boolean takeback()
Takeback a move.

Specified by:
takeback in interface IBoard

isSolution

public boolean isSolution()
Test if it is a solution.

Specified by:
isSolution in interface IBoard
Returns:
True, if solution.

getMoves

public List getMoves()
Get all moves made so far.

Specified by:
getMoves in interface IBoard

getLastMove

public Move getLastMove()
Get all moves made so far.

Specified by:
getLastMove in interface IBoard

wasLastMoveWhite

public boolean wasLastMoveWhite()
Test if the last move was with a white piece. When no move was made, it return true.

Specified by:
wasLastMoveWhite in interface IBoard
Returns:
True, is last move was with white piece.

getSize

public int getSize()
Get the board size.

Specified by:
getSize in interface IBoard

getCurrentPosition

public List getCurrentPosition()
Get the current board position.

Specified by:
getCurrentPosition in interface IBoard

isFreePosition

public boolean isFreePosition(Position pos)
Test if a position is free.

Specified by:
isFreePosition in interface IBoard

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Specified by:
addPropertyChangeListener in interface IBoard
Parameters:
listener - The PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Specified by:
removePropertyChangeListener in interface IBoard
Parameters:
listener - The PropertyChangeListener to be removed.

Jadex 0.96

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.