Some fixups and enhancements.

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4294 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-07-28 02:48:52 +00:00
parent ad74efc332
commit 7c17069a16
4 changed files with 69 additions and 8 deletions
+23 -1
View File
@@ -1,8 +1,10 @@
package com.threerings.io {
import com.threerings.util.ClassUtil;
import com.threerings.util.Cloneable;
public dynamic class TypedArray extends Array
implements Cloneable
{
/**
* Create a TypedArray
@@ -21,9 +23,18 @@ public dynamic class TypedArray extends Array
*/
public static function getJavaType (of :Class) :String
{
if (of === Boolean) {
return "[Z";
} else if (of === int) { // Number will be int if something like 3.0
return "[I";
} else if (of === Number) {
return "[D";
}
var cname :String = Translations.getToServer(
ClassUtil.getClassName(of));
// TODO: primitive types
return "[L" + cname + ";";
}
@@ -41,6 +52,17 @@ public dynamic class TypedArray extends Array
return _jtype;
}
// from Cloneable
public function clone () :Object
{
var clazz :Class = ClassUtil.getClass(this);
var copy :TypedArray = new clazz(_jtype);
for (var ii :int = length - 1; ii >= 0; ii--) {
copy[ii] = this[ii];
}
return copy;
}
/** The 'type' of this array, which doesn't really mean anything
* except gives it a clue as to how to stream to our server. */
protected var _jtype :String;