diff --git a/pmd/src/net/sourceforge/pmd/util/viewer/model/ASTModel.java b/pmd/src/net/sourceforge/pmd/util/viewer/model/ASTModel.java index 55a8a1208c..cefdd89a54 100644 --- a/pmd/src/net/sourceforge/pmd/util/viewer/model/ASTModel.java +++ b/pmd/src/net/sourceforge/pmd/util/viewer/model/ASTModel.java @@ -1,13 +1,15 @@ package net.sourceforge.pmd.util.viewer.model; -import net.sourceforge.pmd.ast.SimpleNode; +import java.util.ArrayList; +import java.util.List; import javax.swing.event.TreeModelEvent; import javax.swing.event.TreeModelListener; import javax.swing.tree.TreeModel; import javax.swing.tree.TreePath; -import java.util.Vector; + +import net.sourceforge.pmd.ast.SimpleNode; /** @@ -17,10 +19,10 @@ import java.util.Vector; * @version $Id$ */ -public class ASTModel - implements TreeModel { +public class ASTModel implements TreeModel { + private SimpleNode root; - private Vector listeners = new Vector(1); + private List listeners = new ArrayList(1); /** * creates the tree model @@ -96,7 +98,7 @@ public class ASTModel protected void fireTreeModelEvent(TreeModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((TreeModelListener) listeners.elementAt(i)).treeNodesChanged(e); + ((TreeModelListener) listeners.get(i)).treeNodesChanged(e); } } diff --git a/pmd/src/net/sourceforge/pmd/util/viewer/model/AttributeToolkit.java b/pmd/src/net/sourceforge/pmd/util/viewer/model/AttributeToolkit.java index f4cfd725f1..d6315aa414 100644 --- a/pmd/src/net/sourceforge/pmd/util/viewer/model/AttributeToolkit.java +++ b/pmd/src/net/sourceforge/pmd/util/viewer/model/AttributeToolkit.java @@ -20,7 +20,7 @@ public class AttributeToolkit { * @return formmated value */ public static String formatValueForXPath(Attribute attribute) { - return "'" + attribute.getValue() + "'"; + return '\'' + attribute.getValue() + '\''; } /** @@ -30,7 +30,7 @@ public class AttributeToolkit { * @return predicate */ public static String constructPredicate(Attribute attribute) { - return "[@" + attribute.getName() + "=" + - formatValueForXPath(attribute) + "]"; + return "[@" + attribute.getName() + '=' + + formatValueForXPath(attribute) + ']'; } } \ No newline at end of file diff --git a/pmd/src/net/sourceforge/pmd/util/viewer/model/SimpleNodeTreeNodeAdapter.java b/pmd/src/net/sourceforge/pmd/util/viewer/model/SimpleNodeTreeNodeAdapter.java index e99a9c16ec..dd234db530 100644 --- a/pmd/src/net/sourceforge/pmd/util/viewer/model/SimpleNodeTreeNodeAdapter.java +++ b/pmd/src/net/sourceforge/pmd/util/viewer/model/SimpleNodeTreeNodeAdapter.java @@ -17,8 +17,8 @@ import java.util.List; * @version $Id$ */ -public class SimpleNodeTreeNodeAdapter - implements TreeNode { +public class SimpleNodeTreeNodeAdapter implements TreeNode { + private SimpleNode node; private List children; private SimpleNodeTreeNodeAdapter parent; @@ -91,7 +91,7 @@ public class SimpleNodeTreeNodeAdapter public boolean isLeaf() { checkChildren(); - return children.size() == 0; + return children.isEmpty(); } diff --git a/pmd/src/net/sourceforge/pmd/util/viewer/model/ViewerModel.java b/pmd/src/net/sourceforge/pmd/util/viewer/model/ViewerModel.java index 2f2767f5bc..00b78755e1 100644 --- a/pmd/src/net/sourceforge/pmd/util/viewer/model/ViewerModel.java +++ b/pmd/src/net/sourceforge/pmd/util/viewer/model/ViewerModel.java @@ -1,25 +1,27 @@ package net.sourceforge.pmd.util.viewer.model; +import java.io.StringReader; +import java.util.ArrayList; +import java.util.List; + import net.sourceforge.pmd.TargetJDKVersion; import net.sourceforge.pmd.ast.ASTCompilationUnit; import net.sourceforge.pmd.ast.ParseException; import net.sourceforge.pmd.ast.SimpleNode; import net.sourceforge.pmd.jaxen.DocumentNavigator; + import org.jaxen.BaseXPath; import org.jaxen.JaxenException; import org.jaxen.XPath; -import java.io.StringReader; -import java.util.List; -import java.util.Vector; - public class ViewerModel { - private Vector listeners; - private SimpleNode rootNode; - private List evaluationResults; + + private List listeners; + private SimpleNode rootNode; + private List evaluationResults; public ViewerModel() { - listeners = new Vector(5); + listeners = new ArrayList(5); } public SimpleNode getRootNode() { @@ -99,7 +101,7 @@ public class ViewerModel { protected void fireViewerModelEvent(ViewerModelEvent e) { for (int i = 0; i < listeners.size(); i++) { - ((ViewerModelListener) listeners.elementAt(i)).viewerModelChanged(e); + ((ViewerModelListener) listeners.get(i)).viewerModelChanged(e); } } }