Class: Deferred

olympe.dc.ranking. Deferred

Deferred rank, acts as a promise to ranks for items at the same depth in a query (ie. a listdef)

  • It needs to store multiple items in case of a Related towards multiple instances.
  • It stores a singe item in case of filtering (or as much item as there was in the parent Deferred).

new Deferred(manager [, parent])

Parameters:
Name Type Argument Description
manager olympe.dc.ranking.Manager
parent olympe.dc.ranking.Deferred <optional>

Members


<protected, nullable> child :olympe.dc.ranking.Deferred

Type:

<protected> depth :number

Type:
  • number

<protected> manager :olympe.dc.ranking.Manager

Type:

<protected, nullable> parent :olympe.dc.ranking.Deferred

Type:

Methods


activate()

Activates the parent deferred and update ranks. That is, ask the ranking manager to compute ranks for the parent depth

Throws:

If the deferred doesn't have a parent

Type
Error

collectItems(siblings)

Adds the items registered in this deferred to the specified array

Parameters:
Name Type Description
siblings Array.<string>

Array of item's indexes


getChild(added, tag, index)

Get the child deferred for this item, representing a new depth level in the transformer chain.

The child is common to all the items at the same depth. This method could be refactored to handle separately getting the child and managing the items at the given level.

Parameters:
Name Type Description
added boolean

Whether the item is added or removed

tag string

Item's tag

index string

Item's index

Returns:
Type
olympe.dc.ranking.Deferred

getDepth()

Gets the depth of this

Returns:
Type
number

getDescendant(depth)

Gets the grand child at the specified depth, or the deepest available child if the transform chain was stopped by a filter

Parameters:
Name Type Description
depth number

Descendant depth (if depth is 0, this deferred is returned)

Returns:
Type
olympe.dc.ranking.Deferred

getManager()

Gets the parent ranking manager

Returns:
Type
olympe.dc.ranking.Manager