jrummikub.model
Class Table

java.lang.Object
  extended by jrummikub.model.StoneTray<StoneSet>
      extended by jrummikub.model.Table
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<Pair<StoneSet,Position>>, IStoneTray<StoneSet>, ITable

public class Table
extends StoneTray<StoneSet>
implements ITable

Class administering the Stones on the game-Table

See Also:
Serialized Form

Nested Class Summary
private static class Table.StoneInfo
           
 
Nested classes/interfaces inherited from class jrummikub.model.StoneTray
StoneTray.Direction
 
Field Summary
private  GameSettings gameSettings
           
private static long serialVersionUID
           
 
Fields inherited from class jrummikub.model.StoneTray
objects
 
Constructor Summary
Table(GameSettings settings)
          Constructor for a table
 
Method Summary
private  Table.StoneInfo findStoneInfo(Stone stone)
          Finds Table.StoneInfo
 StoneSet findStoneSet(Stone stone)
          Finds the StoneSet containing the given Stone
 boolean isValid()
          Tests the Table for rule conflicts by checking all the StoneSet
 void pickUpStone(Stone stone)
          Removes Stone from the Table
private  void splitSet(StoneSet set, Position setPosition, int stonePosition)
          Splits a stone set at a specified position
 
Methods inherited from class jrummikub.model.StoneTray
clone, contains, drop, fixInvalidDrop, getPosition, getSize, iterator, pickUp
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface jrummikub.model.IStoneTray
clone, contains, drop, getPosition, getSize, pickUp
 
Methods inherited from interface java.lang.Iterable
iterator
 

Field Detail

serialVersionUID

private static final long serialVersionUID
See Also:
Constant Field Values

gameSettings

private GameSettings gameSettings
Constructor Detail

Table

public Table(GameSettings settings)
Constructor for a table

Parameters:
settings - GameSettings
Method Detail

pickUpStone

public void pickUpStone(Stone stone)
Removes Stone from the Table

Specified by:
pickUpStone in interface ITable
Parameters:
stone - stone to pick up

findStoneInfo

private Table.StoneInfo findStoneInfo(Stone stone)
Finds Table.StoneInfo

Parameters:
stone - the stone
Returns:
the info

findStoneSet

public StoneSet findStoneSet(Stone stone)
Description copied from interface: ITable
Finds the StoneSet containing the given Stone

Specified by:
findStoneSet in interface ITable
Parameters:
stone - stone whose set we're searching
Returns:
the set containing the stone or null if no set was found

splitSet

private void splitSet(StoneSet set,
                      Position setPosition,
                      int stonePosition)
Splits a stone set at a specified position

Parameters:
set - the stone set to split
setPosition - the set's position on the table
stonePosition - the stone after which splitting should occur

isValid

public boolean isValid()
Tests the Table for rule conflicts by checking all the StoneSet

Specified by:
isValid in interface ITable
Returns:
whether all sets on the table are valid