Home Reference Source Repository
import Strategy from 'lseqtree/lib/strategy.js'
public class | source

Strategy

Enumerate the available sub-allocation strategies. The signature of these functions is f(Id, Id, N+, N+, N, N): Id.

Constructor Summary

Public Constructor
public

constructor(base: Base, boundary: Number)

Member Summary

Private Members
private

_base: *

private

Method Summary

Public Methods
public

bMinus(p: LSeqNode, q: LSeqNode, level: Number, interval: Number, s: Object, c: Number): *

Choose an identifier starting from next bound and substract a random number.

public

bPlus(p: LSeqNode, q: LSeqNode, level: Number, interval: Number, s: Object, c: Number): Identifier

Choose an identifier starting from previous bound and adding random number.

Private Methods
private

_getSC(d: Number, p: LSeqNode, q: LSeqNode, level: Number, s: Object, c: Number): Identifier

Copies the appropriates source and counter from the adjacent identifiers at the insertion position.

Public Constructors

public constructor(base: Base, boundary: Number) source

Params:

NameTypeAttributeDescription
base Base

The base used to create the new identifiers.

boundary Number
  • optional
  • default: 10

The value used as the default maximum spacing between identifiers.

Private Members

private _base: * source

private _boundary: * source

Public Methods

public bMinus(p: LSeqNode, q: LSeqNode, level: Number, interval: Number, s: Object, c: Number): * source

Choose an identifier starting from next bound and substract a random number.

Params:

NameTypeAttributeDescription
p LSeqNode

The previous identifier.

q LSeqNode

The next identifier.

level Number

The number of concatenation composing the new identifier.

interval Number

The interval between p and q.

s Object

The source that creates the new identifier.

c Number

The counter of that source.

Return:

*

public bPlus(p: LSeqNode, q: LSeqNode, level: Number, interval: Number, s: Object, c: Number): Identifier source

Choose an identifier starting from previous bound and adding random number.

Params:

NameTypeAttributeDescription
p LSeqNode

The previous identifier.

q LSeqNode

The next identifier.

level Number

The number of concatenation composing the new identifier.

interval Number

The interval between p and q.

s Object

The source that creates the new identifier.

c Number

The counter of that source.

Return:

Identifier

The new allocated identifier.

Private Methods

private _getSC(d: Number, p: LSeqNode, q: LSeqNode, level: Number, s: Object, c: Number): Identifier source

Copies the appropriates source and counter from the adjacent identifiers at the insertion position.

Params:

NameTypeAttributeDescription
d Number

The digit part of the new identifier.

p LSeqNode

The previous identifier.

q LSeqNode

the next identifier.

level Number

The size of the new identifier.

s Object

The local site identifier.

c Number

The local monotonic counter.

Return:

Identifier

The new allocated identifier.