Class: Limit

olympe.dc.transformers. Limit

A transformer that extracts the subset of instances that are within the specified range. The range is specified with a starting index and a size (or count).

Example:

const subset = lst.transform(new olympe.dc.transformers.Limit(1, 3));

The example above extracts the 3 instances in the list starting at index 1.


new Limit(start, count)

Creates an instance of the Limit transformer.

Parameters:
Name Type Description
start olympe.df.PONumber | number

Starting point of the range.

count olympe.df.PONumber | number

Size of the range.

Implements:

Methods


getCount()

Gets the count value

Returns:
Type
olympe.df.PONumber | number

getName()

Gets this Transformer unique name.

Implements:
Returns:

The name.

Type
string

getStart()

Gets the start value

Returns:
Type
olympe.df.PONumber | number

getTransform(manager, stateResolver, callback)

Get the transformer's transform function. This is the method that implementations of Transformer must provide and is where the actual transformation will take place.

Parameters:
Name Type Description
manager olympe.dc.Manager

The DC manager.

stateResolver olympe.dc.ranking.StateResolver

The state resolver.

callback olympe.dc.Manager.TransformationCallback

The callback.

Implements:
Returns:

The transform function.

Type
olympe.dc.Manager.TransformationCallback

getValueType()

Gets the transformed item's value type. A null value means that the transformer will not change the type of the values (e.g. a sort transformer).

Implements:
Returns:

Returns the transformed listDef value new type or null if this transformer does not change it

Type
function

serialize(parameters)

Serializes the transformer.

Parameters:
Name Type Description
parameters olympe.dc.query.Parameters

The parameters for the serialization.

Implements:
Throws:

If the transformer is not serializable.

Type
Error
Returns:

The JSON representation.

Type
string

toString()

Gets a string representation of the transformer.

Implements:
Returns:

The representation.

Type
string