Class: BuilderNode

BuilderNode

BuilderNodes are nodes in a BuilderGraph. That is, they are nodes in a user defined motif. They are not results of a search for a motif. Rather, they define the motif structure that should be searched for. BuilderNodes are so named because they are the result of the user-facing graph builder.

Constructor

new BuilderNode()

Constructs a BuilderNode
Source:

Extends

Methods

addChild(node)

Adds a child to this node, preserving the invariants described at the top of this document. Specifically:

  • if and only if x is a child of y, then y is a parent of x
  • All the children of a node belong to different hosts
  • All the parents of a node belong to different hosts
  • The last two invariants are preserved by calling removeChild or removeParent on any existing children or parents that violate the invariants.

    A node x cannot be the child of a node y if they have the same host.

    Parameters:
    Name Type Description
    node AbstractNode The child node to add
    Inherited From:
    Source:

    addParent(node)

    Adds a parent to this node, preserving the invariants described at the top of this document. Specifically:

  • if and only if x is a child of y, then y is a parent of x
  • All the children of a node belong to different hosts
  • All the parents of a node belong to different hosts
  • The last two invariants are preserved by calling removeChild or removeParent on any existing children or parents that violate the invariants.

    A node x cannot be the parent of a node y if they have the same host.

    Parameters:
    Name Type Description
    node AbstractNode The node to add as a parent to this
    Inherited From:
    Source:

    clearChildren()

    Removes all of this node's children while preserving the invariants described at the top of this document.
    Inherited From:
    Source:

    clearFamily()

    Removes all of this node's family while preserving the invariants described at the top of this document.
    Inherited From:
    Source:

    clearParents()

    Removes all of this node's parents while preserving the invariants described at the top of this document.
    Inherited From:
    Source:

    getChildByHost(host) → {AbstractNode}

    Returns the child of this node that belongs to a specific host.
    Parameters:
    Name Type Description
    host String The target host
    Inherited From:
    Source:
    Returns:
    The child node or null if no child belongs to host.
    Type
    AbstractNode

    getChildren() → {Array.<AbstractNode>}

    Returns children of this node as an array

    This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of children.

    Inherited From:
    Source:
    Returns:
    Array of child nodes.
    Type
    Array.<AbstractNode>

    getConnections() → {Array.<AbstractNode>}

    Returns the nodes this one is connected to as an array. In the context of this function, a node is said to be connected to this one if it's the previous node, the next node, a parent, or a child. Note that if prev or next is a head or tail or null, it will still be returned.

    This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of connections.

    Inherited From:
    Source:
    Returns:
    an array of connected nodes
    Type
    Array.<AbstractNode>

    getFamily() → {Array.<AbstractNode>}

    Returns the family nodes of this node as an array.

    This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of family nodes.

    Overrides:
    Source:
    Returns:
    an array of connected nodes
    Type
    Array.<AbstractNode>

    getHost() → {String}

    Gets the node's host
    Inherited From:
    Source:
    Returns:
    the name of the host
    Type
    String

    getId() → {Number}

    Gets the globally unique ID of the node
    Inherited From:
    Source:
    Returns:
    the ID
    Type
    Number

    getNext() → {AbstractNode}

    Gets the next node. The next node is the node having the same host as the current one that comes directly after the current node. Note: the next node may be a dummy node (e.g., an isTail node).
    Inherited From:
    Source:
    Returns:
    the next node or null if there is no next node
    Type
    AbstractNode

    getParentByHost(host) → {AbstractNode}

    Returns the parent of this node that belongs to a specific host.
    Parameters:
    Name Type Description
    host String The target host
    Inherited From:
    Source:
    Returns:
    The parent node or null if no parent belongs to host.
    Type
    AbstractNode

    getParents() → {Array.<AbstractNode>}

    Returns parents of this node as an array

    This function makes no guarantees about the ordering of nodes in the array returned. Also note that a new array is created to prevent modification of the underlying private data structure, so this function takes linear rather than constant time on the number of parents.

    Inherited From:
    Source:
    Returns:
    Array of parent nodes.
    Type
    Array.<AbstractNode>

    getPrev() → {AbstractNode}

    Gets the previous node. The previous node is the node having the same host as the current one that comes directly before the current node.
    Inherited From:
    Source:
    Returns:
    the previous node or null if there is no previous node
    Type
    AbstractNode

    hasChildren() → {Boolean}

    Determines whether the node has children.
    Inherited From:
    Source:
    Returns:
    True if the node has children
    Type
    Boolean

    hasFamily() → {Boolean}

    Determines whether the node has family
    Inherited From:
    Source:
    Returns:
    True if the node has family
    Type
    Boolean

    hasHostConstraint() → {Boolean}

    Checks to see if this builder node belongs to a host with a constraint
    Overrides:
    • AbstractNode#hasHostConstraint
    Source:
    Returns:
    True if this node's host has a constraint and false otherwise
    Type
    Boolean

    hasParents() → {Boolean}

    Determines whether the node has parents
    Inherited From:
    Source:
    Returns:
    True if the node has parents
    Type
    Boolean

    insertNext(node)

    Inserts a node after this one, preserving the invariants described at the top of this document. The node to insert is first removed from its previous location (i.e by calling AbstractNode#remove). You cannot insert a node after a tail node.

    Parameters:
    Name Type Description
    node AbstractNode The node to insert
    Inherited From:
    Source:

    insertPrev(node)

    Inserts a node before this one, preserving the invariants described at the top of this document. The node to insert is first removed from its previous location (i.e by calling AbstractNode#remove). You cannot insert a node before a head node.

    Parameters:
    Name Type Description
    node AbstractNode The node to insert
    Inherited From:
    Source:

    isDummy() → {Boolean}

    Determines whether the node is a dummy head or tail node
    Inherited From:
    Source:
    Returns:
    True if node is dummy
    Type
    Boolean

    isHead() → {Boolean}

    Determines whether the node is a dummy head node
    Inherited From:
    Source:
    Returns:
    True if node is head
    Type
    Boolean

    isTail() → {Boolean}

    Determines whether the node is a dummy tail node
    Inherited From:
    Source:
    Returns:
    True if node is tail
    Type
    Boolean

    remove()

    Removes a node, preserving the invariants described at the top of this document. This method will also remove all connections to the node. Head and tail nodes cannot be removed. This function does nothing if it is called on a node that had already been removed.

    Because this method essentially removes all links to and from the node, be careful when using this inside a loop. For example, consider the following code:

    var node = this.getHead(host).getNext();
    while (!curr.isTail()) {
        curr.remove();
        curr = curr.getNext(); // sets curr to null! curr.getNext() == null after removal
    }
    
    Inherited From:
    Source:

    removeChild(node)

    Removes the target node from this's children, preserving the invariants described at the top of this document. If the argument is not one of this' children, this method does nothing.
    Parameters:
    Name Type Description
    node AbstractNode
    Inherited From:
    Source:

    removeChildByHost(host)

    Removes the child of this node that belongs to a specific host. If there is no child that belongs to host, then this method does nothing.
    Parameters:
    Name Type Description
    host String
    Inherited From:
    Source:

    removeFamily(node)

    Removes the target node from this's parents or children, preserving the invariants described at the top of this document. If the argument is not one of this' parents or children, this method does nothing
    Parameters:
    Name Type Description
    node AbstractNode
    Inherited From:
    Source:

    removeParent(node)

    Removes the target node from this's parents, preserving the invariants described at the top of this document. If the argument is not one of this' parents, this method does nothing.
    Parameters:
    Name Type Description
    node AbstractNode
    Inherited From:
    Source:

    removeParentByHost(host)

    Removes the parent of this node that belongs to a specific host. If there is no parent that belongs to host, then this method does nothing.
    Parameters:
    Name Type Description
    host String
    Inherited From:
    Source:

    setHasHostConstraint(hasHostConstraint)

    Sets the hasHostConstraint boolean to the given parameter
    Parameters:
    Name Type Description
    hasHostConstraint Boolean
    Source: