org.jrdf.graph.datatype
Class LexicalComparatorImpl

java.lang.Object
  extended by org.jrdf.graph.datatype.LexicalComparatorImpl
All Implemented Interfaces:
Serializable, Comparator<Literal>, LexicalComparator

public final class LexicalComparatorImpl
extends Object
implements LexicalComparator

See Also:
Serialized Form

Constructor Summary
LexicalComparatorImpl()
           
 
Method Summary
 int compare(Literal o1, Literal o2)
           
 int compareLanguage(Literal o1, Literal o2, boolean ignoreCase)
           
 int compareLexicalForm(Literal o1, Literal o2)
           
 int compareLiteralTypes(Literal o1, Literal o2)
          Returns order based on literal type, always goes plain, language and then data type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Comparator
equals
 

Constructor Detail

LexicalComparatorImpl

public LexicalComparatorImpl()
Method Detail

compare

public int compare(Literal o1,
                   Literal o2)
Specified by:
compare in interface Comparator<Literal>

compareLiteralTypes

public int compareLiteralTypes(Literal o1,
                               Literal o2)
Description copied from interface: LexicalComparator
Returns order based on literal type, always goes plain, language and then data type. i.e. if o1 is a plain literal always -1, if o1 is a language literal and o2 is a plain 1, else -1 and if o1 is a datatype literal then always 1. 0 if literals are equal.

Specified by:
compareLiteralTypes in interface LexicalComparator
Parameters:
o1 - the first literal to compare.
o2 - the second literal to compare.
Returns:
-1, 0 or 1 if literals based on type are smaller, equal or larger.

compareLanguage

public int compareLanguage(Literal o1,
                           Literal o2,
                           boolean ignoreCase)
Specified by:
compareLanguage in interface LexicalComparator

compareLexicalForm

public int compareLexicalForm(Literal o1,
                              Literal o2)
Specified by:
compareLexicalForm in interface LexicalComparator