com.ibm.tspaces.examples.rhonda
Class RockPaperScissors
java.lang.Object
|
+--com.ibm.tspaces.examples.rhonda.RockPaperScissors
- public class RockPaperScissors
- extends java.lang.Object
This class implements the game of Rock-Paper-Scissors using the
rhonda() TupleSpace primitive.
The rhonda operator takes a tuple as an argument
and atomically swaps with another matching rhonda tuple.
That is, if process 1 and process 2 perform rhondas on
Tuples that have matching templates, the tuple that is returned to them
is the other processes tuple.
This is useful for atomic synchronization.
Usage: java RockPaperScissors [r|p|s]
- Author:
- Stephen McLaughry, John Thomas
- See Also:
TupleSpace,
TupleSpace.rhonda(com.ibm.tspaces.Tuple),
Field
|
Method Summary |
static void |
main(java.lang.String[] argv)
|
static java.lang.String |
translate(java.lang.String rps)
|
static void |
usage()
|
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
RockPaperScissors
public RockPaperScissors()
main
public static void main(java.lang.String[] argv)
translate
public static java.lang.String translate(java.lang.String rps)
usage
public static void usage()