summaryrefslogtreecommitdiffstats
path: root/src/jrummikub/model/IStoneTray.java
blob: 17e7ae378826472f1822f257c890a2efeb8bc57a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
package jrummikub.model;

import java.io.Serializable;

import jrummikub.util.Pair;

/**
 * Interface for the {@link StoneTray} model
 * 
 * @param <E>
 *            Objects held by the IStoneTray
 */
public interface IStoneTray<E extends Sizeable> extends
		Iterable<Pair<E, Position>>, Cloneable, Serializable {

	/**
	 * Adds object to the tray
	 * 
	 * @param object
	 *            object to add to Hand
	 * @param position
	 *            {@link Position} to put the object
	 */
	public void drop(E object, Position position);

	/**
	 * Returns the position of an object that is already on the tray
	 * 
	 * @param object
	 *            object whose position is requested
	 * @return position of the object or null when the object is not on the tray
	 */
	public Position getPosition(E object);

	/**
	 * Tries to pick up (remove) a given object
	 * 
	 * @param object
	 *            object to pick up
	 * @return true when the object was successfully removed
	 */
	public boolean pickUp(E object);

	/**
	 * Create a clone of the StoneTray
	 * 
	 * @return cloned StoneTray
	 */
	public IStoneTray<E> clone();

	/**
	 * Return the number of objects on the tray
	 * 
	 * @return number of objects
	 */
	public int getSize();

	/**
	 * Search for an object within the stone tray
	 * 
	 * @param object
	 *            object to search for
	 * @return object found in stone tray
	 */
	public boolean contains(E object);

}