Sorting creates a streaming algorithm that can be used to sort incoming data

Format

An R6Class generator object

Methods


Method new()

Creates a new Sorting streamer object.

Usage

Sorting$new(x = NULL, method = "linked-list")

Arguments

x

values to be used during initialisation (optional)

method

the method used to sort values

Returns

The new Sorting (invisibly)


Method update()

Updates the Sorting streamer object.

Usage

Sorting$update(x)

Arguments

x

values to be added to the stream

Returns

The updated Sorting (invisibly)


Method clone()

The objects of this class are cloneable with this method.

Usage

Sorting$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

sorter <- Sorting$new(c(3, 1))
sorter$update(c(2, 4))
sorter$value
#> [1] 1 2 3 4
#> [1] 1 2 3 4