Author: tfmorris
Date: 2007-11-23 15:48:22-0800
New Revision: 13825
Modified:
trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java
trunk/src_new/org/argouml/uml/GenAncestorClasses.java
trunk/src_new/org/argouml/uml/GenCompositeClasses.java
trunk/src_new/org/argouml/uml/GenDescendantClasses.java
trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java
trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java
trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java
trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java
trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java
trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java
trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java
trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java
trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java
trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
trunk/src_new/org/argouml/uml/reveng/ImportCommon.java
trunk/src_new/org/argouml/uml/reveng/java/ParseState.java
trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java
trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java
trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java
trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java
trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java
trunk/src_new/org/argouml/util/MyTokenizer.java
trunk/src_new/org/argouml/util/logging/SimpleTimer.java
Log:
Replace Vector with List for internal implementations. No API visible changes.
Modified: trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&p2=trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java (original)
+++ trunk/src_new/org/argouml/ui/cmd/CmdSetPreferredSize.java 2007-11-23 15:48:22-0800
@@ -98,7 +98,7 @@
* @param f the fig to resize
*/
public void setFigToResize(Fig f) {
- List figs = new ArrayList(1);
+ List<Fig> figs = new ArrayList<Fig>(1);
figs.add(f);
setArg("figs", figs);
}
@@ -108,7 +108,7 @@
*
* @param figs the list of figs to resize
*/
- public void setFigToResize(Vector figs) {
+ public void setFigToResize(List figs) {
setArg("figs", figs);
}
@@ -119,7 +119,7 @@
*/
public void doIt() {
Editor ce = Globals.curEditor();
- List figs = (List) getArg("figs");
+ List<Fig> figs = (List<Fig>) getArg("figs");
if (figs == null) {
SelectionManager sm = ce.getSelectionManager();
if (sm.getLocked()) {
@@ -129,12 +129,14 @@
figs = sm.getFigs();
}
- if (figs == null) return;
+ if (figs == null) {
+ return;
+ }
int size = figs.size();
if (size == 0) return;
for (int i = 0; i < size; i++) {
- Fig fi = (Fig) figs.get(i);
+ Fig fi = figs.get(i);
/* Only resize elements which the user would also be able
* to resize: */
if (fi.isResizable()
Modified: trunk/src_new/org/argouml/uml/GenAncestorClasses.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/GenAncestorClasses.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/GenAncestorClasses.java&p2=trunk/src_new/org/argouml/uml/GenAncestorClasses.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/GenAncestorClasses.java (original)
+++ trunk/src_new/org/argouml/uml/GenAncestorClasses.java 2007-11-23 15:48:22-0800
@@ -25,9 +25,10 @@
package org.argouml.uml;
import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
+import java.util.HashSet;
+import java.util.Set;
import org.argouml.model.Model;
import org.tigris.gef.util.ChildGenerator;
@@ -41,22 +42,18 @@
* @see org.tigris.gef.util.ChildGenerator#gen(java.lang.Object)
*/
public Enumeration gen(Object cls) {
- Vector res = new Vector();
-
- if (!(Model.getFacade().isAGeneralizableElement(cls))) {
- return res.elements();
+ Set res = new HashSet();
+ if (Model.getFacade().isAGeneralizableElement(cls)) {
+ accumulateAncestors(cls, res);
}
- Collection gens = Model.getFacade().getGeneralizations(cls);
- if (gens == null) return res.elements();
- accumulateAncestors(cls, res);
- return res.elements();
+ return Collections.enumeration(res);
}
/**
* @param cls the class (in fact any GeneralizableElement will do)
* @param accum the accumulated list of generalizations
*/
- public void accumulateAncestors(Object cls, List accum) {
+ public void accumulateAncestors(Object cls, Collection accum) {
Collection gens = Model.getFacade().getGeneralizations(cls);
if (gens == null) {
return;
Modified: trunk/src_new/org/argouml/uml/GenCompositeClasses.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/GenCompositeClasses.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/GenCompositeClasses.java&p2=trunk/src_new/org/argouml/uml/GenCompositeClasses.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/GenCompositeClasses.java (original)
+++ trunk/src_new/org/argouml/uml/GenCompositeClasses.java 2007-11-23 15:48:22-0800
@@ -25,9 +25,10 @@
package org.argouml.uml;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import org.argouml.model.Model;
import org.tigris.gef.util.ChildGenerator;
@@ -60,14 +61,14 @@
* @see org.tigris.gef.util.ChildGenerator#gen(java.lang.Object)
*/
public Enumeration gen(Object o) {
- Vector res = new Vector();
+ List res = new ArrayList();
if (!(Model.getFacade().isAClassifier(o))) {
- return res.elements();
+ return Collections.enumeration(res);
}
Object cls = o;
- Vector ends = new Vector(Model.getFacade().getAssociationEnds(cls));
+ List ends = new ArrayList(Model.getFacade().getAssociationEnds(cls));
if (ends == null) {
- return res.elements();
+ return Collections.enumeration(res);
}
Iterator assocEnds = ends.iterator();
while (assocEnds.hasNext()) {
@@ -88,12 +89,12 @@
}
}
}
- return res.elements();
+ return Collections.enumeration(res);
}
/**
* The UID.
*/
private static final long serialVersionUID = -6027679124153204193L;
-} /* end class GenCompositeClasses */
+}
Modified: trunk/src_new/org/argouml/uml/GenDescendantClasses.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/GenDescendantClasses.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/GenDescendantClasses.java&p2=trunk/src_new/org/argouml/uml/GenDescendantClasses.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/GenDescendantClasses.java (original)
+++ trunk/src_new/org/argouml/uml/GenDescendantClasses.java 2007-11-23 15:48:22-0800
@@ -25,16 +25,20 @@
package org.argouml.uml;
import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
-import java.util.List;
-import java.util.Vector;
+import java.util.HashSet;
+import java.util.Set;
import org.argouml.model.Model;
import org.tigris.gef.util.ChildGenerator;
-/** Utility class to generate the subclasses of a class. It
- * recursively moves down the class hierarchy. But it does that in a
- * safe way that will nothang in case of cyclic inheritance.
- * @stereotype singleton
+
+/**
+ * Utility class to generate the subclasses of a class. It recursively moves
+ * down the class hierarchy. But it does that in a safe way that will not hang
+ * in case of cyclic inheritance.
+ *
+ * @stereotype singleton
*/
public class GenDescendantClasses implements ChildGenerator {
@@ -52,18 +56,12 @@
* @see org.tigris.gef.util.ChildGenerator#gen(java.lang.Object)
*/
public Enumeration gen(Object o) {
- Vector res = new Vector();
- if (!(Model.getFacade().isAGeneralizableElement(o))) {
- return res.elements();
+ Set res = new HashSet();
+ if (Model.getFacade().isAGeneralizableElement(o)) {
+ Object cls = o;
+ accumulateDescendants(cls, res);
}
-
- Object cls = o;
- Collection gens = Model.getFacade().getSpecializations(cls);
- if (gens == null) {
- return res.elements();
- }
- accumulateDescendants(cls, res);
- return res.elements();
+ return Collections.enumeration(res);
}
@@ -71,7 +69,7 @@
* @param cls the starting class (in fact GeneralizableElement)
* @param accum the accumulated list of descendants
*/
- private void accumulateDescendants(final Object cls, List accum) {
+ private void accumulateDescendants(final Object cls, Collection accum) {
Collection gens = Model.getFacade().getSpecializations(cls);
if (gens == null) {
return;
Modified: trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java&p2=trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/ChildGenFind.java 2007-11-23 15:48:22-0800
@@ -24,9 +24,10 @@
package org.argouml.uml.cognitive;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
-import java.util.Vector;
+import java.util.List;
import org.argouml.kernel.Project;
import org.argouml.model.Model;
@@ -55,29 +56,20 @@
* @see org.tigris.gef.util.ChildGenerator#gen(java.lang.Object)
*/
public Enumeration gen(Object o) {
- if (o instanceof Project) {
- Project p = (Project) o;
- Vector res = new Vector();
- res.addAll(p.getUserDefinedModelList());
- res.addAll(p.getDiagramList());
- return res.elements();
- }
-
- if (o instanceof Diagram) {
+ List res = new ArrayList();
+ if (o instanceof Project) {
+ Project p = (Project) o;
+ res.addAll(p.getUserDefinedModelList());
+ res.addAll(p.getDiagramList());
+ } else if (o instanceof Diagram) {
Diagram d = (Diagram) o;
-
- Vector res = new Vector();
res.addAll(d.getGraphModel().getNodes());
res.addAll(d.getGraphModel().getEdges());
- return res.elements();
- }
-
- if (Model.getFacade().isAModelElement(o)) {
- return Collections.enumeration(Model.getFacade()
- .getModelElementContents(o));
+ } else if (Model.getFacade().isAModelElement(o)) {
+ res.addAll(Model.getFacade().getModelElementContents(o));
}
- return new Vector().elements();
+ return Collections.enumeration(res);
}
/**
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrAttrNameConflict.java 2007-11-23 15:48:22-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -24,8 +24,9 @@
package org.argouml.uml.cognitive.critics;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import javax.swing.Icon;
@@ -73,20 +74,24 @@
* @return true if there are two with the same name.
* @see org.argouml.uml.cognitive.critics.CrUML#predicate2(java.lang.Object, org.argouml.cognitive.Designer)
*/
+ @Override
public boolean predicate2(Object dm, Designer dsgr) {
if (!(Model.getFacade().isAClassifier(dm))) {
return NO_PROBLEM;
}
- Vector namesSeen = new Vector();
-
+ Collection<String> namesSeen = new ArrayList<String>();
Iterator attrs = Model.getFacade().getAttributes(dm).iterator();
while (attrs.hasNext()) {
String name = Model.getFacade().getName(attrs.next());
- if (name == null || name.length() == 0) continue;
-
- if (namesSeen.contains(name)) return PROBLEM_FOUND;
- namesSeen.addElement(name);
+ if (name == null || name.length() == 0) {
+ continue;
+ }
+
+ if (namesSeen.contains(name)) {
+ return PROBLEM_FOUND;
+ }
+ namesSeen.add(name);
}
return NO_PROBLEM;
}
@@ -94,9 +99,10 @@
/*
* @see org.argouml.cognitive.Poster#getClarifier()
*/
+ @Override
public Icon getClarifier() {
return ClAttributeCompartment.getTheInstance();
}
-} /* end class CrAttrNameConflict */
+}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrDupParamName.java 2007-11-23 15:48:22-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -24,8 +24,9 @@
package org.argouml.uml.cognitive.critics;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import org.argouml.cognitive.Critic;
import org.argouml.cognitive.Designer;
@@ -54,13 +55,14 @@
* @see org.argouml.uml.cognitive.critics.CrUML#predicate2(
* java.lang.Object, org.argouml.cognitive.Designer)
*/
+ @Override
public boolean predicate2(Object dm, Designer dsgr) {
if (!Model.getFacade().isABehavioralFeature(dm)) {
return NO_PROBLEM;
}
Object bf = dm;
- Vector namesSeen = new Vector();
+ Collection<String> namesSeen = new ArrayList<String>();
Iterator params = Model.getFacade().getParameters(bf).iterator();
while (params.hasNext()) {
Object p = params.next();
@@ -74,10 +76,10 @@
return PROBLEM_FOUND;
}
- namesSeen.addElement(pName);
+ namesSeen.add(pName);
}
return NO_PROBLEM;
}
-} /* end class CrDupParamName */
+}
\ No newline at end of file
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrDupRoleNames.java 2007-11-23 15:48:22-0800
@@ -24,8 +24,9 @@
package org.argouml.uml.cognitive.critics;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import org.argouml.cognitive.Designer;
import org.argouml.model.Model;
@@ -113,9 +114,9 @@
// Loop through all the ends, comparing the name against those already
// seen (ignoring any with no name).
// No problem if there are no connections defined, we will fall
- // through immediatly.
+ // through immediately.
- Vector namesSeen = new Vector();
+ Collection<String> namesSeen = new ArrayList<String>();
Iterator conns = Model.getFacade().getConnections(dm).iterator();
while (conns.hasNext()) {
@@ -134,7 +135,7 @@
return PROBLEM_FOUND;
}
- namesSeen.addElement(name);
+ namesSeen.add(name);
}
// If we drop out there were no clashes
@@ -142,5 +143,5 @@
return NO_PROBLEM;
}
-} /* end class CrDupRoleNames */
+}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrOperNameConflict.java 2007-11-23 15:48:22-0800
@@ -24,8 +24,9 @@
package org.argouml.uml.cognitive.critics;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import javax.swing.Icon;
@@ -107,6 +108,7 @@
* @return {@link #PROBLEM_FOUND PROBLEM_FOUND} if the critic is
* triggered, otherwise {@link #NO_PROBLEM NO_PROBLEM}.
*/
+ @Override
public boolean predicate2(Object dm, Designer dsgr) {
// Only do this for classifiers
@@ -115,33 +117,25 @@
return NO_PROBLEM;
}
- Iterator ops = Model.getFacade().getOperations(dm).iterator();
-
// Get all the features (giving up if there are none). Then loop
// through finding all operations. Each time we find one, we compare
// its signature with all previous (held in vector operSeen), and then
// if it doesn't match add it to the vector.
- Vector operSeen = new Vector();
-
- while (ops.hasNext()) {
-
- Object op = ops.next();
+ Collection operSeen = new ArrayList();
+ for (Object op : Model.getFacade().getOperations(dm)) {
// Compare against all earlier operations. If there's a match we've
// found the problem
-
- int size = operSeen.size();
-
- for (int i = 0; i < size; i++) {
- if (signaturesMatch(op, operSeen.get(i))) {
+ for (Object o : operSeen) {
+ if (signaturesMatch(op, o)) {
return PROBLEM_FOUND;
}
}
// Add to the vector and round to look at the next one
- operSeen.addElement(op);
+ operSeen.add(op);
}
// If we drop out here, there was no match and we have no problem
@@ -162,6 +156,7 @@
*
* @return The {@link javax.swing.Icon Icon} to use.
*/
+ @Override
public Icon getClarifier() {
return ClOperationCompartment.getTheInstance();
}
@@ -201,15 +196,18 @@
// Check that the names match.
String name1 = Model.getFacade().getName(op1);
- if (name1 == null)
+ if (name1 == null) {
return false;
+ }
String name2 = Model.getFacade().getName(op2);
- if (name2 == null)
+ if (name2 == null) {
return false;
+ }
- if (!name1.equals(name2))
+ if (!name1.equals(name2)) {
return false;
+ }
// Check that the parameter lists match.
@@ -238,34 +236,35 @@
return true; // Both lists have the same length
// Different lengths:
- if (p1 == null)
- return false;
- if (p2 == null)
- return false;
+ if (p1 == null || p2 == null) {
+ return false;
+ }
// Compare the type of the parameters. If any of the types is
// null, then we have a match.
Object p1type = Model.getFacade().getType(p1);
- if (p1type == null)
+ if (p1type == null) {
continue;
+ }
Object p2type = Model.getFacade().getType(p2);
- if (p2type == null)
+ if (p2type == null) {
continue;
+ }
- if (!p1type.equals(p2type))
+ if (!p1type.equals(p2type)) {
return false;
+ }
// This pair of params where the same. Lets check the next pair.
}
- if (!params1.hasNext()
- && !params2.hasNext()) {
- // Both lists have the same length.
- return true;
- }
+ if (!params1.hasNext() && !params2.hasNext()) {
+ // Both lists have the same length.
+ return true;
+ }
return false;
}
-} /* end class CrOperNameConflict.java */
+}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrOppEndVsAttr.java 2007-11-23 15:48:22-0800
@@ -24,9 +24,9 @@
package org.argouml.uml.cognitive.critics;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
import org.argouml.cognitive.Critic;
import org.argouml.cognitive.Designer;
@@ -40,7 +40,7 @@
* @author jrobbins
*/
//TODO: split into one critic for inherited problems and
-//one for pproblems directly in this class.
+//one for problems directly in this class.
public class CrOppEndVsAttr extends CrUML {
/**
@@ -60,16 +60,17 @@
* @see org.argouml.uml.cognitive.critics.CrUML#predicate2(
* java.lang.Object, org.argouml.cognitive.Designer)
*/
+ @Override
public boolean predicate2(Object dm, Designer dsgr) {
if (!(Model.getFacade().isAClassifier(dm))) {
return NO_PROBLEM;
}
Object cls = /*(MClassifier)*/ dm;
- Vector namesSeen = new Vector();
+ Collection<String> namesSeen = new ArrayList<String>();
Collection str = Model.getFacade().getFeatures(cls);
- // warn about inheritied name conflicts, different critic?
+ // warn about inherited name conflicts, different critic?
Iterator features = str.iterator();
while (features.hasNext()) {
Object o = features.next();
@@ -90,13 +91,13 @@
continue;
}
- namesSeen.addElement(nameStr);
+ namesSeen.add(nameStr);
}
Collection assocEnds = Model.getFacade().getAssociationEnds(cls);
- // warn about inheritied name conflicts, different critic?
+ // warn about inherited name conflicts, different critic?
Iterator myEnds = assocEnds.iterator();
while (myEnds.hasNext()) {
Object myAe = /*(MAssociationEnd)*/ myEnds.next();
@@ -139,4 +140,4 @@
* The UID.
*/
private static final long serialVersionUID = 5784567698177480475L;
-} /* end class CrOppEndVsAttr.java */
+}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/CrUselessAbstract.java 2007-11-23 15:48:22-0800
@@ -25,9 +25,10 @@
package org.argouml.uml.cognitive.critics;
import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
-import java.util.Vector;
import org.argouml.cognitive.Designer;
import org.argouml.cognitive.Goal;
@@ -64,8 +65,9 @@
return false;
}
Object cls = dm;
- if (!Model.getFacade().isAbstract(cls))
+ if (!Model.getFacade().isAbstract(cls)) {
return false; // original class was not abstract
+ }
ListSet derived =
(new ListSet(cls)).reachable(new ChildGenDerivedClasses());
for (Object c : derived) {
@@ -83,17 +85,17 @@
class ChildGenDerivedClasses implements ChildGenerator {
public Enumeration gen(Object o) {
Object c = o;
- List specs = new ArrayList(Model.getFacade().getSpecializations(c));
+ Collection specs = new ArrayList(Model.getFacade().getSpecializations(c));
if (specs == null) {
return EnumerationEmpty.theInstance();
}
- Vector specClasses = new Vector(specs.size());
+ List specClasses = new ArrayList(specs.size());
for (Object g : specs) {
Object ge = Model.getFacade().getSpecific(g);
if (ge != null) {
specClasses.add(ge);
}
}
- return specClasses.elements();
+ return Collections.enumeration(specClasses);
}
}
Modified: trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java&p2=trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java (original)
+++ trunk/src_new/org/argouml/uml/cognitive/critics/WizCueCards.java 2007-11-23 15:48:22-0800
@@ -24,7 +24,8 @@
package org.argouml.uml.cognitive.critics;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.List;
import javax.swing.JPanel;
@@ -39,7 +40,7 @@
*/
public class WizCueCards extends UMLWizard {
- private Vector cues = new Vector();
+ private List cues = new ArrayList();
/**
* The constructor.
@@ -49,12 +50,17 @@
/*
* @see org.argouml.cognitive.ui.Wizard#getNumSteps()
*/
- public int getNumSteps() { return cues.size(); }
+ @Override
+ public int getNumSteps() {
+ return cues.size();
+ }
/**
* @param s the text for the wizard step
*/
- public void addCue(String s) { cues.addElement(s); }
+ public void addCue(String s) {
+ cues.add(s);
+ }
/**
* Create a new panel for the given step.
@@ -64,7 +70,7 @@
*/
public JPanel makePanel(int newStep) {
if (newStep <= getNumSteps()) {
- String c = (String) cues.elementAt(newStep - 1);
+ String c = (String) cues.get(newStep - 1);
return new WizStepCue(this, c);
}
return null;
@@ -84,9 +90,10 @@
*
* @see org.argouml.cognitive.critics.Wizard#canFinish()
*/
+ @Override
public boolean canFinish() {
return getStep() == getNumSteps();
}
-} /* end class WizCueCards */
+}
Modified: trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java&p2=trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/UMLMutableGraphSupport.java 2007-11-23 15:48:22-0800
@@ -30,7 +30,6 @@
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.Vector;
import org.apache.log4j.Logger;
import org.argouml.kernel.Project;
@@ -66,12 +65,12 @@
/**
* Contains all the nodes in the graphmodel/diagram.
*/
- private Vector nodes = new Vector();
+ private List nodes = new ArrayList();
/**
- * Constains all the edges in the graphmodel/diagram.
+ * Contains all the edges in the graphmodel/diagram.
*/
- private Vector edges = new Vector();
+ private List edges = new ArrayList();
/**
* The "home" UML model of this diagram, not all ModelElements in this
@@ -100,7 +99,7 @@
* Get all the nodes from the graphmodel/diagram.
*
* @see org.tigris.gef.graph.MutableGraphSupport#getNodes()
- * @return Vector of nodes in the graphmodel/diagram
+ * @return List of nodes in the graphmodel/diagram
*/
public List getNodes() {
return nodes;
@@ -109,7 +108,7 @@
/**
* Get all the edges from the graphmodel/diagram.
*
- * @return Vector of edges in the graphmodel/diagram
+ * @return List of edges in the graphmodel/diagram
*/
public List getEdges() {
return edges;
@@ -135,11 +134,12 @@
*
* @param node node to remove
*/
+ @Override
public void removeNode(Object node) {
if (!containsNode(node)) {
return;
}
- nodes.removeElement(node);
+ nodes.remove(node);
fireNodeRemoved(node);
}
@@ -148,11 +148,12 @@
*
* @param edge edge to remove
*/
+ @Override
public void removeEdge(Object edge) {
if (!containsEdge(edge)) {
return;
}
- edges.removeElement(edge);
+ edges.remove(edge);
fireEdgeRemoved(edge);
}
@@ -343,8 +344,8 @@
if (edge instanceof CommentEdge) {
return ((CommentEdge) edge).getDestination();
} else if (Model.getFacade().isAAssociation(edge)) {
- Vector conns = new Vector(Model.getFacade().getConnections(edge));
- return conns.elementAt(1);
+ List conns = new ArrayList(Model.getFacade().getConnections(edge));
+ return conns.get(1);
} else if (Model.getFacade().isARelationship(edge)
|| Model.getFacade().isATransition(edge)
|| Model.getFacade().isAAssociationEnd(edge)) {
Modified: trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java&p2=trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/deployment/ui/AbstractFigComponent.java 2007-11-23 15:48:22-0800
@@ -32,7 +32,6 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.argouml.model.AssociationChangeEvent;
import org.argouml.model.AttributeChangeEvent;
@@ -269,11 +268,11 @@
* ever intended to be part of the public API.
*/
@Deprecated
- public void setNode(Vector figures) {
+ public void setNode(List figures) {
int size = figures.size();
if (figures != null && (size > 0)) {
for (int i = 0; i < size; i++) {
- Object o = figures.elementAt(i);
+ Object o = figures.get(i);
if (o instanceof FigComponent) {
FigComponent figcomp = (FigComponent) o;
figcomp.setEnclosingFig(this);
Modified: trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java&p2=trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/sequence/SequenceDiagramGraphModel.java 2007-11-23 15:48:22-0800
@@ -27,11 +27,11 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.beans.VetoableChangeListener;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.apache.log4j.Logger;
import org.argouml.model.DeleteInstanceEvent;
@@ -98,7 +98,7 @@
* @see org.tigris.gef.graph.GraphModel#getPorts(java.lang.Object)
*/
public List getPorts(Object nodeOrEdge) {
- Vector ports = new Vector();
+ List ports = new ArrayList();
if (Model.getFacade().isAClassifierRole(nodeOrEdge)) {
ports.addAll(Model.getFacade().getReceivedMessages(nodeOrEdge));
ports.addAll(Model.getFacade().getSentMessages(nodeOrEdge));
@@ -120,7 +120,7 @@
* @see org.tigris.gef.graph.GraphModel#getInEdges(java.lang.Object)
*/
public List getInEdges(Object port) {
- Vector res = new Vector();
+ List res = new ArrayList();
if (Model.getFacade().isAClassifierRole(port)) {
res.addAll(Model.getFacade().getSentMessages(port));
}
@@ -131,7 +131,7 @@
* @see org.tigris.gef.graph.GraphModel#getOutEdges(java.lang.Object)
*/
public List getOutEdges(Object port) {
- Vector res = new Vector();
+ List res = new ArrayList();
if (Model.getFacade().isAClassifierRole(port)) {
res.addAll(Model.getFacade().getReceivedMessages(port));
}
@@ -401,7 +401,7 @@
//throws PropertyVetoException
if ("ownedElement".equals(pce.getPropertyName())) {
- Vector oldOwned = (Vector) pce.getOldValue();
+ List oldOwned = (List) pce.getOldValue();
Object eo = pce.getNewValue();
Object me = Model.getFacade().getModelElement(eo);
if (oldOwned.contains(eo)) {
Modified: trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java&p2=trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/state/ui/FigCompositeState.java 2007-11-23 15:48:22-0800
@@ -30,6 +30,7 @@
import java.awt.event.MouseEvent;
import java.beans.PropertyChangeEvent;
import java.util.Iterator;
+import java.util.List;
import java.util.Vector;
import org.argouml.model.Model;
@@ -153,18 +154,18 @@
Rectangle oldBounds = getBounds();
Dimension nameDim = getNameFig().getMinimumSize();
- Vector regionsVector = getEnclosedFigs();
+ List regionsList = getEnclosedFigs();
/* If it is concurrent and contains concurrent regions,
the bottom region has a minimum height*/
if (getOwner() != null) {
if (Model.getFacade().isConcurrent(getOwner())
- && !regionsVector.isEmpty()
- && regionsVector.lastElement()
+ && !regionsList.isEmpty()
+ && regionsList.get(regionsList.size() - 1)
instanceof FigConcurrentRegion) {
- FigConcurrentRegion f =
- ((FigConcurrentRegion) regionsVector.lastElement());
+ FigConcurrentRegion f = ((FigConcurrentRegion) regionsList
+ .get(regionsList.size() - 1));
Rectangle regionBounds = f.getBounds();
if ((h - oldBounds.height + regionBounds.height)
<= (f.getMinimumSize().height)) {
@@ -200,13 +201,13 @@
the regions are resized*/
if (getOwner() != null) {
if (Model.getFacade().isConcurrent(getOwner())
- && !regionsVector.isEmpty()
- && regionsVector.lastElement()
+ && !regionsList.isEmpty()
+ && regionsList.get(regionsList.size() - 1)
instanceof FigConcurrentRegion) {
- FigConcurrentRegion f =
- ((FigConcurrentRegion) regionsVector.lastElement());
- for (int i = 0; i < regionsVector.size() - 1; i++) {
- ((FigConcurrentRegion) regionsVector.elementAt(i))
+ FigConcurrentRegion f = ((FigConcurrentRegion) regionsList
+ .get(regionsList.size() - 1));
+ for (int i = 0; i < regionsList.size() - 1; i++) {
+ ((FigConcurrentRegion) regionsList.get(i))
.setBounds(x - oldBounds.x, y - oldBounds.y,
w - 6, true);
}
@@ -245,12 +246,6 @@
}
-
-
-
- ////////////////////////////////////////////////////////////////
- // fig accessors
-
/*
* @see org.tigris.gef.ui.PopupGenerator#getPopUpActions(java.awt.event.MouseEvent)
*/
@@ -259,10 +254,9 @@
/* Check if multiple items are selected: */
boolean ms = TargetManager.getInstance().getTargets().size() > 1;
if (!ms) {
- popUpActions.insertElementAt(
- new ActionAddConcurrentRegion(),
- (popUpActions.size()
- - getPopupAddOffset()));
+ popUpActions.add(
+ popUpActions.size() - getPopupAddOffset(),
+ new ActionAddConcurrentRegion());
}
return popUpActions;
}
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ClassDiagramGraphModel.java 2007-11-23 15:48:22-0800
@@ -30,7 +30,6 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import org.apache.log4j.Logger;
import org.argouml.model.Model;
@@ -492,7 +491,7 @@
//throws PropertyVetoException
if ("ownedElement".equals(pce.getPropertyName())) {
- Vector oldOwned = (Vector) pce.getOldValue();
+ List oldOwned = (List) pce.getOldValue();
Object elementImport = pce.getNewValue();
Object modelElement =
Model.getFacade().getModelElement(elementImport);
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigClass.java 2007-11-23 15:48:22-0800
@@ -33,7 +33,6 @@
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import javax.swing.Action;
@@ -340,7 +339,7 @@
if (classifier == null) {
return;
}
- int i = new Vector(getAttributesFig().getFigs()).indexOf(ft);
+ int i = new ArrayList(getAttributesFig().getFigs()).indexOf(ft);
if (i != -1) {
highlightedFigText = (CompartmentFigText) ft;
highlightedFigText.setHighlighted(true);
@@ -351,7 +350,7 @@
highlightedFigText.getOwner(), null));
return;
}
- i = new Vector(getOperationsFig().getFigs()).indexOf(ft);
+ i = new ArrayList(getOperationsFig().getFigs()).indexOf(ft);
if (i != -1) {
highlightedFigText = (CompartmentFigText) ft;
highlightedFigText.setHighlighted(true);
@@ -437,7 +436,7 @@
} else {
fgVec = getAttributesFig();
}
- v = new Vector(fgVec.getFigs());
+ v = new ArrayList(fgVec.getFigs());
i = 1;
}
ft2 = (FigText) v.get(i);
Modified: trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&p2=trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/static_structure/ui/FigPackage.java 2007-11-23 15:48:22-0800
@@ -510,12 +510,14 @@
Vector popUpActions = super.getPopUpActions(me);
// Modifier ...
- popUpActions.insertElementAt(buildModifierPopUp(ABSTRACT | LEAF | ROOT),
- popUpActions.size() - getPopupAddOffset());
+ popUpActions.add(
+ popUpActions.size() - getPopupAddOffset(),
+ buildModifierPopUp(ABSTRACT | LEAF | ROOT));
// Visibility ...
- popUpActions.insertElementAt(buildVisibilityPopUp(),
- popUpActions.size() - getPopupAddOffset());
+ popUpActions.add(
+ popUpActions.size() - getPopupAddOffset(),
+ buildVisibilityPopUp());
return popUpActions;
}
@@ -525,14 +527,12 @@
ArgoJMenu showMenu = super.buildShowPopUp();
/* Only show the menuitems if they make sense: */
Editor ce = Globals.curEditor();
- Vector figs = ce.getSelectionManager().getFigs();
- Iterator i = figs.iterator();
+ List<Fig> figs = ce.getSelectionManager().getFigs();
boolean sOn = false;
boolean sOff = false;
boolean vOn = false;
boolean vOff = false;
- while (i.hasNext()) {
- Fig f = (Fig) i.next();
+ for (Fig f : figs) {
if (f instanceof StereotypeContainer) {
boolean v = ((StereotypeContainer) f).isStereotypeVisible();
if (v) {
@@ -575,10 +575,8 @@
*/
private void doStereotype(boolean value) {
Editor ce = Globals.curEditor();
- Vector figs = ce.getSelectionManager().getFigs();
- Iterator i = figs.iterator();
- while (i.hasNext()) {
- Fig f = (Fig) i.next();
+ List<Fig> figs = ce.getSelectionManager().getFigs();
+ for (Fig f : figs) {
if (f instanceof StereotypeContainer) {
((StereotypeContainer) f).setStereotypeVisible(value);
}
@@ -597,10 +595,8 @@
*/
private void doVisibility(boolean value) {
Editor ce = Globals.curEditor();
- Vector figs = ce.getSelectionManager().getFigs();
- Iterator i = figs.iterator();
- while (i.hasNext()) {
- Fig f = (Fig) i.next();
+ List<Fig> figs = ce.getSelectionManager().getFigs();
+ for (Fig f : figs) {
if (f instanceof VisibilityContainer) {
((VisibilityContainer) f).setVisibilityVisible(value);
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionAddConcurrentRegion.java 2007-11-23 15:48:22-0800
@@ -28,7 +28,7 @@
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -96,11 +96,12 @@
/*Here the actions to divide a region*/
Fig f = TargetManager.getInstance().getFigTarget();
- if (Model.getFacade().isAConcurrentRegion(f.getOwner()))
+ if (Model.getFacade().isAConcurrentRegion(f.getOwner())) {
f = f.getEnclosingFig();
+ }
- Vector nodesInside;
- nodesInside = ((Vector) f.getEnclosedFigs().clone());
+ List<Fig> nodesInside;
+ nodesInside = ((List<Fig>) f.getEnclosedFigs().clone());
Object st = f.getOwner();
Editor editor = Globals.curEditor();
GraphModel gm = editor.getGraphModel();
@@ -112,8 +113,9 @@
Rectangle rFig = f.getBounds();
Fig encloser = null;
encloser = f;
- if (!(gm instanceof MutableGraphModel))
+ if (!(gm instanceof MutableGraphModel)) {
return;
+ }
StateDiagramGraphModel mgm = (StateDiagramGraphModel) gm;
@@ -141,7 +143,7 @@
if (!nodesInside.isEmpty()) {
for (int i = 0; i < nodesInside.size(); i++) {
FigStateVertex curFig =
- (FigStateVertex) nodesInside.elementAt(i);
+ (FigStateVertex) nodesInside.get(i);
curFig.setEnclosingFig(region);
curFig.redrawEnclosedFigs();
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionAggregation.java 2007-11-23 15:48:22-0800
@@ -27,7 +27,7 @@
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -90,18 +90,15 @@
agg = a;
}
-
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
- Vector sels = Globals.curEditor().getSelectionManager().selections();
+ List sels = Globals.curEditor().getSelectionManager().selections();
if (sels.size() == 1) {
- Selection sel = (Selection) sels.firstElement();
+ Selection sel = (Selection) sels.get(0);
Fig f = sel.getContent();
Object owner = ((FigEdgeModelElement) f).getOwner();
Collection ascEnds = Model.getFacade().getConnections(owner);
@@ -118,10 +115,10 @@
}
}
- /**
- * @return true if the action is enabled
+ /*
* @see org.tigris.gef.undo.UndoableAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
return true;
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionCompartmentDisplay.java 2007-11-23 15:48:22-0800
@@ -28,7 +28,7 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import org.argouml.i18n.Translator;
import org.argouml.uml.diagram.AttributesCompartmentContainer;
@@ -54,13 +54,6 @@
*/
public class ActionCompartmentDisplay extends UndoableAction {
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // Instance variables
- //
- ///////////////////////////////////////////////////////////////////////////
-
/**
* A flag to indicate whether the action should show or hide the
* relevant compartment.
@@ -79,13 +72,6 @@
private static final int COMPARTMENT_ENUMLITERAL = 8;
-
- ///////////////////////////////////////////////////////////////////////////
- //
- // Class variables
- //
- ///////////////////////////////////////////////////////////////////////////
-
/**
* Static instance to show the attribute compartment of a class.
*/
@@ -168,11 +154,7 @@
"action.hide-enumeration-literal-compartment",
COMPARTMENT_ENUMLITERAL);
- ///////////////////////////////////////////////////////////////////////////
- //
- // constructors
- //
- ///////////////////////////////////////////////////////////////////////////
+
/**
* Constructor for a new instance. Can only be called by this class or
@@ -191,12 +173,6 @@
}
- ///////////////////////////////////////////////////////////////////////////
- //
- // main methods
- //
- ///////////////////////////////////////////////////////////////////////////
-
/**
* Return the compartment show and/or hide actions needed for the selected
* Figs.
@@ -207,9 +183,7 @@
public static Collection getActions() {
Collection actions = new ArrayList();
Editor ce = Globals.curEditor();
- Vector figs = ce.getSelectionManager().getFigs();
- Iterator i = figs.iterator();
-
+
int present = 0;
int visible = 0;
@@ -225,8 +199,8 @@
boolean enumPresent = false;
boolean enumVisible = false;
- while (i.hasNext()) {
- Fig f = (Fig) i.next();
+ List<Fig> figs = ce.getSelectionManager().getFigs();
+ for (Fig f : figs) {
if (f instanceof AttributesCompartmentContainer) {
present++;
@@ -357,7 +331,6 @@
}
}
-} /* end class ActionCompartmentDisplay */
-
+}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionDeleteConcurrentRegion.java 2007-11-23 15:48:22-0800
@@ -27,7 +27,7 @@
import java.awt.Color;
import java.awt.Rectangle;
import java.awt.event.ActionEvent;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -80,6 +80,7 @@
* @param ae The event.
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
@@ -94,7 +95,7 @@
if (Model.getFacade().isAConcurrentRegion(f.getOwner())) {
Fig encloser = f.getEnclosingFig();
- Vector nodesInside = ((Vector) encloser.getEnclosedFigs().clone());
+ List<Fig> nodesInside = ((List<Fig>) encloser.getEnclosedFigs().clone());
int index = nodesInside.indexOf(f);
Rectangle r = f.getBounds();
Rectangle encBound = encloser.getBounds();
@@ -106,11 +107,10 @@
// Adjust the position of the remaining nodes
if (index < nodesInside.size() - 1) {
- Rectangle rFig =
- ((Fig) nodesInside.elementAt(index + 1)).getBounds();
+ Rectangle rFig = nodesInside.get(index + 1).getBounds();
height = rFig.y - r.y;
for (int i = ++index; i < nodesInside.size(); i++) {
- ((FigNodeModelElement) nodesInside.elementAt(i))
+ ((FigNodeModelElement) nodesInside.get(i))
.displace(0, -height);
}
} else {
@@ -132,7 +132,7 @@
if (!nodesInside.isEmpty()) {
for (int i = 0; i < nodesInside.size(); i++) {
FigStateVertex curFig =
- (FigStateVertex) nodesInside.elementAt(i);
+ (FigStateVertex) nodesInside.get(i);
curFig.setEnclosingFig(encloser);
}
}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionMultiplicity.java 2007-11-23 15:48:22-0800
@@ -27,7 +27,7 @@
import java.awt.event.ActionEvent;
import java.util.Collection;
import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -37,7 +37,6 @@
import org.tigris.gef.presentation.Fig;
import org.tigris.gef.undo.UndoableAction;
-
/**
* Action to set the Multiplicity.
*
@@ -46,10 +45,6 @@
private String str = "";
private Object mult = null;
-
- ////////////////////////////////////////////////////////////////
- // static variables
-
// multiplicity
private static UndoableAction srcMultOne =
new ActionMultiplicity("1", "src");
@@ -75,10 +70,6 @@
private static UndoableAction destMultOneToMany =
new ActionMultiplicity("1..*", "dest");
-
- ////////////////////////////////////////////////////////////////
- // constructors
-
/**
* The Constructor.
*
@@ -94,17 +85,15 @@
}
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
- Vector sels = Globals.curEditor().getSelectionManager().selections();
+ List sels = Globals.curEditor().getSelectionManager().selections();
if (sels.size() == 1) {
- Selection sel = (Selection) sels.firstElement();
+ Selection sel = (Selection) sels.get(0);
Fig f = sel.getContent();
Object owner = ((FigEdgeModelElement) f).getOwner();
Collection ascEnds = Model.getFacade().getConnections(owner);
@@ -200,4 +189,4 @@
public static UndoableAction getDestMultOneToMany() {
return destMultOneToMany;
}
-} /* end class ActionSrcMultOneToMany */
+}
Modified: trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/ActionRemoveFromDiagram.java 2007-11-23 15:48:22-0800
@@ -25,7 +25,7 @@
package org.argouml.uml.diagram.ui;
import java.awt.event.ActionEvent;
-import java.util.Vector;
+import java.util.List;
import javax.swing.AbstractAction;
import javax.swing.Action;
@@ -66,13 +66,10 @@
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
public void actionPerformed(ActionEvent ae) {
- int size = 0;
Editor ce = Globals.curEditor();
MutableGraphSupport graph = (MutableGraphSupport) ce.getGraphModel();
- Vector figs = ce.getSelectionManager().getFigs();
- size = figs.size();
- for (int i = 0; i < size; i++) {
- Fig f = (Fig) figs.elementAt(i);
+ List<Fig> figs = ce.getSelectionManager().getFigs();
+ for (Fig f : figs) {
if (!(f.getOwner() instanceof CommentEdge)) {
if (f instanceof GraphElement) {
f.removeFromDiagram();
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigEdgeModelElement.java 2007-11-23 15:48:22-0800
@@ -278,22 +278,22 @@
Vector popUpActions = super.getPopUpActions(me);
// popupAddOffset should be equal to the number of items added here:
- popUpActions.addElement(new JSeparator());
+ popUpActions.add(new JSeparator());
popupAddOffset = 1;
if (removeFromDiagram) {
- popUpActions.addElement(
+ popUpActions.add(
ProjectActions.getInstance().getRemoveFromDiagramAction());
popupAddOffset++;
}
- popUpActions.addElement(new ActionDeleteModelElements());
+ popUpActions.add(new ActionDeleteModelElements());
popupAddOffset++;
/* Check if multiple items are selected: */
boolean ms = TargetManager.getInstance().getTargets().size() > 1;
if (!ms) {
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items =
- (Vector) list.elementsForOffender(getOwner()).clone();
+ List<ToDoItem> items =
+ (List<ToDoItem>) list.elementsForOffender(getOwner()).clone();
if (items != null && items.size() > 0) {
ArgoJMenu critiques = new ArgoJMenu("menu.popup.critiques");
ToDoItem itemUnderMouse = hitClarifier(me.getX(), me.getY());
@@ -301,27 +301,26 @@
critiques.add(new ActionGoToCritique(itemUnderMouse));
critiques.addSeparator();
}
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
- if (item == itemUnderMouse)
+ for (ToDoItem item : items) {
+ if (item == itemUnderMouse) {
continue;
+ }
critiques.add(new ActionGoToCritique(item));
}
- popUpActions.insertElementAt(new JSeparator(), 0);
- popUpActions.insertElementAt(critiques, 0);
+ popUpActions.add(0, new JSeparator());
+ popUpActions.add(0, critiques);
}
}
// Add stereotypes submenu
Action[] stereoActions = getApplyStereotypeActions();
if (stereoActions != null && stereoActions.length > 0) {
- popUpActions.insertElementAt(new JSeparator(), 0);
+ popUpActions.add(0, new JSeparator());
ArgoJMenu stereotypes = new ArgoJMenu(
"menu.popup.apply-stereotypes");
for (int i = 0; i < stereoActions.length; ++i) {
stereotypes.addCheckItem(stereoActions[i]);
}
- popUpActions.insertElementAt(stereotypes, 0);
+ popUpActions.add(0, stereotypes);
}
return popUpActions;
}
@@ -358,10 +357,8 @@
int iconPos = 25, gap = 1, xOff = -4, yOff = -4;
Point p = new Point();
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items = list.elementsForOffender(getOwner());
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ List<ToDoItem> items = list.elementsForOffender(getOwner());
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -374,9 +371,7 @@
}
}
items = list.elementsForOffender(this);
- size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -419,10 +414,8 @@
int iconPos = 25, xOff = -4, yOff = -4;
Point p = new Point();
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items = list.elementsForOffender(getOwner());
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ List<ToDoItem> items = list.elementsForOffender(getOwner());
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
stuffPointAlongPerimeter(iconPos, p);
int width = icon.getIconWidth();
@@ -434,8 +427,7 @@
return item;
iconPos += width;
}
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -445,9 +437,7 @@
}
}
items = list.elementsForOffender(this);
- size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
stuffPointAlongPerimeter(iconPos, p);
int width = icon.getIconWidth();
@@ -459,8 +449,7 @@
return item;
iconPos += width;
}
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
Modified: trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&p2=trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java (original)
+++ trunk/src_new/org/argouml/uml/diagram/ui/FigNodeModelElement.java 2007-11-23 15:48:22-0800
@@ -243,8 +243,8 @@
* Contains the figs of the floating stereotypes when viewed in
* <code>SmallIcon</code> mode.
*/
- private Vector floatingStereotypes = new Vector();
-
+ private List<Fig> floatingStereotypes = new ArrayList<Fig>();
+
/**
* The current stereotype view
*
@@ -278,7 +278,7 @@
* FigGroup that this FigNodeModelElement "is", since these are the
* figures that make up this high-level primitive figure.
*/
- private Vector enclosedFigs = new Vector();
+ private Vector<Fig> enclosedFigs = new Vector<Fig>();
/**
* The figure enclosing this figure.
@@ -382,6 +382,7 @@
/*
* @see java.lang.Object#finalize()
*/
+ @Override
protected void finalize() throws Throwable {
ArgoEventPump.removeListener(ArgoEventTypes.ANY_NOTATION_EVENT, this);
ArgoEventPump.removeListener(
@@ -507,31 +508,32 @@
* This method shall return a Vector of one of these 4 types:
* AbstractAction, JMenu, JMenuItem, JSeparator.
*/
+ @Override
public Vector getPopUpActions(MouseEvent me) {
Vector popUpActions = super.getPopUpActions(me);
// Show ...
ArgoJMenu show = buildShowPopUp();
if (show.getMenuComponentCount() > 0) {
- popUpActions.addElement(show);
+ popUpActions.add(show);
}
// popupAddOffset should be equal to the number of items added here:
- popUpActions.addElement(new JSeparator());
+ popUpActions.add(new JSeparator());
popupAddOffset = 1;
if (removeFromDiagram) {
- popUpActions.addElement(
+ popUpActions.add(
ProjectActions.getInstance().getRemoveFromDiagramAction());
popupAddOffset++;
}
- popUpActions.addElement(new ActionDeleteModelElements());
+ popUpActions.add(new ActionDeleteModelElements());
popupAddOffset++;
/* Check if multiple items are selected: */
if (TargetManager.getInstance().getTargets().size() == 1) {
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items =
- (Vector) list.elementsForOffender(getOwner()).clone();
+ List<ToDoItem> items =
+ (List<ToDoItem>) list.elementsForOffender(getOwner()).clone();
if (items != null && items.size() > 0) {
ArgoJMenu critiques = new ArgoJMenu("menu.popup.critiques");
ToDoItem itemUnderMouse = hitClarifier(me.getX(), me.getY());
@@ -539,28 +541,26 @@
critiques.add(new ActionGoToCritique(itemUnderMouse));
critiques.addSeparator();
}
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
if (item != itemUnderMouse) {
critiques.add(new ActionGoToCritique(item));
}
}
- popUpActions.insertElementAt(new JSeparator(), 0);
- popUpActions.insertElementAt(critiques, 0);
+ popUpActions.add(0, new JSeparator());
+ popUpActions.add(0, critiques);
}
// Add stereotypes submenu
Action[] stereoActions =
StereotypeUtility.getApplyStereotypeActions(getOwner());
if (stereoActions != null) {
- popUpActions.insertElementAt(new JSeparator(), 0);
+ popUpActions.add(0, new JSeparator());
ArgoJMenu stereotypes =
new ArgoJMenu("menu.popup.apply-stereotypes");
for (int i = 0; i < stereoActions.length; ++i) {
stereotypes.addCheckItem(stereoActions[i]);
}
- popUpActions.insertElementAt(stereotypes, 0);
+ popUpActions.add(0, stereotypes);
}
// add stereotype view submenu
@@ -571,7 +571,7 @@
stereotypesView.addRadioItem(new ActionStereotypeViewBigIcon(this));
stereotypesView.addRadioItem(new ActionStereotypeViewSmallIcon(this));
- popUpActions.insertElementAt(stereotypesView, 0);
+ popUpActions.add(0, stereotypesView);
}
return popUpActions;
@@ -635,6 +635,7 @@
/*
* @see org.tigris.gef.presentation.Fig#getEnclosingFig()
*/
+ @Override
public Fig getEnclosingFig() {
return encloser;
}
@@ -649,6 +650,7 @@
*
* @see org.tigris.gef.presentation.FigNode#setEnclosingFig(org.tigris.gef.presentation.Fig)
*/
+ @Override
public void setEnclosingFig(Fig newEncloser) {
Fig oldEncloser = encloser;
@@ -744,7 +746,8 @@
/*
* @see org.tigris.gef.presentation.Fig#getEnclosedFigs()
*/
- public Vector getEnclosedFigs() {
+ @Override
+ public Vector<Fig> getEnclosedFigs() {
return enclosedFigs;
}
@@ -754,16 +757,16 @@
*
* @param figures in the new order
*/
- public void elementOrdering(Vector figures) {
+ public void elementOrdering(List<Fig> figures) {
int size = figures.size();
getLayer().bringToFront(this);
if (size > 0) {
for (int i = 0; i < size; i++) {
- Object o = figures.elementAt(i);
+ Object o = figures.get(i);
if (o instanceof FigNodeModelElement
&& o != getEnclosingFig()) {
FigNodeModelElement fignode = (FigNodeModelElement) o;
- Vector enclosed = fignode.getEnclosedFigs();
+ List<Fig> enclosed = fignode.getEnclosedFigs();
fignode.elementOrdering(enclosed);
}
}
@@ -790,10 +793,8 @@
int iconX = getX();
int iconY = getY() - 10;
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items = list.elementsForOffender(getOwner());
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ List<ToDoItem> items = list.elementsForOffender(getOwner());
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -805,9 +806,7 @@
}
}
items = list.elementsForOffender(this);
- size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -828,10 +827,8 @@
public ToDoItem hitClarifier(int x, int y) {
int iconX = getX();
ToDoList list = Designer.theDesigner().getToDoList();
- Vector items = list.elementsForOffender(getOwner());
- int size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ List<ToDoItem> items = list.elementsForOffender(getOwner());
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
int width = icon.getIconWidth();
if (y >= getY() - 15
@@ -842,8 +839,7 @@
}
iconX += width;
}
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -854,9 +850,7 @@
}
}
items = list.elementsForOffender(this);
- size = items.size();
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
int width = icon.getIconWidth();
if (y >= getY() - 15
@@ -867,8 +861,7 @@
}
iconX += width;
}
- for (int i = 0; i < size; i++) {
- ToDoItem item = (ToDoItem) items.elementAt(i);
+ for (ToDoItem item : items) {
Icon icon = item.getClarifier();
if (icon instanceof Clarifier) {
((Clarifier) icon).setFig(this);
@@ -884,6 +877,7 @@
/*
* @see org.tigris.gef.presentation.Fig#getTipString(java.awt.event.MouseEvent)
*/
+ @Override
public String getTipString(MouseEvent me) {
ToDoItem item = hitClarifier(me.getX(), me.getY());
String tip = "";
@@ -1572,14 +1566,11 @@
originalNameFig = null;
}
- if (!floatingStereotypes.isEmpty()) {
- Iterator it = floatingStereotypes.iterator();
- while (it.hasNext()) {
- Object icon = it.next();
- this.removeFig((Fig) icon);
+ for (Fig icon : floatingStereotypes) {
+ this.removeFig(icon);
}
- floatingStereotypes.clear();
- }
+ floatingStereotypes.clear();
+
int practicalView = getPracticalView();
Object modelElement = getOwner();
@@ -1687,6 +1678,7 @@
*
* @see org.tigris.gef.presentation.Fig#hit(Rectangle)
*/
+ @Override
public boolean hit(Rectangle r) {
int cornersHit = countCornersContained(r.x, r.y, r.width, r.height);
if (_filled) {
@@ -1698,6 +1690,7 @@
/*
* @see org.tigris.gef.presentation.Fig#removeFromDiagram()
*/
+ @Override
public final void removeFromDiagram() {
Fig delegate = getRemoveDelegate();
if (delegate instanceof FigNodeModelElement) {
@@ -1733,6 +1726,7 @@
/*
* @see org.tigris.gef.presentation.Fig#postLoad()
*/
+ @Override
public void postLoad() {
ArgoEventPump.removeListener(this);
ArgoEventPump.addListener(this);
@@ -1866,13 +1860,13 @@
* @param yInc the increment in the y direction
*/
public void displace (int xInc, int yInc) {
- Vector figsVector;
+ List<Fig> figsVector;
Rectangle rFig = getBounds();
setLocation(rFig.x + xInc, rFig.y + yInc);
- figsVector = ((Vector) getEnclosedFigs().clone());
+ figsVector = ((List<Fig>) getEnclosedFigs().clone());
if (!figsVector.isEmpty()) {
for (int i = 0; i < figsVector.size(); i++) {
- ((FigNodeModelElement) figsVector.elementAt(i))
+ ((FigNodeModelElement) figsVector.get(i))
.displace(xInc, yInc);
}
}
Modified: trunk/src_new/org/argouml/uml/reveng/ImportCommon.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/reveng/ImportCommon.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/reveng/ImportCommon.java&p2=trunk/src_new/org/argouml/uml/reveng/ImportCommon.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/reveng/ImportCommon.java (original)
+++ trunk/src_new/org/argouml/uml/reveng/ImportCommon.java 2007-11-23 15:48:22-0800
@@ -35,7 +35,6 @@
import java.util.Hashtable;
import java.util.List;
import java.util.StringTokenizer;
-import java.util.Vector;
import org.argouml.application.api.Argo;
import org.argouml.cognitive.Designer;
@@ -450,11 +449,11 @@
// if (monitor != null) {
// monitor.updateSubTask(ImportsMessages.layoutingAction);
// }
- Vector diagrams = di.getModifiedDiagrams();
+ List<ArgoDiagram> diagrams = di.getModifiedDiagramList();
int total = startingProgress + diagrams.size()
/ 10;
for (int i = 0; i < diagrams.size(); i++) {
- ArgoDiagram diagram = (ArgoDiagram) diagrams.elementAt(i);
+ ArgoDiagram diagram = diagrams.get(i);
ClassdiagramLayouter layouter = new ClassdiagramLayouter(diagram);
layouter.layout();
int act = startingProgress + (i + 1) / 10;
Modified: trunk/src_new/org/argouml/uml/reveng/java/ParseState.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/reveng/java/ParseState.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/reveng/java/ParseState.java&p2=trunk/src_new/org/argouml/uml/reveng/java/ParseState.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/reveng/java/ParseState.java (original)
+++ trunk/src_new/org/argouml/uml/reveng/java/ParseState.java 2007-11-23 15:48:22-0800
@@ -26,8 +26,6 @@
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
import org.apache.log4j.Logger;
import org.argouml.model.Model;
@@ -40,7 +38,7 @@
class ParseState {
/**
- * Logger.<p>
+ * Logger.
*/
private static final Logger LOG = Logger.getLogger(ParseState.class);
@@ -48,13 +46,13 @@
* When the classifier parse is finished, these features will be
* removed from the model.
*/
- private Vector obsoleteFeatures;
+ private Collection obsoleteFeatures;
/**
* When the classifier parse is finished, these inner classes
* will be removed from the model.
*/
- private Vector obsoleteInnerClasses;
+ private Collection obsoleteInnerClasses;
/**
* This prefix is appended to inner classes, if any.
@@ -88,7 +86,7 @@
* @param javaLangPackage The default package java.lang.
*/
public ParseState(Object model, Object javaLangPackage) {
- obsoleteInnerClasses = new Vector();
+ obsoleteInnerClasses = new ArrayList();
classifier = null;
context =
new PackageContext(new PackageContext(null, model),
@@ -114,9 +112,9 @@
+ Model.getFacade().getName(mClassifier)
+ "$";
obsoleteFeatures =
- new Vector(Model.getFacade().getFeatures(mClassifier));
+ new ArrayList(Model.getFacade().getFeatures(mClassifier));
obsoleteInnerClasses =
- new Vector(Model.getFacade().getOwnedElements(mClassifier));
+ new ArrayList(Model.getFacade().getOwnedElements(mClassifier));
context =
new OuterClassifierContext(
previousState.context,
@@ -224,8 +222,7 @@
if (obsoleteFeatures == null) {
return;
}
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object feature = i.next();
+ for (Object feature : obsoleteFeatures) {
Model.getCoreHelper().removeFeature(classifier, feature);
Model.getUmlFactory().delete(feature);
}
@@ -239,8 +236,7 @@
if (obsoleteInnerClasses == null) {
return;
}
- for (Iterator i = obsoleteInnerClasses.iterator(); i.hasNext();) {
- Object element = i.next();
+ for (Object element : obsoleteInnerClasses) {
if (Model.getFacade().isAClassifier(element)) {
Model.getUmlFactory().delete(element);
}
@@ -264,8 +260,7 @@
* @return The found feature, null if not found.
*/
public Object getFeature(String name) {
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object mFeature = i.next();
+ for (Object mFeature : obsoleteFeatures) {
if (name.equals(Model.getFacade().getName(mFeature))) {
return mFeature;
}
@@ -281,8 +276,7 @@
*/
public Collection getFeatures(String name) {
ArrayList list = new ArrayList();
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object mFeature = i.next();
+ for (Object mFeature : obsoleteFeatures) {
if (name.equals(Model.getFacade().getName(mFeature))) {
list.add(mFeature);
}
@@ -297,8 +291,7 @@
* @return The found method, null if not found.
*/
public Object getMethod(String name) {
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object mFeature = i.next();
+ for (Object mFeature : obsoleteFeatures) {
if (Model.getFacade().isAMethod(mFeature)
&& name.equals(Model.getFacade().getName(mFeature))) {
return mFeature;
@@ -314,8 +307,7 @@
* @return The found operation, null if not found.
*/
public Object getOperation(String name) {
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object feature = i.next();
+ for (Object feature : obsoleteFeatures) {
if (Model.getFacade().isAOperation(feature)
&& name.equals(Model.getFacade().getName(feature))) {
return feature;
@@ -331,8 +323,7 @@
* @return The found attribute, null if not found.
*/
public Object getAttribute(String name) {
- for (Iterator i = obsoleteFeatures.iterator(); i.hasNext();) {
- Object feature = i.next();
+ for (Object feature : obsoleteFeatures) {
if (Model.getFacade().isAAttribute(feature)
&& name.equals(Model.getFacade().getName(feature))) {
return feature;
Modified: trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java&p2=trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionDeleteModelElements.java 2007-11-23 15:48:22-0800
@@ -28,7 +28,7 @@
import java.awt.KeyboardFocusManager;
import java.awt.event.ActionEvent;
import java.text.MessageFormat;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
import javax.swing.JOptionPane;
@@ -274,10 +274,12 @@
int size = 0;
try {
Editor ce = Globals.curEditor();
- Vector figs = ce.getSelectionManager().getFigs();
+ List<Fig> figs = ce.getSelectionManager().getFigs();
size = figs.size();
} catch (Exception e) {
- // Ignore
+ // TODO: This catch block needs to be narrower and do something
+ // with the caught exception - tfm 20071120
+ // Ignore
}
if (size > 0) {
return true;
Modified: trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java&p2=trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionGenerateAll.java 2007-11-23 15:48:22-0800
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2007 The Regents of the University of California. All
// Rights Reserved. Permission to use, copy, modify, and distribute this
// software and its documentation without fee, and without a written
// agreement is hereby granted, provided that the above copyright notice
@@ -25,10 +25,9 @@
package org.argouml.uml.ui;
import java.awt.event.ActionEvent;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
import java.util.List;
-import java.util.Vector;
import javax.swing.Action;
@@ -53,8 +52,6 @@
*/
public class ActionGenerateAll extends UndoableAction {
- ////////////////////////////////////////////////////////////////
- // constructors
/**
* Constructor.
@@ -67,12 +64,10 @@
}
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
ArgoDiagram activeDiagram =
@@ -82,17 +77,13 @@
}
UMLClassDiagram d = (UMLClassDiagram) activeDiagram;
- Vector classes = new Vector();
+ List classes = new ArrayList();
List nodes = d.getNodes();
- Iterator elems = nodes.iterator();
- while (elems.hasNext()) {
- Object owner = elems.next();
+ for (Object owner : nodes) {
if (!Model.getFacade().isAClass(owner)
- && !Model.getFacade().isAInterface(owner)) {
-
- continue;
-
- }
+ && !Model.getFacade().isAInterface(owner)) {
+ continue;
+ }
String name = Model.getFacade().getName(owner);
if (name == null
|| name.length() == 0
@@ -101,16 +92,14 @@
continue;
}
- classes.addElement(owner);
+ classes.add(owner);
}
if (classes.size() == 0) {
- Iterator selectedObjects =
- TargetManager.getInstance().getTargets().iterator();
-
- while (selectedObjects.hasNext()) {
- Object selected = selectedObjects.next();
+ Collection selectedObjects =
+ TargetManager.getInstance().getTargets();
+ for (Object selected : selectedObjects) {
if (Model.getFacade().isAPackage(selected)) {
addCollection(Model.getModelManagementHelper()
.getAllModelElementsOfKind(
@@ -125,7 +114,7 @@
} else if (Model.getFacade().isAClass(selected)
|| Model.getFacade().isAInterface(selected)) {
if (!classes.contains(selected)) {
- classes.addElement(selected);
+ classes.add(selected);
}
}
}
@@ -135,9 +124,11 @@
}
/**
- * @return true if the action is enabled and the diagram is a class diagram
+ * @return true if the action is enabled and the active diagram is a class
+ * diagram
* @see org.tigris.gef.undo.UndoableAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
ArgoDiagram activeDiagram =
ProjectManager.getManager().getCurrentProject().getActiveDiagram();
@@ -148,12 +139,11 @@
/**
* Adds elements from collection without duplicates.
*/
- private void addCollection(Collection c, Vector v) {
- for (Iterator it = c.iterator(); it.hasNext();) {
- Object o = it.next();
+ private void addCollection(Collection c, Collection v) {
+ for (Object o : c) {
if (!v.contains(o)) {
- v.addElement(o);
+ v.add(o);
}
}
}
-} /* end class ActionGenerateAll */
+}
\ No newline at end of file
Modified: trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java&p2=trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionGenerateOne.java 2007-11-23 15:48:22-0800
@@ -25,9 +25,9 @@
package org.argouml.uml.ui;
import java.awt.event.ActionEvent;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -46,9 +46,6 @@
*/
public class ActionGenerateOne extends UndoableAction {
- ////////////////////////////////////////////////////////////////
- // constructors
-
/**
* The constructor.
*/
@@ -59,15 +56,13 @@
Translator.localize("action.generate-selected-classes"));
}
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
- Vector classes = getCandidates();
+ List classes = getCandidates();
// There is no need to test if classes is empty because
// the shouldBeEnabled mechanism blanks out the possibility to
// choose this alternative in this case.
@@ -80,23 +75,22 @@
* candidate class
* @see org.tigris.gef.undo.UndoableAction#isEnabled()
*/
+ @Override
public boolean isEnabled() {
if (!super.isEnabled()) {
return false;
}
- Vector classes = getCandidates();
+ List classes = getCandidates();
return classes.size() > 0;
}
/**
* @return the candidates for generation
*/
- private Vector getCandidates() {
- Vector classes = new Vector();
+ private List getCandidates() {
+ List classes = new ArrayList();
Collection targets = TargetManager.getInstance().getTargets();
- Iterator it = targets.iterator();
- while (it.hasNext()) {
- Object target = it.next();
+ for (Object target : targets) {
if (target instanceof Fig) {
target = ((Fig) target).getOwner();
}
@@ -108,4 +102,4 @@
return classes;
}
-} /* end class ActionGenerateOne */
+}
Modified: trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java&p2=trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java (original)
+++ trunk/src_new/org/argouml/uml/ui/ActionGenerateProjectCode.java 2007-11-23 15:48:22-0800
@@ -25,9 +25,9 @@
package org.argouml.uml.ui;
import java.awt.event.ActionEvent;
+import java.util.ArrayList;
import java.util.Collection;
-import java.util.Iterator;
-import java.util.Vector;
+import java.util.List;
import javax.swing.Action;
@@ -47,9 +47,6 @@
*/
public class ActionGenerateProjectCode extends UndoableAction {
- ////////////////////////////////////////////////////////////////
- // constructors
-
/**
* The constructor.
*/
@@ -62,15 +59,13 @@
}
- ////////////////////////////////////////////////////////////////
- // main methods
-
/*
* @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
*/
+ @Override
public void actionPerformed(ActionEvent ae) {
super.actionPerformed(ae);
- Vector classes = new Vector();
+ List classes = new ArrayList();
ArgoDiagram activeDiagram =
ProjectManager.getManager().getCurrentProject().getActiveDiagram();
if (activeDiagram == null) {
@@ -92,11 +87,9 @@
//Collection elems =
//ModelManagementHelper.getHelper()
// .getAllModelElementsOfKind(MClassifier.class);
- Iterator iter = elems.iterator();
- while (iter.hasNext()) {
- Object cls = iter.next();
+ for (Object cls : elems) {
if (isCodeRelevantClassifier(cls)) {
- classes.addElement(cls);
+ classes.add(cls);
}
}
ClassGenerationDialog cgd = new ClassGenerationDialog(classes, true);
@@ -149,4 +142,4 @@
}
-} /* end class ActionGenerateProjectCode */
+}
Modified: trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java&p2=trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java (original)
+++ trunk/src_new/org/argouml/uml/ui/foundation/core/ActionSetFlowSource.java 2007-11-23 15:48:22-0800
@@ -26,7 +26,8 @@
package org.argouml.uml.ui.foundation.core;
import java.awt.event.ActionEvent;
-import java.util.Vector;
+import java.util.ArrayList;
+import java.util.Collection;
import javax.swing.Action;
@@ -70,7 +71,7 @@
}
if (old != source.getSelectedItem()) {
if (source.getSelectedItem() != null) {
- Vector sources = new Vector();
+ Collection sources = new ArrayList();
sources.add(source.getSelectedItem());
Model.getCoreHelper().setSources(flow, sources);
}
Modified: trunk/src_new/org/argouml/util/MyTokenizer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/util/MyTokenizer.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/util/MyTokenizer.java&p2=trunk/src_new/org/argouml/util/MyTokenizer.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/util/MyTokenizer.java (original)
+++ trunk/src_new/org/argouml/util/MyTokenizer.java 2007-11-23 15:48:22-0800
@@ -24,10 +24,11 @@
package org.argouml.util;
+import java.util.ArrayList;
import java.util.Collection;
import java.util.Enumeration;
+import java.util.List;
import java.util.NoSuchElementException;
-import java.util.Vector;
/**
* Internal class for managing the delimiters in MyTokenizer. It's rather
@@ -495,7 +496,7 @@
private final TokenSep delims;
private String savedToken;
private int savedIdx;
- private Vector customSeps;
+ private List customSeps;
private String putToken;
/**
@@ -531,7 +532,7 @@
tokIdx = 0;
eIdx = string.length();
savedToken = null;
- customSeps = new Vector();
+ customSeps = new ArrayList();
customSeps.add(sep);
}
@@ -550,7 +551,7 @@
tokIdx = 0;
eIdx = string.length();
savedToken = null;
- customSeps = new Vector(seps);
+ customSeps = new ArrayList(seps);
}
/**
Modified: trunk/src_new/org/argouml/util/logging/SimpleTimer.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src_new/org/argouml/util/logging/SimpleTimer.java?view=diff&rev=13825&p1=trunk/src_new/org/argouml/util/logging/SimpleTimer.java&p2=trunk/src_new/org/argouml/util/logging/SimpleTimer.java&r1=13824&r2=13825
==============================================================================
--- trunk/src_new/org/argouml/util/logging/SimpleTimer.java (original)
+++ trunk/src_new/org/argouml/util/logging/SimpleTimer.java 2007-11-23 15:48:22-0800
@@ -24,8 +24,9 @@
package org.argouml.util.logging;
+import java.util.ArrayList;
import java.util.Enumeration;
-import java.util.Vector;
+import java.util.List;
/**
* This class makes it easy to get the time between two or several
@@ -34,8 +35,8 @@
* @author Linus Tolke
*/
public class SimpleTimer {
- private Vector points = new Vector();
- private Vector labels = new Vector();
+ private List<Long> points = new ArrayList<Long>();
+ private List<String> labels = new ArrayList<String>();
/**
* The constructor. Creates a simple timer.
@@ -54,11 +55,11 @@
/**
* Mark (Store) the current time.
*
- * @param label the mark will be labelled with this string
+ * @param label the mark will be labeled with this string
*/
public void mark(String label) {
mark();
- labels.setElementAt(label, labels.size() - 1);
+ labels.set(labels.size() - 1, label);
}
/**
@@ -106,18 +107,14 @@
res.append(" ");
res.append(" ");
res.setLength(60);
- res.append((((Long) points.elementAt(count)).
- longValue()
- - ((Long) points.elementAt(count - 1))
- .longValue()));
+ res
+ .append((((Long) points.get(count)).longValue() - ((Long) points
+ .get(count - 1)).longValue()));
} else if (count == points.size()) {
res.append("Total ");
res.setLength(18);
- res.append((((Long) points.
- elementAt(points.size() - 1))
- .longValue()
- - ((Long) points.
- elementAt(0)).longValue()));
+ res.append((((Long) points.get(points.size() - 1))
+ .longValue() - ((Long) points.get(0)).longValue()));
}
}
count++;
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.