Nixed a bunch of redundant casts.
git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@304 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -61,7 +61,7 @@ public class FadeLabelAnimation extends FadeAnimation
|
||||
|
||||
// if our label is not yet laid out, do the deed
|
||||
if (!_label.isLaidOut()) {
|
||||
Graphics2D gfx = (Graphics2D)_mgr.createGraphics();
|
||||
Graphics2D gfx = _mgr.createGraphics();
|
||||
if (gfx != null) {
|
||||
gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
|
||||
_antiAliased ?
|
||||
|
||||
@@ -120,8 +120,7 @@ public class TileSetTrimmer
|
||||
// create the new tileset image
|
||||
BufferedImage image = null;
|
||||
try {
|
||||
image = ImageUtil.createCompatibleImage(
|
||||
(BufferedImage)source.getRawTileSetImage(), nextx, maxy);
|
||||
image = ImageUtil.createCompatibleImage(source.getRawTileSetImage(), nextx, maxy);
|
||||
|
||||
} catch (RasterFormatException rfe) {
|
||||
throw new IOException("Failed to create trimmed tileset image " +
|
||||
|
||||
@@ -157,7 +157,7 @@ public class AStarPathUtil
|
||||
while (info.open.size() > 0) {
|
||||
|
||||
// pop the best node so far from open
|
||||
Node n = (Node)info.open.first();
|
||||
Node n = info.open.first();
|
||||
info.open.remove(n);
|
||||
|
||||
// if node is a goal node
|
||||
|
||||
@@ -94,8 +94,7 @@ public class LineSegmentPath
|
||||
*/
|
||||
public int getFinalOrientation ()
|
||||
{
|
||||
return (_nodes.size() == 0) ? NORTH :
|
||||
((PathNode)_nodes.get(_nodes.size()-1)).dir;
|
||||
return (_nodes.size() == 0) ? NORTH : _nodes.get(_nodes.size()-1).dir;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -121,7 +120,7 @@ public class LineSegmentPath
|
||||
*/
|
||||
public PathNode getNode (int idx)
|
||||
{
|
||||
return (PathNode)_nodes.get(idx);
|
||||
return _nodes.get(idx);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -168,11 +167,10 @@ public class LineSegmentPath
|
||||
|
||||
// compute the total distance along our path
|
||||
float distance = 0;
|
||||
PathNode start = (PathNode)_nodes.get(0);
|
||||
PathNode start = _nodes.get(0);
|
||||
for (int ii = 1; ii < ncount; ii++) {
|
||||
PathNode end = (PathNode)_nodes.get(ii);
|
||||
distance += MathUtil.distance(
|
||||
start.loc.x, start.loc.y, end.loc.x, end.loc.y);
|
||||
PathNode end = _nodes.get(ii);
|
||||
distance += MathUtil.distance(start.loc.x, start.loc.y, end.loc.x, end.loc.y);
|
||||
start = end;
|
||||
}
|
||||
|
||||
@@ -192,7 +190,7 @@ public class LineSegmentPath
|
||||
// move the pathable to the location specified by the first
|
||||
// node (assuming we have a first node)
|
||||
if (size() == 1) {
|
||||
PathNode node = (PathNode)_nodes.get(0);
|
||||
PathNode node = _nodes.get(0);
|
||||
pable.setLocation(node.loc.x, node.loc.y);
|
||||
}
|
||||
// and let the pathable know that we're done
|
||||
@@ -313,7 +311,7 @@ public class LineSegmentPath
|
||||
Point prev = null;
|
||||
int size = size();
|
||||
for (int ii = 0; ii < size; ii++) {
|
||||
PathNode n = (PathNode)getNode(ii);
|
||||
PathNode n = getNode(ii);
|
||||
if (prev != null) {
|
||||
gfx.drawLine(prev.x, prev.y, n.loc.x, n.loc.y);
|
||||
}
|
||||
@@ -354,7 +352,7 @@ public class LineSegmentPath
|
||||
}
|
||||
|
||||
/** The nodes that make up the path. */
|
||||
protected ArrayList _nodes = new ArrayList();
|
||||
protected ArrayList<PathNode> _nodes = new ArrayList<PathNode>();
|
||||
|
||||
/** We use this when moving along this path. */
|
||||
protected Iterator _niter;
|
||||
|
||||
@@ -607,7 +607,7 @@ public class MisoScenePanel extends VirtualMediaPanel
|
||||
// there are any items in the array)
|
||||
int icount = _hitList.size();
|
||||
if (icount > 0) {
|
||||
DirtyItem item = (DirtyItem)_hitList.get(icount-1);
|
||||
DirtyItem item = _hitList.get(icount-1);
|
||||
hobject = item.obj;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ public class SceneBlock
|
||||
// resolve our objects
|
||||
ObjectSet set = new ObjectSet();
|
||||
model.getObjects(_bounds, set);
|
||||
ArrayList scobjs = new ArrayList();
|
||||
ArrayList<SceneObject> scobjs = new ArrayList<SceneObject>();
|
||||
now = System.currentTimeMillis();
|
||||
for (int ii = 0, ll = set.size(); ii < ll; ii++) {
|
||||
SceneObject scobj = new SceneObject(_panel, set.get(ii));
|
||||
@@ -163,8 +163,7 @@ public class SceneBlock
|
||||
", elapsed=" + elapsed + "].");
|
||||
}
|
||||
}
|
||||
_objects = (SceneObject[])scobjs.toArray(
|
||||
new SceneObject[scobjs.size()]);
|
||||
_objects = scobjs.toArray(new SceneObject[scobjs.size()]);
|
||||
|
||||
// resolve our default tileset
|
||||
int bsetid = model.getDefaultBaseTileSet();
|
||||
@@ -339,8 +338,7 @@ public class SceneBlock
|
||||
}
|
||||
}
|
||||
|
||||
_objects = (SceneObject[])
|
||||
ArrayUtil.append(_objects, new SceneObject(_panel, info));
|
||||
_objects = ArrayUtil.append(_objects, new SceneObject(_panel, info));
|
||||
|
||||
// clear out our neighbors array so that the subsequent update
|
||||
// causes us to recompute our coverage
|
||||
@@ -367,7 +365,7 @@ public class SceneBlock
|
||||
if (oidx == -1) {
|
||||
return false;
|
||||
}
|
||||
_objects = (SceneObject[])ArrayUtil.splice(_objects, oidx, 1);
|
||||
_objects = ArrayUtil.splice(_objects, oidx, 1);
|
||||
|
||||
// clear out our neighbors array so that the subsequent update
|
||||
// causes us to recompute our coverage
|
||||
|
||||
@@ -147,7 +147,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
|
||||
public boolean addObject (ObjectInfo info)
|
||||
{
|
||||
if (info.isInteresting()) {
|
||||
objectInfo = (ObjectInfo[])ArrayUtil.append(objectInfo, info);
|
||||
objectInfo = ArrayUtil.append(objectInfo, info);
|
||||
} else {
|
||||
objectTileIds = ArrayUtil.append(objectTileIds, info.tileId);
|
||||
objectXs = ArrayUtil.append(objectXs, (short)info.x);
|
||||
@@ -170,7 +170,7 @@ public class SimpleMisoSceneModel extends MisoSceneModel
|
||||
// look for it in the interesting info array
|
||||
int oidx = ListUtil.indexOf(objectInfo, info);
|
||||
if (oidx != -1) {
|
||||
objectInfo = (ObjectInfo[])ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
objectInfo = ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -190,11 +190,11 @@ public class SimpleMisoSceneModel extends MisoSceneModel
|
||||
public Object clone ()
|
||||
{
|
||||
SimpleMisoSceneModel model = (SimpleMisoSceneModel)super.clone();
|
||||
model.baseTileIds = (int[])baseTileIds.clone();
|
||||
model.objectTileIds = (int[])objectTileIds.clone();
|
||||
model.objectXs = (short[])objectXs.clone();
|
||||
model.objectYs = (short[])objectYs.clone();
|
||||
model.objectInfo = (ObjectInfo[])objectInfo.clone();
|
||||
model.baseTileIds = baseTileIds.clone();
|
||||
model.objectTileIds = objectTileIds.clone();
|
||||
model.objectXs = objectXs.clone();
|
||||
model.objectYs = objectYs.clone();
|
||||
model.objectInfo = objectInfo.clone();
|
||||
return model;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
||||
}
|
||||
|
||||
if (info.isInteresting()) {
|
||||
objectInfo = (ObjectInfo[])ArrayUtil.append(objectInfo, info);
|
||||
objectInfo = ArrayUtil.append(objectInfo, info);
|
||||
} else {
|
||||
objectTileIds = ArrayUtil.append(objectTileIds, info.tileId);
|
||||
objectXs = ArrayUtil.append(objectXs, (short)info.x);
|
||||
@@ -144,8 +144,7 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
||||
// look for it in the interesting info array
|
||||
int oidx = ListUtil.indexOf(objectInfo, info);
|
||||
if (oidx != -1) {
|
||||
objectInfo = (ObjectInfo[])
|
||||
ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
objectInfo = ArrayUtil.splice(objectInfo, oidx, 1);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -216,11 +215,11 @@ public class SparseMisoSceneModel extends MisoSceneModel
|
||||
public Object clone () {
|
||||
try {
|
||||
Section section = (Section)super.clone();
|
||||
section.baseTileIds = (int[])baseTileIds.clone();
|
||||
section.objectTileIds = (int[])objectTileIds.clone();
|
||||
section.objectXs = (short[])objectXs.clone();
|
||||
section.objectYs = (short[])objectYs.clone();
|
||||
section.objectInfo = (ObjectInfo[])objectInfo.clone();
|
||||
section.baseTileIds = baseTileIds.clone();
|
||||
section.objectTileIds = objectTileIds.clone();
|
||||
section.objectXs = objectXs.clone();
|
||||
section.objectYs = objectYs.clone();
|
||||
section.objectInfo = objectInfo.clone();
|
||||
return section;
|
||||
} catch (CloneNotSupportedException cnse) {
|
||||
throw new RuntimeException(cnse);
|
||||
|
||||
@@ -183,7 +183,7 @@ public class KeyDispatcher
|
||||
case KeyEvent.KEY_RELEASED:
|
||||
if (lsize > 0) {
|
||||
for (int ii = 0; ii < lsize; ii++) {
|
||||
((KeyListener) _listeners.get(ii)).keyReleased(e);
|
||||
_listeners.get(ii).keyReleased(e);
|
||||
}
|
||||
// forget the key event
|
||||
_downKeys.remove(e.getKeyCode());
|
||||
@@ -195,19 +195,17 @@ public class KeyDispatcher
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the specified target component supports being typed
|
||||
* into, and thus we shouldn't steal focus away from it if the user
|
||||
* starts typing.
|
||||
* Returns true if the specified target component supports being typed into, and thus we
|
||||
* shouldn't steal focus away from it if the user starts typing.
|
||||
*/
|
||||
protected boolean isTypeableTarget (Component target)
|
||||
{
|
||||
return target.isShowing() &&
|
||||
(((target instanceof JTextComponent) &&
|
||||
((JTextComponent) target).isEditable()) ||
|
||||
(target instanceof JComboBox) ||
|
||||
(target instanceof ChatCantStealFocus) ||
|
||||
(target instanceof JTable) ||
|
||||
(target instanceof JRootPane));
|
||||
(((target instanceof JTextComponent) && ((JTextComponent) target).isEditable()) ||
|
||||
(target instanceof JComboBox) ||
|
||||
(target instanceof ChatCantStealFocus) ||
|
||||
(target instanceof JTable) ||
|
||||
(target instanceof JRootPane));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user