[
https://issues.apache.org/jira/browse/RNG-136?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Alex Herbert resolved RNG-136.
------------------------------
Fix Version/s: 1.4
Resolution: Implemented
In master.
Commit: 826b3f69cac3c021519c11effa45a2c6f4a44be0
> ObjectSampler<T> and SharedStateObjectSampler<T> interfaces
> -----------------------------------------------------------
>
> Key: RNG-136
> URL: https://issues.apache.org/jira/browse/RNG-136
> Project: Commons RNG
> Issue Type: New Feature
> Components: sampling
> Affects Versions: 1.4
> Reporter: Alex Herbert
> Assignee: Alex Herbert
> Priority: Major
> Fix For: 1.4
>
> Time Spent: 1h 20m
> Remaining Estimate: 0h
>
> The sampling package currently contains interfaces for creating int and
> double samples and their extensions to implement the SharedStateSampler
> interface:
> {code:java}
> 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
> }
> {code}
> Add a matching ObjectSampler interface for all samplers that create objects:
> {code:java}
> public interface ObjectSampler<T> {
> T sample();
> }
> public interface SharedStateObjectSampler<T> extends
> ObjectSampler<T>,
> SharedStateSampler<SharedStateObjectSampler<T>> {
> // Composite interface
> }
> {code}
> Samplers currently returning an object should implement the new interface:
> {code:java}
> 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()
> {code}
> Only the UnitVectorSampler will require a new {{sample}} method. The current
> {{nextVector}} method can be marked deprecated.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)