Unary Configurations Next: Binary Configurations Up: Event Configurations Previous: Event Configurations

Unary Configurations

Unary configurations of the abstract class UnaryConfig  are positive or negative configurations. Positive configurations are just events. Negative configurations are negations of events, corresponding to ``not e''. A unary configuration is fixed when the presence method returns a value different from UNKNOWN.

abstract public class UnaryConfig extends Config
implements EventConsts
{
  protected String eventName;
  
  public String name(){ return eventName; }

  public boolean equals(Config config){
     return super.equals(config) &&  
            eventName.equals(((UnaryConfig)config).eventName);
  }

  public boolean fixed(Machine machine){ 
    return (machine.getEvent(eventName)).
                         presence(machine)!=UNKNOWN; 
  }
}

Positive configurations of class PosConfig  are just events and evaluation returns true if the event is generated in the machine.

public class PosConfig extends UnaryConfig
{
  public PosConfig(String eventName){ 
     this.eventName = eventName; 
  }

  public Event event(Machine machine){ 
    return machine.getEvent(eventName); 
  }

  public String toString(){ return eventName; }

  public boolean evaluate(Machine machine){
     return machine.isGenerated(eventName);
  }
}

Negative configurations of class NegConfig are negations of events and evaluation returns true if the event is not generated in the machine.

public class NegConfig extends UnaryConfig
{
  public NegConfig(String eventName){ 
     this.eventName = eventName; 
  }

  public String toString(){ return "not " + eventName; }

  public boolean evaluate(Machine machine){
    return ! machine.isGenerated(eventName);
  }
}