2006/unicorn/src/org/w3c/unicorn/tasklist Task.java,1.5,1.6

Update of /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist
In directory hutz:/tmp/cvs-serv7119/src/org/w3c/unicorn/tasklist

Modified Files:
	Task.java 
Log Message:
added supportedMimeTypes as an instance variable

Index: Task.java
===================================================================
RCS file: /sources/public/2006/unicorn/src/org/w3c/unicorn/tasklist/Task.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- Task.java	4 Sep 2009 13:45:13 -0000	1.5
+++ Task.java	4 Sep 2009 17:41:51 -0000	1.6
@@ -50,6 +50,11 @@
 	 * References to other tasks
 	 */
 	private List<String> listOfReference;
+	
+	/**
+	 * List of mime-types that this task supports
+	 */
+	private List<String> supportedMimeTypes;
 
 	/**
 	 * Root of the execution level tree
@@ -69,7 +74,27 @@
 		this.aLocalizedStringDescription = new LocalizedString();
 		this.mapOfTaskParameter = new LinkedHashMap<String, Parameter>();
 		this.listOfReference = new ArrayList<String>();
-		//output.getGroupList().get(0)
+	}
+	
+	/**
+	 * Creates a new Task.
+	 * 
+	 * @param aLocalizedStringDescription
+	 * @param sID
+	 * @param aLocalizedStringLongName
+	 * @param mapOfParameter
+	 * @param mapOfObservation
+	 */
+	public Task(final String sID,
+			final LocalizedString aLocalizedStringDescription,
+			final LocalizedString aLocalizedStringLongName,
+			final Map<String, Parameter> mapOfParameter) {
+		super();
+		this.aLocalizedStringDescription = aLocalizedStringDescription;
+		this.sID = sID;
+		this.aLocalizedStringLongName = aLocalizedStringLongName;
+		this.mapOfTaskParameter = mapOfParameter;
+		this.listOfReference = new ArrayList<String>();
 	}
 
 	/**
@@ -108,27 +133,6 @@
 	}
 
 	/**
-	 * Creates a new Task.
-	 * 
-	 * @param aLocalizedStringDescription
-	 * @param sID
-	 * @param aLocalizedStringLongName
-	 * @param mapOfParameter
-	 * @param mapOfObservation
-	 */
-	public Task(final String sID,
-			final LocalizedString aLocalizedStringDescription,
-			final LocalizedString aLocalizedStringLongName,
-			final Map<String, Parameter> mapOfParameter) {
-		super();
-		this.aLocalizedStringDescription = aLocalizedStringDescription;
-		this.sID = sID;
-		this.aLocalizedStringLongName = aLocalizedStringLongName;
-		this.mapOfTaskParameter = mapOfParameter;
-		this.listOfReference = new ArrayList<String>();
-	}
-
-	/**
 	 * Returns the internationalized description of this task
 	 * 
 	 * @return Returns the description.
@@ -300,17 +304,19 @@
 	// so it's easier to store the String representation
 	// of mime types :-/
 	public List<String> getSupportedMimeTypes() {
-		List<String> res = new ArrayList<String>();
-		List<Observer> observers = getAllObservers();
-		for (Observer o : observers) {
-			List<MimeType> mimes = o.getSupportedMimeTypes();
-			for (MimeType m : mimes) {
-				if (!res.contains(m.toString())) {
-					res.add(m.toString());
+		if (supportedMimeTypes == null) {
+			supportedMimeTypes = new ArrayList<String>();
+			List<Observer> observers = getAllObservers();
+			for (Observer o : observers) {
+				List<MimeType> mimes = o.getSupportedMimeTypes();
+				for (MimeType m : mimes) {
+					if (!supportedMimeTypes.contains(m.toString())) {
+						supportedMimeTypes.add(m.toString());
+					}
 				}
 			}
 		}
-		return res;
+		return supportedMimeTypes;
 	}
 
 	public void mergeSubtask(final Map<String, Task> mapOfTask, Task subtask) {

Received on Friday, 4 September 2009 17:42:02 UTC