Author: tfmorris
Date: 2008-03-27 23:40:41-0700
New Revision: 14250
Modified:
trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java
trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java
trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java
trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java
Log:
Add generic types to collections
Modified: trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java?view=diff&rev=14250&p1=trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java&p2=trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java&r1=14249&r2=14250
==============================================================================
--- trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java (original)
+++ trunk/src/app/src/org/argouml/uml/reveng/FileImportUtils.java 2008-03-27 23:40:41-0700
@@ -1,5 +1,5 @@
// $Id: FileImportSupport.java 11168 2006-09-14 20:35:24Z andrea_nironi $
-// Copyright (c) 1996-2006 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -53,7 +53,8 @@
* @deprecated for 0.25.4 by tfmorris - use
* {@link #getList(File, boolean, SuffixFilter[], ProgressMonitor)}
*/
- public static List getList(File file, boolean recurse,
+ @Deprecated
+ public static List<File> getList(File file, boolean recurse,
SuffixFilter[] filters) {
return getList(file, recurse, filters, null);
}
@@ -77,10 +78,10 @@
* of time required to get the files is non-deterministic).
* @return a list of files to be imported
*/
- public static List getList(File file, boolean recurse,
+ public static List<File> getList(File file, boolean recurse,
SuffixFilter[] filters, ProgressMonitor monitor) {
if (file == null) {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
List<File> results = new ArrayList<File>();
Modified: trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java?view=diff&rev=14250&p1=trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java&p2=trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java&r1=14249&r2=14250
==============================================================================
--- trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java (original)
+++ trunk/src/app/src/org/argouml/uml/reveng/ImportClassLoader.java 2008-03-27 23:40:41-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 1996-2007 The Regents of the University of California. All
+// Copyright (c) 1996-2008 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
@@ -167,11 +167,10 @@
return;
}
- List urls = new ArrayList(); //getURLs();
- for (int i = 0; i < this.getURLs().length; i++) {
-
- if (!url.equals(getURLs()[i])) {
- urls.add(getURLs()[i]);
+ List<URL> urls = new ArrayList<URL>();
+ for (URL u : getURLs()) {
+ if (!url.equals(u)) {
+ urls.add(u);
}
}
@@ -212,7 +211,7 @@
*/
public static URL[] getURLs(String path) {
- java.util.List urlList = new ArrayList();
+ java.util.List<URL> urlList = new ArrayList<URL>();
StringTokenizer st = new StringTokenizer(path, ";");
while (st.hasMoreTokens()) {
@@ -228,7 +227,7 @@
URL[] urls = new URL[urlList.size()];
for (int i = 0; i < urls.length; i++) {
- urls[i] = (URL) urlList.get(i);
+ urls[i] = urlList.get(i);
}
return urls;
@@ -264,6 +263,7 @@
this.toString());
}
+ @Override
public String toString() {
URL[] urls = this.getURLs();
@@ -280,12 +280,3 @@
}
}
-// try{
-// ImportClassLoader loader = ImportClassLoader.getInstance();
-// // add paths...
-// loader.addFile(new File("/opt/hibernate/hibernate-2.1/lib/odmg.jar"));
-//
-// Class clazz = loader.loadClass("org.odmg.ODMGException");
-// Object db = clazz.newInstance();
-// cat.info("loaded class ok");
-// }catch(Exception e){cat.warn("error loading class: "+e.toString());}
Modified: trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java?view=diff&rev=14250&p1=trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java&p2=trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java&r1=14249&r2=14250
==============================================================================
--- trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java (original)
+++ trunk/src/app/src/org/argouml/uml/reveng/SettingUniqueSelection.java 2008-03-27 23:40:41-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2006 The Regents of the University of California. All
+// Copyright (c) 2006-2008 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,7 +24,7 @@
package org.argouml.uml.reveng;
-import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
@@ -40,7 +40,7 @@
/**
* The list of String options
*/
- private List options;
+ private List<String> options;
/**
* Default selection is UNDEFINED
@@ -61,7 +61,8 @@
* @param defaultVariant
* the default selection or UNDEFINED_SELECTION
*/
- SettingUniqueSelection(String label, List variants, int defaultVariant) {
+ SettingUniqueSelection(String label, List<String> variants,
+ int defaultVariant) {
super(label);
options = variants;
if (isOption(defaultVariant)) {
@@ -96,8 +97,8 @@
*
* @see org.argouml.uml.reveng.SettingsTypes.UniqueSelection#getOptions()
*/
- public List getOptions() {
- return new ArrayList(options);
+ public List<String> getOptions() {
+ return Collections.unmodifiableList(options);
}
/*
Modified: trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java
Url: http://argouml.tigris.org/source/browse/argouml/trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java?view=diff&rev=14250&p1=trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java&p2=trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java&r1=14249&r2=14250
==============================================================================
--- trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java (original)
+++ trunk/src/app/src/org/argouml/uml/reveng/SettingsTypes.java 2008-03-27 23:40:41-0700
@@ -1,5 +1,5 @@
// $Id$
-// Copyright (c) 2006 The Regents of the University of California. All
+// Copyright (c) 2006-2008 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
@@ -56,14 +56,17 @@
*/
interface UniqueSelection extends Setting {
+ /**
+ * Selection is undefined.
+ */
public int UNDEFINED_SELECTION = -1;
/**
- * Returns the available options from wich the user can pick one.
+ * Returns the available options from which the user can pick one.
*
* @return a list with Strings that identinfies the options
*/
- List getOptions();
+ List<String> getOptions();
/**
* This is the default selected option, if the user doesn't choose other
@@ -86,7 +89,7 @@
* @return true if was successful or false if the selection is out of
* bounds
*/
- boolean setSelection(int seletion);
+ boolean setSelection(int selection);
}
/**
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.