OSDN Git Service

* gcj/javaprims.h: Rebuilt class list.
[pf3gnuchains/gcc-fork.git] / libjava / java / lang / Number.java
1 /* java.lang.Number
2    Copyright (C) 1998, 2001 Free Software Foundation, Inc.
3
4 This file is part of GNU Classpath.
5
6 GNU Classpath is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2, or (at your option)
9 any later version.
10  
11 GNU Classpath is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with GNU Classpath; see the file COPYING.  If not, write to the
18 Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
19 02111-1307 USA.
20
21 As a special exception, if you link this library with other files to
22 produce an executable, this library does not by itself cause the
23 resulting executable to be covered by the GNU General Public License.
24 This exception does not however invalidate any other reasons why the
25 executable file might be covered by the GNU General Public License. */
26
27
28 package java.lang;
29
30 import java.io.Serializable;
31
32 /**
33  ** Number is a generic superclass of all the numeric classes, namely
34  ** <code>Byte</code>, <code>Short</code>, <code>Integer</code>,
35  ** <code>Long</code>, <code>Float</code>, and <code>Double</code>.
36  **
37  ** It provides ways to convert from any one value to any other.
38  **
39  ** @author Paul Fisher
40  ** @author John Keiser
41  ** @author Warren Levy
42  ** @since JDK1.0
43  **/
44 public abstract class Number implements Serializable
45 {
46   /** Return the value of this <code>Number</code> as a <code>byte</code>.
47    ** @return the value of this <code>Number</code> as a <code>byte</code>.
48    **/
49   public byte byteValue()
50   {
51     return (byte) intValue();
52   }
53
54   /** Return the value of this <code>Number</code> as a <code>short</code>.
55    ** @return the value of this <code>Number</code> as a <code>short</code>.
56    **/
57   public short shortValue()
58   {
59     return (short) intValue();
60   }
61
62   /** Return the value of this <code>Number</code> as an <code>int</code>.
63    ** @return the value of this <code>Number</code> as an <code>int</code>.
64    **/
65   public abstract int intValue();
66
67   /** Return the value of this <code>Number</code> as a <code>long</code>.
68    ** @return the value of this <code>Number</code> as a <code>long</code>.
69    **/
70   public abstract long longValue();
71
72   /** Return the value of this <code>Number</code> as a <code>float</code>.
73    ** @return the value of this <code>Number</code> as a <code>float</code>.
74    **/
75   public abstract float floatValue();
76
77   /** Return the value of this <code>Number</code> as a <code>float</code>.
78    ** @return the value of this <code>Number</code> as a <code>float</code>.
79    **/
80   public abstract double doubleValue();
81
82   private static final long serialVersionUID = -8742448824652078965L;
83 }