Mercurial > projects > dwt2
diff java/src/java/lang/Boolean.d @ 0:6dd524f61e62
add dwt win and basic java stuff
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Mon, 02 Mar 2009 14:44:16 +0100 |
parents | |
children | 9b96950f2c3c |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java/src/java/lang/Boolean.d Mon Mar 02 14:44:16 2009 +0100 @@ -0,0 +1,45 @@ +module java.lang.Boolean; + +import java.lang.util; +import java.lang.System; + +class Boolean : ValueWrapperT!(bool) { + public static Boolean TRUE; + public static Boolean FALSE; + + static this(){ + TRUE = new Boolean(true); + FALSE = new Boolean(false); + } + public this( bool v ){ + super(v); + } + + alias ValueWrapperT!(bool).opEquals opEquals; + public int opEquals( int other ){ + return value == ( other !is 0 ); + } + public int opEquals( Object other ){ + if( auto o = cast(Boolean)other ){ + return value == o.value; + } + return false; + } + public bool booleanValue(){ + return value; + } + public static Boolean valueOf( String s ){ + if( s == "yes" || s == "true" ){ + return TRUE; + } + return FALSE; + } + public static Boolean valueOf( bool b ){ + return b ? TRUE : FALSE; + } + public static bool getBoolean(String name){ + return tango.text.Ascii.icompare(System.getProperty(name, "false"), "true" ) is 0; + } +} + +alias Boolean ValueWrapperBool;