home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-02-20 | 1.5 KB | 55 lines |
-
- package simula.random;
-
- import java.util.Random;
-
- /**
- * The abstract class Generator is the common parent of the hierarchy
- * of the classes implementing generators with different distribution.
- * Every implementation of this class offers the possibility to draw
- * integer, real or boolean values according to the chosen distribution.
- * The class RandomEngine is the source of the pseudo-random bits.
- * Every implementation should define its own constructors in a proper
- * way such that its paramaters would be properly initialized.
- * @author Dalcorso Luca, Fin Alessando, Riva Nicola
- * @see RandomEngine
- */
- public abstract class Generator {
-
- /**
- * Identifies a boolean valued generator.
- */
- public static final int BOOLEAN_TYPE = 0;
-
- /**
- * Identifies an integer valued generator.
- */
- public static final int INTEGER_TYPE = 1;
-
- /**
- * Identifies a real valued generator.
- */
- public static final int REAL_TYPE = 2;
-
- /**
- * Source of the pseudo-random bits.
- */
- protected RandomEngine random;
-
-
- /**
- * Draws a value from the generator: its type can be read with the <code>type</code> method.
- * @return Value object encapsulating the drawed value.
- * @see Value
- */
- public abstract Value draw();
- /**
- * Abstract method that allows to identify the type of the value.
- * Every implementation must provide this method.
- * @return Type of the values extracted.
- * @see REAL_TYPE
- * @see INTEGER_TYPE
- * @see BOOLEAN_TYPE
- */
- public abstract int type();
- }