[Swift-commit] cog r3429

swift at ci.uchicago.edu swift at ci.uchicago.edu
Sat Jul 14 19:00:04 CDT 2012


------------------------------------------------------------------------
r3429 | hategan | 2012-07-14 18:55:47 -0500 (Sat, 14 Jul 2012) | 1 line

added strict sub-context check method
------------------------------------------------------------------------
Index: modules/karajan/src/org/globus/cog/karajan/util/ThreadingContext.java
===================================================================
--- modules/karajan/src/org/globus/cog/karajan/util/ThreadingContext.java	(revision 3428)
+++ modules/karajan/src/org/globus/cog/karajan/util/ThreadingContext.java	(working copy)
@@ -41,8 +41,9 @@
 			if (prev == null) {
 				return tc.prev == null;
 			}
-			else
+			else {
 				return prev.equals(tc.prev);
+			}
 		}
 		return false;
 	}
@@ -51,7 +52,7 @@
 	 * Returns true if
 	 * 
 	 * @param reference
-	 *            is a sub context of this context
+	 *            is a sub context of this context (or if the two are equal)
 	 */
 	public boolean isSubContext(ThreadingContext reference) {
 		ThreadingContext crt = this;
@@ -63,6 +64,20 @@
 		}
 		return false;
 	}
+	
+	/** 
+	 * Like isSubContext except it returns false of the two are equal.
+	 */
+	public boolean isStrictlySubContext(ThreadingContext reference) {
+        ThreadingContext crt = this.prev;
+        while (crt != null) {
+            if (crt.equals(reference)) {
+                return true;
+            }
+            crt = crt.prev;
+        }
+        return false;
+    }
 
 	public int hashCode() {
 		return prev == null ? id : id + prev.hashCode();



More information about the Swift-commit mailing list