org.game.Juzzle
Interface IPuzzlePartList

All Known Implementing Classes:
DummyPuzzlePartList, PuzzlePartList

public interface IPuzzlePartList

this model is using to realise the DummyPuzzlePartList to create a game with no function. This is needed to write this code in the PuzzlePanel:

partModel.doAnythingWithPart();

instead of:

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

for faster performance.

See Also:
PuzzlePartList, DummyPuzzlePartList, PuzzlePanel

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
 

Method Detail

getPartsCount

public int getPartsCount()
return the puzzle part count
Returns:
the puzzle part count

getSolvedPartsCount

public int getSolvedPartsCount()
return the solved puzzle part count
Returns:
the solved puzzle part count

getFirstNode

public PuzzlePartList.PuzzlePart getFirstNode()
return the first node
Returns:
the first node

getPartArray

public PuzzlePartList.PuzzlePart[] getPartArray()
get the array with all parts, the array is never changing for a game, only the list is changing
Returns:
a array with all parts

isSelectedPart

public boolean isSelectedPart(PuzzlePartList.PuzzlePart part)
is the part the selected part or not
Parameters:
part - the part to compare
Returns:
true if the same part or false if not

selectPart

public boolean selectPart(java.awt.Point point)
select part at the point
Parameters:
point - point for selection
Returns:
true if selected or false if not

deselectPart

public void deselectPart()
deselect the selected part if one selected

setRedrawRect

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

moveLocation

public void moveLocation(int dx,
                         int dy)
move the selected part
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