MaximaSet

Container which stores only pairs forming strictly increasing trend in both keys and values. This structure is based on SortedMap.

new MaximaSet()

/**
 * Creates an instance of MaximaSet.
 *
 * @param iterable Iterable of X, Y pairs to create the new maxima set with.
 * @param compareX Comparison function for pairs sorting by X values. Xs are compared as numbers by default.
 * @param compareY Comparison function for pairs sorting by Y values. Ys are compared as numbers by default.
 */
constructor(
  iterable: Iterable<[X, Y]> = [],
  protected compareX: CompareFunc<X> = compareAsNumbers,
  protected compareY: CompareFunc<Y> = compareAsNumbers,
)

length

/**
 * Number of pairs in the set.
 *
 * @readonly
 */
get length(): number;

add()

getBest()

clear()

getFirst()

getLast()

isEmpty()

[Symbol.iterator]()

Last updated

Was this helpful?