Enum Class KeyPath.KeyComparator

java.lang.Object
java.lang.Enum<KeyPath.KeyComparator>
ghidra.trace.model.target.path.KeyPath.KeyComparator
All Implemented Interfaces:
Serializable, Comparable<KeyPath.KeyComparator>, Constable, Comparator<String>
Enclosing class:
KeyPath

public static enum KeyPath.KeyComparator extends Enum<KeyPath.KeyComparator> implements Comparator<String>
Comparators for keys, i.e., strings in a path
  • Enum Constant Details

    • ATTRIBUTE

      public static final KeyPath.KeyComparator ATTRIBUTE
      Sort keys by attribute name, lexicographically.
    • ELEMENT

      public static final KeyPath.KeyComparator ELEMENT
      Sort keys by element index.

      Element indices may be multidimensional, in which case the dimensions are separated by commas, and sorting prioritizes the left-most dimensions. Where indices (or dimensions thereof) appear to be numeric, they are sorted as such. Otherwise, they are sorted lexicographically. Numeric types can be encoded in hexadecimal. While decimal is typical you may run into difficulties if those numbers are too large, as the implementation must assume numeric types are hexadecimal.

      Implementation Notes:
      The only way I can think to resolve the numeric encoding issue is to examine all keys before even selecting a comparator. As is, a comparator can only see two keys at a time, and has no context to what it's actually sorting.
    • ELEMENT_DIM

      public static final KeyPath.KeyComparator ELEMENT_DIM
      Sort keys by element index, allowing only one dimension.

      Please use ELEMENT, unless you really know you need this instead.

    • CHILD

      public static final KeyPath.KeyComparator CHILD
      Sort keys by element or index as appropriate, placing elements first.
  • Method Details

    • values

      public static KeyPath.KeyComparator[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static KeyPath.KeyComparator valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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 class has no constant with the specified name
      NullPointerException - if the argument is null