summaryrefslogtreecommitdiffstats
path: root/tests/ajde/examples/spacewar/coordination/MethodState.java
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ajde/examples/spacewar/coordination/MethodState.java')
-rw-r--r--tests/ajde/examples/spacewar/coordination/MethodState.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/ajde/examples/spacewar/coordination/MethodState.java b/tests/ajde/examples/spacewar/coordination/MethodState.java
new file mode 100644
index 000000000..d823f26de
--- /dev/null
+++ b/tests/ajde/examples/spacewar/coordination/MethodState.java
@@ -0,0 +1,28 @@
+
+package coordination;
+
+import java.util.Vector;
+import java.util.Enumeration;
+
+
+class MethodState {
+
+ Vector threads=new Vector();
+
+ void enterInThread (Thread t) {
+ threads.addElement(t);
+ }
+
+ void exitInThread(Thread t) {
+ threads.removeElement(t);
+ }
+
+ boolean hasOtherThreadThan(Thread t) {
+ Enumeration e = threads.elements();
+ while (e.hasMoreElements())
+ if (e.nextElement() != t)
+ return(true);
+ return (false);
+ }
+
+}