org.xshare.base.collections.helpers
Class ForAll

java.lang.Object
  |
  +--org.xshare.base.collections.helpers.ForAll

public final class ForAll
extends java.lang.Object

This class contains some helper methods which perform sometimes needed operations for collections and iterations.

Notes On The Implemenation

Since:
0.20
Version:
$Revision: 1.5.2.1 $
Author:
Oliver Fischer

Method Summary
static boolean and(java.util.Collection aCollection, GetBooleanMethod aAdaptor)
          Returns the conjunction of all boolean values returned by the GetBooleanMethod adaptor for every element of a iteration.
static boolean and(java.util.Iterator aIterator, GetBooleanMethod aAdaptor)
          Returns the conjunction of all boolean values returned by the GetBooleanMethod adaptor for every element of a iteration.
static boolean check(java.util.Collection aCollection, UnaryPredicate aPredicate)
          Checks every object of a given collection, if it satisfies a given condition.
static boolean check(java.util.Iterator aIterator, UnaryPredicate aPredicate)
          Checks every object of a given iteration, if it satisfies a given condition.
static void exec(java.util.Collection aCollection, Closure aOperation)
          Executes the given Closure for every element in the given collection.
static void exec(java.util.Iterator aIteration, Closure aOperation)
          Executes the given Closure for every element in the given iteration.
static boolean or(java.util.Collection aCollection, GetBooleanMethod aAdaptor)
          Returns the boolean conjunction with or of all boolean values returned by the GetBooleanMethod adaptor for every element.
static boolean or(java.util.Iterator aIterator, GetBooleanMethod aAdaptor)
          Returns the boolean conjunction with or of all boolean values returned by the GetBooleanMethod adaptor for every element.
static double sumDouble(java.util.Iterator aIteration, GetDoubleMethod aAdaptor)
          Computes the sum of all double values returned by the GetDoubleMethod adaptor for every element.
static float sumFloat(java.util.Collection aCollection, GetFloatMethod aAdaptor)
          Computes the sum of all float values returned by the GetFloatMethod adaptor for every element.
static float sumFloat(java.util.Iterator aIterator, GetFloatMethod aAdaptor)
          Computes the sum of all float values returned by the GetFloatMethod adaptor for every element.
static int sumInt(java.util.Collection aCollection, GetIntMethod aAdapter)
          Computes the sum of all int values returned by the GetIntMethod adaptor for every element of a given collection.
static int sumInt(java.util.Iterator aIterator, GetIntMethod aAdaptor)
          Computes the sum of all int values returned by the GetIntMethod adaptor for every element of a given iteration.
static long sumLong(java.util.Collection aCollection, GetLongMethod aAdaptor)
          Describe sumLong method here.
static long sumLong(java.util.Iterator aIterator, GetLongMethod aAdaptor)
          Describe sumLong method here.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

exec

public static void exec(java.util.Iterator aIteration,
                        Closure aOperation)
Executes the given Closure for every element in the given iteration.

Parameters:
aOperation - a Closure object representing the operation to execute on every object.
aIteration - an Iterator pointing to the elements to pass to the given operation.

exec

public static void exec(java.util.Collection aCollection,
                        Closure aOperation)
Executes the given Closure for every element in the given collection.

Parameters:
aCollection - a Collection object containing all the elements, which will be passed to the given closure.
aOperation - a Closure object representing the operation to execute on every object.

sumDouble

public static double sumDouble(java.util.Iterator aIteration,
                               GetDoubleMethod aAdaptor)
Computes the sum of all double values returned by the GetDoubleMethod adaptor for every element.

Parameters:
aIteration - an Iterator value
aAdaptor - a GetDoubleMethod value
Returns:
a double value containing the sum of all accessed double values.
Throws:
OverRunException - if the result becomes larger then Double.MAX_VALUE.

sumInt

public static int sumInt(java.util.Collection aCollection,
                         GetIntMethod aAdapter)
Computes the sum of all int values returned by the GetIntMethod adaptor for every element of a given collection.

