[Swift-commit] cog r3841

swift at ci.uchicago.edu swift at ci.uchicago.edu
Mon Nov 25 00:05:03 CST 2013


------------------------------------------------------------------------
r3841 | hategan | 2013-11-25 00:02:11 -0600 (Mon, 25 Nov 2013) | 1 line

allow non-hashtable backed implementations of task constraints
------------------------------------------------------------------------
Index: modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraintsImpl.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraintsImpl.java	(revision 0)
+++ modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraintsImpl.java	(revision 3841)
@@ -0,0 +1,66 @@
+// ----------------------------------------------------------------------
+// This code is developed as part of the Java CoG Kit project
+// The terms of the license can be found at http://www.cogkit.org/license
+// This message may not be removed or altered.
+// ----------------------------------------------------------------------
+
+/*
+ *
+ * Created on Mar 1, 2004
+ *
+ */
+package org.globus.cog.karajan.scheduler;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+
+public class TaskConstraintsImpl implements TaskConstraints {
+	private static final long serialVersionUID = -5513157963657615563L;
+	private Map<String, Object> map;
+
+	public TaskConstraintsImpl() {
+	}
+
+	private synchronized Map<String, Object> getMap() {
+		if (map == null) {
+			map = new HashMap<String, Object>();
+		}
+		return map;
+	}
+
+	public void addConstraint(String name, Object value) {
+		getMap().put(name, value);
+	}
+
+	public Object getConstraint(String name) {
+		return getMap().get(name);
+	}
+
+	public Collection<String> getConstraintNames() {
+		return getMap().keySet();
+	}
+
+	public String toString() {
+		return getMap().toString();
+	}
+
+	public boolean equals(Object obj) {
+		if (obj instanceof TaskConstraintsImpl) {
+			TaskConstraintsImpl tc = (TaskConstraintsImpl) obj;
+			if (map == null) {
+				return tc.map == null;
+			}
+			else {
+				return map.equals(tc.map);
+			}
+		}
+		else {
+			return false;
+		}
+	}
+
+	public int hashCode() {
+		return map == null ? 0 : map.hashCode();
+	}
+}
Index: modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraints.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraints.java	(revision 3840)
+++ modules/karajan/src/org/globus/cog/karajan/scheduler/TaskConstraints.java	(working copy)
@@ -12,55 +12,10 @@
 package org.globus.cog.karajan.scheduler;
 
 import java.util.Collection;
-import java.util.HashMap;
-import java.util.Map;
 
-public class TaskConstraints {
-	private static final long serialVersionUID = -5513157963657615563L;
-	private Map map;
+public interface TaskConstraints {
+    
+	Object getConstraint(String name);
 
-	public TaskConstraints() {
-	}
-
-	private synchronized Map getMap() {
-		if (map == null) {
-			map = new HashMap();
-		}
-		return map;
-	}
-
-	public void addConstraint(String name, Object value) {
-		getMap().put(name, value);
-	}
-
-	public Object getConstraint(String name) {
-		return getMap().get(name);
-	}
-
-	public Collection getConstraintNames() {
-		return getMap().entrySet();
-	}
-
-	public String toString() {
-		return getMap().toString();
-	}
-
-	public boolean equals(Object obj) {
-		if (obj instanceof TaskConstraints) {
-			TaskConstraints tc = (TaskConstraints) obj;
-			if (map == null) {
-				return tc.map == null;
-			}
-			else {
-				return map.equals(tc.map);
-			}
-		}
-		else {
-			return false;
-		}
-	}
-
-	public int hashCode() {
-		return map == null ? 0 : map.hashCode();
-	}
+	Collection<String> getConstraintNames();
 }



More information about the Swift-commit mailing list