net.sourceforge.domian.test.combinatorics
Class Permutation

java.lang.Object
  extended by net.sourceforge.domian.test.combinatorics.Sequence
      extended by net.sourceforge.domian.test.combinatorics.Permutation
All Implemented Interfaces:
java.util.Iterator<int[]>

public class Permutation
extends Sequence

This class generates a list with number permutations according to a given length, n, and number of elements, m. The permuation list are zero-based.

The permutations of n elements chosen from a list of m elements, are the possible arrangements where each element only can appear once and the ordering of elements is taken into consideration.

no: "Urnemodell - Ordnet utvalg uten tilbakelegging"

Med "ordnet" menes det at rekkefølgen som elementene er ordnet etter tas hensyn til.
Med "uten tilbakelegging" menes det at ingen elementer kan forekomme mer enn én gang.

Author:
Eirik Torske

Field Summary
private  long P
           
 
Fields inherited from class net.sourceforge.domian.test.combinatorics.Sequence
m, n, sequence, sequenceNumber
 
Constructor Summary
Permutation(int n)
           
Permutation(int m, int n)
           
 
Method Summary
protected  void calculateTotalNumberOfSequences()
           
 boolean hasNext()
           
protected  boolean sequenceConstraintOk()
          Permutation constraint: No numbers in the number sequence can be similar.
 
Methods inherited from class net.sourceforge.domian.test.combinatorics.Sequence
next, remove, reset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

P

private long P
Constructor Detail

Permutation

public Permutation(int n)

Permutation

public Permutation(int m,
                   int n)
Method Detail

calculateTotalNumberOfSequences

protected void calculateTotalNumberOfSequences()
Overrides:
calculateTotalNumberOfSequences in class Sequence

sequenceConstraintOk

protected boolean sequenceConstraintOk()
Permutation constraint: No numbers in the number sequence can be similar.

Overrides:
sequenceConstraintOk in class Sequence

hasNext

public boolean hasNext()
Specified by:
hasNext in interface java.util.Iterator<int[]>
Overrides:
hasNext in class Sequence


Copyright © 2008-2010. All Rights Reserved.