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