Implemented a Ray-proposed solution where we keep track of events that were

(pre-applied and) posted before we received our object but processed (and hence
dispatched to us) after we received our object.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4715 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2007-05-18 03:37:14 +00:00
parent db3fe80e9d
commit 9bcca099ac
10 changed files with 268 additions and 230 deletions
@@ -72,13 +72,17 @@ public class EntryRemovedEvent<T extends DSet.Entry> extends NamedEvent
return _oldEntry;
}
/**
* Applies this event to the object.
*/
@Override // from DEvent
public boolean alreadyApplied ()
{
return (_oldEntry != UNSET_OLD_ENTRY);
}
@Override // from DEvent
public boolean applyToObject (DObject target)
throws ObjectAccessException
{
if (_oldEntry == UNSET_OLD_ENTRY) {
if (!alreadyApplied()) {
DSet<T> set = target.getSet(_name);
// remove, fetch the previous value for interested callers
_oldEntry = set.removeKey(_key);