er.extensions.foundation
Class ERXArrayUtilities.MedianOperator
java.lang.Object
er.extensions.foundation.ERXArrayUtilities.MedianOperator
- All Implemented Interfaces:
- NSArray.Operator
- Enclosing class:
- ERXArrayUtilities
public static class ERXArrayUtilities.MedianOperator
- extends Object
Define an NSArray.Operator for the key median.
This allows for key value paths like:
myArray.valueForKey("@median.someMorePath");
which return the median of the array elements at the given key path.
The median is the value for which half of the elements are above and half the elements are below.
As such, an array sort is needed and this might be very costly depending of the size of the array.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ERXArrayUtilities.MedianOperator
public ERXArrayUtilities.MedianOperator()
- public empty constructor
compute
public Object compute(NSArray array,
String keypath)
- returns the median value for the values of the keypath.
- Parameters:
array - array to be checked.keypath - value of reverse.
- Returns:
- reversed array for keypath.
contents
public NSArray contents(NSArray array,
String keypath)
Copyright © 2002 – 2007 Project Wonder.