Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46EC698AE for ; Wed, 22 Feb 2012 12:20:26 +0000 (UTC) Received: (qmail 66069 invoked by uid 500); 22 Feb 2012 12:20:26 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 65994 invoked by uid 500); 22 Feb 2012 12:20:26 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 65986 invoked by uid 99); 22 Feb 2012 12:20:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 12:20:25 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 22 Feb 2012 12:20:24 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id EC9742388900 for ; Wed, 22 Feb 2012 12:20:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1292251 - /commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java Date: Wed, 22 Feb 2012 12:20:04 -0000 To: commits@commons.apache.org From: erans@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120222122004.EC9742388900@eris.apache.org> Author: erans Date: Wed Feb 22 12:20:04 2012 New Revision: 1292251 URL: http://svn.apache.org/viewvc?rev=1292251&view=rev Log: Removed usage of non-localized error message. Changed exception type. Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java Modified: commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java?rev=1292251&r1=1292250&r2=1292251&view=diff ============================================================================== --- commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java (original) +++ commons/proper/math/trunk/src/main/java/org/apache/commons/math3/stat/regression/RegressionResults.java Wed Feb 22 12:20:04 2012 @@ -20,6 +20,7 @@ import java.io.Serializable; import java.util.Arrays; import org.apache.commons.math3.util.FastMath; import org.apache.commons.math3.util.MathArrays; +import org.apache.commons.math3.exception.OutOfRangeException; /** * Results of a Multiple Linear Regression model fit. @@ -56,8 +57,6 @@ public class RegressionResults implement private final boolean containsConstant; /** array storing global results, SSE, MSE, RSQ, adjRSQ */ private final double[] globalFitInfo; - /** error message */ - private final String indexOutOfBound = "Index is outside of the 0 to number of variables - 1 range"; /** * Set the default constructor to private access @@ -143,16 +142,17 @@ public class RegressionResults implement *

A redundant regressor will have its redundancy flag set, as well as * a parameters estimated equal to {@code Double.NaN}

* - * @param index an integer index which must be in the range [0, numberOfParameters-1] - * @return parameters estimated for regressor at index - * @throws IndexOutOfBoundsException thrown if the index >= numberOfParameters + * @param index Index. + * @return the parameters estimated for regressor at index. + * @throws OutOfRangeException if {@code index} is not in the interval + * {@code [0, number of parameters)}. */ - public double getParameterEstimate(int index) throws IndexOutOfBoundsException { + public double getParameterEstimate(int index) { if (parameters == null) { return Double.NaN; } if (index < 0 || index >= this.parameters.length) { - throw new IndexOutOfBoundsException(indexOutOfBound); + throw new OutOfRangeException(index, 0, this.parameters.length - 1); } return this.parameters[index]; } @@ -179,16 +179,17 @@ public class RegressionResults implement * error of the parameter estimate at index, * usually denoted s(bindex). * - * @param index an integer index which must be in the range [0, numberOfParameters-1] - * @return standard errors associated with parameters estimated at index - * @throws IndexOutOfBoundsException thrown if the index >= numberOfParameters + * @param index Index. + * @return the standard errors associated with parameters estimated at index. + * @throws OutOfRangeException if {@code index} is not in the interval + * {@code [0, number of parameters)}. */ - public double getStdErrorOfEstimate(int index) throws IndexOutOfBoundsException { + public double getStdErrorOfEstimate(int index) { if (parameters == null) { return Double.NaN; } if (index < 0 || index >= this.parameters.length) { - throw new IndexOutOfBoundsException(indexOutOfBound); + throw new OutOfRangeException(index, 0, this.parameters.length - 1); } double var = this.getVcvElement(index, index); if (!Double.isNaN(var) && var > Double.MIN_VALUE) { @@ -230,22 +231,21 @@ public class RegressionResults implement *

If there are problems with an ill conditioned design matrix then the covariance * which involves redundant columns will be assigned {@code Double.NaN}.

* - * @param i - the ith regression parameter - * @param j - the jth regression parameter - * @return the covariance of the parameter estimates - * @throws IndexOutOfBoundsException thrown when i,j >= number of parameters + * @param i {@code i}th regression parameter. + * @param j {@code j}th regression parameter. + * @return the covariance of the parameter estimates. + * @throws OutOfRangeException if {@code i} or {@code j} is not in the + * interval {@code [0, number of parameters)}. */ - public double getCovarianceOfParameters(int i, int j) throws IndexOutOfBoundsException { + public double getCovarianceOfParameters(int i, int j) { if (parameters == null) { return Double.NaN; } if (i < 0 || i >= this.parameters.length) { - throw new IndexOutOfBoundsException(" Row index is outside of the 0 " + - "to number of variables - 1 range"); + throw new OutOfRangeException(i, 0, this.parameters.length - 1); } if (j < 0 || j >= this.parameters.length) { - throw new IndexOutOfBoundsException(" Column index is outside of the 0" + - " to number of variables - 1 range"); + throw new OutOfRangeException(j, 0, this.parameters.length - 1); } return this.getVcvElement(i, j); }