Prog1Tools
Class Permutation

java.lang.Object
  extended by Prog1Tools.Permutation
All Implemented Interfaces:
PermutationSpec

public class Permutation
extends java.lang.Object
implements PermutationSpec

Klasse zum Erzeugen von Permutationen.

Version:
1.0
Author:
hagen.buchwald@kit.edu

Constructor Summary
Permutation(int n)
          Konstruktor.
 
Method Summary
 long getFactorial(int n)
          Abfrage der Fakutltaet von n
 int[] getNext()
          Kommando, die naechste Permutation zu erzeugen.
 long getNumLeft()
          Abfrage der noch ausstehenden Permutationen.
 long getTotal()
          Abfrage der Gesamtanzahl der Permutationen.
 boolean hasMore()
          Abfrage, ob noch weitere Permutationen ausstehen.
 void reset()
          Kommando, die Permutationen wieder von vorn zu beginnen.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Permutation

public Permutation(int n)
Konstruktor.

Parameters:
n - Laenge des Indizes-Feldes a, das erzeugt und permutiert werden soll.
Method Detail

reset

public void reset()
Description copied from interface: PermutationSpec
Kommando, die Permutationen wieder von vorn zu beginnen.

Specified by:
reset in interface PermutationSpec

getNumLeft

public long getNumLeft()
Description copied from interface: PermutationSpec
Abfrage der noch ausstehenden Permutationen.

Specified by:
getNumLeft in interface PermutationSpec

getTotal

public long getTotal()
Description copied from interface: PermutationSpec
Abfrage der Gesamtanzahl der Permutationen.

Specified by:
getTotal in interface PermutationSpec

hasMore

public boolean hasMore()
Description copied from interface: PermutationSpec
Abfrage, ob noch weitere Permutationen ausstehen.

Specified by:
hasMore in interface PermutationSpec

getFactorial

public long getFactorial(int n)
Description copied from interface: PermutationSpec
Abfrage der Fakutltaet von n

Specified by:
getFactorial in interface PermutationSpec
Parameters:
n - Wert, fuer den die Fakutltaet berechnet werden soll.

getNext

public int[] getNext()
Description copied from interface: PermutationSpec
Kommando, die naechste Permutation zu erzeugen. Quelle: Kenneth H. Rosen, Discrete Mathematics and Its Applications, 2nd edition (NY: McGraw-Hill, 1991), pp. 282-284.

Specified by:
getNext in interface PermutationSpec