From 2f9ea3a69e52cc99b36928e7fb9d69c641823ea4 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Wed, 19 Jul 2006 23:59:55 +0000 Subject: [PATCH] Added a streaming Boolean wrapper. Untested. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4279 542714f4-19e9-0310-aa3c-eee0fc999fb1 --- src/as/com/threerings/io/Translations.as | 1 + src/as/com/threerings/util/langBoolean.as | 44 +++++++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/as/com/threerings/util/langBoolean.as diff --git a/src/as/com/threerings/io/Translations.as b/src/as/com/threerings/io/Translations.as index 9ae1a0762..c03daaeae 100644 --- a/src/as/com/threerings/io/Translations.as +++ b/src/as/com/threerings/io/Translations.as @@ -35,5 +35,6 @@ public class Translations // initialize some standard classes addTranslation("Object", "java.lang.Object"); + addTranslation("com.threerings.util.langBoolean", "java.lang.Boolean"); } } diff --git a/src/as/com/threerings/util/langBoolean.as b/src/as/com/threerings/util/langBoolean.as new file mode 100644 index 000000000..87d4138ed --- /dev/null +++ b/src/as/com/threerings/util/langBoolean.as @@ -0,0 +1,44 @@ +package com.threerings.util { + +import com.threerings.io.ObjectInputStream; +import com.threerings.io.ObjectOutputStream; +import com.threerings.io.Streamable; + +/** + * Equivalent to java.lang.Boolean. + */ +public class langBoolean + implements Equalable, Streamable +{ + public var value :Boolean; + + public static function valueOf (val :Boolean) :langBoolean + { + return new langBoolean(val); + } + + public function langBoolean (value :Boolean = false) + { + this.value = value; + } + + // from Equalable + public function equals (other :Object) :Boolean + { + return (other is langBoolean) && + (value === (other as langBoolean).value); + } + + // from Streamable + public function writeObject (out :ObjectOutputStream) :void + { + out.writeBoolean(value); + } + + // from Streamable + public function readObject (ins :ObjectInputStream) :void + { + value = ins.readBoolean(); + } +} +}