These should all be immutable.
Hopefully nothing was setting the values. If so, maybe we'll see compile-time errors/warnings. Maybe. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5677 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user