KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > math > stat > descriptive > StorelessUnivariateStatistic


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  * Extends the definition of {@link UnivariateStatistic} with
20  * {@link #increment} and {@link #incrementAll(double[])} methods for adding
21  * values and updating internal state.
22  * <p>
23  * This interface is designed to be used for calculating statistics that can be computed in
24  * one pass through the data without storing the full array of sample values.
25  *
26  * @version $Revision$ $Date: 2005-02-26 05:11:52 -0800 (Sat, 26 Feb 2005) $
27  */

28 public interface StorelessUnivariateStatistic extends UnivariateStatistic {
29
30     /**
31      * Updates the internal state of the statistic to reflect the addition of the new value.
32      * @param d the new value.
33      */

34     void increment(double d);
35     
36     /**
37      * Updates the internal state of the statistic to reflect addition of
38      * all values in the values array. Does not clear the statistic first --
39      * i.e., the values are added <strong>incrementally</stong> to the dataset.
40      *
41      * @param values array holding the new values to add
42      * @throws IllegalArgumentException if the array is null
43      */

44     void incrementAll(double[] values);
45     
46     /**
47      * Updates the internal state of the statistic to reflect addition of
48      * the values in the designated portion of the values array. Does not
49      * clear the statistic first -- i.e., the values are added
50      * <strong>incrementally</stong> to the dataset.
51      *
52      * @param values array holding the new values to add
53      * @param start the array index of the first value to add
54      * @param length the number of elements to add
55      * @throws IllegalArgumentException if the array is null or the index
56      */

57     void incrementAll(double[] values, int start, int length);
58
59     /**
60      * Returns the current value of the Statistic.
61      * @return value of the statistic, <code>Double.NaN</code> if it
62      * has been cleared or just instantiated.
63      */

64     double getResult();
65
66     /**
67      * Returns the number of values that have been added.
68      * @return the number of values.
69      */

70     long getN();
71
72     /**
73      * Clears the internal state of the Statistic
74      */

75     void clear();
76
77 }
Popular Tags