samples.random
Class ProportionRandomListGenerator

java.lang.Object
  extended by samples.random.RandomListGenerator
      extended by samples.random.ProportionRandomListGenerator
Direct Known Subclasses:
CoarseProportionRandomListGenerator

public abstract class ProportionRandomListGenerator
extends RandomListGenerator

This class allows generating integer random lists using a proportion model. A given fixed number of tuples is randomly generated.


Nested Class Summary
 
Nested classes/interfaces inherited from class samples.random.RandomListGenerator
RandomListGenerator.Structure
 
Field Summary
protected  int nbAllowedOverflows
          The number of allowed overflows wrt the maximum number of occurences of each value.
protected  int nbCurrentOverflows
          The current number of overflows wrt the maximum number of occurences of each value.
protected  int nbMaxOccurences
          The maximum number of occurences of each value.
protected  int nbWishedOccurences
          The wished number of occurences of each value.
protected static int OCCURENCES_LIMIT
           
 
Fields inherited from class samples.random.RandomListGenerator
fixedTuple, LOGGER, nbMaxValues, nbOccurences, nbValues, random, requiredFixedTuple, seed, tupleLength, tupleRepetition, tuples, type, valueRepetition
 
Constructor Summary
ProportionRandomListGenerator(int[] nbValues, long seed)
          Builds a proportion random list generator.
ProportionRandomListGenerator(int nb, int tupleLength, long seed)
          Builds a proportion random list generator.
 
Method Summary
 void displayTuples()
          Displays the current random generated list.
protected  void fixLimits(RandomListGenerator.Structure type)
          Fixes some limits, according to the given type, about the generation of tuples.
protected abstract  void makeSelection()
          Makes the selection of the given number of tuples.
protected  boolean mustTupleWait(int[] tuple)
          Determines if the given tuple can be currently selected.
protected  boolean mustValueWait(int value)
          Determines (according to some selection constraints) if the given value can be currently selected.
protected  void restoreNbOccurrences()
          Restores the current number of occurences of each value and the current number of overflows.
 int[][] selectTuples(int nbTuples, RandomListGenerator.Structure type, boolean tupleRepetition, boolean valueRepetition)
          Generates and returns a random list.
 int[][] selectTuples(int nbTuples, RandomListGenerator.Structure type, boolean tupleRepetition, boolean valueRepetition, int[] fixedTuple, boolean requiredFixedTuple)
          Generates and returns a random list.
protected  void storeNbOccurrences()
          Saves the current number of occurences of each value and the current number of overflows.
 
Methods inherited from class samples.random.RandomListGenerator
cnp, computeNbArrangementsFrom, computeNbCombinationsFrom, computeNbCombinationsFrom, computeNbDistinctTuples, getSelectionDescription, getTuples, saveElements, setParameters, updateNbValueOccurencesFor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OCCURENCES_LIMIT

protected static final int OCCURENCES_LIMIT
See Also:
Constant Field Values

nbWishedOccurences

protected int nbWishedOccurences
The wished number of occurences of each value.


nbMaxOccurences

protected int nbMaxOccurences
The maximum number of occurences of each value.


nbAllowedOverflows

protected int nbAllowedOverflows
The number of allowed overflows wrt the maximum number of occurences of each value.


nbCurrentOverflows

protected int nbCurrentOverflows
The current number of overflows wrt the maximum number of occurences of each value.

Constructor Detail

ProportionRandomListGenerator

public ProportionRandomListGenerator(int[] nbValues,
                                     long seed)
Builds a proportion random list generator.

Parameters:
nbValues - the number of values for each element of the tuples
seed - the seed used to generate random numbers

ProportionRandomListGenerator

public ProportionRandomListGenerator(int nb,
                                     int tupleLength,
                                     long seed)
Builds a proportion random list generator.

Parameters:
nb - the uniform number of values used to build tuples
tupleLength - the length of each tuple
seed - the seed used to generate random numbers
Method Detail

storeNbOccurrences

protected void storeNbOccurrences()
Saves the current number of occurences of each value and the current number of overflows.


restoreNbOccurrences

protected void restoreNbOccurrences()
Restores the current number of occurences of each value and the current number of overflows.


fixLimits

protected void fixLimits(RandomListGenerator.Structure type)
Fixes some limits, according to the given type, about the generation of tuples.

Parameters:
type - the type of the generated lists which can be UNSTRUCTURED, CONNECTED or BALANCED

mustValueWait

protected boolean mustValueWait(int value)
Determines (according to some selection constraints) if the given value can be currently selected.

Parameters:
value - a given value
Returns:
false iff the given value can be currently put in a tuple.

mustTupleWait

protected boolean mustTupleWait(int[] tuple)
Determines if the given tuple can be currently selected.

Parameters:
tuple - the given tuple
Returns:
false iff the given value can be currently put in a tuple

makeSelection

protected abstract void makeSelection()
Makes the selection of the given number of tuples.


selectTuples

public int[][] selectTuples(int nbTuples,
                            RandomListGenerator.Structure type,
                            boolean tupleRepetition,
                            boolean valueRepetition,
                            int[] fixedTuple,
                            boolean requiredFixedTuple)
Generates and returns a random list.

Parameters:
nbTuples - the number of tuples to be selected
type - the type of the generated lists which can be UNSTRUCTURED, CONNECTED or BALANCED
tupleRepetition - indicates if the same tuple can occur several times in the generated lists
valueRepetition - indicates if the same value can occur several times in a generated tuple
fixedTuple - a particular tuple, which if not null , must or must not belong to the generated lists
requiredFixedTuple - indicates if the fixed tuple, if not null , must or must not belong to the generated lists
Returns:
a random generated list

selectTuples

public int[][] selectTuples(int nbTuples,
                            RandomListGenerator.Structure type,
                            boolean tupleRepetition,
                            boolean valueRepetition)
Generates and returns a random list.

Parameters:
nbTuples - the number of tuples to be selected
type - the type of the generated lists which can be UNSTRUCTURED, CONNECTED or BALANCED
tupleRepetition - indicates if the same tuple can occur several times in the generated lists
valueRepetition - indicates if the same value can occur several times in a generated tuple
Returns:
a random generated list

displayTuples

public void displayTuples()
Description copied from class: RandomListGenerator
Displays the current random generated list.

Overrides:
displayTuples in class RandomListGenerator


Copyright © 2012. All Rights Reserved.