Class: AbstractSortArray

sort/abstract. AbstractSortArray

Base abstract class for arrays that implement sorting algorithms. Do not invoke directly.


<abstract> new AbstractSortArray( [interrupt])

Parameters:
Name Type Argument Default Description
interrupt module:sort/virtual.interruptCallback <optional>
() => {}
Throws:
  • Illegal constructor.

    Type
    TypeError
  • interrupt must be a function.

    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
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> 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.


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.


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.

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.