new MultiEvaluator( [elements])
This Evaluable combine a collection of evaluators to evaluates a specified value.
This Evaluable combine a collection of evaluators to evaluates a specified value.
Parameters:
| Name | Type | Argument | Description |
|---|---|---|---|
elements |
array |
<optional> |
An optional array of evaluators to group. |
Example
var MultiEvaluator = system.evaluators.MultiEvaluator ;
var PropertyEvaluator = system.evaluators.PropertyEvaluator ;
var RomanEvaluator = system.evaluators.RomanEvaluator ;
var obj = { id : "XII" , count : 100 } ;
var evaluator1 = new PropertyEvaluator( obj ) ;
var evaluator2 = new RomanEvaluator() ;
var evaluator = new MultiEvaluator() ;
evaluator.add( evaluator1 ) ;
evaluator.add( evaluator2 ) ;
trace( evaluator.eval( 'id' ) ) ; // 12
trace( evaluator.eval( 'count' ) ) ; // C
Extends
Members
-
autoClear :boolean
-
Indicates if the MultiEvaluator is cleared before insert new
Evaluableobjects (in the add method).Type:
- boolean
- Default Value:
-
- false
-
<readonly> length :number
-
Indicates the number of elements registered in this collection.
Type:
- number
Methods
-
add(evaluators)
-
Inserts an
Evaluableobjects in theMultiEvaluator.Parameters:
Name Type Argument Description evaluatorssystem.Evaluable <repeatable>
The enumeration list of
Evaluableobjets or Arrays of Evaluator. Only Array and Evaluable are compatible to fill the MultiEvaluator. -
clear()
-
Clear all the
Evaluableobjects. -
eval(value)
-
Evaluates the specified object.
Parameters:
Name Type Description value* The object to evaluates.
- Overrides:
Returns:
The result of the evaluation.
-
remove(evaluator)
-
Removes an
Evaluableobjects in the MultiEvaluator if is register.Parameters:
Name Type Description evaluatorThe
Evaluableto find and remove.Returns:
trueif the Evaluable is removed. -
toString()
-
Returns the string representation of this instance.
- Overrides:
Returns:
the string representation of this instance.