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:
@@ -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