org.game.Juzzle
Class DummyPuzzlePartList

java.lang.Object
  |
  +--org.game.Juzzle.DummyPuzzlePartList
All Implemented Interfaces:
IPuzzlePartList

public class DummyPuzzlePartList
extends java.lang.Object
implements IPuzzlePartList

this class is used to write this code in the PuzzlePanel if no game is set:

partModel.doAnythingWithPart();

instead of:

if(part != null) { // do anything }

for faster performance.

See Also:
IPuzzlePartList, PuzzlePartList, PuzzlePanel

Constructor Summary
DummyPuzzlePartList()
          simply constructor.
 
Method Summary
 void deselectPart()
          deselect the selected part if one selected
 PuzzlePartList.PuzzlePart getFirstNode()
          return the first node
 PuzzlePartList.PuzzlePart[] getPartArray()
          get the array with all parts, the array is never changing for a game, only the list is changing
 int getPartsCount()
          return the puzzle part count
 int getSolvedPartsCount()
          return the solved puzzle part count
 boolean isSelectedPart(PuzzlePartList.PuzzlePart part)
          is the part the selected part or not
 void moveLocation(int dx, int dy)
          move the selected part
 boolean selectPart(java.awt.Point point)
          select part at the point
 void setRedrawRect(java.awt.Rectangle repaintRect)
          ask the model for the part that has changed and should be repainted
 void updatePart()
          if the piece is releasing, test if it pass to another part and if true create a new part
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DummyPuzzlePartList

public DummyPuzzlePartList()
simply constructor.
Method Detail

getPartsCount

public int getPartsCount()
return the puzzle part count
Specified by:
getPartsCount in interface IPuzzlePartList
Returns:
always -1

getSolvedPartsCount

public int getSolvedPartsCount()
return the solved puzzle part count
Specified by:
getSolvedPartsCount in interface IPuzzlePartList
Returns:
always -1

getFirstNode

public PuzzlePartList.PuzzlePart getFirstNode()
return the first node
Specified by:
getFirstNode in interface IPuzzlePartList
Returns:
always null

getPartArray

public PuzzlePartList.PuzzlePart[] getPartArray()
get the array with all parts, the array is never changing for a game, only the list is changing
Specified by:
getPartArray in interface IPuzzlePartList
Returns:
always null

isSelectedPart

public boolean isSelectedPart(PuzzlePartList.PuzzlePart part)
is the part the selected part or not
Specified by:
isSelectedPart in interface IPuzzlePartList
Parameters:
part - the part to compare
Returns:
always false

selectPart

public boolean selectPart(java.awt.Point point)
select part at the point
Specified by:
selectPart in interface IPuzzlePartList
Parameters:
point - point for selection
Returns:
always false

deselectPart

public void deselectPart()
deselect the selected part if one selected
Specified by:
deselectPart in interface IPuzzlePartList

setRedrawRect

public void setRedrawRect(java.awt.Rectangle repaintRect)
ask the model for the part that has changed and should be repainted
Specified by:
setRedrawRect in interface IPuzzlePartList
Parameters:
repaintRect - reference to the Rectangle, that get the repaint rectangle

moveLocation

public void moveLocation(int dx,
                         int dy)
move the selected part
Specified by:
moveLocation in interface IPuzzlePartList
Parameters:
dx - new x position
dy - new y position

updatePart

public void updatePart()
if the piece is releasing, test if it pass to another part and if true create a new part
Specified by:
updatePart in interface IPuzzlePartList