Class: KeyedSortArray

sort/keyed. KeyedSortArray

Base abstract class for arrays that implement non-comparative sorting algorithms.


<abstract> new KeyedSortArray( [interrupt] [, key])

Parameters:
Name Type Argument Default Description
interrupt module:sort/virtual.interruptCallback <optional>
key module:sort/virtual.keyCallback <optional>
o => 0
Throws:

key must be a function of 1 argument.

Type
TypeError

Extends

Methods


delete(key)

Parameters:
Name Type Description
key *

Reference key of scoped variable.

Inherited From:
Implements:
Returns:

successful - Is true if removed, false if element does not exist.

Type
boolean

<generator> fill(factory [, length])

A method to interruptably populate the array with elements generated from factory.

Parameters:
Name Type Argument Default Description
factory module:sort/virtual.fillCallback
length number <optional>
this.length
Inherited From:
Throws:

factory must be a function.

Type
TypeError

get(key)

Parameters:
Name Type Description
key *

Reference key of scoped variable.

Inherited From:
Implements:
Returns:

value - Scoped variable for the given key or undefined if none exists.

Type
*

has(key)

Parameters:
Name Type Description
key *

Reference key of scoped variable.

Inherited From:
Implements:
Returns:

exists - Instance contains a scoped variable for the given key.

Type
boolean

<generator> key(index [, value])

A method to interruptably key an element in the array. value is optional, since index can sometimes be used to represent an index that is virtual in the key.

Parameters:
Name Type Argument Default Description
index number

Index of the element to key.

value * <optional>
this[i]

Value of the element to key.

Returns:

result - A non-negative integer value representing the relational index of value.

Type
number

<generator> put(index, value)

A method to interruptably put an element in the array.

Parameters:
Name Type Description
index number

Index to put element value.

value *

Value to put in index.

Inherited From:

set(key, value)

Parameters:
Name Type Description
key *

Reference key of scoped variable.

value *

Value of scoped variable to set.

Inherited From:
Implements:
Returns:
Type
this

<generator> shuffle()

A method to interruptably randomize the order of elements in the array. Uses the Knuth Fisher Yates method.

Inherited From:

slice( [begin] [, end])

Shallow copy a portion of an array into a new array object.

Parameters:
Name Type Argument Default Description
begin number <optional>
0

First index of shallow copy.

end number <optional>
this.length

Last index of shallow copy, not included.

Inherited From:
Returns:
Type
Array

<generator, abstract> sort()

Abstract method to interruptably sort array of elements.

Inherited From:
Throws:

Illegal invocation.

Type
TypeError

<generator> swap(i, j)

A method to interruptably swap two elements in the array.

Parameters:
Name Type Description
i number

Index of first element to swap.

j number

Index of second element to swap.

Inherited From: