| Modifier and Type | Field and Description |
|---|---|
| private final int[] | |
| private final List | |
| private BigInteger | |
| private final BigInteger |
| Access | Constructor and Description |
|---|---|
| public | |
| public |
| Modifier and Type | Method and Description |
|---|---|
| private static BigInteger | Returns: the factorial for nthe input integer n)Compute factorial (TODO: expose this) |
| public BigInteger | |
| public boolean | |
| public List | Returns: the items permutedImplements java. |
| public void | remove()
Overrides default java. |
| public void |
| a | back to summary |
|---|---|
| private final int[] a | |
| items | back to summary |
|---|---|
| private final List<E> items | |
| numLeft | back to summary |
|---|---|
| private BigInteger numLeft | |
| total | back to summary |
|---|---|
| private final BigInteger total | |
| PermutationGenerator | back to summary |
|---|---|
| public PermutationGenerator(Collection<E> items) Warning Don't make n too large. Recall that the number of permutations is n! which can be very large, even when n is as small as 20 -- 20! = 2,432,902,008,176,640,000 and 21! is too big to fit into a Java long, which is why we use BigInteger instead.
| |
| PermutationGenerator | back to summary |
|---|---|
| public PermutationGenerator(Iterable<E> items) | |
| getFactorial | back to summary |
|---|---|
| private static BigInteger getFactorial(int n) Compute factorial (TODO: expose this)
| |
| getTotal | back to summary |
|---|---|
| public BigInteger getTotal() | |
| hasNext | back to summary |
|---|---|
| public boolean hasNext() Implements java. Doc from java. Returns
| |
| next | back to summary |
|---|---|
| public List Implements java. Generate next permutation (algorithm from Rosen p. 284)
| |
| remove | back to summary |
|---|---|
| public void remove() Overrides default java. Doc from java. Removes from the underlying collection the last element returned
by this iterator (optional operation). This method can be called
only once per call to The behavior of an iterator is unspecified if the underlying collection is modified while the iteration is in progress in any way other than by calling this method, unless an overriding class has specified a concurrent modification policy.
The behavior of an iterator is unspecified if this method is called
after a call to the | |
| reset | back to summary |
|---|---|
| public void reset() | |