// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/DisagreementMeasure.java
// public abstract class DisagreementMeasure
//     implements IAgreementMeasure
// {
//     /**
//      * Calculates the inter-rater agreement for the annotation study that was passed to the class
//      * constructor and the currently assigned distance function.
//      * 
//      * @throws NullPointerException if the study is null.
//      * 
//      * @throws ArithmeticException if the study does not contain any item or the number of raters is
//      * smaller than 2.
//      */
//     @Override
//     public double calculateAgreement()
//     {
//         double D_O = calculateObservedDisagreement();
//         double D_E = calculateExpectedDisagreement();
//         if (D_O == D_E) {
//             return 0.0;
//         }
//         else {
//             return 1.0 - (D_O / D_E);
//         }
//     }
// 
//     protected abstract double calculateObservedDisagreement();
// 
//     protected double calculateExpectedDisagreement()
//     {
//         return 0.0;
//     }
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IWeightedAgreement.java
// public interface IWeightedAgreement
// {
//     /**
//      * Returns the distance function that is used to measure the distance between two annotation
//      * categories.
//      */
//     public IDistanceFunction getDistanceFunction();
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/IDistanceFunction.java
// public interface IDistanceFunction
// {
// 
//     /**
//      * Returns a distance value for the given pair of categories used within the given annotation
//      * study. Normally, the measure should return a distance of 0 if, and only if, the two
//      * categories are equal and a positive number otherwise.
//      */
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2);
// 
// }


import org.dkpro.statistics.agreement.DisagreementMeasure;
import org.dkpro.statistics.agreement.IWeightedAgreement;
import org.dkpro.statistics.agreement.distance.IDistanceFunction;
/*
 * Copyright 2014
 * Ubiquitous Knowledge Processing (UKP) Lab
 * Technische Universität Darmstadt
 *
 * Licensed 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.dkpro.statistics.agreement.coding;


/**
 * Abstract base class for weighted measures. In most cases, weighted measures are defined as
 * disagreement functions. They are characterized by a distance function that is used to score the
 * similarity between two categories.
 * 
 * @see IDistanceFunction
 * @see DisagreementMeasure
 * @author Christian M. Meyer
 */
public abstract class WeightedAgreement
    extends DisagreementMeasure
    implements IWeightedAgreement
{

    protected IDistanceFunction distanceFunction;
    protected ICodingAnnotationStudy study;

    /**
     * Initializes the instance for the given annotation study. The study should never be null.
     */
    public WeightedAgreement(final ICodingAnnotationStudy study)
    {
        this.study = study;
    }

// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/DisagreementMeasure.java
// public abstract class DisagreementMeasure
//     implements IAgreementMeasure
// {
//     /**
//      * Calculates the inter-rater agreement for the annotation study that was passed to the class
//      * constructor and the currently assigned distance function.
//      * 
//      * @throws NullPointerException if the study is null.
//      * 
//      * @throws ArithmeticException if the study does not contain any item or the number of raters is
//      * smaller than 2.
//      */
//     @Override
//     public double calculateAgreement()
//     {
//         double D_O = calculateObservedDisagreement();
//         double D_E = calculateExpectedDisagreement();
//         if (D_O == D_E) {
//             return 0.0;
//         }
//         else {
//             return 1.0 - (D_O / D_E);
//         }
//     }
// 
//     protected abstract double calculateObservedDisagreement();
// 
//     protected double calculateExpectedDisagreement()
//     {
//         return 0.0;
//     }
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IWeightedAgreement.java
// public interface IWeightedAgreement
// {
//     /**
//      * Returns the distance function that is used to measure the distance between two annotation
//      * categories.
//      */
//     public IDistanceFunction getDistanceFunction();
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/IDistanceFunction.java
// public interface IDistanceFunction
// {
// 
//     /**
//      * Returns a distance value for the given pair of categories used within the given annotation
//      * study. Normally, the measure should return a distance of 0 if, and only if, the two
//      * categories are equal and a positive number otherwise.
//      */
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2);
// 
// }


// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/coding/WeightedAgreement.java
import org.dkpro.statistics.agreement.DisagreementMeasure;
import org.dkpro.statistics.agreement.IWeightedAgreement;
import org.dkpro.statistics.agreement.distance.IDistanceFunction;

/*
 * Copyright 2014
 * Ubiquitous Knowledge Processing (UKP) Lab
 * Technische Universität Darmstadt
 *
 * Licensed 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.dkpro.statistics.agreement.coding;


/**
 * Abstract base class for weighted measures. In most cases, weighted measures are defined as
 * disagreement functions. They are characterized by a distance function that is used to score the
 * similarity between two categories.
 * 
 * @see IDistanceFunction
 * @see DisagreementMeasure
 * @author Christian M. Meyer
 */
public abstract class WeightedAgreement
    extends DisagreementMeasure
    implements IWeightedAgreement
{

    protected IDistanceFunction distanceFunction;
    protected ICodingAnnotationStudy study;

    /**
     * Initializes the instance for the given annotation study. The study should never be null.
     */
    public WeightedAgreement(final ICodingAnnotationStudy study)
    {
        this.study = study;
    }

    @Override