T
- the type of collection generatedpublic abstract class CollectionGenerator<T extends Collection> extends ComponentizedGenerator<T>
Base class for generators of Collection
s.
The generated collection has a number of elements limited by
GenerationStatus.size()
, or else by the attributes of a Size
marking. The individual elements will have a type corresponding to the
collection's type argument.
Modifier | Constructor and Description |
---|---|
protected |
CollectionGenerator(Class<T> type) |
Modifier and Type | Method and Description |
---|---|
void |
configure(Size size)
Tells this generator to add elements to the generated collection
a number of times within a specified minimum and/or maximum, inclusive,
chosen with uniform distribution.
|
List<T> |
doShrink(SourceOfRandomness random,
T larger) |
protected T |
empty() |
T |
generate(SourceOfRandomness random,
GenerationStatus status) |
int |
numberOfNeededComponents() |
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, componentGenerators, configure, hasComponents, provide
canShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, gen, narrow, shrink, types
public void configure(Size size)
Tells this generator to add elements to the generated collection a number of times within a specified minimum and/or maximum, inclusive, chosen with uniform distribution.
Note that some kinds of collections disallow duplicates, so the
number of elements added may not be equal to the collection's
Collection.size()
.
size
- annotation that gives the size constraintspublic T generate(SourceOfRandomness random, GenerationStatus status)
public List<T> doShrink(SourceOfRandomness random, T larger)
doShrink
in class Generator<T extends Collection>
public int numberOfNeededComponents()
numberOfNeededComponents
in class Generator<T extends Collection>
protected final T empty()
© Copyright 2010-2016 Paul R. Holser, Jr. All rights reserved. Licensed under The MIT License. pholser@alumni.rice.edu