Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.metacosm.framework.random
Class DiceDistributionLaw  view DiceDistributionLaw download DiceDistributionLaw.java

java.lang.Object
  extended byorg.metacosm.framework.random.DiceDistributionLaw
All Implemented Interfaces:
DistributionLaw, org.metacosm.framework.persistence.Persistent, java.io.Serializable

public class DiceDistributionLaw
extends java.lang.Object
implements DistributionLaw

Rolls the given number of dice with the given number of faces. Example: dice(3,6) = 3D6


Field Summary
private  int nbDice
           
private  int nbFaces
           
private  java.lang.Class type
           
 
Constructor Summary
DiceDistributionLaw(java.lang.Class type, int nbDice, int nbFaces)
           
 
Method Summary
 void load(java.io.InputStream is)
          Loads from the stream.
 java.lang.Object nextValue()
          Rolls dice.
 void save(java.io.OutputStream os)
          Saves on the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nbDice

private int nbDice

nbFaces

private int nbFaces

type

private java.lang.Class type
Constructor Detail

DiceDistributionLaw

public DiceDistributionLaw(java.lang.Class type,
                           int nbDice,
                           int nbFaces)
Method Detail

nextValue

public java.lang.Object nextValue()
Rolls dice.

Specified by:
nextValue in interface DistributionLaw

save

public void save(java.io.OutputStream os)
          throws java.io.IOException
Description copied from interface: org.metacosm.framework.persistence.Persistent
Saves on the stream.

Specified by:
save in interface org.metacosm.framework.persistence.Persistent

load

public void load(java.io.InputStream is)
          throws java.io.IOException
Description copied from interface: org.metacosm.framework.persistence.Persistent
Loads from the stream.

Specified by:
load in interface org.metacosm.framework.persistence.Persistent