Package jadex.bdiv3.examples.puzzle
Class JackBoard
- java.lang.Object
- 
- jadex.bdiv3.examples.puzzle.JackBoard
 
- 
- All Implemented Interfaces:
- IBoard,- java.io.Serializable
 
 public class JackBoard extends java.lang.Object implements IBoard, java.io.Serializable The View Board represents the puzzle board and the pegs.- See Also:
- Serialized Form
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected Pieceblack_pieceprotected java.util.List<Move>movesSimplePropertyChangeSupportpcsprotected Piecewhite_piece
 - 
Constructor SummaryConstructors Constructor Description JackBoard()
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddPropertyChangeListener(PropertyChangeListener listener)Add a PropertyChangeListener to the listener list.java.util.List<Piece>getCurrentPosition()Get the current board position.MovegetLastMove()Get all moves made so far.java.util.List<Move>getMoves()Get all moves made so far.PiecegetPiece(Position pos)Get a piece for a location.java.util.List<Move>getPossibleMoves()Get possible moves.intgetSize()Get the board size.booleanisFreePosition(Position pos)Test if a position is free.booleanisSolution()Test if it is a solution.booleanmove(Move move)Do a move.voidremovePropertyChangeListener(PropertyChangeListener listener)Remove a PropertyChangeListener from the listener list.booleantakeback()Takeback a move.java.lang.StringtoString()Get the string representation.booleanwasLastMoveWhite()Test if the last move was with a white piece.
 
- 
- 
- 
Field Detail- 
white_pieceprotected Piece white_piece 
 - 
black_pieceprotected Piece black_piece 
 - 
movesprotected java.util.List<Move> moves 
 - 
pcspublic SimplePropertyChangeSupport pcs 
 
- 
 - 
Method Detail- 
getPossibleMovespublic java.util.List<Move> getPossibleMoves() Get possible moves.- Specified by:
- getPossibleMovesin interface- IBoard
- Returns:
- Get all possible move.
 
 - 
movepublic boolean move(Move move) Do a move.
 - 
isSolutionpublic boolean isSolution() Test if it is a solution.- Specified by:
- isSolutionin interface- IBoard
- Returns:
- True, if solution.
 
 - 
getMovespublic java.util.List<Move> getMoves() Get all moves made so far.
 - 
getLastMovepublic Move getLastMove() Get all moves made so far.- Specified by:
- getLastMovein interface- IBoard
 
 - 
wasLastMoveWhitepublic boolean wasLastMoveWhite() Test if the last move was with a white piece. When no move was made, it return true.- Specified by:
- wasLastMoveWhitein interface- IBoard
- Returns:
- True, is last move was with white piece.
 
 - 
getCurrentPositionpublic java.util.List<Piece> getCurrentPosition() Get the current board position.- Specified by:
- getCurrentPositionin interface- IBoard
 
 - 
isFreePositionpublic boolean isFreePosition(Position pos) Test if a position is free.- Specified by:
- isFreePositionin interface- IBoard
 
 - 
addPropertyChangeListenerpublic void addPropertyChangeListener(PropertyChangeListener listener) Add a PropertyChangeListener to the listener list. The listener is registered for all properties.- Specified by:
- addPropertyChangeListenerin interface- IBoard
- Parameters:
- listener- The PropertyChangeListener to be added.
 
 - 
removePropertyChangeListenerpublic void removePropertyChangeListener(PropertyChangeListener listener) Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.- Specified by:
- removePropertyChangeListenerin interface- IBoard
- Parameters:
- listener- The PropertyChangeListener to be removed.
 
 - 
toStringpublic java.lang.String toString() Get the string representation.- Overrides:
- toStringin class- java.lang.Object
 
 
- 
 
-