Project Wonder 5.0.0.8795

er.extensions.foundation
Class ERXArrayUtilities.AvgNonNullOperator

java.lang.Object
  extended by er.extensions.foundation.ERXArrayUtilities.AvgNonNullOperator
All Implemented Interfaces:
NSArray.Operator
Enclosing class:
ERXArrayUtilities

public static class ERXArrayUtilities.AvgNonNullOperator
extends Object
implements NSArray.Operator

Define an NSArray.Operator for the key avgNonNull.

This allows for key value paths like:

myArray.valueForKey("@avgNonNull.revenue");

which will sum up all values and divide by the number of nun-null entries.


Constructor Summary
ERXArrayUtilities.AvgNonNullOperator()
          public empty constructor
 
Method Summary
 Object compute(NSArray array, String keypath)
          returns the average value for over all non-null values.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXArrayUtilities.AvgNonNullOperator

public ERXArrayUtilities.AvgNonNullOperator()
public empty constructor

Method Detail

compute

public Object compute(NSArray array,
                      String keypath)
returns the average value for over all non-null values.

Specified by:
compute in interface NSArray.Operator
Parameters:
array - array to be checked.
keypath - value of average.
Returns:
computed average as double or NULL.

Last updated: Fri, Jan 9, 2009 • 04:35 AM EST

Copyright © 2002 – 2007 Project Wonder.