- Just use dictionaries, which are inside the HashMaps anyway.

- Register Long.

(I could probably sweep through narya and re-jigger a bunch of
the actionscript code that was written while I was learning the
language.)


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5609 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2008-12-30 23:59:40 +00:00
parent e6ea84e5da
commit e9152193b7
+8 -7
View File
@@ -21,7 +21,7 @@
package com.threerings.io { package com.threerings.io {
import com.threerings.util.HashMap; import flash.utils.Dictionary;
/** /**
* Maintains a set of translations between actionscript class names * Maintains a set of translations between actionscript class names
@@ -31,27 +31,27 @@ public class Translations
{ {
public static function getToServer (asName :String) :String public static function getToServer (asName :String) :String
{ {
var javaName :String = (_toServer.get(asName) as String); var javaName :String = (_toServer[asName] as String);
return (javaName == null) ? asName.replace("_", "$") : javaName; return (javaName == null) ? asName.replace("_", "$") : javaName;
} }
public static function getFromServer (javaName :String) :String public static function getFromServer (javaName :String) :String
{ {
var asName :String = (_fromServer.get(javaName) as String); var asName :String = (_fromServer[javaName] as String);
return (asName == null) ? javaName.replace("$", "_") : asName; return (asName == null) ? javaName.replace("$", "_") : asName;
} }
public static function addTranslation (asName :String, javaName :String) :void public static function addTranslation (asName :String, javaName :String) :void
{ {
_toServer.put(asName, javaName); _toServer[asName] = javaName;
_fromServer.put(javaName, asName); _fromServer[javaName] = asName;
} }
/** A mapping of actionscript names to java names. */ /** A mapping of actionscript names to java names. */
protected static var _toServer :HashMap = new HashMap(); protected static var _toServer :Dictionary = new Dictionary();
/** A mapping of java names to actionscript names. */ /** A mapping of java names to actionscript names. */
protected static var _fromServer :HashMap = new HashMap(); protected static var _fromServer :Dictionary = new Dictionary();
// initialize some standard classes // initialize some standard classes
addTranslation("Object", "java.lang.Object"); addTranslation("Object", "java.lang.Object");
@@ -60,6 +60,7 @@ public class Translations
addTranslation("com.threerings.util.langBoolean", "java.lang.Boolean"); addTranslation("com.threerings.util.langBoolean", "java.lang.Boolean");
addTranslation("com.threerings.util.Byte", "java.lang.Byte"); addTranslation("com.threerings.util.Byte", "java.lang.Byte");
addTranslation("com.threerings.util.Integer", "java.lang.Integer"); addTranslation("com.threerings.util.Integer", "java.lang.Integer");
addTranslation("com.threerings.util.Long", "java.lang.Long");
addTranslation("com.threerings.util.Float", "java.lang.Float"); addTranslation("com.threerings.util.Float", "java.lang.Float");
} }
} }