Plexus v0.13.1

com.phoenixst.collections
Class CartesianProduct

java.lang.Object
  extended by java.util.AbstractCollection
      extended by com.phoenixst.collections.AbstractUnmodifiableCollection
          extended by com.phoenixst.collections.CartesianProduct
All Implemented Interfaces:
Serializable, Iterable, Collection

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
See Also:
Serialized Form

Method Summary
 Collection getLeftOperand()
           
 Collection getRightOperand()
           
static 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.
static 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.
static 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.
static 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.
 
Methods inherited from class com.phoenixst.collections.AbstractUnmodifiableCollection
addAll, clear, remove, removeAll, retainAll, size
 
Methods inherited from class java.util.AbstractCollection
add, contains, containsAll, isEmpty, iterator, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Method Detail

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.


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.


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.


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.


getLeftOperand

public final Collection getLeftOperand()

getRightOperand

public final Collection getRightOperand()

Plexus v0.13.1

See the Plexus project home, hosted by SourceForge.
Copyright ? 1994-2006, by Phoenix Software Technologists, Inc. and others. All Rights Reserved. Use is subject to license terms.