Class GremlinValueComparator

  • All Implemented Interfaces:

    public abstract class GremlinValueComparator
    extends Object
    implements Comparator<Object>
    An implementation of the Comparability/Orderability semantics as defined in the Apache TinkerPop Provider documentation.
    Mike Personick (
    • Field Detail


        public static final GremlinValueComparator ORDERABILITY
        Orderability comparator allows for a total order across all types (no type error exceptions).

        public static final GremlinValueComparator COMPARABILITY
        Comparability has very similar semantics to orderability with the following exceptions: 1. NaN is not equal to anything, including itself, and cannot be compared to anything: equals(NaN, anything) = FALSE compare(NaN, anything) = ERROR 2. Unlike Orderability, Comparability is limited to a single type space: compare(type1, type2) = ERROR Note that because of type errors for Comparability, equals(a,b) does not necessarily produce the same result as compare(a,b) == 0. Make sure to use equals(a,b) for P.eq/neq.
    • Method Detail

      • compare

        public abstract int compare​(Object f,
                                    Object s)
        Compare(a,b) is defined differently for Comparablity vs. Orderability.
        Specified by:
        compare in interface Comparator<Object>
      • equals

        public abstract boolean equals​(Object f,
                                       Object s)
        Equals(a,b) is defined differently for Comparablity (equality) vs. Orderability (equivalence).