Interface: Comparator

olympe.dc. Comparator

A Comparator is used by transformers to compare two instances in order to determine whether they are equals, or which one has a higher rank. But it also specifies how to retrieve the value from the instance.

Methods


<abstract> compare(a, b)

Compares two values, a and b, (as retrieved by getComparedValue()). Returns:

  • 0 if 'a' & 'b' are equal.
  • 1 if 'a' is bigger than 'b'.
  • -1 if 'a' is smaller than 'b'.
Parameters:
Name Type Description
a T

The value to the left of the comparison.

b T

The value to the right of the comparison.

Returns:

'0', '1', or '-1'.

Type
number

<abstract> getComparedValue(dcManager, tag)

Gets the value to compare for the specified instance.

Parameters:
Name Type Description
dcManager olympe.dc.Manager

Datacloud manager

tag string

Instance tag

Returns:

The value.

Type
olympe.df.Proxy.<T> | T

<abstract> getInternalPath()

Returns the path in the graph followed by this comparator to be evaluated.

Returns:
Type
Array.<!olympe.dc.query.Relation>

<abstract> getName()

Gets the name of this Comparator.

Returns:

The name of this comparator.

Type
string

<abstract> serialize(parameters)

Serializes the comparator - should return a string unique to this comparator

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

Serialization parameters.

Throws:

If the comparator is not serializable

Type
Error
Returns:

A string containing the serialized form.

Type
string

<abstract> toString()

Gets a string representation

Returns:

The string representation.

Type
string