Parameters:
aCollection - a Collection value
aAdapter - a GetIntMethod value
Returns:
a int value containing the sum of all accessed int values.
Throws:
OverRunException - if the result becomes larger then Integer.MAX_VALUE.

sumInt

public static int sumInt(java.util.Iterator aIterator,
                         GetIntMethod aAdaptor)
Computes the sum of all int values returned by the GetIntMethod adaptor for every element of a given iteration.

Parameters:
aIterator - an Iterator value
aAdaptor - a GetIntMethod value
Returns:
a int value containing the sum of all accessed int values.
Throws:
OverRunException - if the result becomes larger then Integer.MAX_VALUE.

sumLong

public static long sumLong(java.util.Iterator aIterator,
                           GetLongMethod aAdaptor)
Describe sumLong method here.

Parameters:
aIterator - an Iterator value
aAdaptor - a GetLongMethod value
Returns:
a long value

sumLong

public static long sumLong(java.util.Collection aCollection,
                           GetLongMethod aAdaptor)
Describe sumLong method here.

Parameters:
aCollection - a Collection value
aAdaptor - a GetLongMethod value
Returns:
a long value

sumFloat

public static float sumFloat(java.util.Iterator aIterator,
                             GetFloatMethod aAdaptor)
Computes the sum of all float values returned by the GetFloatMethod adaptor for every element.

Parameters:
aIterator - an Iterator value
aAdaptor - a GetFloatMethod value
Returns:
a float value containing the sum of all accessed float values.
Throws:
OverRunException - if the result becomes larger then Float.MAX_VALUE.

sumFloat

public static float sumFloat(java.util.Collection aCollection,
                             GetFloatMethod aAdaptor)
Computes the sum of all float values returned by the GetFloatMethod adaptor for every element.

Parameters:
aCollection - a Collection value
aAdaptor - a GetFloatMethod value
Returns:
a float value containing the sum of all accessed float values.
Throws:
OverRunException - if the result becomes larger then Float.MAX_VALUE.

check

public static boolean check(java.util.Collection aCollection,
                            UnaryPredicate aPredicate)
Checks every object of a given collection, if it satisfies a given condition. This condition has to be expressed as a UnaryPredicate.

Parameters:
aCollection - a Collection value
aPredicate - an UnaryPredicate value
Returns:
a boolean value

check

public static boolean check(java.util.Iterator aIterator,
                            UnaryPredicate aPredicate)
Checks every object of a given iteration, if it satisfies a given condition. This condition has to be expressed as a UnaryPredicate.

Parameters:
aIterator - an Iterator value
aPredicate - an UnaryPredicate value
Returns:
a boolean value

and

public static boolean and(java.util.Iterator aIterator,
                          GetBooleanMethod aAdaptor)
Returns the conjunction of all boolean values returned by the GetBooleanMethod adaptor for every element of a iteration.

Parameters:
aIterator - an Iterator value
aAdaptor - a GetBooleanMethod value
Returns:
a boolean value containing the result of this conjunction.

and

public static boolean and(java.util.Collection aCollection,
                          GetBooleanMethod aAdaptor)
Returns the conjunction of all boolean values returned by the GetBooleanMethod adaptor for every element of a iteration.

Parameters:
aCollection - a Collection value
aAdaptor - a GetBooleanMethod value
Returns:
a boolean value containing the result of this conjunction.

or

public static boolean or(java.util.Collection aCollection,
                         GetBooleanMethod aAdaptor)
Returns the boolean conjunction with or of all boolean values returned by the GetBooleanMethod adaptor for every element.

Parameters:
aCollection - a Collection value
aAdaptor - a GetBooleanMethod value
Returns:
a boolean value containing the result of this or conjuntion.

or

public static boolean or(java.util.Iterator aIterator,
                         GetBooleanMethod aAdaptor)
Returns the boolean conjunction with or of all boolean values returned by the GetBooleanMethod adaptor for every element.

Parameters:
aIterator - an Iterator value
aAdaptor - a GetBooleanMethod value
Returns:
a boolean value containing the result of this or conjuntion.


jKiska Base 0.2.1 Release Esche [http://jkiska.sourceforge.net]