aherbert commented on pull request #26: URL: https://github.com/apache/commons-statistics/pull/26#issuecomment-782051472
Thanks for the contribution. The implementation and tests look good (all edge cases are covered). The code is currently failing PMD checks. Most of these are for missing the `final` keyword on local variables. You can see the PMD errors by running: ``` mvn pmd:pmd ``` Then open the file in `target/site/pmd.html` There is also an error for a confusing ternary. I think it is OK in this context but to avoid the issue what do you think to rewriting the constructor as: ```java if (lower == Double.NEGATIVE_INFINITY) { if (upper == Double.POSITIVE_INFINITY) { // No truncation this.mean = mean; variance = sd * sd; } else { // One-sided lower tail truncation double betaRatio = pdfBeta / cdfBeta; this.mean = mean - sd * betaRatio; variance = sd * sd * (1 - beta * betaRatio - betaRatio * betaRatio); } } else { if (upper == Double.POSITIVE_INFINITY) { // One-sided upper tail truncation double alphaRatio = pdfAlpha / cdfDelta; this.mean = mean + sd * alphaRatio; variance = sd * sd * (1 + alpha * alphaRatio - alphaRatio * alphaRatio); } else { // Two-sided truncation this.mean = mean + pdfCdfDelta * parentSd; variance = sd * sd * (1 + alphaBetaDelta - pdfCdfDelta * pdfCdfDelta); } } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org