Mercurial > projects > dwt-linux
view dwt/dwthelper/Integer.d @ 13:3d9bbe0a83a0
FileFormats
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sun, 06 Jan 2008 22:54:14 +0100 |
parents | |
children | de2578a843a7 |
line wrap: on
line source
/** * Authors: Frank Benoit <keinfarbton@googlemail.com> */ module dwt.dwthelper.Integer; import dwt.dwthelper.utils; static import tango.text.convert.Integer; public final class Integer { public static int MIN_VALUE = 0x80000000; public static int MAX_VALUE = 0x7fffffff; public static int SIZE = 32; public int value; public this ( int value ){ this.value = value; } public this ( char[] s ){ } public static char[] toString( int i, int radix ){ switch( radix ){ case 2: return toBinaryString(i); case 8: return toOctalString(i); case 10: return toString(i); case 16: return toHexString(i); default: implMissing( __FILE__, __LINE__ ); return null; } } public static char[] toHexString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Hex ); } public static char[] toOctalString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Octal ); } public static char[] toBinaryString( int i ){ return tango.text.convert.Integer.toString(i, tango.text.convert.Integer.Style.Binary ); } public static char[] toString( int i ){ return tango.text.convert.Integer.toString(i); } public static int parseInt( char[] s, int radix ){ return tango.text.convert.Integer.parse( s, cast(uint)radix ); } public static int parseInt( char[] s ){ return tango.text.convert.Integer.parse( s ); } public static Integer valueOf( char[] s, int radix ){ implMissing( __FILE__, __LINE__ ); return null; } public static Integer valueOf( char[] s ){ implMissing( __FILE__, __LINE__ ); return null; } public static Integer valueOf( int i ){ implMissing( __FILE__, __LINE__ ); return null; } public byte byteValue(){ return cast(byte)value; } public short shortValue(){ return cast(short)value; } public int intValue(){ return value; } public long longValue(){ return cast(long)value; } public float floatValue(){ return cast(float)value; } public double doubleValue(){ return cast(double)value; } public override hash_t toHash(){ return intValue(); } public override int opEquals( Object obj ){ implMissing( __FILE__, __LINE__ ); return false; } public override char[] toString(){ return tango.text.convert.Integer.toString( value ); } }