home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-02-20 | 1.6 KB | 49 lines |
-
- package simula.random;
-
- import java.util.Random;
-
- /**
- * The class Value is the value extracted from the pseudo-random generator.
- * It encapsulate either boolean, integer or real values. The three implementation
- * of this class supply infact these values. Trying to get the wrong type of
- * value fires an exception. The class Value fires exception in every case.
- * @see draw
- * @see BooleanValue
- * @see IntegerValue
- * @see RealValue
- */
- public class Value {
-
-
- /**
- * Returns a boolean representation of the value. If it is meaningless
- * fires an Exception.
- * @return a boolean representation of the value. If it is meaningless
- * fires an Exception.
- * @exception TypeDrawnException fired if meaningless.
- */
- public boolean asBoolean() throws TypeDrawnException {
- throw new TypeDrawnException(TypeDrawnException.TYPE_MISMATCH);
- }
- /**
- * Returns an integer representation of the value. If it is meaningless
- * fires an Exception.
- * @return an integer representation of the value. If it is meaningless
- * fires an Exception.
- * @exception TypeDrawnException fired if meaningless.
- */
- public int asInteger() throws TypeDrawnException {
- throw new TypeDrawnException(TypeDrawnException.TYPE_MISMATCH);
- }
- /**
- * Returns a real representation of the value. If it is meaningless
- * fires an Exception.
- * @return a real representation of the value. If it is meaningless
- * fires an Exception.
- * @exception TypeDrawnException fired if meaningless.
- */
- public double asReal() throws TypeDrawnException {
- throw new TypeDrawnException(TypeDrawnException.TYPE_MISMATCH);
- }
- }