Class NumericSorter

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public class NumericSorter extends Sorter

Sorts items numerically.

To obtain the numbers to compare, this sorter evaluates a Expression.

  • Constructor Details

    • NumericSorter

      public NumericSorter(MemorySegment address)
      Create a NumericSorter instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • NumericSorter

      public NumericSorter(@Nullable Expression expression)

      Creates a new numeric sorter using the given expression.

      Smaller numbers will be sorted first. You can call setSortOrder(SortType) to change this.

      Parameters:
      expression - The expression to evaluate
    • NumericSorter

      public NumericSorter()
      Create a new NumericSorter.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the NumericSorter class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected NumericSorter asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class Sorter
      Returns:
      the instance as if it were its parent type
    • getExpression

      public @Nullable Expression getExpression()
      Gets the expression that is evaluated to obtain numbers from items.
      Returns:
      a GtkExpression
    • getSortOrder

      public SortType getSortOrder()
      Gets whether this sorter will sort smaller numbers first.
      Returns:
      the order of the numbers
    • setExpression

      public void setExpression(@Nullable Expression expression)

      Sets the expression that is evaluated to obtain numbers from items.

      Unless an expression is set on self, the sorter will always compare items as invalid.

      The expression must have a return type that can be compared numerically, such as G_TYPE_INT or G_TYPE_DOUBLE.

      Parameters:
      expression - a GtkExpression
    • setSortOrder

      public void setSortOrder(SortType sortOrder)
      Sets whether to sort smaller numbers before larger ones.
      Parameters:
      sortOrder - whether to sort smaller numbers first
    • builder

      public static NumericSorter.Builder<? extends NumericSorter.Builder> builder()
      A NumericSorter.Builder object constructs a NumericSorter with the specified properties. Use the various set...() methods to set properties, and finish construction with NumericSorter.Builder.build().
      Returns:
      the builder object