new And()
Evaluates a type string expression and return the property value who corresponding in the target object specified in this evaluator.
- Implements:
Example
var And = system.rules.And ; var BooleanRule = system.rules.BooleanRule ; var rule1 = new BooleanRule( true ) ; var rule2 = new BooleanRule( false ) ; var rule3 = new BooleanRule( true ) ; var a ; a = new And( rule1 , rule1 ) ; trace( a.eval() ) ; // true a = new And( rule1 , rule1 , rule1 ) ; trace( a.eval() ) ; // true a = new And( rule1 , rule2 ) ; trace( a.eval() ) ; // false a = new And( rule2 , rule1 ) ; trace( a.eval() ) ; // false a = new And( rule2 , rule2 ) ; trace( a.eval() ) ; // false a = new And( rule1 , rule2 , rule3 ) ; trace( a.eval() ) ; // false a = new And( rule1 , rule3 ) ; a.add( rule2 ) ; trace( a.length ) ; // 3 trace( a.eval() ) ; // false a.clear() trace( a.length ) ; // 0 trace( a.eval() ) ; // false a.add(rule1) ; trace( a.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> And#eval()
-
Evaluates the specified object.
-
add(rule)
-
Insert a new Rule in the And 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.