com.phoenixst.collections

Class CartesianProduct

public abstract class CartesianProduct extends AbstractUnmodifiableCollection implements Serializable

A Collection whose elements are all of the ordered pairs (x, y), where x is from the first delegate collection and y is from the second. Here, the elements are instances of OrderedPair. This class has no public constructors, please use the provided factory methods. If both delegate collections are sets, then this collection will be as well, except that it does not conform to the Set interface with regards to Set#equals(java.lang.Object) and Set#hashCode().

Since: 1.0

Version: $Revision: 1.2 $

Author: Ray A. Conner

Method Summary
CollectiongetLeftOperand()
CollectiongetRightOperand()
static IteratorleftIterator(Collection left, Collection right)
Returns an Iterator over the elements of the product of the specified collections with the left one controlling the outer loop.
static CartesianProductleftProduct(Collection left, Collection right)
Creates and returns a new CartesianProduct of the specified collections with the left one controlling the outer loop of its iterator.
static IteratorrightIterator(Collection left, Collection right)
Returns an Iterator over the elements of the product of the specified collections with the right one controlling the outer loop.
static CartesianProductrightProduct(Collection left, Collection right)
Creates and returns a new CartesianProduct of the specified collections with the right one controlling the outer loop of its iterator.

Method Detail

getLeftOperand

public final Collection getLeftOperand()

getRightOperand

public final Collection getRightOperand()

leftIterator

public static final Iterator leftIterator(Collection left, Collection right)
Returns an Iterator over the elements of the product of the specified collections with the left one controlling the outer loop. This factory method is preferable when the left collection is more expensive to use than the right one.

leftProduct

public static final CartesianProduct leftProduct(Collection left, Collection right)
Creates and returns a new CartesianProduct of the specified collections with the left one controlling the outer loop of its iterator. This factory method is preferable when the left collection is more expensive to use than the right one.

rightIterator

public static final Iterator rightIterator(Collection left, Collection right)
Returns an Iterator over the elements of the product of the specified collections with the right one controlling the outer loop. This factory method is preferable when the right collection is more expensive to use than the left one.

rightProduct

public static final CartesianProduct rightProduct(Collection left, Collection right)
Creates and returns a new CartesianProduct of the specified collections with the right one controlling the outer loop of its iterator. This factory method is preferable when the right collection is more expensive to use than the left one.
See the Plexus project home, hosted by SourceForge.
Copyright B) 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.