Added an applyToDelegates() that restricts its application to delegates
that derive from a particular class. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1359 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// $Id: PlaceController.java,v 1.8 2002/03/21 00:55:10 mdb Exp $
|
||||
// $Id: PlaceController.java,v 1.9 2002/05/13 23:03:24 mdb Exp $
|
||||
|
||||
package com.threerings.crowd.client;
|
||||
|
||||
@@ -180,6 +180,24 @@ public abstract class PlaceController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Applies the supplied operation to the registered delegates that
|
||||
* derive from the specified class.
|
||||
*/
|
||||
protected void applyToDelegates (Class dclass, DelegateOp op)
|
||||
{
|
||||
if (_delegates != null) {
|
||||
int dcount = _delegates.size();
|
||||
for (int i = 0; i < dcount; i++) {
|
||||
PlaceControllerDelegate delegate =
|
||||
(PlaceControllerDelegate)_delegates.get(i);
|
||||
if (dclass.isAssignableFrom(delegate.getClass())) {
|
||||
op.apply(delegate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** A reference to the active client context. */
|
||||
protected CrowdContext _ctx;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user