Siena (v.1.5.5) API documentation

siena
Class Filter

java.lang.Object
  extended by siena.Filter
All Implemented Interfaces:
java.io.Serializable

public class Filter
extends java.lang.Object
implements java.io.Serializable

a selection predicate defined over notifications. The form of a Filter is a conjunction of constraints (see AttributeConstraint). Each constraint poses an elementary condition on a specific attribute of the event. For example a contraint[price < 10] requires that the event contain an attribute named "price" whose value is a number less than 10. A Filter can have more that one constraint for an attribute. For example, a Filter can express things like [model="custom", price > 10, price <= 20].

Every constraint in a Filter implicitly expresses an existential quantifier over the event. The filter of the previous example ([model="custom", price > 10, price <= 20]) requires that an event contain an attribute named "model", whose value is the string "custom", and an attribute named "price" whose value is a number between 10 and 20 (20 included).

The valid syntax for attribute names is the same for Notification.

See Also:
AttributeConstraint, Notification, Serialized Form

Constructor Summary
Filter()
          creates an empty filter.
Filter(Filter f)
          creates a (deep) copy of a given filter.
Filter(java.lang.String s)
           
 
Method Summary
 void addConstraint(java.lang.String name, AttributeConstraint a)
          puts a constraint a on attribute name.
 void addConstraint(java.lang.String s, boolean bval)
          puts a constraint on attribute name using the equality operator and a boolean argument bval.
 void addConstraint(java.lang.String s, byte[] sval)
          puts a constraint on attribute name using the equality operator and a byte[] argument sval.
 void addConstraint(java.lang.String s, double dval)
          puts a constraint on attribute name using the equality operator and a double argument dval.
 void addConstraint(java.lang.String s, long lval)
          puts a constraint on attribute name using the equality operator and a long argument lval.
 void addConstraint(java.lang.String s, short op, boolean bval)
          puts a constraint on attribute name using comparison operator op and a boolean argument bval.
 void addConstraint(java.lang.String s, short op, byte[] sval)
          puts a constraint on attribute name using comparison operator op and a byte[] argument sval.
 void addConstraint(java.lang.String s, short op, double dval)
          puts a constraint on attribute name using comparison operator op and a double argument dval.
 void addConstraint(java.lang.String s, short op, long lval)
          puts a constraint on attribute name using comparison operator op and a long argument lval.
 void addConstraint(java.lang.String s, short op, java.lang.String sval)
          puts a constraint on attribute name using comparison operator op and a String argument sval.
 void addConstraint(java.lang.String s, java.lang.String sval)
          puts a constraint on attribute name using the equality operator and a String argument sval.
 void clear()
          removes all constraints.
 java.util.Iterator constraintNamesIterator()
          returns an iterator for the set of attribute (constraint) names of this Filter.
 java.util.Iterator constraintsIterator(java.lang.String name)
          returns an iterator for the set of constraints over attribute name of this Filter.
 boolean containsConstraint(java.lang.String s)
          returns true if this filter contains at least one constraint for the specified attribute
 boolean isEmpty()
          true iff this filter contains no constraints
static Filter parseFilter(java.lang.String s)
           
 boolean removeConstraints(java.lang.String s)
          removes all the constraints for the specified attribute.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Filter

public Filter()
creates an empty filter. creates a filter with no constraints. Notice that an empty filter does not match any notification.


Filter

public Filter(Filter f)
creates a (deep) copy of a given filter.


Filter

public Filter(java.lang.String s)
       throws SENPInvalidFormat
Throws:
SENPInvalidFormat
Method Detail

parseFilter

public static Filter parseFilter(java.lang.String s)
                          throws SENPInvalidFormat
Throws:
SENPInvalidFormat

isEmpty

public boolean isEmpty()
true iff this filter contains no constraints


addConstraint

public void addConstraint(java.lang.String name,
                          AttributeConstraint a)
puts a constraint a on attribute name. Example:

            Filter f = new Filter();
            AttributeConstraint a;
            a = new AttrbuteConstraint(Op.SS, "soft") 
            f.addConstraint("subject", a);
        


addConstraint

public void addConstraint(java.lang.String s,
                          short op,
                          java.lang.String sval)
puts a constraint on attribute name using comparison operator op and a String argument sval.

            Filter f = new Filter();
            f.addConstraint("subject", Op.SS, "soft");
        


addConstraint

public void addConstraint(java.lang.String s,
                          short op,
                          byte[] sval)
puts a constraint on attribute name using comparison operator op and a byte[] argument sval.


addConstraint

public void addConstraint(java.lang.String s,
                          short op,
                          long lval)
puts a constraint on attribute name using comparison operator op and a long argument lval.


addConstraint

public void addConstraint(java.lang.String s,
                          short op,
                          boolean bval)
puts a constraint on attribute name using comparison operator op and a boolean argument bval.

      Filter f = new Filter();
            f.addConstraint("failed", Op.EQ, true);
  


addConstraint

public void addConstraint(java.lang.String s,
                          short op,
                          double dval)
puts a constraint on attribute name using comparison operator op and a double argument dval.


addConstraint

public void addConstraint(java.lang.String s,
                          java.lang.String sval)
puts a constraint on attribute name using the equality operator and a String argument sval. Example:

      Filter f = new Filter();
      f.addConstraint("name", "Antonio");
  


addConstraint

public void addConstraint(java.lang.String s,
                          byte[] sval)
puts a constraint on attribute name using the equality operator and a byte[] argument sval.


addConstraint

public void addConstraint(java.lang.String s,
                          boolean bval)
puts a constraint on attribute name using the equality operator and a boolean argument bval.


addConstraint

public void addConstraint(java.lang.String s,
                          long lval)
puts a constraint on attribute name using the equality operator and a long argument lval.


addConstraint

public void addConstraint(java.lang.String s,
                          double dval)
puts a constraint on attribute name using the equality operator and a double argument dval.


containsConstraint

public boolean containsConstraint(java.lang.String s)
returns true if this filter contains at least one constraint for the specified attribute


removeConstraints

public boolean removeConstraints(java.lang.String s)
removes all the constraints for the specified attribute.

Returns:
true if any constraints existed and has been removed

clear

public void clear()
removes all constraints.


constraintNamesIterator

public java.util.Iterator constraintNamesIterator()
returns an iterator for the set of attribute (constraint) names of this Filter.


constraintsIterator

public java.util.Iterator constraintsIterator(java.lang.String name)
returns an iterator for the set of constraints over attribute name of this Filter.


toString

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

Siena (v.1.5.5) API documentation

Copyright © 2000-2005 University of Colorado.
Copyright © 2005-2008 Antonio Carzaniga.
This documentation is maintained by Antonio Carzaniga