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

LSeqNode

A node of the LSeq tree.

Static Method Summary

Static Public Methods
public static

Cast a JSON object to an LSeqNode.

Constructor Summary

Public Constructor
public

constructor(triples: Triple[], element: Object)

Member Summary

Public Members
public get

Getter to the first child.

public

children: *[]

public

e: *

public get

Check if the node has children.

public
public

t: *

Private Members
private get

Method Summary

Public Methods
public

add(node: LSeqNode): Boolean

Add a node to the current node.

public

Comparator between to LSeqNodes.

public

del(node: LSeqNode): Boolean

Remove the node of the tree and all node within path being useless.

public

get(index: Number): LSeqNode

The ordered tree can be linearized.

public

The ordered tree can be linearized into a sequence.

Private Methods
private

_binaryIndexOf(searchElement: LSeqNode): Number

private

_contains(searchElement: LSeqNode): Boolean

private

Static Public Methods

public static fromJSON(o: Object): LSeqNode source

Cast a JSON object to an LSeqNode.

Params:

NameTypeAttributeDescription
o Object

The JSON object.

Return:

LSeqNode

An LSeqNode.

Public Constructors

public constructor(triples: Triple[], element: Object) source

Params:

NameTypeAttributeDescription
triples Triple[]

The list of triples composing the path to the element.

element Object

The element to insert in the structure, e.g., a character in a text document.

Public Members

public get child: LSeqNode: * source

Getter to the first child.

Return:

LSeqNode

The first child of this node. Null if it does not exists.

public children: *[] source

public e: * source

public get isLeaf: Boolean: * source

Check if the node has children.

Return:

Boolean

True if the node has children, false otherwise.

public subCounter: * source

public t: * source

Private Members

private get _hasElement: Boolean: * source

Return:

Boolean

True if the node has an element, false otherwise.

Public Methods

public add(node: LSeqNode): Boolean source

Add a node to the current node.

Params:

NameTypeAttributeDescription
node LSeqNode

The node to add as a children of this node.

Return:

Boolean

False if the element already exists, True otherwise.

public compareTo(o: LSeqNode): * source

Comparator between to LSeqNodes.

Params:

NameTypeAttributeDescription
o LSeqNode

The other LSeqNode to compare to.

Return:

*

public del(node: LSeqNode): Boolean source

Remove the node of the tree and all node within path being useless.

Params:

NameTypeAttributeDescription
node LSeqNode

the node containing the path to remove

Return:

Boolean

True if the node has been removed, False if it does not exist.

public get(index: Number): LSeqNode source

The ordered tree can be linearized. This function gets the node at the index in the projected sequence.

Params:

NameTypeAttributeDescription
index Number

The index in the sequence.

Return:

LSeqNode

The node at the index.

public indexOf(node: LSeqNode): Number source

The ordered tree can be linearized into a sequence. This function get the index of the path represented by the list of triples.

Params:

NameTypeAttributeDescription
node LSeqNode

The node containing -- at least -- the path to the element.

Return:

Number

The index of the node in the linearized sequence; -1 if the element does not exist.

Private Methods

private _binaryIndexOf(searchElement: LSeqNode): Number source

Params:

NameTypeAttributeDescription
searchElement LSeqNode

The item to search for within the array.

Return:

Number

The index of the element which defaults to -1 when not found.

private _contains(searchElement: LSeqNode): Boolean source

Params:

NameTypeAttributeDescription
searchElement LSeqNode

The element to look for.

Return:

Boolean

True if this node contains the node in its children, False otherwise.

private _getIndexes(node: LSeqNode): Number[] source

Params:

NameTypeAttributeDescription
node LSeqNode

The node containing the path.

Return:

Number[]

The successive indexes to get to the node. An empty list if the node does not exist.