Description
The sampling package currently contains interfaces for creating int and double samples and their extensions to implement the SharedStateSampler interface:
public interface DiscreteSampler { int sample(); } public interface SharedStateDiscreteSampler extends DiscreteSampler, SharedStateSampler<SharedStateDiscreteSampler> { // Composite interface } public interface ContinuousSampler { double sample(); } public interface SharedStateContinuousSampler extends ContinuousSampler, SharedStateSampler<SharedStateContinuousSampler> { // Composite interface }
Add a matching ObjectSampler interface for all samplers that create objects:
public interface ObjectSampler<T> { T sample(); } public interface SharedStateObjectSampler<T> extends ObjectSampler<T>, SharedStateSampler<SharedStateObjectSampler<T>> { // Composite interface }
Samplers currently returning an object should implement the new interface:
int[] CombinationSampler.sample() int[] PermutationSampler.sample() double[] UnitSphereSampler.nextVector() T CollectionSampler<T>.sample() T DiscreteProbabilityCollectionSampler<T>.sample() double[] BoxSampler.sample() double[] LineSampler.sample() double[] TriangleSampler.sample() double[] TetrahedronSampler.sample() double[] UnitBallSampler.sample()
Only the UnitVectorSampler will require a new sample method. The current nextVector method can be marked deprecated.