org.apache.tinkerpop.gremlin.process.traversal

## Enum Compare

- java.lang.Object
- - java.lang.Enum<Compare>
  - - org.apache.tinkerpop.gremlin.process.traversal.Compare

- All Implemented Interfaces:
    Serializable, Comparable<Compare>, BiPredicate<Object,Object>

      public enum Compare
      extends Enum<Compare>
      implements BiPredicate<Object,Object>

  `Compare` is a `BiPredicate` that determines whether the first argument is `==`, `!=`, `>`, `>=`, `<`, `<=` to the second argument.
  Author:
    Marko A. Rodriguez (http://markorodriguez.com), Stephen Mallette (http://stephen.genoprime.com), Matt Frantz (http://github.com/mhfrantz)

- - ### Enum Constant Summary

    Enum Constants
    Enum Constant and Description
    `eq` Evaluates if the first object is equal to the second.
    `gt` Evaluates if the first object is greater than the second.
    `gte` Evaluates if the first object is greater-equal to the second.
    `lt` Evaluates if the first object is less than the second.
    `lte` Evaluates if the first object is less-equal to the second.
    `neq` Evaluates if the first object is not equal to the second.

  - ### Method Summary

    All Methods Static Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `abstract Compare` | `negate()` Produce the opposite representation of the current `Compare` enum.
    `static Compare` | `valueOf(String name)` Returns the enum constant of this type with the specified name.
    `static Compare[]` | `values()` Returns an array containing the constants of this enum type, in the order they are declared.

    - ### Methods inherited from class java.lang.Enum

      `clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf`

    - ### Methods inherited from class java.lang.Object

      `getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface java.util.function.BiPredicate

      `and, or, test`

- - ### Enum Constant Detail

    - #### eq

          public static final Compare eq

      Evaluates if the first object is equal to the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.compareTo(java.math.BigDecimal)`. Otherwise they are evaluated via `Object.equals(Object)`. Testing against `Number.doubleValue()` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

    - #### neq

          public static final Compare neq

      Evaluates if the first object is not equal to the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.equals(java.lang.Object)`. Otherwise they are evaluated via `Object.equals(Object)`. Testing against `Number.doubleValue()` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

    - #### gt

          public static final Compare gt

      Evaluates if the first object is greater than the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.compareTo(java.math.BigDecimal)`. Otherwise they are evaluated via `Comparable.compareTo(Object)`. Testing against `BigDecimal.compareTo(java.math.BigDecimal)` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

    - #### gte

          public static final Compare gte

      Evaluates if the first object is greater-equal to the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.compareTo(java.math.BigDecimal)`. Otherwise they are evaluated via `Comparable.compareTo(Object)`. Testing against `BigDecimal.compareTo(java.math.BigDecimal)` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

    - #### lt

          public static final Compare lt

      Evaluates if the first object is less than the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.compareTo(java.math.BigDecimal)`. Otherwise they are evaluated via `Comparable.compareTo(Object)`. Testing against `BigDecimal.compareTo(java.math.BigDecimal)` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

    - #### lte

          public static final Compare lte

      Evaluates if the first object is less-equal to the second. If both are of type `Number` but not of the same class (i.e. double for the first object and long for the second object) both values are converted to `BigDecimal` so that it can be evaluated via `BigDecimal.compareTo(java.math.BigDecimal)`. Otherwise they are evaluated via `Comparable.compareTo(Object)`. Testing against `BigDecimal.compareTo(java.math.BigDecimal)` enables the compare operations to be a bit more forgiving with respect to comparing different number types.

  - ### Method Detail

    - #### values

          public static Compare[] values()

      Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:

          for (Compare c : Compare.values())
              System.out.println(c);

      Returns:
        an array containing the constants of this enum type, in the order they are declared

    - #### valueOf

          public static Compare valueOf(String name)

      Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)
      Parameters:
        `name` - the name of the enum constant to be returned.
      Returns:
        the enum constant with the specified name
      Throws:
        `IllegalArgumentException` - if this enum type has no constant with the specified name
        `NullPointerException` - if the argument is null

    - #### negate

          public abstract Compare negate()

      Produce the opposite representation of the current `Compare` enum.
      Specified by:
        `negate` in interface `BiPredicate<Object,Object>`

Copyright © 2013–2018 Apache Software Foundation. All rights reserved.