All Packages Class Hierarchy This Package Previous Next Index
Class COM.objectspace.jgl.algorithms.Sorting
java.lang.Object
|
+----COM.objectspace.jgl.algorithms.Sorting
- public final class Sorting
- extends Object
The Sorting class contains generic sorting algorithms.
- See Also:
- SortingExamples
-
iterSort(Container)
- Sort the iterators in a container according to their hash code.
-
iterSort(Container, BinaryPredicate)
- Sort the iterators in a container using a comparator.
-
iterSort(ForwardIterator, ForwardIterator)
- Sort the iterators according to their hash code.
-
iterSort(ForwardIterator, ForwardIterator, BinaryPredicate)
- Sort the iterators using a comparator.
-
sort(ForwardIterator, ForwardIterator)
- Sort the elements in a sequence according to their hash code.
-
sort(ForwardIterator, ForwardIterator, BinaryPredicate)
- Sort the elements in a sequence using a comparator.
-
sort(Sequence)
- Sort the elements in a Sequence container according to their hash code.
-
sort(Sequence, BinaryPredicate)
- Sort the elements in a random access container using a comparator.
sort
public static void sort(ForwardIterator first,
ForwardIterator last)
- Sort the elements in a sequence according to their hash code. The object with the
smallest hash code is placed first. The time complexity is O(NlogN) 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.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
sort
public static void sort(ForwardIterator first,
ForwardIterator last,
BinaryPredicate comparator)
- Sort the elements in a sequence using a comparator. The time complexity is O(NlogN)
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.
- comparator - A binary function that returns true if its first operand should be positioned before its second operand.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
sort
public static void sort(Sequence container)
- Sort the elements in a Sequence container according to their hash code. The
object with the smallest hash code is placed first. The time complexity is O(NlogN)
and the space complexity is constant.
- Parameters:
- container - A Sequence container.
sort
public static void sort(Sequence container,
BinaryPredicate comparator)
- Sort the elements in a random access container using a comparator. The time
complexity is O(NlogN) and the space complexity is constant.
- Parameters:
- container - A random access container.
- comparator - A BinaryFunction that returns true if its first operand should be positioned before its second operand.
iterSort
public static Range iterSort(Container container)
- Sort the iterators in a container according to their hash code. The
object with the smallest hash code is placed first. The underlying
container will not be changed, simply the order in which the elements
are visited.
- Parameters:
- container - A container.
- Returns:
- a Range object composed of two ForwardIterators that will
traverse the original range in the desired order.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
iterSort
public static Range iterSort(Container container,
BinaryPredicate comparator)
- Sort the iterators in a container using a comparator. The
object with the smallest hash code is placed first. The underlying
container will not be changed, simply the order in which the elements
are visited.
- Parameters:
- container - A container.
- comparator - A binary function that returns true if its first
operand should be positioned before its second operand.
- Returns:
- a Range object composed of two ForwardIterators that will
traverse the original range in the desired order.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
iterSort
public static Range iterSort(ForwardIterator first,
ForwardIterator last)
- Sort the iterators according to their hash code. The
underlying container will not be changed, simply the order in which
the elements are visited.
- Parameters:
- first - An iterator positioned at the first element.
- last - An iterator positioned immediately after the last element.
- comparator - A binary function that returns true if its first
operand should be positioned before its second operand.
- Returns:
- a Range object composed of two ForwardIterators that will
traverse the original range in the desired order.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
iterSort
public static Range iterSort(ForwardIterator first,
ForwardIterator last,
BinaryPredicate comparator)
- Sort the iterators using a comparator. The underlying container will
not be changed, simply the order in which the elements are visited.
- Parameters:
- first - An iterator positioned at the first element.
- last - An iterator positioned immediately after the last element.
- comparator - A binary function that returns true if its first
operand should be positioned before its second operand.
- Returns:
- a Range object composed of two ForwardIterators that will
traverse the original range in the desired order.
- Throws: IllegalArgumentException
- If the iterators are incompatible
or if the containers upon which the iteratore operate is not a COM.objectspace.jgl.Sequence.
All Packages Class Hierarchy This Package Previous Next Index