net.sourceforge.domian.test.combinatorics
Class Sequence
java.lang.Object
net.sourceforge.domian.test.combinatorics.Sequence
- All Implemented Interfaces:
- java.util.Iterator<int[]>
- Direct Known Subclasses:
- Combination, Permutation
public class Sequence
- extends java.lang.Object
- implements java.util.Iterator<int[]>
This class generates a list with number sequences according to a given length, n
, and number of elements, m
.
The list of number sequences are zero-based.
The number sequences of n
elements chosen from a list of m
elements, are the possible number arrangements where the ordering of elements is taken into consideration.
no: "Urnemodell - Ordnet utvalg med tilbakelegging"
Med "ordnet" menes det at rekkefølgen som elementene er ordnet etter tas hensyn til.
Med "med tilbakelegging" menes det at elementer kan forekomme mer enn én gang.
- Author:
- Eirik Torske
Constructor Summary |
Sequence(int n)
The number of elements to use is set equal to the length of the number sequences. |
Sequence(int m,
int n)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
m
protected final int m
n
protected final int n
S
private long S
sequenceNumber
protected long sequenceNumber
sequence
protected int[] sequence
Sequence
public Sequence(int n)
- The number of elements to use is set equal to the length of the number sequences.
- Parameters:
n
- the length of the number sequences.
Sequence
public Sequence(int m,
int n)
- Parameters:
m
- the number of possible elements to use within each number sequence.n
- the length of the number sequences.
revolveSequence
private void revolveSequence()
calculateTotalNumberOfSequences
protected void calculateTotalNumberOfSequences()
sequenceConstraintOk
protected boolean sequenceConstraintOk()
- Number sequence constraint: None.
hasNext
public boolean hasNext()
- Specified by:
hasNext
in interface java.util.Iterator<int[]>
next
public int[] next()
- Specified by:
next
in interface java.util.Iterator<int[]>
remove
public void remove()
- Specified by:
remove
in interface java.util.Iterator<int[]>
reset
public void reset()
Copyright © 2008-2010. All Rights Reserved.