|
Jadex 0.96 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjadex.examples.puzzle.Board
public class Board
The board containing places, pieces and played moves.
Field Summary | |
---|---|
SimplePropertyChangeSupport |
pcs
The helper object for bean events. |
Fields inherited from interface jadex.examples.puzzle.IBoard |
---|
MOVE, TAKEBACK |
Constructor Summary | |
---|---|
Board()
Create a new board. |
|
Board(int size)
Create a new board. |
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 aposition is free. |
boolean |
isSolution()
Test if it is a solution. |
static void |
main(String[] args)
Main for testing. |
boolean |
move(Move move)
Do a move. |
void |
removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. |
boolean |
takeback()
Takeback a move. |
String |
toString()
Get the string representation. |
boolean |
wasLastMoveWhite()
Test if the last move was with a white piece. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public SimplePropertyChangeSupport pcs
Constructor Detail |
---|
public Board()
public Board(int size)
Method Detail |
---|
public Piece getPiece(Position pos)
getPiece
in interface IBoard
public List getPossibleMoves()
getPossibleMoves
in interface IBoard
public boolean move(Move move)
move
in interface IBoard
move
- The move.public boolean takeback()
takeback
in interface IBoard
public boolean isSolution()
isSolution
in interface IBoard
public List getMoves()
getMoves
in interface IBoard
public Move getLastMove()
getLastMove
in interface IBoard
public boolean wasLastMoveWhite()
wasLastMoveWhite
in interface IBoard
public boolean isFreePosition(Position pos)
isFreePosition
in interface IBoard
public int getSize()
getSize
in interface IBoard
public List getCurrentPosition()
getCurrentPosition
in interface IBoard
public String toString()
toString
in class Object
public void addPropertyChangeListener(PropertyChangeListener listener)
addPropertyChangeListener
in interface IBoard
listener
- The PropertyChangeListener to be added.public void removePropertyChangeListener(PropertyChangeListener listener)
removePropertyChangeListener
in interface IBoard
listener
- The PropertyChangeListener to be removed.public static void main(String[] args)
|
Jadex 0.96 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.