Package org.jspace
Class Template
java.lang.Object
org.jspace.Template
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<TemplateField>
public final class Template extends java.lang.Object implements java.lang.Iterable<TemplateField>, java.io.Serializable
An instance of class
Template is used as a pattern to select
tuples in a space.- See Also:
- Serialized Form
-
Constructor Summary
Constructors Constructor Description Template(java.lang.Object... fields)Template(TemplateField... fields)Creates a new template starting from its fields. -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object obj)TemplateFieldgetElementAt(int i)TemplateField[]getFields()inthashCode()java.util.Iterator<TemplateField>iterator()intlength()Returns the number of fields in the template.booleanmatch(Tuple t)Check if tupletmatches the tempalte.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
Template
Creates a new template starting from its fields.- Parameters:
fields-
-
Template
public Template(java.lang.Object... fields)
-
-
Method Details
-
match
Check if tupletmatches the tempalte.- Parameters:
t- tuple to match- Returns:
trueif the tuple matches against this template,falseotherwise.
-
length
public int length()Returns the number of fields in the template.- Returns:
- number of fields in the template.
-
equals
public boolean equals(java.lang.Object obj)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-
iterator
- Specified by:
iteratorin interfacejava.lang.Iterable<TemplateField>
-
getElementAt
-
getFields
-