jrummikub.model
Interface IStoneTray<E extends Sizeable>

Type Parameters:
E - Objects held by the IStoneTray
All Superinterfaces:
java.lang.Cloneable, java.lang.Iterable<Pair<E,Position>>, java.io.Serializable
All Known Subinterfaces:
IHand, ITable
All Known Implementing Classes:
Hand, StoneTray, Table

public interface IStoneTray<E extends Sizeable>
extends java.lang.Iterable<Pair<E,Position>>, java.lang.Cloneable, java.io.Serializable

Interface for the StoneTray model


Method Summary
 IStoneTray<E> clone()
          Create a clone of the StoneTray
 boolean contains(E object)
          Search for an object within the stone tray
 void drop(E object, Position position)
          Adds object to the tray
 Position getPosition(E object)
          Returns the position of an object that is already on the tray
 int getSize()
          Return the number of objects on the tray
 boolean pickUp(E object)
          Tries to pick up (remove) a given object
 
Methods inherited from interface java.lang.Iterable
iterator
 

Method Detail

drop

void drop(E object,
          Position position)
Adds object to the tray

Parameters:
object - object to add to Hand
position - Position to put the object

getPosition

Position getPosition(E object)
Returns the position of an object that is already on the tray

Parameters:
object - object whose position is requested
Returns:
position of the object or null when the object is not on the tray

pickUp

boolean pickUp(E object)
Tries to pick up (remove) a given object

Parameters:
object - object to pick up
Returns:
true when the object was successfully removed

clone

IStoneTray<E> clone()
Create a clone of the StoneTray

Returns:
cloned StoneTray

getSize

int getSize()
Return the number of objects on the tray

Returns:
number of objects

contains

boolean contains(E object)
Search for an object within the stone tray

Parameters:
object - object to search for
Returns:
object found in stone tray