You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Alex Herbert (Jira)" <ji...@apache.org> on 2019/11/27 15:43:00 UTC

[jira] [Created] (RNG-126) PoissonSamplerCache to return a SharedStateDiscreteSampler

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)