| 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectnet.sf.tuplespace.simple.SimpleTemplate
An implementation of Template which considers null
 as matching anything, and Class matching objects of the specified
 class.
| Field Summary | |
protected  org.apache.commons.logging.Log | 
logger
A Log instance that this class and subclasses can use to log
 their actions. | 
| Constructor Summary | |
SimpleTemplate(Object template0)
Instantiate a template with a single parameter.  | 
|
SimpleTemplate(Object[] templates)
The general constructor–instantiate a template with a variable number of parameters.  | 
|
SimpleTemplate(Object template0,
               Object template1)
Instantiate a template with two parameters.  | 
|
SimpleTemplate(Object template0,
               Object template1,
               Object template2)
Instantiate a template with three parameters.  | 
|
| Method Summary | |
 boolean | 
equals(Object o)
Templates can be equal to each other if they follow the same template, that is they have the same formal and actual parameters in the same order.  | 
 int | 
hashCode()
 | 
protected  boolean | 
isTemplateATypeMatch(Object templateValue)
Determines if templateValue represents a type match.  | 
protected  boolean | 
isTemplateAValueMatch(Object templateValue)
Determines if templateValue represents a value match.  | 
protected  boolean | 
isTemplateAWildcardMatch(Object templateValue)
Determines if templateValue is a wildcard match.  | 
protected  boolean | 
isTypeMatch(Object templateValue,
            Object tupleValue)
Determines if both values match according to a type match.  | 
protected  boolean | 
isValueMatch(Object templateValue,
             Object tupleValue)
Determines if both values are equal, according to some definition of equal.  | 
protected  boolean | 
isWildcardMatch(Object templateValue,
                Object tupleValue)
Determines if tupleValue is acceptable as a wildcard value.  | 
 boolean | 
matches(Tuple tuple)
Attempt to match tuple with this template.  | 
 String | 
toString()
 | 
| Methods inherited from class java.lang.Object | 
clone, finalize, getClass, notify, notifyAll, wait, wait, wait | 
| Field Detail | 
protected final org.apache.commons.logging.Log logger
Log instance that this class and subclasses can use to log
 their actions.
| Constructor Detail | 
public SimpleTemplate(Object template0)
template0 - The template value.
public SimpleTemplate(Object template0,
                      Object template1)
template0 - A template value.template1 - A template value.
public SimpleTemplate(Object template0,
                      Object template1,
                      Object template2)
template0 - A template value.template1 - A template value.template2 - A template value.public SimpleTemplate(Object[] templates)
templates - The template values.| Method Detail | 
public final boolean matches(Tuple tuple)
This implementation allows nulls in the template to
 match anything.  If the template's value at the same position is
 a Class, any objects of the specified class (or a subtype)
 will match.
The following table explains the relationships:
| Template value | Tuple value | Result | Description | 
|---|---|---|---|
null | 
 Any | true | 
 null always matches | 
 
String.class | 
 new Integer(4) | 
 false | 
 Object not of same type | 
String.class | 
 null | 
 false | 
 Object not of same type | 
new Integer(32) | 
 null | 
 false | 
 Object not of same type | 
Number.class | 
 new Integer(4) | 
 true | 
 Object assignable to template class | 
"abc | 
 "123" | 
 false | 
 Not equal, according to String.equals(java.lang.Object) | 
 
"abc | 
 "Abc" | 
 false | 
 Not equal, according to String.equals(java.lang.Object) | 
 
matches in interface Templatetuple - The tuple to match.
true if the tuple matches.protected boolean isTemplateAWildcardMatch(Object templateValue)
templateValue - The value, as retrieved from the template.
true if this is a wildcard match,
         false if not.
protected boolean isWildcardMatch(Object templateValue,
                                  Object tupleValue)
templateValue - The value, as retrieved from the template.tupleValue - The value, as retrieved from the tuple.
true if tupleValue matches the wildcard
         pattern, false if not.protected boolean isTemplateATypeMatch(Object templateValue)
Type matches are matches based on types, not on values.
templateValue - The value, as retrieved from the template.
true if this is a type match,
         false if not.
protected boolean isTypeMatch(Object templateValue,
                              Object tupleValue)
templateValue - The value, as retrieved from the template.tupleValue - The value, as retrieved from the tuple.
true if tupleValue matches, based
         only on the parameters types, false if not.protected boolean isTemplateAValueMatch(Object templateValue)
templateValue - The value, as retrieved from the template.
true if this is a value match,
         false if not.
protected boolean isValueMatch(Object templateValue,
                               Object tupleValue)
templateValue - The value, as retrieved from the template.tupleValue - The value, as retrieved from the tuple.
true if tupleValue matches, based
         on the object's values, false if not.public boolean equals(Object o)
o - The other template to test equality against.
true if both templates have the same formal and
         actual parameters in the same order.public int hashCode()
public String toString()
  | 
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||