Class ImmutableStats

java.lang.Object
io.substrait.hint.Hint.Stats
io.substrait.hint.ImmutableStats
All Implemented Interfaces:
HasExtension

public final class ImmutableStats extends Hint.Stats
Immutable implementation of Hint.Stats.

Use the builder to create immutable instances: ImmutableStats.builder().

  • Method Details

    • getExtension

      public Optional<AdvancedExtension> getExtension()
      Returns:
      the AdvancedExtension associated directly with the class
    • rowCount

      public double rowCount()
      Specified by:
      rowCount in class Hint.Stats
      Returns:
      The value of the rowCount attribute
    • recordSize

      public double recordSize()
      Specified by:
      recordSize in class Hint.Stats
      Returns:
      The value of the recordSize attribute
    • withExtension

      public final ImmutableStats withExtension(AdvancedExtension value)
      Copy the current immutable object by setting a present value for the optional extension attribute.
      Parameters:
      value - The value for extension
      Returns:
      A modified copy or this if not changed
    • withExtension

      public final ImmutableStats withExtension(Optional<? extends AdvancedExtension> optional)
      Copy the current immutable object by setting an optional value for the extension attribute. A shallow reference equality check is used on unboxed optional value to prevent copying of the same value by returning this.
      Parameters:
      optional - An optional value for extension
      Returns:
      A modified copy or this if not changed
    • withRowCount

      public final ImmutableStats withRowCount(double value)
      Copy the current immutable object by setting a value for the rowCount attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for rowCount
      Returns:
      A modified copy or the this object
    • withRecordSize

      public final ImmutableStats withRecordSize(double value)
      Copy the current immutable object by setting a value for the recordSize attribute. A value strict bits equality used to prevent copying of the same value by returning this.
      Parameters:
      value - A new value for recordSize
      Returns:
      A modified copy or the this object
    • equals

      public boolean equals(Object another)
      This instance is equal to all instances of ImmutableStats that have equal attribute values.
      Overrides:
      equals in class Object
      Returns:
      true if this is equal to another instance
    • hashCode

      public int hashCode()
      Computes a hash code from attributes: extension, rowCount, recordSize.
      Overrides:
      hashCode in class Object
      Returns:
      hashCode value
    • toString

      public String toString()
      Prints the immutable value Stats with attribute values.
      Overrides:
      toString in class Object
      Returns:
      A string representation of the value
    • copyOf

      public static ImmutableStats copyOf(Hint.Stats instance)
      Creates an immutable copy of a Hint.Stats value. Uses accessors to get values to initialize the new immutable instance. If an instance is already immutable, it is returned as is.
      Parameters:
      instance - The instance to copy
      Returns:
      A copied immutable Stats instance
    • builder

      public static ImmutableStats.Builder builder()
      Creates a builder for ImmutableStats.
       ImmutableStats.builder()
          .extension(Optional<io.substrait.extension.AdvancedExtension>) // optional extension
          .rowCount(double) // required rowCount
          .recordSize(double) // required recordSize
          .build();
       
      Returns:
      A new ImmutableStats builder