|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsamples.random.RandomListGenerator
public abstract class RandomListGenerator
This class allows generating integer random lists. A random list is formed of fixed-size tuples, the values of which range from 0 to a limit given by the user. When generating random lists, it is possible to indicate:
Nested Class Summary | |
---|---|
static class |
RandomListGenerator.Structure
|
Field Summary | |
---|---|
protected int[] |
fixedTuple
A particular tuple, which if not null , must or must not belong to the generated lists. |
protected static Logger |
LOGGER
|
protected int |
nbMaxValues
The maximum number of values for the elements of the generated tuples. |
protected int[] |
nbOccurences
The number of occurrences of each value in the generated lists. |
protected int[] |
nbValues
The number of values for each element of the tuples of the generated lists. |
protected Random |
random
The Random object used to generate lists. |
protected boolean |
requiredFixedTuple
Indicates if the fixed tuple, if not null , must or must not belong to the generated lists. |
protected long |
seed
The seed used to generate random numbers. |
protected int |
tupleLength
The length of each tuple of the generated lists. |
protected boolean |
tupleRepetition
Indicates if the same tuple can occur several times in the generated lists. |
protected int[][] |
tuples
The generated tuples. |
protected RandomListGenerator.Structure |
type
The type of the generated lists which can be UNSTRUCTURED, CONNECTED or BALANCED. |
protected boolean |
valueRepetition
Indicates if the same value can occur several times in a generated tuple. |
Constructor Summary | |
---|---|
RandomListGenerator(int[] nbValues,
long seed)
Builds a random list generator. |
|
RandomListGenerator(int nb,
int tupleLength,
long seed)
Builds a random list generator. |
Method Summary | |
---|---|
protected static double |
cnp(int n,
int p)
Returns the number of combinations of p elements chosen among n elements. |
static double |
computeNbArrangementsFrom(int[] t)
|
static double |
computeNbCombinationsFrom(int[] t)
|
static double |
computeNbCombinationsFrom(int[] t,
int i,
int j)
|
protected double |
computeNbDistinctTuples()
Reurns the number of distinct tuples (hence, we do not take into account tuple repetition). |
void |
displayTuples()
Displays the current random generated list. |
protected String |
getSelectionDescription()
|
int[][] |
getTuples()
Returns the generated tuples. |
void |
saveElements()
Saves the current generated list in a file. |
void |
setParameters(RandomListGenerator.Structure type,
boolean tupleRepetition,
boolean valueRepetition,
int[] fixedTuple,
boolean requiredFixedTuple)
Sets the parameters used to generate random lists. |
protected void |
updateNbValueOccurencesFor(int[] tuple)
Updates the number of occurrences of each value in the given tuple |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final Logger LOGGER
protected Random random
Random
object used to generate lists.
protected long seed
protected int[] nbValues
{0,1,...,n-1}
.
protected int tupleLength
protected RandomListGenerator.Structure type
protected boolean tupleRepetition
protected boolean valueRepetition
protected int[][] tuples
protected int[] fixedTuple
null
, must or must not belong to the generated lists.
protected boolean requiredFixedTuple
null
, must or must not belong to the generated lists.
protected int[] nbOccurences
protected int nbMaxValues
Constructor Detail |
---|
public RandomListGenerator(int[] nbValues, long seed)
nbValues
- the number of values for each element of the tuplesseed
- the seed used to generate random numberspublic RandomListGenerator(int nb, int tupleLength, long seed)
nb
- the uniform number of values used to build tuplestupleLength
- the length of each tupleseed
- the seed used to generate random numbersMethod Detail |
---|
public int[][] getTuples()
public void setParameters(RandomListGenerator.Structure type, boolean tupleRepetition, boolean valueRepetition, int[] fixedTuple, boolean requiredFixedTuple)
type
- the type of the generated lists which can be UNSTRUCTURED, CONNECTED or BALANCEDtupleRepetition
- indicates if the same tuple can occur several times in the generated listsvalueRepetition
- indicates if the same value can occur several times in a generated tuplefixedTuple
- a particular tuple, which if not null
, must or must not belong to the generated listsrequiredFixedTuple
- indicates if the fixed tuple, if not null
, must or must not belong to the generated listsprotected void updateNbValueOccurencesFor(int[] tuple)
tuple
- a generated tupleprotected static double cnp(int n, int p)
n
- the number of elements that can be selectedp
- the number of elements to select
public static double computeNbArrangementsFrom(int[] t)
public static double computeNbCombinationsFrom(int[] t, int i, int j)
public static double computeNbCombinationsFrom(int[] t)
protected double computeNbDistinctTuples()
protected String getSelectionDescription()
public void saveElements()
public void displayTuples()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |