PrevTopNext

Developing Rules for Value Checks (2)

  • Other subclasses of Check for comparing to sets of individual values, for pattern matching, etc.
  • Insert IntRangeCheck objects as facts
  • Rule - version 1:
    rule "Check all Item integer ranges"
    when
        $item: Item()
        $cond: IntRangeCheck( clazz == ( Item.class ) )
        eval( ! $cond.isValid( $item ) )
    then
        System.out.println( $cond.getError() + " " + $item.toString() );
    end
    
  • Rule - version 2:
    rule "Check all integer ranges"
    when
        $fact: Object()
        $cond: IntRangeCheck( clazz == ( $fact.getClass() ) )
        eval( ! $cond.isValid( $fact ) )
    then
        System.out.println( $cond.getError() + " " + $fact.toString() );
    end
    
  • Further reduction is possible, so that we finally arrive at...

PrevTopNext