//
// UnsignedInt32.java
//
// The contents of this file are subject to the SNIA Public License Version 1.0
// (the "License"); you may not use this file except in compliance with the
// License. You may obtain a copy of the License at
//
//	http://www.snia.org/resources/openSource.html
//
// Software distributed under the License is distributed on an "AS IS" basis,
// WITHOUT WARRANTY OF ANY KIND, either express or implied. See the 
// License for the specific language governing rights and limitations
// under the License.
//
// The Original Code is UnsignedInt32.java
// 
// The Initial Developer of the Original Code is David Simons.
//
// Contributor(s): Angela Lee
//
// This source uses the Solaris WBEM APIs version 2.2. 
// Synchronization will be maintained with the Solaris WBEM APIS,
// which are being standardized through the Java Community Process.
//
//
// $Id: UnsignedInt32.java,v 1.1 2003/07/17 18:32:55 kumpf Exp $
//
// $Log: UnsignedInt32.java,v $
// Revision 1.1  2003/07/17 18:32:55  kumpf
// HP-BAPU: PEP-64 CIM Client and CIM Listener Java Interface
//
// Revision 1.1.1.1  2001/10/31 18:14:41  karl
// import of SNIA 0_7
//
// Revision 1.2  2001/03/31 11:50:47  davidsi
// - Fixed long return value.
//
// Revision 1.1  2000/11/18 14:22:13  davidsi
// - Initial version.
//
//
//
package org.snia.wbem.cim;

import java.lang.Number;

/**
    Creates and instantiates an unsigned 32-bit integer object.
 */

public class UnsignedInt32  extends Number {

    public static final long MAX_VALUE=4294967295L;
    public static final long MIN_VALUE=0;

    private long value;

    public UnsignedInt32(long inVal)  {
	value=inVal & (long)0xffffffff;
    }

    public UnsignedInt32(java.lang.String inStr) throws java.lang.NumberFormatException {
	Long l=new Long(inStr);
	long val=l.longValue();
        if (val<0 || val>MAX_VALUE)
            throw new java.lang.NumberFormatException("Not an unsigned 32 bit integer");
	value=val & (long)0xffffffff;
    }
	

    public String toString() {
	return(""+value);
    }

    public int hashCode(){
	return((int)(value  & 2147483647)); 
    }

    public boolean equals(java.lang.Object o){
	if ( !(o instanceof UnsignedInt32) )
	    return(false);
	return( ((UnsignedInt32)o).value == value );
    }

    public int intValue() {
	return((int)(value  & (MAX_VALUE))); 
    }

    public long longValue() {
	return(value);
    }

    public float floatValue() {
	return ((float)value);
    }

    public double doubleValue() {
	return ((double)value);
    }

    public byte byteValue() {
	return((byte)(value  & 0xff)); 
    }

    public short shortValue() {
	return((short)(value  & 0xffff)); 
    }
}
