/*
 * @(#)XNumber.java    1.0  18 February 2001
 *
 * Copyright 2004
 * College of Computer and Information Science
 * Northeastern University
 * Boston, MA  02115
 *
 * The Java Power Tools software may be used for educational
 * purposes as long as this copyright notice is retained intact
 * at the top of all source files.
 *
 * To discuss possible commercial use of this software, 
 * contact Richard Rasala at Northeastern University, 
 * College of Computer and Information Science,
 * 617-373-2462 or rasala@ccs.neu.edu.
 *
 * The Java Power Tools software has been designed and built
 * in collaboration with Viera Proulx and Jeff Raab.
 *
 * Should this software be modified, the words "Modified from 
 * Original" must be included as a comment below this notice.
 *
 * All publication rights are retained.  This software or its 
 * documentation may not be published in any media either
 * in whole or in part without explicit permission.
 *
 * This software was created with support from Northeastern 
 * University and from NSF grant DUE-9950829.
 */

package edu.neu.ccs;

/**
 * <P>Abstract superclass for 
 * <CODE>{@link Stringable Stringable}</CODE> objects 
 * that wrap a numeric value, whether it is a primitive type
 * or an arbitrary precision representation.
 *
 * The intention of this class is to provide a specification
 * for the required casting operations for wrapper classes.
 *
 * It is documented, though not required
 * that derived classes of this abstract class
 * should police promotion and demotion between types
 * and throw instances of <CODE>NumberFormatException</CODE>
 * when such casting operations cannot be safely performed.</P>
 * 
 * @author  Jeff Raab
 * @version 2.2
 * @since   1.0
 */
public abstract class XNumber extends XObject {

    /**
     * Returns the value of this number 
     * as a <CODE>byte</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract byte byteValue();

    /**
     * Returns the value of this number 
     * as a <CODE>short</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract short shortValue();

    /**
     * Returns the value of this number 
     * as a <CODE>int</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract int intValue();

    /**
     * Returns the value of this number 
     * as a <CODE>long</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract long longValue();

    /**
     * Returns the value of this number 
     * as a <CODE>float</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract float floatValue();

    /**
     * Returns the value of this number 
     * as a <CODE>double</CODE> value.
     *
     * @throws NumberFormatException if the value cannot be
     *      promoted or demoted to the type
     */
    public abstract double doubleValue();
}
