View Javadoc

    1   /*
    2    * Copyright 2005 The Apache Software Foundation.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
    10   * Unless required by applicable law or agreed to in writing, software
    11   * distributed under the License is distributed on an "AS IS" BASIS,
    12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13   * See the License for the specific language governing permissions and
    14   * limitations under the License.
    15   */
    16  package org.apache.commons.math.stat.inference;
    17  import org.apache.commons.discovery.tools.DiscoverClass;
    18
    19  /***
    20   * Abstract factory to create inference test instances.
    21   *
    22   * @since 1.1
    23   * @version $Revision: 209144 $ $Date: 2005-07-04 16:30:05 -0700 (Mon, 04 Jul 2005) $
    24   */
    25  public abstract class TestFactory {
    26      /***
    27       * Default constructor.
    28       */
    29      protected TestFactory() {
    30          super();
    31      }
    32
    33      /***
    34       * Create an instance of a <code>TestFactory</code>
    35       *
    36       * @return a new factory.
    37       */
    38      public static TestFactory newInstance() {
    39          TestFactory factory = null;
    40          try {
    41              DiscoverClass dc = new DiscoverClass();
    42              factory = (TestFactory) dc.newInstance(
    43                      TestFactory.class,
    44              "org.apache.commons.math.stat.inference.TestFactoryImpl");
    45          } catch(Throwable t) {
    46              return new TestFactoryImpl();
    47          }
    48          return factory;
    49      }
    50
    51      /***
    52       * Create a TTest instance.
    53       *
    54       * @return a new TTest instance
    55       */
    56      public abstract TTest createTTest();
    57
    58      /***
    59       * Create a ChiSquareTest instance.
    60       *
    61       * @return a new ChiSquareTest instance
    62       */
    63      public abstract ChiSquareTest createChiSquareTest();
    64  }