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
+20 -9
View File
@@ -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;
}
}