Enum Class BucketizationStrategy

java.lang.Object
java.lang.Enum<BucketizationStrategy>
com.ggalmazor.ltdownsampling.BucketizationStrategy
All Implemented Interfaces:
Serializable, Comparable<BucketizationStrategy>, Constable

public enum BucketizationStrategy extends Enum<BucketizationStrategy>
Selects the bucket size strategy used to divide the input series before the Largest-Triangle Three-Buckets selection step.

These strategies correspond directly to the dynamic and fixed bucket sizes described in the original LTTB paper: Downsampling Time Series for Visual Representation by Sveinn Steinarsson (2013).

  • Use DYNAMIC (the default) when samples are evenly distributed across the x-axis. Each bucket contains the same number of points, so bucket x-span varies with data density.
  • Use FIXED when samples are unevenly distributed, or when there are gaps in the series. Each bucket covers the same x-span, so bucket point count varies with data density. Empty buckets (x-intervals with no points) are silently skipped; the output may therefore have fewer than desiredBuckets + 2 points.
  • Enum Constant Details

    • DYNAMIC

      public static final BucketizationStrategy DYNAMIC
      Dynamic bucket size: each bucket contains an equal number of points.

      This is the default strategy, corresponding to the dynamic bucket size variant in the original LTTB paper. It works well when samples are evenly distributed across the x-axis, where equal point counts correspond to equal x-spans.

      Requires at least desiredBuckets + 2 points in the input. Throws IllegalArgumentException if the input is too small.

    • FIXED

      public static final BucketizationStrategy FIXED
      Fixed bucket size: each bucket covers an equal x-axis span.

      Corresponds to the fixed bucket size variant in the original LTTB paper. The total x range [x_first, x_last] is divided into desiredBuckets equal-width intervals. Each point is assigned to the interval that contains its Point.x() value. This works correctly whether x() represents timestamps, plain numeric indices, or any other monotonically increasing dimension.

      X-intervals that contain no points are silently skipped. As a result, the output may contain fewer than desiredBuckets + 2 points when the input has gaps or highly uneven density.

      Point.x() must be monotonically non-decreasing across the input list.

  • Method Details

    • values

      public static BucketizationStrategy[] 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 BucketizationStrategy 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