minor cleanup (Vector -> ArrayList), etc

git-svn-id: https://pmd.svn.sourceforge.net/svnroot/pmd/trunk@4710 51baf565-9d33-0410-a72c-fc3788e3496d
This commit is contained in:
Brian Remedios
2006-10-20 02:40:14 +00:00
parent dff3475e32
commit d120170a5e
4 changed files with 25 additions and 21 deletions

View File

@ -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);
}
}

View File

@ -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) + ']';
}
}

View File

@ -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();
}

View File

@ -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);
}
}
}