More code hygiene. Need to do some fiddling to make dispatchers not generate

generics warnings when calling methods with generic types.


git-svn-id: svn+ssh://src.earth.threerings.net/vilya/trunk@698 c613c5cb-e716-0410-b11b-feb51c14d237
This commit is contained in:
Michael Bayne
2008-08-01 14:40:54 +00:00
parent 7708bc96a6
commit bb0d6c5ba4
62 changed files with 292 additions and 274 deletions
@@ -39,6 +39,7 @@ import com.threerings.crowd.chat.data.ChatCodes;
import com.threerings.crowd.client.LocationAdapter;
import com.threerings.crowd.client.LocationDirector;
import com.threerings.crowd.data.BodyObject;
import com.threerings.crowd.data.PlaceConfig;
import com.threerings.crowd.data.PlaceObject;
import com.threerings.whirled.client.SceneDirector;
@@ -58,7 +59,7 @@ import static com.threerings.whirled.spot.Log.log;
* Extends the standard scene director with facilities to move between locations within a scene.
*/
public class SpotSceneDirector extends BasicDirector
implements SpotCodes, Subscriber, AttributeChangeListener
implements SpotCodes, Subscriber<DObject>, AttributeChangeListener
{
/**
* Creates a new spot scene director with the specified context and which will cooperate with
@@ -121,7 +122,7 @@ public class SpotSceneDirector extends BasicDirector
* request will be made and when the response is received, the location observers will be
* notified of success or failure.
*/
public boolean traversePortal (int portalId, ResultListener rl)
public boolean traversePortal (int portalId, ResultListener<PlaceConfig> rl)
{
// look up the destination scene and location
SpotScene scene = (SpotScene)_scdir.getScene();
@@ -178,7 +179,7 @@ public class SpotSceneDirector extends BasicDirector
* anticipation of a successful location change (like by starting a sprite moving toward the
* new location), but backtrack if it finds out that the location change failed.
*/
public void changeLocation (Location loc, final ResultListener listener)
public void changeLocation (Location loc, final ResultListener<Location> listener)
{
// refuse if there's a pending location change or if we're already at the specified
// location
@@ -243,7 +244,7 @@ public class SpotSceneDirector extends BasicDirector
* user's cluster.
* @param listener will be notified of success or failure.
*/
public void joinCluster (int froid, final ResultListener listener)
public void joinCluster (int froid, final ResultListener<Void> listener)
{
SpotScene scene = (SpotScene)_scdir.getScene();
if (scene == null) {
@@ -41,7 +41,7 @@ public class Cluster extends Rectangle
public int clusterOid;
// documentation inherited
public Comparable getKey ()
public Comparable<?> getKey ()
{
if (_key == null) {
_key = Integer.valueOf(clusterOid);
@@ -55,7 +55,7 @@ public class SceneLocation extends SimpleStreamableObject
}
// documentation inherited
public Comparable getKey ()
public Comparable<?> getKey ()
{
if (_key == null) {
_key = Integer.valueOf(bodyOid);
@@ -43,7 +43,7 @@ public interface SpotScene
/**
* Returns an iterator over the portals in this scene.
*/
public Iterator getPortals ();
public Iterator<Portal> getPortals ();
/**
* Returns the portal id that should be assigned to the next portal
@@ -452,7 +452,7 @@ public class SpotSceneManager extends SceneManager
/**
* Used to manage clusters which are groups of users that can chat to one another.
*/
protected class ClusterRecord extends HashIntMap
protected class ClusterRecord extends HashIntMap<ClusteredBodyObject>
{
public ClusterRecord ()
{
@@ -460,9 +460,7 @@ public class SpotSceneManager extends SceneManager
_clusters.put(_clobj.getOid(), this);
// let any mapped users know about our cluster
Iterator iter = values().iterator();
while (iter.hasNext()) {
ClusteredBodyObject body = (ClusteredBodyObject)iter.next();
for (ClusteredBodyObject body : values()) {
body.setClusterOid(_clobj.getOid());
_clobj.addToOccupants(((BodyObject)body).getOid());
}
@@ -495,7 +493,7 @@ public class SpotSceneManager extends SceneManager
// make sure our intrepid joiner is not in any another cluster
removeFromCluster(body.getOid());
put(body.getOid(), body);
put(body.getOid(), (ClusteredBodyObject)body);
_ssobj.startTransaction();
try {
body.startTransaction();
@@ -110,9 +110,9 @@ public abstract class SpotSceneRuleSet implements NestableRuleSet
throws Exception
{
Portal portal = (Portal) digester.peek();
Class portalClass = portal.getClass();
Class<?> portalClass = portal.getClass();
Location loc = portal.loc;
Class locClass = loc.getClass();
Class<?> locClass = loc.getClass();
// iterate over the attributes, setting public fields where
// applicable
@@ -87,7 +87,7 @@ public class SpotSceneWriter
{
// we just add all the visible fields of the location, but something
// more sophisticated could be done
Class clazz = portalLoc.getClass();
Class<?> clazz = portalLoc.getClass();
Field[] fields = clazz.getFields();
for (int ii=0; ii < fields.length; ii++) {
try {