Class: Or

system.rules. Or


new Or()

Evaluates a type string expression and return the property value who corresponding in the target object specified in this evaluator.

Implements:
Example
var Or = system.rules.Or ;
var BooleanRule = system.rules.BooleanRule ;

var rule1 = new BooleanRule( true  ) ;
var rule2 = new BooleanRule( false ) ;
var rule3 = new BooleanRule( true  ) ;

var o ;

o = new Or( rule1 , rule1 ) ;
trace( o.eval() ) ; // true

o = new Or( rule1 , rule1 , rule1 ) ;
trace( o.eval() ) ; // true

o = new Or( rule1 , rule2 ) ;
trace( o.eval() ) ; // true

o = new Or( rule2 , rule1 ) ;
trace( o.eval() ) ; // true

o = new Or( rule2 , rule2 ) ;
trace( o.eval() ) ; // false

o = new Or( rule1 , rule2 , rule3 ) ;
trace( o.eval() ) ; // true

o = new Or( rule1 , rule3 ) ;
o.add( rule2 ) ;
trace( o.length ) ; // 3
trace( o.eval() ) ; // true

o.clear()
trace( o.length ) ; // 0
trace( o.eval() ) ; // false
o.add(rule1) ;
trace( o.eval() ) ; // true

Extends

Members


<readonly> length :number

The number of rules to evaluate.

Type:
  • number

rules :array

The collection of all rules to evaluate.

Type:
  • array

Methods


<static> Or#eval()

Evaluates the specified object.


add(rule)

Insert a new Rule in the Or condition.

Parameters:
Name Type Description
rule system.rules.Rule

The rule to register.

Returns:

The current object reference.


clear()

Clear all rules to evaluates.

Returns:

The current object reference.


eval()

Evaluates the specified condition.

Inherited From:
Implements:

toString()

Returns the string representation of this instance.

Inherited From:
Implements:
Returns:

the string representation of this instance.