diff options
Diffstat (limited to 'src/cldc-library/scala/runtime/BoxesRunTime.java')
-rw-r--r-- | src/cldc-library/scala/runtime/BoxesRunTime.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cldc-library/scala/runtime/BoxesRunTime.java b/src/cldc-library/scala/runtime/BoxesRunTime.java index 33c418381a..9374f6bce6 100644 --- a/src/cldc-library/scala/runtime/BoxesRunTime.java +++ b/src/cldc-library/scala/runtime/BoxesRunTime.java @@ -127,6 +127,39 @@ public class BoxesRunTime { /* UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING ... UNBOXING */ public static boolean unboxToBoolean(Object b) { + return b == null ? false : ((Boolean)b).booleanValue(); + } + + public static char unboxToChar(Object c) { + return c == null ? 0 : ((Character)c).charValue(); + } + + public static byte unboxToByte(Object b) { + return b == null ? 0 : ((Byte)b).byteValue(); + } + + public static short unboxToShort(Object s) { + return s == null ? 0 : ((Short)s).shortValue(); + } + + public static int unboxToInt(Object i) { + return i == null ? 0 : ((Integer)i).intValue(); + } + + public static long unboxToLong(Object l) { + return l == null ? 0 : ((Long)l).longValue(); + } + + public static float unboxToFloat(Object f) { + return f == null ? 0.0f : ((Float)f).floatValue(); + } + + public static double unboxToDouble(Object d) { + return d == null ? 0.0d : ((Double)d).doubleValue(); + } + + /* + public static boolean unboxToBoolean(Object b) { if (b == null) throw new ClassCastException("null is no Boolean value"); return ((Boolean)b).booleanValue(); @@ -161,6 +194,7 @@ public class BoxesRunTime { throw new ClassCastException("null is no Long value"); return ((Long)l).longValue(); } + */ /* COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON ... COMPARISON */ |