helix.graph.util
Class IPermutationIterator

java.lang.Object
  extended by helix.graph.util.IPermutationIterator
All Implemented Interfaces:
Iterator<IPermutation>

public class IPermutationIterator
extends Object
implements Iterator<IPermutation>

An iterator over all possible permutations of 'size' elements. Use in conjunction with the IPermutation class to apply permutation on a list of objects. example: ArrayList lst = new ArrayList(); lst.add("a"); lst.add("b"); lst.add("c"); IPermutationIterator iter = new IPermutationIterator(lst.size()); while (iter.hasNext()) { List permut = iter.next().apply(lst); } The base algorithm is described by Kenneth H. Rosen, Discrete Mathematics and Its Applications, 2nd edition (NY: McGraw-Hill, 1991), pp. 282-284. see : http://www.merriampark.com/perm.htm


Constructor Summary
IPermutationIterator(int size)
          constructor
 
Method Summary
 boolean hasNext()
           
 IPermutation next()
           
 void remove()
          not implemented : throws UnsupportedOperationException
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

IPermutationIterator

public IPermutationIterator(int size)
constructor

Parameters:
size - > 0
Method Detail

hasNext

public boolean hasNext()
Specified by:
hasNext in interface Iterator<IPermutation>

next

public IPermutation next()
Specified by:
next in interface Iterator<IPermutation>

remove

public void remove()
not implemented : throws UnsupportedOperationException

Specified by:
remove in interface Iterator<IPermutation>