|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jrummikub.model.StoneSet
public class StoneSet
Class managing Stone
s joined together to form sets
Nested Class Summary | |
---|---|
static class |
StoneSet.Type
Validity type of the set |
Field Summary | |
---|---|
(package private) static float |
HORIZONTAL_BORDER
|
private static long |
serialVersionUID
|
private java.util.ArrayList<Stone> |
stones
|
(package private) static float |
VERTICAL_BORDER
|
Constructor Summary | |
---|---|
StoneSet(java.util.List<Stone> stones)
Create a stone set from a list of stones |
|
StoneSet(Stone stone)
Create a new single stone stone set |
Method Summary | |
---|---|
Pair<StoneSet.Type,java.lang.Integer> |
classify(GameSettings settings)
Test for rule conflict within the StoneSet and determine whether the set is a group or a run |
private Pair<StoneSet.Type,java.lang.Integer> |
classifyJokersOnly(GameSettings settings)
Test for rule conflict within a StoneSet with jokers only and determine whether the set is a group or a run |
Stone |
get(int i)
Returns the i-th stone of the set (starting with 0) |
float |
getHeight()
Get the height of the object |
int |
getSize()
Returns the number of stones in the set. |
float |
getWidth()
Get the width of the object |
boolean |
isValid(GameSettings settings)
Test for rule conflict within the StoneSet |
private int |
isValidGroup(int value,
GameSettings settings)
Test for rule conflict within the StoneSet, assuming we have a group |
private int |
isValidRun(int referencePosition,
GameSettings settings)
Test for rule conflict within the StoneSet, assuming we have a run |
java.util.Iterator<Stone> |
iterator()
|
StoneSet |
join(StoneSet other)
Joins StoneSet to another StoneSet and returns the resulting new StoneSet |
Pair<StoneSet,StoneSet> |
splitAt(int position)
Splits the StoneSet at a specified Position and returns two new
Stone Sets |
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private static final long serialVersionUID
static final float VERTICAL_BORDER
static final float HORIZONTAL_BORDER
private java.util.ArrayList<Stone> stones
Constructor Detail |
---|
public StoneSet(Stone stone)
stone
- single stone of the setpublic StoneSet(java.util.List<Stone> stones)
stones
- list of stones to build a set ofMethod Detail |
---|
public boolean isValid(GameSettings settings)
settings
- GameSettings
public Pair<StoneSet.Type,java.lang.Integer> classify(GameSettings settings)
settings
- GameSettings
private Pair<StoneSet.Type,java.lang.Integer> classifyJokersOnly(GameSettings settings)
settings
- the game settings
private int isValidRun(int referencePosition, GameSettings settings)
referencePosition
- position of stone used as reference (any non-joker stone)settings
- the game settings
private int isValidGroup(int value, GameSettings settings)
value
- the value of the stones (all have the same in a group)settings
- the game settings
public Pair<StoneSet,StoneSet> splitAt(int position)
Position
and returns two new
Stone Sets
position
- Splitting Position
public StoneSet join(StoneSet other)
other
- StoneSet to be joined to active StoneSet
public int getSize()
public Stone get(int i)
i
- number of the stone to return
public java.util.Iterator<Stone> iterator()
iterator
in interface java.lang.Iterable<Stone>
public float getWidth()
Sizeable
getWidth
in interface Sizeable
public float getHeight()
Sizeable
getHeight
in interface Sizeable
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |