Alex Herbert created RNG-126:
--------------------------------

             Summary: PoissonSamplerCache to return a SharedStateDiscreteSampler
                 Key: RNG-126
                 URL: https://issues.apache.org/jira/browse/RNG-126
             Project: Commons RNG
          Issue Type: Improvement
          Components: sampling
    Affects Versions: 1.3
            Reporter: Alex Herbert
            Assignee: Alex Herbert


The {{PoissonSamplerCache}} method:

{code:java}
public DiscreteSampler createPoissonSampler(UniformRandomProvider rng,
                                            double mean) {
{code}

Can now be:

{code:java}
public SharedStateDiscreteSampler createPoissonSampler(UniformRandomProvider 
rng,
                                                       double mean) {
{code}

This works with no other code changes but breaks binary compatibility as the 
return type, although a sub-interface, is different.

The solution is to create a new method:
{code:java}
public SharedStateDiscreteSampler createSharedStateSampler(
    UniformRandomProvider rng, 
    double mean) {
{code}

And deprecate the old method in favour of the new one.

An alternative is to add javadoc to the current method stating that a cast to 
SharedStateDiscreteSampler is supported. This would have to be checked by a 
unit test.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to