Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

MethodState.java 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. /* -*- Mode: Java; -*-
  2. Copyright (c) Xerox Corporation 1998-2002. All rights reserved.
  3. Use and copying of this software and preparation of derivative works based
  4. upon this software are permitted. Any distribution of this software or
  5. derivative works must comply with all applicable United States export control
  6. laws.
  7. This software is made available AS IS, and Xerox Corporation makes no warranty
  8. about the software, its performance or its conformity to any specification.
  9. |<--- this code is formatted to fit into 80 columns --->|
  10. |<--- this code is formatted to fit into 80 columns --->|
  11. |<--- this code is formatted to fit into 80 columns --->|
  12. */
  13. package coordination;
  14. import java.util.Vector;
  15. import java.util.Enumeration;
  16. class MethodState {
  17. Vector threads=new Vector();
  18. void enterInThread (Thread t) {
  19. threads.addElement(t);
  20. }
  21. void exitInThread(Thread t) {
  22. threads.removeElement(t);
  23. }
  24. boolean hasOtherThreadThan(Thread t) {
  25. Enumeration e = threads.elements();
  26. while (e.hasMoreElements())
  27. if (e.nextElement() != t)
  28. return(true);
  29. return (false);
  30. }
  31. }