psteitz 2004/07/10 09:07:07
Modified: math/src/test/org/apache/commons/math/stat
CertifiedDataTest.java
Log:
Eliminated dependency on [logging].
Revision Changes Path
1.18 +49 -63
jakarta-commons/math/src/test/org/apache/commons/math/stat/CertifiedDataTest.java
Index: CertifiedDataTest.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/math/src/test/org/apache/commons/math/stat/CertifiedDataTest.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- CertifiedDataTest.java 12 Apr 2004 02:27:49 -0000 1.17
+++ CertifiedDataTest.java 10 Jul 2004 16:07:07 -0000 1.18
@@ -20,11 +20,7 @@
import junit.framework.TestSuite;
import java.io.BufferedReader;
-import java.io.FileNotFoundException;
-import java.io.IOException;
import java.io.InputStreamReader;
-import org.apache.commons.logging.LogFactory;
-import org.apache.commons.logging.Log;
import org.apache.commons.math.stat.univariate.SummaryStatistics;
import org.apache.commons.math.stat.univariate.SummaryStatisticsImpl;
@@ -40,8 +36,6 @@
protected double std = Double.NaN;
- protected Log log = LogFactory.getLog(this.getClass());
-
/**
* Certified Data Test Constructor
* @param name
@@ -94,7 +88,7 @@
/**
* Test StorelessDescriptiveStatistics
*/
- public void testStoredUnivariateImpl() {
+ public void testStoredUnivariateImpl() throws Exception {
DescriptiveStatistics u = DescriptiveStatistics.newInstance();
@@ -124,60 +118,52 @@
* @param file
* @param statistical summary
*/
- private void loadStats(String resource, Object u) {
-
- DescriptiveStatistics d = null;
- SummaryStatistics s = null;
- if (u instanceof DescriptiveStatistics) {
- d = (DescriptiveStatistics) u;
- } else {
- s = (SummaryStatistics) u;
- }
- try {
- u.getClass().getDeclaredMethod("clear", null).invoke(u, null);
- mean = Double.NaN;
- std = Double.NaN;
-
- BufferedReader in =
- new BufferedReader(
- new InputStreamReader(
-
getClass().getResourceAsStream(resource)));
-
- String line = null;
-
- for (int j = 0; j < 60; j++) {
- line = in.readLine();
- if (j == 40) {
- mean =
- Double.parseDouble(
-
line.substring(line.lastIndexOf(":") + 1).trim());
- }
- if (j == 41) {
- std =
- Double.parseDouble(
-
line.substring(line.lastIndexOf(":") + 1).trim());
- }
- }
-
- line = in.readLine();
-
- while (line != null) {
- if (d != null) {
- d.addValue(Double.parseDouble(line.trim()));
- } else {
- s.addValue(Double.parseDouble(line.trim()));
- }
- line = in.readLine();
- }
-
- in.close();
-
- } catch (FileNotFoundException fnfe) {
- log.error(fnfe.getMessage(), fnfe);
- } catch (IOException ioe) {
- log.error(ioe.getMessage(), ioe);
- } catch (Exception ioe) {
- log.error(ioe.getMessage(), ioe);
- }
+ private void loadStats(String resource, Object u) throws Exception {
+
+ DescriptiveStatistics d = null;
+ SummaryStatistics s = null;
+ if (u instanceof DescriptiveStatistics) {
+ d = (DescriptiveStatistics) u;
+ } else {
+ s = (SummaryStatistics) u;
+ }
+
+ u.getClass().getDeclaredMethod("clear", null).invoke(u, null);
+ mean = Double.NaN;
+ std = Double.NaN;
+
+ BufferedReader in =
+ new BufferedReader(
+ new InputStreamReader(
+ getClass().getResourceAsStream(resource)));
+
+ String line = null;
+
+ for (int j = 0; j < 60; j++) {
+ line = in.readLine();
+ if (j == 40) {
+ mean =
+ Double.parseDouble(
+ line.substring(line.lastIndexOf(":") + 1).trim());
+ }
+ if (j == 41) {
+ std =
+ Double.parseDouble(
+ line.substring(line.lastIndexOf(":") + 1).trim());
+ }
+ }
+
+ line = in.readLine();
+
+ while (line != null) {
+ if (d != null) {
+ d.addValue(Double.parseDouble(line.trim()));
+ } else {
+ s.addValue(Double.parseDouble(line.trim()));
+ }
+ line = in.readLine();
+ }
+
+ in.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]