|
CoCoME System Tests | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.cocome.tradingsystem.systests.util.ProductGenerator
public class ProductGenerator
This class is used to generate random but reproducable products.
| Field Summary | |
|---|---|
private static java.lang.String |
ALPHA
Available alphabet for product name generation. |
private IEnterprise |
enterprise
The enterprise used for creating products. |
private java.util.List<GeneratedProduct> |
generatedProducts
A list of all products generated so far. |
private java.util.Random |
rng
The random number generator used. |
private java.util.Set<java.lang.Integer> |
usedBarcodes
The set of used barcodes to avoid repetition. |
private java.util.Set<java.lang.String> |
usedNames
The set of used names to avoid repetition. |
| Constructor Summary | |
|---|---|
ProductGenerator(long randomSeed,
IEnterprise enterprise)
Construct a new product generator. |
|
| Method Summary | |
|---|---|
int |
generate()
Generate a single random product. |
void |
generate(int n)
Generate the given number of random products. |
GeneratedProduct |
getGeneratedProduct(int i)
Returns the product generated when i products had been
generated already. |
int |
getNumberOfProducts()
Returns the number of products generated so far. |
int |
getUnusedBarcode()
Returns a new barcode which is not already used for any product. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.lang.String ALPHA
private final java.util.Random rng
private final IEnterprise enterprise
private final java.util.Set<java.lang.Integer> usedBarcodes
private final java.util.Set<java.lang.String> usedNames
private final java.util.List<GeneratedProduct> generatedProducts
| Constructor Detail |
|---|
public ProductGenerator(long randomSeed,
IEnterprise enterprise)
randomSeed - the random seed used for initializing the random number
generator.enterprise - the enterprise used for creating products.| Method Detail |
|---|
public int getNumberOfProducts()
public GeneratedProduct getGeneratedProduct(int i)
i products had been
generated already.
public void generate(int n)
throws java.lang.Exception
java.lang.Exception
public int generate()
throws java.lang.Exception
java.lang.Exceptionpublic int getUnusedBarcode()
|
CoCoME System Tests | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||