All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class COM.objectspace.jgl.algorithms.Finding

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

public final class Finding
extends Object
The Finding class contains generic Finding algorithms.

See Also:
FindingExamples

Method Index

 o adjacentFind(Container)
Find the first consecutive sequence of elements that match using equals().
 o adjacentFind(Container, BinaryPredicate)
Find the first consecutive sequence of elements that match using a predicate.
 o adjacentFind(InputIterator, InputIterator)
Find the first consecutive sequence of elements that match using equals().
 o adjacentFind(InputIterator, InputIterator, BinaryPredicate)
Find the first consecutive sequence of elements that match using a predicate.
 o detect(Container, UnaryPredicate)
Return the first object in a container that satisfies a specified predicate, or null if no such object exists.
 o detect(ForwardIterator, ForwardIterator, UnaryPredicate)
Return the first object in a range that satisfies a specified predicate, or null if no such object exists.
 o every(Container, UnaryPredicate)
Return true if every object in the container satisfies a particular predicate.
 o every(ForwardIterator, ForwardIterator, UnaryPredicate)
Return true if every object in the specified range satisfies a particular predicate.
 o find(Container, Object)
Find the first element in a container that matches a particular object using equals().
 o find(InputIterator, InputIterator, Object)
Find the first element in a sequence that matches a particular object using equals().
 o findIf(Container, UnaryPredicate)
Find the first element in a container that satisfies a predicate.
 o findIf(InputIterator, InputIterator, UnaryPredicate)
Find the first element in a sequence that satisfies a predicate.
 o some(Container, UnaryPredicate)
Return true if at least one object in the container satisfies the specified unary predicate.
 o some(ForwardIterator, ForwardIterator, UnaryPredicate)
Return true if at least one object in the given range satisfies the specified unary predicate.

Methods

 o find
 public static InputIterator find(InputIterator first,
                                  InputIterator last,
                                  Object object)
Find the first element in a sequence that matches 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 of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
object - The object to find.
Returns:
An iterator positioned at the first element that matches. If no match is found, return an iterator positioned immediately after the last element of the sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o find
 public static InputIterator find(Container container,
                                  Object object)
Find the first element in a container that matches a particular object using equals(). The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
object - The object to find.
Returns:
An iterator positioned at the first element that matches. If no match is found, return an iterator positioned immediately after the last element of the container.
 o findIf
 public static InputIterator findIf(InputIterator first,
                                    InputIterator last,
                                    UnaryPredicate predicate)
Find the first element in a sequence that satisfies a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
predicate - A unary predicate.
Returns:
An iterator positioned at the first element that matches. If no match is found, return an iterator positioned immediately after the last element of the sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o findIf
 public static InputIterator findIf(Container container,
                                    UnaryPredicate predicate)
Find the first element in a container that satisfies a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container.
predicate - A unary predicate.
Returns:
An iterator positioned at the first element that matches. If no match is found, return an iterator positioned immediately after the last element of the sequence.
 o adjacentFind
 public static InputIterator adjacentFind(InputIterator first,
                                          InputIterator last)
Find the first consecutive sequence of elements that match using equals(). The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
Returns:
An iterator positioned at the first element in the consecutive sequence. If no consecutive sequence is found, return an iterator positioned immediately after the last element of the input sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o adjacentFind
 public static InputIterator adjacentFind(Container container)
Find the first consecutive sequence of elements that match using equals(). The time complexity is linear and the space complexity is constant.

Parameters:
container - The container to search.
Returns:
An iterator positioned at the first element in the consecutive sequence. If no consecutive sequence is found, return an iterator positioned immediately after the last element of the container.
 o adjacentFind
 public static InputIterator adjacentFind(InputIterator first,
                                          InputIterator last,
                                          BinaryPredicate predicate)
Find the first consecutive sequence of elements that match using a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
first - An iterator positioned at the first element of the sequence.
last - An iterator positioned immediately after the last element of the sequence.
predicate - A binary predicate.
Returns:
An iterator positioned at the first element in the consecutive sequence. If no consecutive sequence is found, return an iterator positioned immediately after the last element of the input sequence.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o adjacentFind
 public static InputIterator adjacentFind(Container container,
                                          BinaryPredicate predicate)
Find the first consecutive sequence of elements that match using a predicate. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container to search.
predicate - A binary predicate.
Returns:
An iterator positioned at the first element in the consecutive sequence. If no consecutive sequence is found, return an iterator positioned immediately after the last element of the container.
 o detect
 public static Object detect(ForwardIterator first,
                             ForwardIterator last,
                             UnaryPredicate predicate)
Return the first object in a range that satisfies a specified predicate, or null if no such object exists. 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 first object that causes the predicate to return true.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o detect
 public static Object detect(Container container,
                             UnaryPredicate predicate)
Return the first object in a container that satisfies a specified predicate, or null if no such object exists. The time complexity is linear and the space complexity is constant.

Parameters:
container - The container to search.
predicate - A unary predicate.
Returns:
The first object that causes the predicate to return true.
Throws: IllegalArgumentException
If the iterator containers are different.
 o some
 public static boolean some(ForwardIterator first,
                            ForwardIterator last,
                            UnaryPredicate predicate)
Return true if at least one object in the given range satisfies the specified unary 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:
true if at least one object satisfies the predicate.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o some
 public static boolean some(Container container,
                            UnaryPredicate predicate)
Return true if at least one object in the container satisfies the specified unary predicate. The time complexity is linear and the space complexity is constant.

Parameters:
container - A container to search
predicate - A unary predicate.
Returns:
true if at least one object satisfies the predicate.
 o every
 public static boolean every(ForwardIterator first,
                             ForwardIterator last,
                             UnaryPredicate predicate)
Return true if every object in the specified range satisfies a particular 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:
true if all objects satisfy the predicate.
Throws: IllegalArgumentException
If the iterators are incompatible.
 o every
 public static boolean every(Container container,
                             UnaryPredicate predicate)
Return true if every object in the container satisfies a particular predicate. The time complexity is linear and the space complexity is constant.

Parameters:
container - A container to search
predicate - A unary predicate.
Returns:
true if all objects satisfy the predicate.

All Packages  Class Hierarchy  This Package  Previous  Next  Index