|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.groovydice.DiceRollingCommand
public class DiceRollingCommand
This class provides the basic dice rolling functionality and methods to allow dice rolling commands to be compared and derived.
| Constructor Summary | |
|---|---|
DiceRollingCommand()
|
|
| Method Summary | |
|---|---|
int |
compareTo(Object command)
Compare the sum of this roll to the sum of the given roll. |
Object |
derive(Object allDice,
Object sides)
Create a new dice rolling command based on this one. |
boolean |
equals(Object command)
Whether the sum of this roll is equals to the sum of the given roll. |
List |
getAllDice()
|
GroovyDice |
getConfig()
|
groovy.lang.MetaClass |
getMetaClass()
|
Object |
getProperty(String name)
|
Integer |
getSides()
|
Object |
getView()
Get a copy of dice results lists. |
int |
hashCode()
Simple hashCode method. |
Object |
invokeMethod(String name,
Object args)
|
Object |
isCase(Object condition)
Returns whether the given parameter is found in this dice roll. |
Object |
roll(int n)
Roll the dice using the number generator specified at the configuration context. |
void |
setAllDice(List value)
|
void |
setConfig(GroovyDice value)
|
void |
setMetaClass(groovy.lang.MetaClass metaClass)
|
void |
setProperty(String name,
Object value)
|
void |
setSides(Integer value)
|
String |
toString()
Default string representation of this object. |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public DiceRollingCommand()
| Method Detail |
|---|
public Integer getSides()
public void setSides(Integer value)
public List getAllDice()
public void setAllDice(List value)
public GroovyDice getConfig()
public void setConfig(GroovyDice value)
public Object getView()
Numbers that represents the rolled dice.allDicepublic Object roll(int n)
n - Optional parameter that specify the number of dice to roll.
Defaults to 1.
this.
public Object derive(Object allDice,
Object sides)
allDice - Specify the set of already rolled dice.sides - Optional parameter to specify the number of sides.
public boolean equals(Object command)
equals in class Objectcommand - Dice rolling command.
public int compareTo(Object command)
compareTo in interface Comparablecommand - Dice rolling command.
ClassCastException - if the given object is not expected.public Object isCase(Object condition)
condition - Can be any object accepted by grep()
method,like a number, an array, a range, a closure etc. You can also
pass a dice rolling command to use its dice as the condition.
public int hashCode()
hashCode in class Objectpublic String toString()
toString in class Objectpublic groovy.lang.MetaClass getMetaClass()
getMetaClass in interface groovy.lang.GroovyObjectpublic void setMetaClass(groovy.lang.MetaClass metaClass)
setMetaClass in interface groovy.lang.GroovyObject
public Object invokeMethod(String name,
Object args)
invokeMethod in interface groovy.lang.GroovyObjectpublic Object getProperty(String name)
getProperty in interface groovy.lang.GroovyObject
public void setProperty(String name,
Object value)
setProperty in interface groovy.lang.GroovyObject
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||