View Javadoc

1   /*
2    * Copyright 2003-2004 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.descriptive;
17  
18  /**
19   * Base evaluation interface implemented by all statistics.
20   * <p>
21   * Includes "stateless" <code>evaluate</code> methods that take
22   * <code>double[]</code> arrays as input and return the value of the statistic
23   * applied to the input values.
24   * 
25   * @version $Revision: 155427 $ $Date: 2005-02-26 06:11:52 -0700 (Sat, 26 Feb 2005) $
26   */
27  public interface UnivariateStatistic {
28  
29      /**
30       * Returns the result of evaluating the statistic over the input array.
31       * 
32       * @param values input array
33       * @return the value of the statistic applied to the input array
34       */
35      double evaluate(double[] values);
36  
37      /**
38       * Returns the result of evaluating the statistic over the specified entries
39       * in the input array.
40       * 
41       * @param values the input array
42       * @param begin the index of the first element to include
43       * @param length the number of elements to include
44       * @return the value of the statistic applied to the included array entries
45       */
46      double evaluate(double[] values, int begin, int length);
47  
48  }