diff --git a/src/as/com/threerings/util/Byte.as b/src/as/com/threerings/util/Byte.as index b9f17b88f..9e11c0b40 100644 --- a/src/as/com/threerings/util/Byte.as +++ b/src/as/com/threerings/util/Byte.as @@ -27,34 +27,45 @@ package com.threerings.util { public class Byte implements Equalable, Boxed { - public var value :int; - public static function valueOf (val :int) :Byte { return new Byte(val); } - public function Byte (value :int) + /** + * Access the immutable value. + */ + public function get value () :int { - this.value = value; + return _value; + } + + /** + * Constructor. + */ + public function Byte (byteValue :int) + { + _value = byteValue; } // from Equalable public function equals (other :Object) :Boolean { - return (other is Byte) && (value === (other as Byte).value); + return (other is Byte) && (_value === (other as Byte).value); } // from Boxed public function unbox () :Object { - return value; + return _value; } // override public function toString () :String { - return "Byte(" + value + ")"; + return "Byte(" + _value + ")"; } + + protected var _value :int; } } diff --git a/src/as/com/threerings/util/Float.as b/src/as/com/threerings/util/Float.as index 44d27efc0..de73cb986 100644 --- a/src/as/com/threerings/util/Float.as +++ b/src/as/com/threerings/util/Float.as @@ -27,28 +27,39 @@ package com.threerings.util { public class Float implements Equalable, Boxed { - public var value :Number; - public static function valueOf (val :Number) :Float { return new Float(val); } - public function Float (value :Number) + /** + * Access the immutable value. + */ + public function get value () :Number { - this.value = value; + return _value; + } + + /** + * Constructor. + */ + public function Float (floatValue :Number) + { + _value = floatValue; } // from Equalable public function equals (other :Object) :Boolean { - return (other is Float) && (value === (other as Float).value); + return (other is Float) && (_value === (other as Float).value); } // from Boxed public function unbox () :Object { - return value; + return _value; } + + protected var _value :Number; } } diff --git a/src/as/com/threerings/util/Integer.as b/src/as/com/threerings/util/Integer.as index f77f40d3c..3aea36532 100644 --- a/src/as/com/threerings/util/Integer.as +++ b/src/as/com/threerings/util/Integer.as @@ -32,34 +32,43 @@ package com.threerings.util { public class Integer implements Equalable, Boxed { - public var value :int; - public static function valueOf (val :int) :Integer { return new Integer(val); } - public function Integer (value :int) + /** + * Access the immutable value. + */ + public function get value () :int { - this.value = value; + return _value; + } + + /** + * Constructor. + */ + public function Integer (intValue :int) + { + _value = intValue; } // from Equalable public function equals (other :Object) :Boolean { - return (other is Integer) && (value === (other as Integer).value); + return (other is Integer) && (_value === (other as Integer).value); } // from Boxed public function unbox () :Object { - return value; + return _value; } // cannot use the override keyword on toString() because actionscript is stupid public function toString () :String { - return value.toString(); + return _value.toString(); } /** @@ -69,5 +78,8 @@ public class Integer { return (val1 > val2) ? 1 : (val1 == val2 ? 0 : -1); } + + protected var _value :int; + } } diff --git a/src/as/com/threerings/util/Short.as b/src/as/com/threerings/util/Short.as index e1d17721e..e810ff802 100644 --- a/src/as/com/threerings/util/Short.as +++ b/src/as/com/threerings/util/Short.as @@ -33,29 +33,36 @@ public class Short /** The maximum possible short value. */ public static const MAX_VALUE :int = (Math.pow(2, 15) - 1); - /** The value of this short. */ - public var value :int; - public static function valueOf (val :int) :Short { return new Short(val); } - public function Short (value :int) + /** + * Access the immutable value. + */ + public function get value () :int { - this.value = value; + return _value; + } + + public function Short (shortValue :int) + { + _value = shortValue; } // from Equalable public function equals (other :Object) :Boolean { - return (other is Short) && (value === (other as Short).value); + return (other is Short) && (_value === (other as Short).value); } // from Boxed public function unbox () :Object { - return value; + return _value; } + + protected var _value :int; } } diff --git a/src/as/com/threerings/util/langBoolean.as b/src/as/com/threerings/util/langBoolean.as index 9f2f247e5..ea36ec05d 100644 --- a/src/as/com/threerings/util/langBoolean.as +++ b/src/as/com/threerings/util/langBoolean.as @@ -31,47 +31,58 @@ import com.threerings.io.Streamable; public class langBoolean implements Equalable, Streamable, Boxed { - public var value :Boolean; - public static function valueOf (val :Boolean) :langBoolean { return new langBoolean(val); } - public function langBoolean (value :Boolean = false) + /** + * Access the immutable value. + */ + public function get value () :Boolean { - this.value = value; + return _value; + } + + /** + * Constructor. + */ + public function langBoolean (boolValue :Boolean = false) + { + _value = boolValue; } // from Equalable public function equals (other :Object) :Boolean { return (other is langBoolean) && - (value === (other as langBoolean).value); + (_value === (other as langBoolean).value); } // from Streamable public function writeObject (out :ObjectOutputStream) :void { - out.writeBoolean(value); + out.writeBoolean(_value); } // from Streamable public function readObject (ins :ObjectInputStream) :void { - value = ins.readBoolean(); + _value = ins.readBoolean(); } // from Boxed public function unbox () :Object { - return value; + return _value; } // cannot use the override keyword on toString() because actionscript is stupid public function toString () :String { - return value.toString(); + return _value.toString(); } + + protected var _value :Boolean; } }