    001    /*
    002     * Licensed to the Apache Software Foundation (ASF) under one or more
    003     * contributor license agreements.  See the NOTICE file distributed with
    004     * this work for additional information regarding copyright ownership.
    005     * The ASF licenses this file to You under the Apache License, Version 2.0
    006     * (the "License"); you may not use this file except in compliance with
    007     * the License.  You may obtain a copy of the License at
    008     *
    009     *      http://www.apache.org/licenses/LICENSE-2.0
    010     *
    011     * Unless required by applicable law or agreed to in writing, software
    012     * distributed under the License is distributed on an "AS IS" BASIS,
    013     * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    014     * See the License for the specific language governing permissions and
    015     * limitations under the License.
    016     */
    017    package org.apache.commons.math3.stat.descriptive;
    018
    019    import org.apache.commons.math3.exception.MathIllegalArgumentException;
    020
    021    /**
    022     * Weighted evaluation for statistics.
    023     *
    024     * @since 2.1
    025     * @version $Id: WeightedEvaluation.java 1382332 2012-09-08 17:27:47Z psteitz $
    026     */
    027    public interface WeightedEvaluation {
    028
    029        /**
    030         * Returns the result of evaluating the statistic over the input array,
    031         * using the supplied weights.
    032         *
    033         * @param values input array
    034         * @param weights array of weights
    035         * @return the value of the weighted statistic applied to the input array
    036         * @throws MathIllegalArgumentException if either array is null, lengths
    037         * do not match, weights contain NaN, negative or infinite values, or
    038         * weights does not include at least on positive value
    039         */
    040        double evaluate(double[] values, double[] weights) throws MathIllegalArgumentException;
    041
    042        /**
    043         * Returns the result of evaluating the statistic over the specified entries
    044         * in the input array, using corresponding entries in the supplied weights array.
    045         *
    046         * @param values the input array
    047         * @param weights array of weights
    048         * @param begin the index of the first element to include
    049         * @param length the number of elements to include
    050         * @return the value of the weighted statistic applied to the included array entries
    051         * @throws MathIllegalArgumentException if either array is null, lengths
    052         * do not match, indices are invalid, weights contain NaN, negative or
    053         * infinite values, or weights does not include at least on positive value
    054         */
    055        double evaluate(double[] values, double[] weights, int begin, int length)
    056        throws MathIllegalArgumentException;
    057
    058    }