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:
Ray Greenwell
2009-03-03 22:30:15 +00:00
parent 07a42c7364
commit 1566d00c75
5 changed files with 88 additions and 36 deletions
+14 -7
View File
@@ -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;
}
}