Check out the new USENIX Web site. next up previous
Next: Programming Example Up: Subscription Patterns Previous: Patterns and conditions

Expressing patterns

F is namely explicitly constructed by combining conditions. These combinations are expressed through specific conditions, reflecting binary predicates, like And (Figure 10), Or, etc. Furthermore, we propose a condition Not for negation. To ease the expression of combinations, we introduce the SimpleCondition interface (Figure 11), an extension of Condition, which our basic conditions in fact implement.[*]


This subscription scheme based on conditions inherently expresses the subscription grammar. Syntax errors known from subscription languages, where they are only recognized at execution of the parser, are here detected by the JAVA compiler.



public final class And
  implements Condition, java.io.Serializable
{
  /* the two arguments */
  private Condition first;
  private Condition second;

  public And(Condition first, 
             Condition second)
    { this.first = first; this.second = second; }

  public boolean conforms(Object m)
    { return first.conforms(m) && 
        second.conforms(m); }
  ...  
}




Figure 10: And Class (Excerpt)
  



public interface SimpleCondition
  extends Condition

{
  public SimpleCondition and(Condition with);
  public SimpleCondition or(Condition with);
  public SimpleCondition nand(Condition with);
  public SimpleCondition nor(Condition with);
  public SimpleCondition xor(Condition with);
  public SimpleCondition not();
}




Figure 11: SimpleCondition Interface
  



Patrick Eugster
12/10/2000