Project Wonder 5.0.0.8795

er.extensions.foundation
Class ERXArrayUtilities.MedianOperator

java.lang.Object
  extended by 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.


Constructor Summary
ERXArrayUtilities.MedianOperator()
          public empty constructor
 
Method Summary
 Object compute(NSArray array, String keypath)
          returns the median value for the values of the keypath.
 NSArray contents(NSArray array, String keypath)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ERXArrayUtilities.MedianOperator

public ERXArrayUtilities.MedianOperator()
public empty constructor

Method Detail

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)

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

Copyright © 2002 – 2007 Project Wonder.