home *** CD-ROM | disk | FTP | other *** search
Java Source | 1998-02-20 | 919 b | 36 lines |
-
- package simula.random;
-
- /**
- * Implementation of the class Value that encapsulate real values.
- * @see Value
- */
- public class IntegerValue extends Value {
-
- private int value;
-
-
- /**
- * Creates a new object encapsulating the given integer value.
- * @param v The integer value to encapsulate.
- */
- IntegerValue(int v) {
- value = v;
- }
- /**
- * Returns the encapsulated integer number.
- * @return the encapsulated integer number.
- * @exception TypeDrawnException Fired whenever meaningless
- */
- public int asInteger() throws TypeDrawnException {
- return value;
- }
- /**
- * Returns the encapsulated integer value converted to a floating point number.
- * @return the encapsulated integer value converted to a floating point number.
- * @exception TypeDrawnException Fired whenever meaningless
- */
- public double asReal() throws TypeDrawnException {
- return (double)value;
- }
- }