Class OptionalDoubleGenerator
java.lang.Object
com.pholser.junit.quickcheck.generator.Generator<OptionalDouble>
com.pholser.junit.quickcheck.generator.java.util.OptionalDoubleGenerator
- All Implemented Interfaces:
Gen<OptionalDouble>,Shrink<OptionalDouble>
Produces values of type
OptionalDouble.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidTells this generator to produce values, whenpresent, within a specified minimum (inclusive) and/or maximum (exclusive) with uniform distribution.doShrink(SourceOfRandomness random, OptionalDouble larger) Gives some objects that are "smaller" than a given "larger" object.generate(SourceOfRandomness random, GenerationStatus status) Generates a value, possibly influenced by a source of randomness and metadata about the generation.Gives a hint to the shrinking process as to the magnitude of the given value.Methods inherited from class com.pholser.junit.quickcheck.generator.Generator
addComponentGenerators, canGenerateForParametersOfTypes, canRegisterAsType, canShrink, compatibleWithTypeParameter, configurationAnnotationsOn, configure, configure, copy, gen, gen, hasComponents, narrow, numberOfNeededComponents, provide, shrink, types
-
Field Details
-
doubles
-
-
Constructor Details
-
OptionalDoubleGenerator
public OptionalDoubleGenerator()
-
-
Method Details
-
configure
Tells this generator to produce values, whenpresent, within a specified minimum (inclusive) and/or maximum (exclusive) with uniform distribution.InRange.min()andInRange.max()take precedence overInRange.minDouble()andInRange.maxDouble(), if non-empty.- Parameters:
range- annotation that gives the range's constraints
-
generate
Description copied from interface:GenGenerates a value, possibly influenced by a source of randomness and metadata about the generation.- Parameters:
random- source of randomness to be used when generating the valuestatus- an object that can be used to influence the generated value. For example, generating lists can use thesizemethod to generate lists with a given number of elements.- Returns:
- the generated value
-
doShrink
Description copied from class:GeneratorGives some objects that are "smaller" than a given "larger" object.
Unless overridden, a generator will produce an empty list of "smaller" values.
- Overrides:
doShrinkin classGenerator<OptionalDouble>- Parameters:
random- source of randomness to use in shrinking, if desiredlarger- the larger object- Returns:
- objects that are "smaller" than the larger object. Smaller objects should be provided before bigger objects to make shrinking process faster.
-
magnitude
Description copied from class:GeneratorGives a hint to the shrinking process as to the magnitude of the given value. The shrinking process will prefer trying values of greater magnitude before values of lesser magnitude. If not overridden, this implementation returns "one".
Note to generator writers: Do not worry about normalizing a magnitude to a positive value; the shrinking mechanism will take care of it.
- Overrides:
magnitudein classGenerator<OptionalDouble>- Parameters:
value- the value to assess- Returns:
- a measure of the given value's magnitude
- See Also:
-