public int compare()

in ConfigurableFeatureExtractor/src/main/java/org/apache/uima/tools/cfe/support/UIMAAnnotationOffsetComparator.java [48:73]


    public int compare(Annotation a1, Annotation a2)
    {
        if (a1.getBegin() < a2.getBegin()) {
            return -1;
        }
        else if (a1.getBegin() > a2.getBegin()) {
            return 1;
        }
        else if (a1.getEnd() < a2.getEnd()) {
            return -1;
        }
        else if (a1.getEnd() > a2.getEnd()) {
            return 1;
        }

        int p1 = 0; 
        int p2 = 0;
        if (null != m_typePriorities) {
            p1 = m_typePriorities.indexOf(a1.getClass()); 
            p2 = m_typePriorities.indexOf(a2.getClass());
        }

        return (p1 == p2) ?
                   (a1.getAddress() == a2.getAddress() ? 0 : (a1.getAddress() > a2.getAddress()) ? 1 : -1) :
                   (p1 <  p2 ? -1 : 1);  
    }