Package org.apache.commons.rng.sampling
Class CompositeSamplers.SharedStateObjectSamplerFactory.CompositeSharedStateObjectSampler<T>
- java.lang.Object
-
- org.apache.commons.rng.sampling.CompositeSamplers.CompositeSampler<SharedStateObjectSampler<T>>
-
- org.apache.commons.rng.sampling.CompositeSamplers.SharedStateObjectSamplerFactory.CompositeSharedStateObjectSampler<T>
-
- Type Parameters:
T- Type of sample
- All Implemented Interfaces:
ObjectSampler<T>,SharedStateObjectSampler<T>,SharedStateSampler<SharedStateObjectSampler<T>>
- Enclosing class:
- CompositeSamplers.SharedStateObjectSamplerFactory<T>
private static final class CompositeSamplers.SharedStateObjectSamplerFactory.CompositeSharedStateObjectSampler<T> extends CompositeSamplers.CompositeSampler<SharedStateObjectSampler<T>> implements SharedStateObjectSampler<T>
A composite object sampler with shared state support.The source sampler for each sampler is chosen based on a user-defined discrete probability distribution.
-
-
Field Summary
-
Fields inherited from class org.apache.commons.rng.sampling.CompositeSamplers.CompositeSampler
discreteSampler, samplers
-
-
Constructor Summary
Constructors Constructor Description CompositeSharedStateObjectSampler(SharedStateDiscreteSampler discreteSampler, java.util.List<SharedStateObjectSampler<T>> samplers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Tsample()Create an object sample.CompositeSamplers.SharedStateObjectSamplerFactory.CompositeSharedStateObjectSampler<T>withUniformRandomProvider(UniformRandomProvider rng)Create a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.-
Methods inherited from class org.apache.commons.rng.sampling.CompositeSamplers.CompositeSampler
nextSampler
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.commons.rng.sampling.ObjectSampler
samples, samples
-
-
-
-
Constructor Detail
-
CompositeSharedStateObjectSampler
CompositeSharedStateObjectSampler(SharedStateDiscreteSampler discreteSampler, java.util.List<SharedStateObjectSampler<T>> samplers)
- Parameters:
discreteSampler- Discrete sampler to choose the individual sampler to sample.samplers- Collection of samplers to be sampled from.
-
-
Method Detail
-
sample
public T sample()
Description copied from interface:ObjectSamplerCreate an object sample.- Specified by:
samplein interfaceObjectSampler<T>- Returns:
- a sample.
-
withUniformRandomProvider
public CompositeSamplers.SharedStateObjectSamplerFactory.CompositeSharedStateObjectSampler<T> withUniformRandomProvider(UniformRandomProvider rng)
Description copied from interface:SharedStateSamplerCreate a new instance of the sampler with the same underlying state using the given uniform random provider as the source of randomness.- Specified by:
withUniformRandomProviderin interfaceSharedStateSampler<T>- Parameters:
rng- Generator of uniformly distributed random numbers.- Returns:
- the sampler
-
-