// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IAnnotationStudy.java
// public interface IAnnotationStudy
//     extends Serializable
// {
// 
//     // -- Raters --
// 
//     /** Returns the number of raters participating in this study. */
//     int getRaterCount();
//     
//     int findRater(final String name);
// 
//     // -- Categories --
// 
//     /**
//      * Returns an iterator over all annotation categories within the study. Note that the categories
//      * are not per se clear; they might need to be gathered by iterating through all associated
//      * items, which yields performance problems in large-scale annotation studies.
//      */
//     Iterable<Object> getCategories();
// 
//     /**
//      * Returns the number of annotation categories in the study. Note that the categories are not
//      * per se clear; they might need to be gathered by iterating through all associated items, which
//      * yields performance problems in large-scale annotation studies.
//      */
//     int getCategoryCount();
// 
//     /**
//      * Returns true if, and only if, the categories defined by the study yield a dichotomy (i.e.,
//      * there are exactly two categories).
//      */
//     boolean isDichotomous();
// 
//     // -- Units --
// 
//     // public Iterable<? extends IAnnotationUnit> getUnits();
// 
//     /**
//      * Returns the number of annotation units defined by the study. That is, the number of
//      * annotations coded by the raters.
//      */
//     int getUnitCount();
// }
// 
// 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/distance/IntervalDistanceFunction.java
// public class IntervalDistanceFunction
//     implements IDistanceFunction
// {
// 
//     @Override
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2)
//     {
//         if (category1 instanceof Integer && category2 instanceof Integer) {
//             return (((Integer) category1) - ((Integer) category2))
//                     * (((Integer) category1) - ((Integer) category2));
//         }
// 
//         if (category1 instanceof Double && category2 instanceof Double) {
//             return (((Double) category1) - ((Double) category2))
//                     * (((Double) category1) - ((Double) category2));
//         }
// 
//         return (category1.equals(category2) ? 0.0 : 1.0);
//     }
// 
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/NominalDistanceFunction.java
// public class NominalDistanceFunction
//     implements IDistanceFunction
// {
// 
//     @Override
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2)
//     {
//         return (category1.equals(category2) ? 0.0 : 1.0);
//     }
// 
// }


import java.util.Hashtable;
import org.dkpro.statistics.agreement.IAnnotationStudy;
import org.dkpro.statistics.agreement.distance.IDistanceFunction;
import org.dkpro.statistics.agreement.distance.IntervalDistanceFunction;
import org.dkpro.statistics.agreement.distance.NominalDistanceFunction;
import junit.framework.TestCase;
/*
 * 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;




/**
 * Tests for {@link WeightedKappaAgreement} and {@link KrippendorffAlphaAgreement}.
 * 
 * @author Christian M. Meyer
 */
public class WeightedAgreementTest
    extends TestCase
{

    
    public void testDistanceFunction1()
    {
        ICodingAnnotationStudy study = createExample();

// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/IAnnotationStudy.java
// public interface IAnnotationStudy
//     extends Serializable
// {
// 
//     // -- Raters --
// 
//     /** Returns the number of raters participating in this study. */
//     int getRaterCount();
//     
//     int findRater(final String name);
// 
//     // -- Categories --
// 
//     /**
//      * Returns an iterator over all annotation categories within the study. Note that the categories
//      * are not per se clear; they might need to be gathered by iterating through all associated
//      * items, which yields performance problems in large-scale annotation studies.
//      */
//     Iterable<Object> getCategories();
// 
//     /**
//      * Returns the number of annotation categories in the study. Note that the categories are not
//      * per se clear; they might need to be gathered by iterating through all associated items, which
//      * yields performance problems in large-scale annotation studies.
//      */
//     int getCategoryCount();
// 
//     /**
//      * Returns true if, and only if, the categories defined by the study yield a dichotomy (i.e.,
//      * there are exactly two categories).
//      */
//     boolean isDichotomous();
// 
//     // -- Units --
// 
//     // public Iterable<? extends IAnnotationUnit> getUnits();
// 
//     /**
//      * Returns the number of annotation units defined by the study. That is, the number of
//      * annotations coded by the raters.
//      */
//     int getUnitCount();
// }
// 
// 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/distance/IntervalDistanceFunction.java
// public class IntervalDistanceFunction
//     implements IDistanceFunction
// {
// 
//     @Override
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2)
//     {
//         if (category1 instanceof Integer && category2 instanceof Integer) {
//             return (((Integer) category1) - ((Integer) category2))
//                     * (((Integer) category1) - ((Integer) category2));
//         }
// 
//         if (category1 instanceof Double && category2 instanceof Double) {
//             return (((Double) category1) - ((Double) category2))
//                     * (((Double) category1) - ((Double) category2));
//         }
// 
//         return (category1.equals(category2) ? 0.0 : 1.0);
//     }
// 
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/distance/NominalDistanceFunction.java
// public class NominalDistanceFunction
//     implements IDistanceFunction
// {
// 
//     @Override
//     public double measureDistance(final IAnnotationStudy study, final Object category1,
//             final Object category2)
//     {
//         return (category1.equals(category2) ? 0.0 : 1.0);
//     }
// 
// }


// Path: dkpro-statistics-agreement/src/test/java/org/dkpro/statistics/agreement/coding/WeightedAgreementTest.java
import java.util.Hashtable;
import org.dkpro.statistics.agreement.IAnnotationStudy;
import org.dkpro.statistics.agreement.distance.IDistanceFunction;
import org.dkpro.statistics.agreement.distance.IntervalDistanceFunction;
import org.dkpro.statistics.agreement.distance.NominalDistanceFunction;
import junit.framework.TestCase;

/*
 * 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;




/**
 * Tests for {@link WeightedKappaAgreement} and {@link KrippendorffAlphaAgreement}.
 * 
 * @author Christian M. Meyer
 */
public class WeightedAgreementTest
    extends TestCase
{

    
    public void testDistanceFunction1()
    {
        ICodingAnnotationStudy study = createExample();

        IDistanceFunction weightedDistanceFunction = new IDistanceFunction()