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 tuple t 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

      public Template​(TemplateField... fields)
      Creates a new template starting from its fields.
      Parameters:
      fields -
    • Template

      public Template​(java.lang.Object... fields)
  • Method Details

    • match

      public boolean match​(Tuple t)
      Check if tuple t 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 class java.lang.Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object
    • iterator

      public java.util.Iterator<TemplateField> iterator()
      Specified by:
      iterator in interface java.lang.Iterable<TemplateField>
    • getElementAt

      public TemplateField getElementAt​(int i)
    • getFields

      public TemplateField[] getFields()