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 boolean
equals(java.lang.Object obj)
TemplateField
getElementAt(int i)
TemplateField[]
getFields()
int
hashCode()
java.util.Iterator<TemplateField>
iterator()
int
length()
Returns the number of fields in the template.boolean
match(Tuple t)
Check if tuplet
matches the tempalte.java.lang.String
toString()
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods 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 tuplet
matches the tempalte.- Parameters:
t
- tuple to match- Returns:
true
if the tuple matches against this template,false
otherwise.
-
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:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCode
in classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object
-
iterator
- Specified by:
iterator
in interfacejava.lang.Iterable<TemplateField>
-
getElementAt
-
getFields
-