diff --git a/src/java/com/samskivert/swing/RadialMenu.java b/src/java/com/samskivert/swing/RadialMenu.java index 86ac49ee..2e18029f 100644 --- a/src/java/com/samskivert/swing/RadialMenu.java +++ b/src/java/com/samskivert/swing/RadialMenu.java @@ -196,7 +196,7 @@ public class RadialMenu { int icount = _items.size(); for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)_items.get(i); + RadialMenuItem item = _items.get(i); if (item.command.equals(command)) { _items.remove(i); return true; @@ -357,7 +357,7 @@ public class RadialMenu // render each of our items in turn int icount = _items.size(); for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)_items.get(i); + RadialMenuItem item = _items.get(i); if (!item.isIncluded(this)) { continue; } @@ -412,7 +412,7 @@ public class RadialMenu int icount = _items.size(); for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)_items.get(i); + RadialMenuItem item = _items.get(i); if (item.isIncluded(this) && item.closedBounds.contains(x, y)) { _activeItem = item; @@ -514,7 +514,7 @@ public class RadialMenu int icount = _items.size(); ArrayList items = new ArrayList(); for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)_items.get(i); + RadialMenuItem item = _items.get(i); if (item.isIncluded(this)) { items.add(item); } @@ -524,7 +524,7 @@ public class RadialMenu int maxwid = 0, maxhei = 0; icount = items.size(); for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)items.get(i); + RadialMenuItem item = items.get(i); item.layout(gfx, font); // track maximum menu item size @@ -552,7 +552,7 @@ public class RadialMenu // now position each item accordingly double angle = -Math.PI/2; for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)items.get(i); + RadialMenuItem item = items.get(i); int ix = (int)(radius * Math.cos(angle)); int iy = (int)(radius * Math.sin(angle)); item.openBounds.x = item.closedBounds.x = ix - maxwid/2; @@ -581,7 +581,7 @@ public class RadialMenu // include the bounds for all menu items for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)items.get(i); + RadialMenuItem item = items.get(i); // we need the open bounds rather than the closed ones _bounds.add(item.openBounds); } @@ -593,7 +593,7 @@ public class RadialMenu _centerLabel.closedBounds.translate(-_bounds.x, -_bounds.y); } for (int i = 0; i < icount; i++) { - RadialMenuItem item = (RadialMenuItem)items.get(i); + RadialMenuItem item = items.get(i); item.openBounds.translate(-_bounds.x, -_bounds.y); item.closedBounds.translate(-_bounds.x, -_bounds.y); } diff --git a/src/java/com/samskivert/swing/ScaledIcon.java b/src/java/com/samskivert/swing/ScaledIcon.java index b6201c18..a31e1516 100644 --- a/src/java/com/samskivert/swing/ScaledIcon.java +++ b/src/java/com/samskivert/swing/ScaledIcon.java @@ -64,13 +64,13 @@ public class ScaledIcon implements Icon // documentation inherited from interface Icon public int getIconWidth () { - return (int) Math.round(_icon.getIconWidth() * _scale); + return Math.round(_icon.getIconWidth() * _scale); } // documentation inherited from interface Icon public int getIconHeight () { - return (int) Math.round(_icon.getIconHeight() * _scale); + return Math.round(_icon.getIconHeight() * _scale); } // documentation inherited from interface Icon diff --git a/src/java/com/samskivert/swing/ScrollBox.java b/src/java/com/samskivert/swing/ScrollBox.java index 209e5571..08a13a44 100644 --- a/src/java/com/samskivert/swing/ScrollBox.java +++ b/src/java/com/samskivert/swing/ScrollBox.java @@ -141,13 +141,10 @@ public class ScrollBox extends JPanel _hFactor = (_active.width) / (float) (_horz.getMaximum() - hmin); _vFactor = (_active.height) / (float) (_vert.getMaximum() - vmin); - _box.x = _active.x + (int) Math.round((_horz.getValue() - hmin) * - _hFactor); - _box.width = (int) Math.round(_horz.getExtent() * _hFactor); - - _box.y = _active.y + (int) Math.round((_vert.getValue() - vmin) * - _vFactor); - _box.height = (int) Math.round(_vert.getExtent() * _vFactor); + _box.x = _active.x + Math.round((_horz.getValue() - hmin) * _hFactor); + _box.width = Math.round(_horz.getExtent() * _hFactor); + _box.y = _active.y + Math.round((_vert.getValue() - vmin) * _vFactor); + _box.height = Math.round(_vert.getExtent() * _vFactor); } /** @@ -194,10 +191,8 @@ public class ScrollBox extends JPanel { if (_lastPoint != null) { Point p = e.getPoint(); - _horz.setValue(_horz.getValue() + - (int) Math.round((p.x - _lastPoint.x) / _hFactor)); - _vert.setValue(_vert.getValue() + - (int) Math.round((p.y - _lastPoint.y) / _vFactor)); + _horz.setValue(_horz.getValue() + Math.round((p.x - _lastPoint.x) / _hFactor)); + _vert.setValue(_vert.getValue() + Math.round((p.y - _lastPoint.y) / _vFactor)); _lastPoint = p; } } diff --git a/src/java/com/samskivert/util/ArrayIntSet.java b/src/java/com/samskivert/util/ArrayIntSet.java index 43ee1cc3..100b05f6 100644 --- a/src/java/com/samskivert/util/ArrayIntSet.java +++ b/src/java/com/samskivert/util/ArrayIntSet.java @@ -399,7 +399,7 @@ public class ArrayIntSet extends AbstractSet { try { ArrayIntSet nset = (ArrayIntSet)super.clone(); - nset._values = (int[]) _values.clone(); + nset._values = _values.clone(); return nset; } catch (CloneNotSupportedException cnse) { diff --git a/src/java/com/samskivert/util/ConfigUtil.java b/src/java/com/samskivert/util/ConfigUtil.java index 2165b422..e343007e 100644 --- a/src/java/com/samskivert/util/ConfigUtil.java +++ b/src/java/com/samskivert/util/ConfigUtil.java @@ -331,13 +331,13 @@ public class ConfigUtil if (rsrcs.size() == 1) { // parse the metadata for our only properties file - root = parseMetaData(path, (URL)rsrcs.get(0)); + root = parseMetaData(path, rsrcs.get(0)); } else { map = new HashMap(); for (int ii = 0; ii < rsrcs.size(); ii++) { // parse the metadata for this properties file - PropRecord record = parseMetaData(path, (URL)rsrcs.get(ii)); + PropRecord record = parseMetaData(path, rsrcs.get(ii)); // make sure the record we parseded is valid because we're // going to be doing overrides diff --git a/src/java/com/samskivert/util/LoggingLogProvider.java b/src/java/com/samskivert/util/LoggingLogProvider.java index c1ef78b4..0e395ba6 100644 --- a/src/java/com/samskivert/util/LoggingLogProvider.java +++ b/src/java/com/samskivert/util/LoggingLogProvider.java @@ -71,7 +71,7 @@ public class LoggingLogProvider protected final Logger getLogger (String moduleName) { - Logger logger = Logger.global; + Logger logger = Logger.getLogger("global"); if (!StringUtil.isBlank(moduleName)) { logger = _loggers.get(moduleName); if (logger == null) { diff --git a/src/java/com/samskivert/util/MethodFinder.java b/src/java/com/samskivert/util/MethodFinder.java index 5fae7fbd..b43bfb14 100644 --- a/src/java/com/samskivert/util/MethodFinder.java +++ b/src/java/com/samskivert/util/MethodFinder.java @@ -179,7 +179,7 @@ public class MethodFinder "No member in " + _clazz.getName() + " matching given args"); } if (matchingMembers.size() == 1) { - return (Member)matchingMembers.get(0); + return matchingMembers.get(0); } return findMostSpecificMemberIn(matchingMembers); @@ -240,7 +240,7 @@ public class MethodFinder "Ambiguous request for member in " + _clazz.getName() + " matching given args" ); } - return (Member)mostSpecificMembers.get(0); + return mostSpecificMembers.get(0); } @Override // from Object diff --git a/src/java/com/samskivert/util/ShortestPath.java b/src/java/com/samskivert/util/ShortestPath.java index e2d97401..316455b0 100644 --- a/src/java/com/samskivert/util/ShortestPath.java +++ b/src/java/com/samskivert/util/ShortestPath.java @@ -87,7 +87,7 @@ public class ShortestPath // now execute the main part of the search while (uptight.size() > 0) { // remove the cheapest known node - NodeInfo info = (NodeInfo)uptight.remove(uptight.size()-1); + NodeInfo info = uptight.remove(uptight.size()-1); // make a note that it is now relaxed relaxed.add(info.node); // relax its uptight neighbors @@ -101,7 +101,7 @@ public class ShortestPath // if the path through this node to its neighbor is // cheaper than the existing known shortest path, update // the neighbor to reflect this new shorter path - NodeInfo oinfo = (NodeInfo)nodes.get(onode); + NodeInfo oinfo = nodes.get(onode); int weight = graph.computeWeight(edge, info.node); if (oinfo.weightTo > info.weightTo + weight) { oinfo.weightTo = info.weightTo + weight; diff --git a/src/java/com/samskivert/util/StringUtil.java b/src/java/com/samskivert/util/StringUtil.java index 91a04e31..ece1a4d2 100644 --- a/src/java/com/samskivert/util/StringUtil.java +++ b/src/java/com/samskivert/util/StringUtil.java @@ -1268,7 +1268,7 @@ public class StringUtil int code = 0; for (int ii = 0, uu = 0; ii < value.length(); ii++) { char c = Character.toLowerCase(value.charAt(ii)); - Integer cc = (Integer)_letterToBits.get(c); + Integer cc = _letterToBits.get(c); if (cc == null) { continue; } diff --git a/src/java/com/samskivert/util/tests/ArrayUtilTest.java b/src/java/com/samskivert/util/tests/ArrayUtilTest.java index be3cc141..af7edbbd 100644 --- a/src/java/com/samskivert/util/tests/ArrayUtilTest.java +++ b/src/java/com/samskivert/util/tests/ArrayUtilTest.java @@ -41,120 +41,120 @@ public class ArrayUtilTest extends TestCase { // test reversing an array int[] values = new int[] { 0 }; - int[] work = (int[])values.clone(); + int[] work = values.clone(); ArrayUtil.reverse(work); Log.info("reverse: " + StringUtil.toString(work)); values = new int[] { 0, 1, 2 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.reverse(work); Log.info("reverse: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.reverse(work, 0, 2); Log.info("reverse first-half: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.reverse(work, 1, 2); Log.info("reverse second-half: " + StringUtil.toString(work)); values = new int[] { 0, 1, 2, 3, 4 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.reverse(work, 1, 3); Log.info("reverse middle: " + StringUtil.toString(work)); values = new int[] { 0, 1, 2, 3 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.reverse(work); Log.info("reverse even: " + StringUtil.toString(work)); // test shuffling two elements values = new int[] { 0, 1 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 0, 1); Log.info("first-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 1, 1); Log.info("second-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work); Log.info("full shuffle: " + StringUtil.toString(work)); // test shuffling three elements values = new int[] { 0, 1, 2 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 0, 2); Log.info("first-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 1, 2); Log.info("second-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work); Log.info("full shuffle: " + StringUtil.toString(work)); // test shuffling ten elements values = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 }; - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 0, 5); Log.info("first-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work, 5, 5); Log.info("second-half shuffle: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); ArrayUtil.shuffle(work); Log.info("full shuffle: " + StringUtil.toString(work)); // test splicing with simple truncate beyond offset values = new int[] { 0, 1, 2 }; - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 0); Log.info("splice truncate 0: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 1); Log.info("splice truncate 1: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 2); Log.info("splice truncate 2: " + StringUtil.toString(work)); values = new int[] { 0 }; - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 0); Log.info("single element splice truncate 0: " + StringUtil.toString(work)); // test splicing out a single element values = new int[] { 0, 1, 2 }; - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 0, 1); Log.info("splice concat 0, 1: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 1, 1); Log.info("splice concat 1, 1: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 2, 1); Log.info("splice concat 2, 1: " + StringUtil.toString(work)); // test splicing out two elements values = new int[] { 0, 1, 2, 3 }; - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 0, 2); Log.info("splice concat 0, 2: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 1, 2); Log.info("splice concat 1, 2: " + StringUtil.toString(work)); - work = (int[])values.clone(); + work = values.clone(); work = ArrayUtil.splice(work, 2, 2); Log.info("splice concat 2, 2: " + StringUtil.toString(work)); }