osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: commons-rng git commit: Adding PoissonSampler deprecations. Use the correct faster public methods



> On Aug 9, 2018, at 8:47 AM, Gilles <gilles@xxxxxxxxxxxxxxxxxxxxx> wrote:
> 
> On Thu, 9 Aug 2018 08:27:16 -0400, Rob Tompkins wrote:
>>> On Aug 8, 2018, at 1:59 PM, Gilles <gilles@xxxxxxxxxxxxxxxxxxxxx> wrote:
>>> 
>>> Hello Rob.
>>> 
>>> On Wed, 8 Aug 2018 12:44:16 -0400, Rob Tompkins wrote:
>>>> @Gilles - thoughts here?? Just kinda what I was thinking, but I’m
>>>> only a +0 on this change. So, if you want to revert it before going up
>>>> with 1.1, that’s fine.
>>> 
>>> I don't understand this change after what I answered to Gary's strange
>>> proposal.
>>> The comment is *wrong*.  As I said previously, the base class provides
>>> boiler-plate code; that is *not* deprecated.  The issue is that those
>>> methods were not meant to be used further down the hierarchy (in user's
>>> subclasses). [And now, furthermore, they are not used anymore in class
>>> "PoissonSampler", following the change in RNG-50 (delegation to other
>>> classes).]
>>> The sampler classes should have been made "final"; but now, this change
>>> would also be "breaking" (even though I doubt about legitimate use-cases
>>> for inherithing from the sampler implementations).
>> 
>> My goal was to have the class look like is has the same functionality
>> at 1.0, but instead accommodate for local javadoc changes
>> to point out what the user should be doing. That said, it’s entirely
>> possible that I wasn’t precise enough with the “@deprecated” messaging
>> due to lack of familiarity with the issue at hand.
>> 
>> It is however unclear to me how these changes would be breaking as
>> the methods exposed on the class don’t change signature or
>> accessibility quantifier, but I could have overlooked something.
> 
> ?
> I'm saying that the appropriate change (that is: make the sampler
> classes "final") would be breaking BC (in the sense that Clirr will
> report errors).  However, users of this library most probably
> wouldn't use it so as to be impacted by the change (that is: their
> code will work as with 1.0).

Right, but we’re stuck not being able to make the appropriate change for 1.1. So we have to find the next best thing, and I’m just poking around trying to find anything that works in that category.

> 
> Gilles
> 
>> Regardless, it was just an idea, and I figured the easiest way to
>> make a proposal was to push a commit up. Like I said I’m a +0 on it,
>> and if
>> we come up with a better mechanism, then I’m on board with that.
>> 
>> Cheers,
>> -Rob
>> 
>>> 
>>> Please revert.
>>> 
>>> Thanks,
>>> Gilles
>>> 
>>>> 
>>>> -Rob
>>>> 
>>>>> On Aug 8, 2018, at 12:42 PM, chtompki@xxxxxxxxxx wrote:
>>>>> 
>>>>> Repository: commons-rng
>>>>> Updated Branches:
>>>>> refs/heads/1.1 50b984b1d -> f8159f28a
>>>>> 
>>>>> 
>>>>> Adding PoissonSampler deprecations. Use the correct faster public methods
>>>>> 
>>>>> 
>>>>> Project: http://git-wip-us.apache.org/repos/asf/commons-rng/repo
>>>>> Commit: http://git-wip-us.apache.org/repos/asf/commons-rng/commit/f8159f28
>>>>> Tree: http://git-wip-us.apache.org/repos/asf/commons-rng/tree/f8159f28
>>>>> Diff: http://git-wip-us.apache.org/repos/asf/commons-rng/diff/f8159f28
>>>>> 
>>>>> Branch: refs/heads/1.1
>>>>> Commit: f8159f28a52197d0e7b55e39b115702147cf57a0
>>>>> Parents: 50b984b
>>>>> Author: Rob Tompkins <chtompki@xxxxxxxxx>
>>>>> Authored: Wed Aug 8 12:42:45 2018 -0400
>>>>> Committer: Rob Tompkins <chtompki@xxxxxxxxx>
>>>>> Committed: Wed Aug 8 12:42:45 2018 -0400
>>>>> 
>>>>> ----------------------------------------------------------------------
>>>>> .../sampling/distribution/PoissonSampler.java   | 42 ++++++++++++++++++++
>>>>> 1 file changed, 42 insertions(+)
>>>>> ----------------------------------------------------------------------
>>>>> 
>>>>> 
>>>>> http://git-wip-us.apache.org/repos/asf/commons-rng/blob/f8159f28/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
>>>>> ----------------------------------------------------------------------
>>>>> diff --git a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
>>>>> index d0733ba..29d0e4e 100644
>>>>> --- a/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
>>>>> +++ b/commons-rng-sampling/src/main/java/org/apache/commons/rng/sampling/distribution/PoissonSampler.java
>>>>> @@ -67,6 +67,48 @@ public class PoissonSampler
>>>>>       return poissonSampler.sample();
>>>>>   }
>>>>> 
>>>>> +    /**
>>>>> +     * @return a random value from a uniform distribution in the
>>>>> +     * interval {@code [0, 1)}.
>>>>> +     * @deprecated - one should be using the {@link PoissonSampler#sample()} method,
>>>>> +     * as it is considerably faster.
>>>>> +     */
>>>>> +    @Deprecated
>>>>> +    protected double nextDouble() {
>>>>> +        return super.nextDouble();
>>>>> +    }
>>>>> +
>>>>> +    /**
>>>>> +     * @return a random {@code int} value.
>>>>> +     * @deprecated - one should be using the {@link PoissonSampler#sample()} method,
>>>>> +     * as it is considerably faster.
>>>>> +     */
>>>>> +    @Deprecated
>>>>> +    protected int nextInt() {
>>>>> +        return super.nextInt();
>>>>> +    }
>>>>> +
>>>>> +    /**
>>>>> +     * @param max Upper bound (excluded).
>>>>> +     * @return a random {@code int} value in the interval {@code [0, max)}.
>>>>> +     * @deprecated - one should be using the {@link PoissonSampler#sample()} method,
>>>>> +     *      * as it is considerably faster.
>>>>> +     */
>>>>> +    @Deprecated
>>>>> +    protected int nextInt(int max) {
>>>>> +        return super.nextInt(max);
>>>>> +    }
>>>>> +
>>>>> +    /**
>>>>> +     * @return a random {@code long} value.
>>>>> +     * @deprecated - one should be using the {@link PoissonSampler#sample()} method,
>>>>> +     *      * as it is considerably faster.
>>>>> +     */
>>>>> +    @Deprecated
>>>>> +    protected long nextLong() {
>>>>> +        return super.nextLong();
>>>>> +    }
>>>>> +
>>>>>   /** {@inheritDoc} */
>>>>>   @Override
>>>>>   public String toString() {
>>>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxxxx
> For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxxxx
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@xxxxxxxxxxxxxxxxxx
For additional commands, e-mail: dev-help@xxxxxxxxxxxxxxxxxx