Commons Math example source code file (MixedListUnivariateImplTest.java)
This example Commons Math source code file (MixedListUnivariateImplTest.java) is included in the DevDaily.com
"Java Source Code
Warehouse" project. The intent of this project is to help you "Learn Java by Example" TM.
The Commons Math MixedListUnivariateImplTest.java source code
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.math.stat.descriptive;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import junit.framework.TestCase;
import org.apache.commons.math.util.NumberTransformer;
import org.apache.commons.math.util.TransformerMap;
/**
* Test cases for the {@link ListUnivariateImpl} class.
*
* @version $Revision: 902201 $ $Date: 2010-01-22 13:18:16 -0500 (Fri, 22 Jan 2010) $
*/
public final class MixedListUnivariateImplTest extends TestCase {
private double one = 1;
private float two = 2;
private int three = 3;
private double mean = 2;
private double sumSq = 18;
private double sum = 8;
private double var = 0.666666666666666666667;
private double std = Math.sqrt(var);
private double n = 4;
private double min = 1;
private double max = 3;
private double tolerance = 10E-15;
private TransformerMap transformers = new TransformerMap();
public MixedListUnivariateImplTest(String name) {
super(name);
transformers = new TransformerMap();
transformers.putTransformer(Foo.class, new FooTransformer());
transformers.putTransformer(Bar.class, new BarTransformer());
}
/** test stats */
public void testStats() {
List<Object> externalList = new ArrayList