Alex Herbert created RNG-136:
--------------------------------
Summary: 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
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}
double[] CombinationSampler.sample()
double[] PermutationSampler.sample()
double[] UnitVectorSampler.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)