com.bigdata.rdf.model.BigdataValueIdComparator Maven / Gradle / Ivy
/**
The Notice below must appear in each file of the Source Code of any
copy you distribute of the Licensed Product. Contributors to any
Modifications may add their own copyright notices to identify their
own contributions.
License:
The contents of this file are subject to the CognitiveWeb Open Source
License Version 1.1 (the License). You may not copy or use this file,
in either source code or executable form, except in compliance with
the License. You may obtain a copy of the License from
http://www.CognitiveWeb.org/legal/license/
Software distributed under the License is distributed on an AS IS
basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
the License for the specific language governing rights and limitations
under the License.
Copyrights:
Portions created by or assigned to CognitiveWeb are Copyright
(c) 2003-2003 CognitiveWeb. All Rights Reserved. Contact
information for CognitiveWeb is available at
http://www.CognitiveWeb.org
Portions Copyright (c) 2002-2003 Bryan Thompson.
Acknowledgements:
Special thanks to the developers of the Jabber Open Source License 1.0
(JOSL), from which this License was derived. This License contains
terms that differ from JOSL.
Special thanks to the CognitiveWeb Open Source Contributors for their
suggestions and support of the Cognitive Web.
Modifications:
*/
/*
* Created on Jul 5, 2008
*/
package com.bigdata.rdf.model;
import java.util.Comparator;
import com.bigdata.rdf.internal.IV;
/**
* Places {@link BigdataValue}s into an ordering determined by their assigned
* {@link BigdataValue#getIV() term identifiers}.
*
* @author Bryan Thompson
* @version $Id$
*/
public class BigdataValueIdComparator implements Comparator {
public static final transient Comparator INSTANCE = new BigdataValueIdComparator();
/**
* Note: comparison avoids possible overflow of long
by
* not computing the difference directly.
*/
public int compare(BigdataValue term1, BigdataValue term2) {
final IV iv1 = term1.getIV();
final IV iv2 = term2.getIV();
return iv1.compareTo(iv2);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy