-
Notifications
You must be signed in to change notification settings - Fork 1
Home
At the core of how a tuplespace works is the idea of matching. A tuple can be removed or read from a space if it matches a supplied template. A template is of the same type as the tuple and a matcher does a field by field comparison between the tuple and the template. A null or a '*' will always match.
Matching is performed in the following way
If tuple and template are both of type SimpleTuple,
then a NaiveMatcher is used to match them and the result of the NaiveMatcher is returned. The NaiveMatcher will be described later.
Otherwise the following is done: If the results of calling getClass() on tuple and template are different then false is returned unless the template is a superclass of the tuple as determined by tupleClass.getSuperclass().(They can't match if they are of different types)
If they are of the same time (as determined by getClass() ) then a field by field comparison is done between the two classes. This field based comparison uses the equals() method. A null value or a '*' in a template field will always match.
If all the fields, public and private are equal then the tuple is deemed to match the template and a value of true is returned. Otherwise the method returns false.
See