Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RangeSearch<T>

A representation of an inequality that can be used to search and sort the elements of an array into buckets. It is a collection of Points. Each Point will include any values less that its own and, if the point is inclusive, equal to its own.

Type parameters

  • T

Hierarchy

  • RangeSearch

Index

Constructors

constructor

Properties

Private cf

greater_find_least

greater_find_least: boolean = false

True if only one value is kept for elements after the last point. Used to find the inorder successor.

Private Optional last_bucket

last_bucket: string

lesser_find_greatest

lesser_find_greatest: boolean = false

True if only one value is kept for elements before the first point. Used to find the inorder predecessor.

Private points

points: Point<T>[] = []

Methods

all_greater

  • all_greater(bucket?: string): void
  • Set the default bucket for any values greater than the last point.

    Parameters

    • Optional bucket: string

    Returns void

getBucketInfo

  • getBucketInfo(data: T, current?: object, clear_buckets?: boolean, traverse_left?: function): object
  • A function used by Binary Search Trees to determine traversal.

    Parameters

    • data: T

      The value to compare.

    • Optional current: object

      The current values that are stored.

      • [key: string]: T[]
    • Default value clear_buckets: boolean = false

      If true, elements from current will be eliminated if they are affected by lesser_find_greatest or greater_find_least and an alternative closer to data is found.

    • Optional traverse_left: function

      Will be called when there is the possibility that there are elements smaller than this one that will satisfy greater_find_least, thereby reducing the number of necessary traversals.

        • (): void
        • Returns void

    Returns object

    An object containing left and right, which are booleans that tell whether more data could be found to the left and right of data, respectively, as well as an optional bucket string to tell where data should be sorted.

    • Optional bucket?: string
    • left: boolean
    • right: boolean

push_point

  • push_point(data: T, bucket: string, inclusive?: boolean): void
  • Add a point to the collection.

    Parameters

    • data: T

      The value for comparison.

    • bucket: string

      The bucket to sort values into, or undefined to discard.

    • Default value inclusive: boolean = false

      Determines if the point includes data.

    Returns void

search_array

  • search_array(array: T[]): object
  • Parameters

    • array: T[]

    Returns object

    • [key: string]: T[]

sort

  • sort(data: T, range_buckets?: object): object
  • Parameters

    • data: T
    • Default value range_buckets: object = {}
      • [key: string]: T[]

    Returns object

    • [key: string]: T[]

Static gt

Static gteq

Static lt

Static lteq

Generated using TypeDoc