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