| 
WebObjects 5.2.2 | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
Objects implementing NSArray.Operator are used to perform operations on an array's elements.
To compute an operation on an array's elements,
 the key-value coding methods with a specially formatted key are used. The
 character @ introduces the name of the operator to be performed. For
 example, to compute the average salary of an array's elements,
 the method valueForKeyPath can be used with "@avg.salary" as
 key path.
The new operator class can be made
 available for use with NSArrays with the method
 setOperatorForKey. The operatorNames method
 returns the keys for the operators that NSArray knows about, and
 operatorForKey returns the operator for a specified key.
compute(com.webobjects.foundation.NSArray, java.lang.String), 
NSArray.valueForKeyPath(java.lang.String), 
NSArray.operatorForKey(java.lang.String), 
NSArray.setOperatorForKey(java.lang.String, com.webobjects.foundation.NSArray.Operator), 
NSArray| Method Summary | |
 Object | 
compute(NSArray values,
        String keyPath)
This interface must be implemented in order to add new operators to NSArray.  | 
| Method Detail | 
public Object compute(NSArray values,
                      String keyPath)
class CountOperator implements NSArray.Operator { CountOperator() {} public Object compute(NSArray values, String keyPath) { return new Integer(values.count()); } }
Performs an operation on the elements in values and returns the result.
 The keyPath argument optionally specifies a particular property of the
 elements in values to perform the operation on.
values - array of input objectskeyPath - property of the elements in values to perform the operation on
  | 
Last updated Mon Oct 13 15:42:52 PDT 2003. | ||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||