CoMa Container Classes

ccc.util
Class MinMax

java.lang.Object
  |
  +--ccc.util.MinMax

public class MinMax
extends Object

A collection of trivial algorithms on containers of ccc package.

Since:
CCC 3.01
Version:
3.01 - April 10th 2003
Author:
Georg Baier
See Also:
ccc

Constructor Summary
MinMax()
           
 
Method Summary
static Iterator max(Container c)
          Find the maximal element in a container.
static Iterator max(Container c, Comparator cmp)
          Find the maximal element in a container with respect to the given ordering.
static Iterator min(Container c)
          Find the minimal element in a container.
static Iterator min(Container c, Comparator cmp)
          Find the minimal element in a container with respect to the given ordering.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MinMax

public MinMax()
Method Detail

max

public static Iterator max(Container c)
Find the maximal element in a container. All objects in the container must be Comparable otherwise a ClassCastException is thrown.

Parameters:
c - container where to search for the maximal element.
Returns:
iterator pointing to the found object or to end of container if the container is empty.
Throws:
ClassCastException - if the object's type prevents them from being compared pairwise.
See Also:
Comparable

max

public static Iterator max(Container c,
                           Comparator cmp)
Find the maximal element in a container with respect to the given ordering. All objects in the container must be Comparable otherwise a ClassCastException is thrown.

Parameters:
c - container where to search for the maximal element.
cmp - comparator giving the ordering of the elements.
Returns:
iterator pointing to the found object or to end of container if the container is empty.
Throws:
ClassCastException - if the object's type prevents them from being compared pairwise.
See Also:
Comparator, Comparable

min

public static Iterator min(Container c)
Find the minimal element in a container. All objects in the container must be Comparable otherwise a ClassCastException is thrown.

Parameters:
c - container where to search for the minimal element.
Returns:
iterator pointing to the found object or to end of container if the container is empty.
Throws:
ClassCastException - if the object's type prevents them from being compared pairwise.
See Also:
Comparable

min

public static Iterator min(Container c,
                           Comparator cmp)
Find the minimal element in a container with respect to the given ordering. All objects in the container must be Comparable otherwise a ClassCastException is thrown.

Parameters:
c - container where to search for the minimal element.
cmp - comparator giving the ordering of the elements.
Returns:
iterator pointing to the found object or to end of container if the container is empty.
Throws:
ClassCastException - if the object's type prevents them from being compared pairwise.
See Also:
Comparator, Comparable

Written for CoMa 2003
Academic Development Version 4.0.0 from Thu, Aug/28/2003

Andreas Fest