// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/IUnitizingAnnotationStudy.java
// public interface IUnitizingAnnotationStudy
//     extends IAnnotationStudy
// {
// 
//     // -- Units --
// 
//     /** Allows iterating all annotation units of this study. */
//     Collection<IUnitizingAnnotationUnit> getUnits();
// 
//     // -- Continuum --
// 
//     // @Deprecated
//     // public int getSectionCount();
//     //
//     // @Deprecated
//     // public Iterable<Integer> getSectionBoundaries();
// 
//     /**
//      * Returns the begin of the continuum (i.e., the first offset that is considered valid for
//      * annotation units).
//      */
//     long getContinuumBegin();
// 
//     /**
//      * Returns the length of the continuum (i.e., the last possible right delimiter of an annotation
//      * unit).
//      */
//     long getContinuumLength();
// 
//     /**
//      * Returns the number of units rated by the given rater.
//      */
//     long getUnitCount(int aRaterIdx);
// 
//     // TODO: public void addSectionBoundary(long position);
// 
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/IUnitizingAnnotationUnit.java
// public interface IUnitizingAnnotationUnit
//     extends IAnnotationUnit, Comparable<IUnitizingAnnotationUnit>
// {
// 
//     /**
//      * Returns the offset of the annotation unit (i.e., the start position of the identified
//      * segment).
//      */
//     public long getOffset();
// 
//     /**
//      * Returns the length of the annotation unit (i.e., the difference between the end and start
//      * position of the identified segment).
//      */
//     public long getLength();
// 
//     /**
//      * Returns the right delimiter of the annotation unit (i.e., the end position of the identified
//      * segment). The method is a shorthand for {@link #getOffset()} + {@link #getLength()}.
//      */
//     public long getEndOffset();
// 
// }


import java.io.PrintStream;
import java.util.Objects;
import org.dkpro.statistics.agreement.unitizing.IUnitizingAnnotationStudy;
import org.dkpro.statistics.agreement.unitizing.IUnitizingAnnotationUnit;
/*
 * 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.visualization;



/**
 * Plain-text visualization for unitizing studies. The visualization prints 
 * the continuum and marks the units of each individual rater and for each 
 * category using asterisks. For category A of Krippendorff's (1995) example, 
 * the implementation prints, for instance: <pre>               1         2   2
 * r    0123456789012345678901234
 * 0      ********    ******    
 * 1        ****       **</pre>
 * That is, a continuum starting at 0, ending at 24, in which two raters 
 * identified two units. By defining a {@link PrintStream}, it is possible to
 * display a study on the console or to write the results to a text file.<br><br>
 * References:<ul>
 * <li>Krippendorff, K.: On the reliability of unitizing contiguous data.
 *   Sociological Methodology 25:47–76, 1995.</li></ul>
 * @see IUnitizingAnnotationStudy
 * @author Christian M. Meyer
 */
public class UnitizingStudyPrinter
{

    /**
     * Prints an integer scale of the continuum used for the given unitzing study. Optionally, the
     * given prefix is printed left of the continuum scale and the output is correctly indented.
     */
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/IUnitizingAnnotationStudy.java
// public interface IUnitizingAnnotationStudy
//     extends IAnnotationStudy
// {
// 
//     // -- Units --
// 
//     /** Allows iterating all annotation units of this study. */
//     Collection<IUnitizingAnnotationUnit> getUnits();
// 
//     // -- Continuum --
// 
//     // @Deprecated
//     // public int getSectionCount();
//     //
//     // @Deprecated
//     // public Iterable<Integer> getSectionBoundaries();
// 
//     /**
//      * Returns the begin of the continuum (i.e., the first offset that is considered valid for
//      * annotation units).
//      */
//     long getContinuumBegin();
// 
//     /**
//      * Returns the length of the continuum (i.e., the last possible right delimiter of an annotation
//      * unit).
//      */
//     long getContinuumLength();
// 
//     /**
//      * Returns the number of units rated by the given rater.
//      */
//     long getUnitCount(int aRaterIdx);
// 
//     // TODO: public void addSectionBoundary(long position);
// 
// }
// 
// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/unitizing/IUnitizingAnnotationUnit.java
// public interface IUnitizingAnnotationUnit
//     extends IAnnotationUnit, Comparable<IUnitizingAnnotationUnit>
// {
// 
//     /**
//      * Returns the offset of the annotation unit (i.e., the start position of the identified
//      * segment).
//      */
//     public long getOffset();
// 
//     /**
//      * Returns the length of the annotation unit (i.e., the difference between the end and start
//      * position of the identified segment).
//      */
//     public long getLength();
// 
//     /**
//      * Returns the right delimiter of the annotation unit (i.e., the end position of the identified
//      * segment). The method is a shorthand for {@link #getOffset()} + {@link #getLength()}.
//      */
//     public long getEndOffset();
// 
// }


// Path: dkpro-statistics-agreement/src/main/java/org/dkpro/statistics/agreement/visualization/UnitizingStudyPrinter.java
import java.io.PrintStream;
import java.util.Objects;
import org.dkpro.statistics.agreement.unitizing.IUnitizingAnnotationStudy;
import org.dkpro.statistics.agreement.unitizing.IUnitizingAnnotationUnit;

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



/**
 * Plain-text visualization for unitizing studies. The visualization prints 
 * the continuum and marks the units of each individual rater and for each 
 * category using asterisks. For category A of Krippendorff's (1995) example, 
 * the implementation prints, for instance: <pre>               1         2   2
 * r    0123456789012345678901234
 * 0      ********    ******    
 * 1        ****       **</pre>
 * That is, a continuum starting at 0, ending at 24, in which two raters 
 * identified two units. By defining a {@link PrintStream}, it is possible to
 * display a study on the console or to write the results to a text file.<br><br>
 * References:<ul>
 * <li>Krippendorff, K.: On the reliability of unitizing contiguous data.
 *   Sociological Methodology 25:47–76, 1995.</li></ul>
 * @see IUnitizingAnnotationStudy
 * @author Christian M. Meyer
 */
public class UnitizingStudyPrinter
{

    /**
     * Prints an integer scale of the continuum used for the given unitzing study. Optionally, the
     * given prefix is printed left of the continuum scale and the output is correctly indented.
     */
    public void printContinuum(final PrintStream out, final IUnitizingAnnotationStudy study,