Cleaned up some redundant casts and deprecated calls.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2243 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -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<RadialMenuItem> items = new ArrayList<RadialMenuItem>();
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -399,7 +399,7 @@ public class ArrayIntSet extends AbstractSet<Integer>
|
||||
{
|
||||
try {
|
||||
ArrayIntSet nset = (ArrayIntSet)super.clone();
|
||||
nset._values = (int[]) _values.clone();
|
||||
nset._values = _values.clone();
|
||||
return nset;
|
||||
|
||||
} catch (CloneNotSupportedException cnse) {
|
||||
|
||||
@@ -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<String,PropRecord>();
|
||||
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
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user