KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > jboss > util > MuNumber


1 /***************************************
2  * *
3  * JBoss: The OpenSource J2EE WebOS *
4  * *
5  * Distributable under LGPL license. *
6  * See terms of license at gnu.org. *
7  * *
8  ***************************************/

9
10 package org.jboss.util;
11
12 /**
13  * An abstract mutable number class.
14  *
15  * <p>This is a base wrapper class for <code>java.lang.Number</code>.
16  *
17  * @version <tt>$Revision: 1.1 $</tt>
18  * @author <a HREF="mailto:jason@planet57.com">Jason Dillon</a>
19  */

20 public abstract class MuNumber
21    extends Number JavaDoc
22    implements Comparable JavaDoc, Cloneable JavaDoc, Mutable
23 {
24    /**
25     * Returns the value of the specified number as a <code>byte</code>.
26     * This may involve rounding or truncation.
27     *
28     * @return The numeric value represented by this object after conversion
29     * to type <code>byte</code>.
30     */

31    public byte byteValue() {
32       return (byte)longValue();
33    }
34
35    /**
36     * Returns the value of the specified number as a <code>short</code>.
37     * This may involve rounding or truncation.
38     *
39     * @return The numeric value represented by this object after conversion
40     * to type <code>short</code>.
41     */

42    public short shortValue() {
43       return (short)longValue();
44    }
45
46    /**
47     * Returns the value of the specified number as a <code>int</code>.
48     * This may involve rounding or truncation.
49     *
50     * @return The numeric value represented by this object after conversion
51     * to type <code>int</code>.
52     */

53    public int intValue() {
54       return (int)longValue();
55    }
56
57    /**
58     * Returns the value of the specified number as a <code>float</code>.
59     * This may involve rounding or truncation.
60     *
61     * @return The numeric value represented by this object after conversion
62     * to type <code>float</code>.
63     */

64    public float floatValue() {
65       return (float)doubleValue();
66    }
67 }
68
Popular Tags