Fixed up a number of TODOs; created a new Wrapped interface to simplify
auto-unwrapping. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4286 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -4,7 +4,7 @@ package com.threerings.util {
|
||||
* Equivalent to java.lang.Byte.
|
||||
*/
|
||||
public class Byte
|
||||
implements Equalable
|
||||
implements Equalable, Wrapped
|
||||
{
|
||||
public var value :int;
|
||||
|
||||
@@ -18,13 +18,19 @@ public class Byte
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Equalable
|
||||
// from Equalable
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
return (other is Byte) && (value === (other as Byte).value);
|
||||
}
|
||||
|
||||
// documentation inherited
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
// override
|
||||
public function toString () :String
|
||||
{
|
||||
return "Byte(" + value + ")";
|
||||
|
||||
@@ -71,7 +71,7 @@ public class Config
|
||||
var listener :Function = function (evt :NetStatusEvent) :void {
|
||||
// TODO: as of beta3 there is a bug where the status
|
||||
// is always "SharedObject.Flush.Failed", even on success
|
||||
//trace("================[" + evt.info.code + "]");
|
||||
trace("================[" + evt.info.code + "]");
|
||||
if ("SharedObject.Flush.Success" == evt.info.code) {
|
||||
rl.requestCompleted(thisConfig);
|
||||
} else {
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.threerings.util {
|
||||
* Equivalent to java.lang.Float.
|
||||
*/
|
||||
public class Float
|
||||
implements Equalable
|
||||
implements Equalable, Wrapped
|
||||
{
|
||||
public var value :Number;
|
||||
|
||||
@@ -18,10 +18,16 @@ public class Float
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Equalable
|
||||
// from Equalable
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
return (other is Float) && (value === (other as Float).value);
|
||||
}
|
||||
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package com.threerings.util {
|
||||
// Number <--> java.lang.Double. However, a Number object that refers
|
||||
// to an integer value is actually an int. Yes, it's totally fucked.
|
||||
public class Integer
|
||||
implements Equalable
|
||||
implements Equalable, Wrapped
|
||||
{
|
||||
public var value :int;
|
||||
|
||||
@@ -23,10 +23,16 @@ public class Integer
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Equalable
|
||||
// from Equalable
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
return (other is Integer) && (value === (other as Integer).value);
|
||||
}
|
||||
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.threerings.util {
|
||||
* Equivalent to java.lang.Long.
|
||||
*/
|
||||
public class Long
|
||||
implements Equalable
|
||||
implements Equalable, Wrapped
|
||||
{
|
||||
public var high :int;
|
||||
public var low :int;
|
||||
@@ -20,7 +20,7 @@ public class Long
|
||||
this.high = high;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Equalable
|
||||
// from Equalable
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
if (!(other is Long)) {
|
||||
@@ -29,5 +29,11 @@ public class Long
|
||||
var that :Long = (other as Long);
|
||||
return (this.high == that.high) && (this.low == that.low);
|
||||
}
|
||||
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return low; // TODO
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package com.threerings.util {
|
||||
* Equivalent to java.lang.Short.
|
||||
*/
|
||||
public class Short
|
||||
implements Equalable
|
||||
implements Equalable, Wrapped
|
||||
{
|
||||
public var value :int;
|
||||
|
||||
@@ -18,10 +18,16 @@ public class Short
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
// documentation inherited from interface Equalable
|
||||
// from Equalable
|
||||
public function equals (other :Object) :Boolean
|
||||
{
|
||||
return (other is Short) && (value === (other as Short).value);
|
||||
}
|
||||
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.threerings.util {
|
||||
|
||||
/**
|
||||
* An interface implemented by our wrapper classes.
|
||||
*/
|
||||
public interface Wrapped
|
||||
{
|
||||
/**
|
||||
* Return the wrapped value.
|
||||
*/
|
||||
function unwrap () :Object;
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import com.threerings.io.Streamable;
|
||||
* Equivalent to java.lang.Boolean.
|
||||
*/
|
||||
public class langBoolean
|
||||
implements Equalable, Streamable
|
||||
implements Equalable, Streamable, Wrapped
|
||||
{
|
||||
public var value :Boolean;
|
||||
|
||||
@@ -40,5 +40,11 @@ public class langBoolean
|
||||
{
|
||||
value = ins.readBoolean();
|
||||
}
|
||||
|
||||
// from Wrapped
|
||||
public function unwrap () :Object
|
||||
{
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user