Uploaded image for project: 'Commons RNG'
  1. Commons RNG
  2. RNG-126

PoissonSamplerCache to return a SharedStateDiscreteSampler

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Implemented
    • 1.3
    • 1.4
    • sampling
    • None

    Description

      The PoissonSamplerCache method:

      public DiscreteSampler createPoissonSampler(
          UniformRandomProvider rng,
          double mean) {
      

      Can now be:

      public SharedStateDiscreteSampler createPoissonSampler(
          UniformRandomProvider rng,
          double mean) {
      

      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:

      public SharedStateDiscreteSampler createSharedStateSampler(
          UniformRandomProvider rng, 
          double mean) {
      

      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.

      Attachments

        Activity

          People

            aherbert Alex Herbert
            aherbert Alex Herbert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: