All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bigdata.rdf.lexicon.KVOTermIdComparator Maven / Gradle / Ivy

package com.bigdata.rdf.lexicon;

import java.util.Comparator;

import com.bigdata.btree.keys.KVO;
import com.bigdata.rdf.internal.IV;
import com.bigdata.rdf.model.BigdataValue;

/**
 * Places {@link KVO}s containing {@link BigdataValue} references into an
 * ordering determined by the assigned term identifiers}.
 * 
 * @author Bryan Thompson
 * @version $Id$
 * 
 * @see BigdataValue#getIV()
 */
public class KVOTermIdComparator implements Comparator> {

    public static final transient Comparator> INSTANCE = new KVOTermIdComparator();

    /**
     * Note: defers to natural ordering for {@link IV} objects.
     */
    public int compare(final KVO term1,
            final KVO term2) {

        final IV iv1 = term1.obj.getIV();
        final IV iv2 = term2.obj.getIV();

        return iv1.compareTo(iv2);

    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy