it.amattioli.workstate.actions
Class NegatedGuard

Show UML class diagram
java.lang.Object
  extended by it.amattioli.workstate.actions.NegatedGuard
All Implemented Interfaces:
Guard

public class NegatedGuard
extends Object
implements Guard

A decorator that negates a guard. The result of the check(AttributeReader, AttributeReader) method on this guard corresponds to the "not" operator applied to the result of the check(AttributeReader, AttributeReader) method on the guard passed to the constructor.


Constructor Summary
NegatedGuard(Guard negatingGuard)
          Build a guard that negates the result of the guard passed as parameter.
 
Method Summary
 boolean check(AttributeReader event, AttributeReader state)
          Check if the condition is satisfied or not.
 boolean equals(Object o)
           
 Integer getPriority()
          The priority of this guard is equals to the priority of the negating guard passed to the constructor
 int hashCode()
           
 boolean negates(Guard guard)
          Check if this guard is the negation of the guard passed as the parameter
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NegatedGuard

public NegatedGuard(Guard negatingGuard)
Build a guard that negates the result of the guard passed as parameter.

Parameters:
negatingGuard - the negating guard
Throws:
NullPointerException - if the negating guard is null
Method Detail

check

public boolean check(AttributeReader event,
                     AttributeReader state)
Description copied from interface: Guard
Check if the condition is satisfied or not. The check can be performed using event parameters and state attributes.

Specified by:
check in interface Guard
Parameters:
event - the event that triggered the transition to which this guard is associated
state - the state that completely contains the transition to which this guard is associated

getPriority

public Integer getPriority()
The priority of this guard is equals to the priority of the negating guard passed to the constructor

Specified by:
getPriority in interface Guard

negates

public boolean negates(Guard guard)
Check if this guard is the negation of the guard passed as the parameter


equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object


Copyright © 2011. All Rights Reserved.