Let's name inner classes with an "_" where Java puts a "$", and do
automatic name translation for those names. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4129 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -55,7 +55,7 @@ public class LocationMarshaller extends InvocationMarshaller
|
||||
// documentation inherited from interface
|
||||
public function moveTo (arg1 :Client, arg2 :int, arg3 :MoveListener) :void
|
||||
{
|
||||
var listener3 :MoveMarshaller = new MoveMarshaller();
|
||||
var listener3 :LocationMarshaller_MoveMarshaller = new LocationMarshaller_MoveMarshaller();
|
||||
listener3.listener = arg3;
|
||||
sendRequest(arg1, MOVE_TO, [ new Integer(arg2), listener3 ]);
|
||||
}
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.threerings.presents.data.ListenerMarshaller;
|
||||
|
||||
import com.threerings.crowd.client.MoveListener
|
||||
|
||||
public class MoveMarshaller extends ListenerMarshaller
|
||||
public class LocationMarshaller_MoveMarshaller extends ListenerMarshaller
|
||||
{
|
||||
/** The method id used to dispatch {@link #moveSucceeded}
|
||||
* responses. */
|
||||
@@ -24,7 +24,7 @@ package com.threerings.crowd.data {
|
||||
import com.threerings.util.Integer;
|
||||
import com.threerings.util.Name;
|
||||
|
||||
import com.threerings.presents.dobj.DSetEntry;
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
import com.threerings.crowd.data.BodyObject;
|
||||
|
||||
@@ -48,7 +48,7 @@ import com.threerings.io.ObjectOutputStream;
|
||||
* is requested.
|
||||
*/
|
||||
public class OccupantInfo
|
||||
implements DSetEntry
|
||||
implements DSet_Entry
|
||||
{
|
||||
/** Constant value for {@link #status}. */
|
||||
public static const ACTIVE :int = 0;
|
||||
@@ -77,7 +77,7 @@ public class OccupantInfo
|
||||
return bodyOid.value;
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSetEntry
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return bodyOid;
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.DSetEntry;
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
import com.threerings.presents.dobj.OidList;
|
||||
|
||||
import com.threerings.crowd.Log;
|
||||
@@ -121,7 +121,7 @@ public class PlaceObject extends DObject
|
||||
* <code>occupantInfo</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public function addToOccupantInfo (elem :DSetEntry) :void
|
||||
public function addToOccupantInfo (elem :DSet_Entry) :void
|
||||
{
|
||||
requestEntryAdd(OCCUPANT_INFO, elem);
|
||||
}
|
||||
@@ -141,7 +141,7 @@ public class PlaceObject extends DObject
|
||||
* <code>occupantInfo</code> set. The set will not change until the event is
|
||||
* actually propagated through the system.
|
||||
*/
|
||||
public function updateOccupantInfo (elem :DSetEntry) :void
|
||||
public function updateOccupantInfo (elem :DSet_Entry) :void
|
||||
{
|
||||
requestEntryUpdate(OCCUPANT_INFO, elem);
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ public class Translations
|
||||
public static function getToServer (asName :String) :String
|
||||
{
|
||||
var javaName :String = (_toServer.get(asName) as String);
|
||||
return (javaName == null) ? asName : javaName;
|
||||
return (javaName == null) ? asName.replace("_", "$") : javaName;
|
||||
}
|
||||
|
||||
public static function getFromServer (javaName :String) :String
|
||||
{
|
||||
var asName :String = (_fromServer.get(javaName) as String);
|
||||
return (asName == null) ? javaName : asName;
|
||||
return (asName == null) ? javaName.replace("$", "_") : asName;
|
||||
}
|
||||
|
||||
public static function addTranslation (
|
||||
|
||||
@@ -51,21 +51,9 @@ public class Communicator
|
||||
inputFrameReceived);
|
||||
_inStream = new ObjectInputStream();
|
||||
|
||||
addClassTranslations();
|
||||
|
||||
_socket.connect(_client.getHostname(), _client.getPort());
|
||||
}
|
||||
|
||||
private function addClassTranslations () :void
|
||||
{
|
||||
Translations.addTranslation(
|
||||
"com.threerings.presents.dobj.DSetEntry",
|
||||
"com.threerings.presents.dobj.DSet$Entry");
|
||||
Translations.addTranslation(
|
||||
"com.threerings.crowd.data.MoveMarshaller",
|
||||
"com.threerings.crowd.data.LocationMarshaller$MoveMarshaller");
|
||||
}
|
||||
|
||||
public function logoff () :void
|
||||
{
|
||||
if (_socket == null) {
|
||||
|
||||
@@ -6,7 +6,7 @@ import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
import com.threerings.presents.dobj.DSet;
|
||||
import com.threerings.presents.dobj.DSetEntry;
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
/**
|
||||
* Used to maintain a registry of invocation receivers that can be
|
||||
@@ -14,7 +14,7 @@ import com.threerings.presents.dobj.DSetEntry;
|
||||
* numbers.
|
||||
*/
|
||||
public class InvocationRegistration
|
||||
implements DSetEntry
|
||||
implements DSet_Entry
|
||||
{
|
||||
/** The unique hash code associated with this invocation receiver class. */
|
||||
public var receiverCode :String;
|
||||
@@ -31,7 +31,7 @@ public class InvocationRegistration
|
||||
this.receiverId = receiverId;
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSetEntry
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return receiverCode;
|
||||
|
||||
@@ -71,7 +71,7 @@ public class ClientObject extends DObject
|
||||
}
|
||||
|
||||
// AUTO-GENERATED: METHODS START
|
||||
public function addToReceivers (elem :DSetEntry) :void
|
||||
public function addToReceivers (elem :DSet_Entry) :void
|
||||
{
|
||||
requestEntryAdd(RECEIVERS, elem);
|
||||
}
|
||||
@@ -81,7 +81,7 @@ public class ClientObject extends DObject
|
||||
requestEntryRemove(RECEIVERS, key);
|
||||
}
|
||||
|
||||
public function updateReceivers (elem :DSetEntry) :void
|
||||
public function updateReceivers (elem :DSet_Entry) :void
|
||||
{
|
||||
requestEntryUpdate(RECEIVERS, elem);
|
||||
}
|
||||
|
||||
@@ -98,17 +98,17 @@ public /* abstract */ class DEvent
|
||||
/** The oid of the object that is the target of this event. */
|
||||
protected var _toid :int;
|
||||
|
||||
protected static const UNSET_OLD_ENTRY :DSetEntry = new DummyEntry();
|
||||
protected static const UNSET_OLD_ENTRY :DSet_Entry = new DummyEntry();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
import com.threerings.presents.dobj.DSetEntry;
|
||||
import com.threerings.presents.dobj.DSet_Entry;
|
||||
|
||||
import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
class DummyEntry implements DSetEntry
|
||||
class DummyEntry implements DSet_Entry
|
||||
{
|
||||
public function DummyEntry ()
|
||||
{
|
||||
|
||||
@@ -240,7 +240,7 @@ public class DObject // extends EventDispatcher
|
||||
/**
|
||||
* Calls by derived instances when a set adder method was called.
|
||||
*/
|
||||
protected function requestEntryAdd (name :String, entry :DSetEntry) :void
|
||||
protected function requestEntryAdd (name :String, entry :DSet_Entry) :void
|
||||
{
|
||||
// dispatch an entry added event
|
||||
postEvent(new EntryAddedEvent(_oid, name, entry));
|
||||
@@ -258,7 +258,7 @@ public class DObject // extends EventDispatcher
|
||||
/**
|
||||
* Calls by derived instances when a set updater method was called.
|
||||
*/
|
||||
protected function requestEntryUpdate (name :String, entry :DSetEntry) :void
|
||||
protected function requestEntryUpdate (name :String, entry :DSet_Entry) :void
|
||||
{
|
||||
// dispatch an entry updated event
|
||||
postEvent(new EntryUpdatedEvent(_oid, name, entry, null));
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DSet
|
||||
* <code>equals()</code> the key returned by <code>getKey()</code> of
|
||||
* the supplied entry. Returns false otherwise.
|
||||
*/
|
||||
public function contains (elem :DSetEntry) :Boolean
|
||||
public function contains (elem :DSet_Entry) :Boolean
|
||||
{
|
||||
return containsKey(elem.getKey());
|
||||
}
|
||||
@@ -68,10 +68,10 @@ public class DSet
|
||||
* the specified key or null if no entry could be found that matches
|
||||
* the key.
|
||||
*/
|
||||
public function get (key :Object) :DSetEntry
|
||||
public function get (key :Object) :DSet_Entry
|
||||
{
|
||||
// o(n) for now
|
||||
for each (var entry :DSetEntry in _entries) {
|
||||
for each (var entry :DSet_Entry in _entries) {
|
||||
if (isSameKey(key, entry.getKey())) {
|
||||
return entry;
|
||||
}
|
||||
@@ -112,7 +112,7 @@ public class DSet
|
||||
* @return true if the entry was added, false if it was already in
|
||||
* the set.
|
||||
*/
|
||||
internal function add (elem :DSetEntry) :Boolean
|
||||
internal function add (elem :DSet_Entry) :Boolean
|
||||
{
|
||||
if (_entries.length == 0) {
|
||||
// there is nothing in the map yet, check the key validity
|
||||
@@ -140,7 +140,7 @@ public class DSet
|
||||
* @return true if the entry was removed, false if it was not in the
|
||||
* set.
|
||||
*/
|
||||
internal function remove (elem :DSetEntry) :Boolean
|
||||
internal function remove (elem :DSet_Entry) :Boolean
|
||||
{
|
||||
return (null != removeKey(elem.getKey()));
|
||||
}
|
||||
@@ -154,11 +154,11 @@ public class DSet
|
||||
* @return the old matching entry if found and removed, null if not
|
||||
* found.
|
||||
*/
|
||||
internal function removeKey (key :Object) :DSetEntry
|
||||
internal function removeKey (key :Object) :DSet_Entry
|
||||
{
|
||||
// o(n) for now
|
||||
for (var ii :int = 0; ii < _entries.length; ii++) {
|
||||
var entry :DSetEntry = _entries[ii];
|
||||
var entry :DSet_Entry = _entries[ii];
|
||||
if (isSameKey(key, entry.getKey())) {
|
||||
_entries.splice(ii, 1);
|
||||
return entry;
|
||||
@@ -177,11 +177,11 @@ public class DSet
|
||||
* @return the old entry that was replaced, or null if it was not
|
||||
* found (in which case nothing is updated).
|
||||
*/
|
||||
internal function update (elem :DSetEntry) :DSetEntry
|
||||
internal function update (elem :DSet_Entry) :DSet_Entry
|
||||
{
|
||||
var key :Object = elem.getKey();
|
||||
for (var ii :int = 0; ii < _entries.length; ii++) {
|
||||
var entry :DSetEntry = _entries[ii];
|
||||
var entry :DSet_Entry = _entries[ii];
|
||||
if (isSameKey(key, entry.getKey())) {
|
||||
_entries[ii] = elem;
|
||||
return entry; // return the old entry
|
||||
|
||||
+1
-1
@@ -4,7 +4,7 @@ import com.threerings.util.Equalable;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
|
||||
public interface DSetEntry extends Streamable
|
||||
public interface DSet_Entry extends Streamable
|
||||
{
|
||||
/**
|
||||
* Get the key used to identify this object. On the java side of things,
|
||||
@@ -4,13 +4,13 @@ import com.threerings.io.ObjectInputStream;
|
||||
import com.threerings.io.ObjectOutputStream;
|
||||
|
||||
public class DummyEntry
|
||||
implements DSetEntry
|
||||
implements DSet_Entry
|
||||
{
|
||||
public function DummyEntry ()
|
||||
{
|
||||
}
|
||||
|
||||
// documentation inherited from interface DSetEntry
|
||||
// documentation inherited from interface DSet_Entry
|
||||
public function getKey () :Object
|
||||
{
|
||||
return null; // dummy
|
||||
|
||||
@@ -27,7 +27,7 @@ public class EntryAddedEvent extends NamedEvent
|
||||
* @param entry the entry to add to the set attribute.
|
||||
*/
|
||||
public function EntryAddedEvent (
|
||||
targetOid :int = 0, name :String = null, entry :DSetEntry = null)
|
||||
targetOid :int = 0, name :String = null, entry :DSet_Entry = null)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_entry = entry;
|
||||
@@ -36,7 +36,7 @@ public class EntryAddedEvent extends NamedEvent
|
||||
/**
|
||||
* Returns the entry that has been added.
|
||||
*/
|
||||
public function getEntry () :DSetEntry
|
||||
public function getEntry () :DSet_Entry
|
||||
{
|
||||
return _entry;
|
||||
}
|
||||
@@ -79,9 +79,9 @@ public class EntryAddedEvent extends NamedEvent
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_entry = (ins.readObject() as DSetEntry);
|
||||
_entry = (ins.readObject() as DSet_Entry);
|
||||
}
|
||||
|
||||
protected var _entry :DSetEntry;
|
||||
protected var _entry :DSet_Entry;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
*/
|
||||
public function EntryRemovedEvent (
|
||||
targetOid :int = 0, name :String = null, key :Object = null,
|
||||
oldEntry :DSetEntry = null)
|
||||
oldEntry :DSet_Entry = null)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_key = key;
|
||||
@@ -50,7 +50,7 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
/**
|
||||
* Returns the entry that was in the set prior to being updated.
|
||||
*/
|
||||
public function getOldEntry () :DSetEntry
|
||||
public function getOldEntry () :DSet_Entry
|
||||
{
|
||||
return _oldEntry;
|
||||
}
|
||||
@@ -104,6 +104,6 @@ public class EntryRemovedEvent extends NamedEvent
|
||||
}
|
||||
|
||||
protected var _key :Object;
|
||||
protected var _oldEntry :DSetEntry = UNSET_OLD_ENTRY;
|
||||
protected var _oldEntry :DSet_Entry = UNSET_OLD_ENTRY;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,8 @@ public class EntryUpdatedEvent extends NamedEvent
|
||||
* @param oldEntry the previous value of the entry.
|
||||
*/
|
||||
public function EntryUpdatedEvent (
|
||||
targetOid :int = 0, name :String = null, entry :DSetEntry = null,
|
||||
oldEntry :DSetEntry = null)
|
||||
targetOid :int = 0, name :String = null, entry :DSet_Entry = null,
|
||||
oldEntry :DSet_Entry = null)
|
||||
{
|
||||
super(targetOid, name);
|
||||
_entry = entry;
|
||||
@@ -41,7 +41,7 @@ public class EntryUpdatedEvent extends NamedEvent
|
||||
/**
|
||||
* Returns the entry that has been updated.
|
||||
*/
|
||||
public function getEntry () :DSetEntry
|
||||
public function getEntry () :DSet_Entry
|
||||
{
|
||||
return _entry;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ public class EntryUpdatedEvent extends NamedEvent
|
||||
/**
|
||||
* Returns the entry that was in the set prior to being updated.
|
||||
*/
|
||||
public function getOldEntry ():DSetEntry
|
||||
public function getOldEntry ():DSet_Entry
|
||||
{
|
||||
return _oldEntry;
|
||||
}
|
||||
@@ -100,10 +100,10 @@ public class EntryUpdatedEvent extends NamedEvent
|
||||
public override function readObject (ins :ObjectInputStream) :void
|
||||
{
|
||||
super.readObject(ins);
|
||||
_entry = (ins.readObject() as DSetEntry);
|
||||
_entry = (ins.readObject() as DSet_Entry);
|
||||
}
|
||||
|
||||
protected var _entry :DSetEntry;
|
||||
protected var _oldEntry :DSetEntry = UNSET_OLD_ENTRY;
|
||||
protected var _entry :DSet_Entry;
|
||||
protected var _oldEntry :DSet_Entry = UNSET_OLD_ENTRY;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user