All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.objectspace.jgl.algorithms.Counting

java.lang.Object
   |
   +----COM.objectspace.jgl.algorithms.Counting

public final class Counting
extends Object
The Counting class contains generic counting algorithms.

See Also:
CountingExamples

Method Index

 o accumulate(Container, Number)
Add the value of each element in a container to an inital value and return the sum.
 o accumulate(Container, Number, BinaryFunction)
Add the value of each element in a container to an inital value and return the sum.
 o accumulate(InputIterator, InputIterator, Number)
Add the value of each element in a range to an inital value and return the sum.
 o accumulate(InputIterator, InputIterator, Number, BinaryFunction)
Add the value of each element in a range to an inital value and return the sum.
 o adjacentDifference(Container, Container)
Iterate through every element in a container and calculate the difference between each element and its preceding element.
 o adjacentDifference(Container, Container, BinaryFunction)
Iterate through every element in a container and calculate the difference between each element and its preceding element.
 o adjacentDifference(Container, OutputIterator)
Iterate through every element in a container and calculate the difference between each element and its preceding element.
 o adjacentDifference(Container, OutputIterator, BinaryFunction)
Iterate through every element in a container and calculate the difference between each element and its preceding element.
 o adjacentDifference(InputIterator, InputIterator, OutputIterator)
Iterate through every element in a range and calculate the difference between each element and its preceding element.
 o adjacentDifference(InputIterator, InputIterator, OutputIterator, BinaryFunction)
Iterate through every element in a range and calculate the difference between each element and its preceding element.
 o count(Container, Object)
Return the number of elements in a container that match a particular object using equals().
 o count(InputIterator, InputIterator, Object)
Return the number of elements in a range that match a particular object using equals().
 o countIf(Container, UnaryPredicate)
Return the number of elements in a container that satisfy a predicate.
 o countIf(InputIterator, InputIterator, UnaryPredicate)
Return the number of elements in a range that satisfy a predicate.

Methods

 o count
 public static int count(InputIterator first,
                         InputIterator last,
                         Object object)
Return the number of elements in a range that match a particular object using equals(). The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
object - The object to count.
Returns:
The number of objects that matched.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o count
 public static int count(Container container,
                         Object object)
Return the number of elements in a container that match a particular object using equals(). The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
object - The object to count.
Returns:
The number of objects that matched.
 o countIf
 public static int countIf(InputIterator first,
                           InputIterator last,
                           UnaryPredicate predicate)
Return the number of elements in a range that satisfy a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
predicate - A unary predicate.
Returns:
The number of objects that matched.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o countIf
 public static int countIf(Container container,
                           UnaryPredicate predicate)
Return the number of elements in a container that satisfy a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
predicate - A unary predicate.
Returns:
The number of objects that matched.
 o accumulate
 public static Number accumulate(InputIterator first,
                                 InputIterator last,
                                 Number init)
Add the value of each element in a range to an inital value and return the sum. All elements the iterators represent must be instances of java.lang.Number. Use COM.objectspace.jgl.functions.PlusNumber( init.getClass() ) to perform the addition.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
Returns:
The number of objects that matched.
Throws: IllegalArgumentException
If the iterators are incompatible.
See Also:
Number, PlusNumber
 o accumulate
 public static Number accumulate(Container container,
                                 Number init)
Add the value of each element in a container to an inital value and return the sum. All elements the iterators represent must be instances of java.lang.Number. Use COM.objectspace.jgl.functions.PlusNumber( init.getClass() ) to perform the addition.

Parameters:
container - The container.
Returns:
The number of objects that matched.
See Also:
Number, PlusNumber
 o accumulate
 public static Number accumulate(InputIterator first,
                                 InputIterator last,
                                 Number init,
                                 BinaryFunction function)
Add the value of each element in a range to an inital value and return the sum. All elements the iterators represent must be instances of java.lang.Number. Use a specified binary function to perform the addition.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
function - A binary function.
Returns:
The number of objects that matched.
Throws: IllegalArgumentException
If the iterators are incompatible.
See Also:
Number
 o accumulate
 public static Number accumulate(Container container,
                                 Number init,
                                 BinaryFunction function)
Add the value of each element in a container to an inital value and return the sum. All elements the iterators represent must be instances of java.lang.Number. Use a specified binary function to perform the addition.

Parameters:
container - The container.
Returns:
The number of objects that matched.
See Also:
Number
 o adjacentDifference
 public static OutputIterator adjacentDifference(InputIterator first,
                                                 InputIterator last,
                                                 OutputIterator result)
Iterate through every element in a range and calculate the difference between each element and its preceding element. Use COM.objectspace.jgl.functions.MinusNumber() to calculate the difference. Assignment back into the original range is allowed.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
result - An iterator positioned at the first element of the output range.
Returns:
An iterator positioned immediately after the last element of the output range.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o adjacentDifference
 public static OutputIterator adjacentDifference(Container input,
                                                 OutputIterator result)
Iterate through every element in a container and calculate the difference between each element and its preceding element. Use COM.objectspace.jgl.functions.MinusNumber() to calculate the difference. Assignment back into the original range is allowed.

Parameters:
input - The input container.
result - An iterator positioned at the first element of the output range.
Returns:
An iterator positioned immediately after the last element of the output range.
 o adjacentDifference
 public static OutputIterator adjacentDifference(Container source,
                                                 Container destination)
Iterate through every element in a container and calculate the difference between each element and its preceding element. Use COM.objectspace.jgl.functions.MinusNumber() to calculate the difference. Assignment back into the original range is allowed.

Parameters:
source - The source container.
destination - The destination container.
Returns:
An iterator positioned immediately after the last element of the output range.
 o adjacentDifference
 public static OutputIterator adjacentDifference(InputIterator first,
                                                 InputIterator last,
                                                 OutputIterator result,
                                                 BinaryFunction function)
Iterate through every element in a range and calculate the difference between each element and its preceding element. Assignment back into the original range is allowed.

Parameters:
first - An iterator positioned at the first element in the range.
last - An iterator positioned immediately after the last element in the range.
result - An iterator positioned at the first element of the output range.
function - A binary function.
Returns:
An iterator positioned immediately after the last element of the output range.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o adjacentDifference
 public static OutputIterator adjacentDifference(Container input,
                                                 OutputIterator result,
                                                 BinaryFunction function)
Iterate through every element in a container and calculate the difference between each element and its preceding element. Assignment back into the original range is allowed.

Parameters:
input - The input container.
result - An iterator positioned at the first element of the output range.
function - A binary function.
Returns:
An iterator positioned immediately after the last element of the output range.
 o adjacentDifference
 public static OutputIterator adjacentDifference(Container source,
                                                 Container destination,
                                                 BinaryFunction function)
Iterate through every element in a container and calculate the difference between each element and its preceding element. Assignment back into the original range is allowed.

Parameters:
source - The source container.
destination - The destination container.
function - A binary function.
Returns:
An iterator positioned immediately after the last element of the output range.

All Packages  Class Hierarchy  This Package  Previous  Next  Index