Enum Class TraverseType

java.lang.Object
java.lang.Enum<TraverseType>
org.gnome.glib.TraverseType
All Implemented Interfaces:
Serializable, Comparable<TraverseType>, Constable, Enumeration

@Generated("org.javagi.JavaGI") public enum TraverseType extends Enum<TraverseType> implements Enumeration

Specifies the type of traversal performed by g_tree_traverse(), g_node_traverse() and g_node_find().

The different orders are illustrated here:

  • In order: A, B, C, D, E, F, G, H, I Sorted binary tree, in-order traversal
  • Pre order: F, B, A, D, C, E, G, I, H Sorted binary tree, pre-order traversal
  • Post order: A, C, E, D, B, H, I, G, F Sorted binary tree, post-order traversal
  • Level order: F, B, G, A, D, I, C, E, H Sorted binary tree, breadth-first level order traversal
  • Enum Constant Details

    • IN_ORDER

      public static final TraverseType IN_ORDER
      visits a node's left child first, then the node itself, then its right child. This is the one to use if you want the output sorted according to the compare function.
    • PRE_ORDER

      public static final TraverseType PRE_ORDER
      visits a node, then its children.
    • POST_ORDER

      public static final TraverseType POST_ORDER
      visits the node's children, then the node itself.
    • LEVEL_ORDER

      public static final TraverseType LEVEL_ORDER
      is not implemented for balanced binary trees. For n-ary trees, it visits the root node first, then its children, then its grandchildren, and so on. Note that this is less efficient than the other orders.
  • Method Details

    • values

      public static TraverseType[] 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 TraverseType 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
    • of

      public static TraverseType of(int value)
      Create a new TraverseType for the provided value
      Parameters:
      value - the enum value
      Returns:
      the enum for the provided value
    • getValue

      public int getValue()
      Get the numeric value of this enum
      Specified by:
      getValue in interface Enumeration
      Returns:
      the enum value
    • of

      public static TraverseType of(MemorySegment address)
      Create a new TraverseType for the value in the provided memory address.
      Parameters:
      address - the memory address holding a enum value
      Returns:
      the enum for the value in the provided memory address