diff options
author | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-02-17 17:03:05 +0000 |
---|---|---|
committer | Andrew John Hughes <gnu_andrew@member.fsf.org> | 2008-02-17 17:03:05 +0000 |
commit | c0e05bb21392173b88075b70e2e4bcc9a62908d1 (patch) | |
tree | ff5fe3105fe55c7092f4b12d340d42df2fb28dee /javax | |
parent | 2ce57bbca567e5f64bb2f891204ce659320f7625 (diff) | |
download | classpath-c0e05bb21392173b88075b70e2e4bcc9a62908d1.tar.gz |
2008-02-17 Andrew John Hughes <gnu_andrew@member.fsf.org>
* javax/swing/tree/FixedHeightLayoutCache.java,
* javax/swing/tree/VariableHeightLayoutCache.java,
* javax/swing/undo/StateEdit.java:
Use type parameters with collections classes.
Diffstat (limited to 'javax')
-rw-r--r-- | javax/swing/tree/FixedHeightLayoutCache.java | 30 | ||||
-rw-r--r-- | javax/swing/tree/VariableHeightLayoutCache.java | 30 | ||||
-rw-r--r-- | javax/swing/undo/StateEdit.java | 4 |
3 files changed, 32 insertions, 32 deletions
diff --git a/javax/swing/tree/FixedHeightLayoutCache.java b/javax/swing/tree/FixedHeightLayoutCache.java index dff9298e8..488809e02 100644 --- a/javax/swing/tree/FixedHeightLayoutCache.java +++ b/javax/swing/tree/FixedHeightLayoutCache.java @@ -135,7 +135,7 @@ public class FixedHeightLayoutCache } } - LinkedList lpath = new LinkedList(); + LinkedList<Object> lpath = new LinkedList<Object>(); NodeRecord rp = this; while (rp != null) { @@ -173,17 +173,17 @@ public class FixedHeightLayoutCache /** * The set of all expanded tree nodes. */ - Set expanded = new HashSet(); + Set<Object> expanded = new HashSet<Object>(); /** * Maps nodes to the row numbers. */ - Hashtable nodes = new Hashtable(); + Hashtable<Object,NodeRecord> nodes = new Hashtable<Object,NodeRecord>(); /** * Maps row numbers to nodes. */ - Hashtable row2node = new Hashtable(); + Hashtable<Integer,Object> row2node = new Hashtable<Integer,Object>(); /** * If true, the row map must be recomputed before using. @@ -338,7 +338,7 @@ public class FixedHeightLayoutCache if (dirty) update(); Object last = path.getLastPathComponent(); - NodeRecord r = (NodeRecord) nodes.get(last); + NodeRecord r = nodes.get(last); if (r == null) // This node is not visible. { @@ -373,7 +373,7 @@ public class FixedHeightLayoutCache return null; else { - NodeRecord r = (NodeRecord) nodes.get(last); + NodeRecord r = nodes.get(last); return r.getPath(); } } @@ -391,7 +391,7 @@ public class FixedHeightLayoutCache if (dirty) update(); - NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent()); + NodeRecord r = nodes.get(path.getLastPathComponent()); if (r == null) return - 1; else @@ -413,13 +413,13 @@ public class FixedHeightLayoutCache // As the rows have arbitrary height, we need to iterate. NodeRecord best = null; NodeRecord r; - Enumeration en = nodes.elements(); + Enumeration<NodeRecord> en = nodes.elements(); int dist = Integer.MAX_VALUE; while (en.hasMoreElements() && dist > 0) { - r = (NodeRecord) en.nextElement(); + r = en.nextElement(); if (best == null) { best = r; @@ -474,7 +474,7 @@ public class FixedHeightLayoutCache } /** - * Get the enumeration over all visible pathes that start from the given + * Get the enumeration over all visible paths that start from the given * parent path. * * @param parentPath the parent path @@ -491,7 +491,7 @@ public class FixedHeightLayoutCache for (int i = 0; i < parentPath.getPathCount(); i++) { node = parentPath.getPathComponent(i); - nr = (NodeRecord) nodes.get(node); + nr = nodes.get(node); if (nr.row >= 0) p.add(node); } @@ -583,10 +583,10 @@ public class FixedHeightLayoutCache if (dirty) update(); totalHeight = 0; - Enumeration en = nodes.elements(); + Enumeration<NodeRecord> en = nodes.elements(); while (en.hasMoreElements()) { - NodeRecord nr = (NodeRecord) en.nextElement(); + NodeRecord nr = en.nextElement(); Rectangle r = nr.getBounds(); totalHeight += r.height; } @@ -602,10 +602,10 @@ public class FixedHeightLayoutCache update(); maximalWidth = 0; - Enumeration en = nodes.elements(); + Enumeration<NodeRecord> en = nodes.elements(); while (en.hasMoreElements()) { - NodeRecord nr = (NodeRecord) en.nextElement(); + NodeRecord nr = en.nextElement(); Rectangle r = nr.getBounds(); if (r.x + r.width > maximalWidth) maximalWidth = r.x + r.width; diff --git a/javax/swing/tree/VariableHeightLayoutCache.java b/javax/swing/tree/VariableHeightLayoutCache.java index 8c70c13af..50e8e5ce9 100644 --- a/javax/swing/tree/VariableHeightLayoutCache.java +++ b/javax/swing/tree/VariableHeightLayoutCache.java @@ -138,7 +138,7 @@ public class VariableHeightLayoutCache } } - LinkedList lpath = new LinkedList(); + LinkedList<Object> lpath = new LinkedList<Object>(); NodeRecord rp = this; while (rp != null) { @@ -146,7 +146,7 @@ public class VariableHeightLayoutCache if (rp.parent != null) { Object parent = rp.parent; - rp = (NodeRecord) nodes.get(parent); + rp = nodes.get(parent); // Add the root node, even if it is not visible. if (rp == null) lpath.addFirst(parent); @@ -171,17 +171,17 @@ public class VariableHeightLayoutCache /** * The set of all expanded tree nodes. */ - Set expanded = new HashSet(); + Set<Object> expanded = new HashSet<Object>(); /** * Maps nodes to the row numbers. */ - Hashtable nodes = new Hashtable(); + Hashtable<Object,NodeRecord> nodes = new Hashtable<Object,NodeRecord>(); /** * Maps row numbers to nodes. */ - ArrayList row2node = new ArrayList(); + ArrayList<Object> row2node = new ArrayList<Object>(); /** * If true, the row map must be recomputed before using. @@ -292,7 +292,7 @@ public class VariableHeightLayoutCache */ public void invalidatePathBounds(TreePath path) { - NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent()); + NodeRecord r = nodes.get(path.getLastPathComponent()); if (r != null) r.bounds = null; } @@ -354,7 +354,7 @@ public class VariableHeightLayoutCache Object last = path.getLastPathComponent(); Rectangle result = null; - NodeRecord r = (NodeRecord) nodes.get(last); + NodeRecord r = nodes.get(last); if (r != null) { // The RI allows null arguments for rect, in which case a new Rectangle @@ -405,7 +405,7 @@ public class VariableHeightLayoutCache if (dirty) update(); - NodeRecord r = (NodeRecord) nodes.get(path.getLastPathComponent()); + NodeRecord r = nodes.get(path.getLastPathComponent()); if (r == null) return - 1; else @@ -427,13 +427,13 @@ public class VariableHeightLayoutCache // As the rows have arbitrary height, we need to iterate. NodeRecord best = null; NodeRecord r; - Enumeration en = nodes.elements(); + Enumeration<NodeRecord> en = nodes.elements(); int dist = Integer.MAX_VALUE; while (en.hasMoreElements() && dist > 0) { - r = (NodeRecord) en.nextElement(); + r = en.nextElement(); if (best == null) { best = r; @@ -488,7 +488,7 @@ public class VariableHeightLayoutCache } /** - * Get the enumeration over all visible pathes that start from the given + * Get the enumeration over all visible paths that start from the given * parent path. * * @param parentPath the parent path @@ -505,7 +505,7 @@ public class VariableHeightLayoutCache for (int i = 0; i < parentPath.getPathCount(); i++) { node = parentPath.getPathComponent(i); - nr = (NodeRecord) nodes.get(node); + nr = nodes.get(node); if (nr != null && nr.row >= 0) p.add(node); } @@ -603,7 +603,7 @@ public class VariableHeightLayoutCache int rowCount = getRowCount(); if (rowCount > 0) { - NodeRecord last = (NodeRecord) nodes.get(row2node.get(rowCount - 1)); + NodeRecord last = nodes.get(row2node.get(rowCount - 1)); height = last.bounds.y + last.bounds.height; } return height; @@ -618,10 +618,10 @@ public class VariableHeightLayoutCache update(); maximalWidth = 0; - Enumeration en = nodes.elements(); + Enumeration<NodeRecord> en = nodes.elements(); while (en.hasMoreElements()) { - NodeRecord nr = (NodeRecord) en.nextElement(); + NodeRecord nr = en.nextElement(); if (nr != null) { Rectangle r = nr.getBounds(); diff --git a/javax/swing/undo/StateEdit.java b/javax/swing/undo/StateEdit.java index 91fc88faa..55282ab37 100644 --- a/javax/swing/undo/StateEdit.java +++ b/javax/swing/undo/StateEdit.java @@ -177,8 +177,8 @@ public class StateEdit { object = obj; undoRedoName = name; - preState = new Hashtable(); - postState = new Hashtable(); + preState = new Hashtable<Object,Object>(); + postState = new Hashtable<Object,Object>(); obj.storeState(preState); } |