Class: modelit.layout.Node

Extends: matlab.mixin.SetGet & handle & matlab.mixin.Heterogeneous

DESCRIPTION:

A node in a tree data structure. A node may have at most one parent and zero or more children. A node with no parent is the root of its tree; a node with no children is a leaf.

Properties

allowsChildren Boolean, default value: true
  True if the node is able to have children.
children (Read-only) Array, default value: []
  Array of children,
  May be [] if this node has no children.
  Children are ordered according to their rank.
  NOTE:
   get.children(obj) returns children sorted in rank order.
parent modelit.layout.Node or [], default value: []
  This node's parent, or empty if this node has no parent.
rank Integer, default value: 0
  Relative position of the node.
  When ordering horizontally: Low rank goes left. High rank goes right.
  When ordering vertically. Low rank goes on top. High rank goes below.
  NOTE: only the relative ranks are important.
signature (Read-only) Unique numeric signature (within objects of class Node)

Public Method: Node

DESCRIPTION:

modelit.layout.Node constructor.

CALL:

obj = modelit.layout.Node(allowsChildren)

INPUT:

allowsChildren any
boolean, true if this node can have children.

OUTPUT:

obj any
 modelit.layout.Node
Documentation for modelit.layout.Node/Node
   doc modelit.layout.Node

Public Sealed Method: getPathToRoot

DESCRIPTION:

Builds the parents of node up to and including the root node, where the original node is the last element in the returned array.

CALL:

value = getPathToRoot(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
list of modelit.layout.Node

Public Sealed Method: getLevel

DESCRIPTION:

Returns the number of levels above this node, i.e. the distance from the root to this node.

CALL:

value = getLevel(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
integer

Public Sealed Method: getDepthFirstList

DESCRIPTION:

Creates a list on nodes in depth-first order for the subtree starting at the specified node.

CALL:

list = getDepthFirstList(obj, list)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

list any
array of modelit.layout.Node in depth-first order

Public Sealed Method: getBreadthFirstList

DESCRIPTION:

Creates a list on nodes in breadth-first order for the subtree starting at the specified node.

CALL:

list = getBreadthFirstList(obj)

INPUT:

obj any
<modelit.layout.Node>

OUTPUT:

list any
<array of modelit.layout.Node> in breadth-first order

Public Sealed Method: isactivenode

DESCRIPTION:

Determine if a node is active.

CALL:

selectindx = isactivenode(list, parentIndex)

INPUT:

list any
Nx1 array of Frames
parentIndex any
Nx1 array of parent index

OUTPUT:

selectindx any
Mx1 array, index in list, sorted according to parent
and rank. Sorting is essential for correct display.

Public Sealed Method: getBreadthFirstListActive

DESCRIPTION:

Create list of active frames only, see getBreadthFirstList.

CALL:

list = getBreadthFirstList(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

list any
array of modelit.layout.Node in breadth-first order

Public Sealed Method: getPreviousSibling

DESCRIPTION:

Returns the previous sibling of this node. Returns [] if this node has no parent or if it is the parent's first child.

CALL:

value = getPreviousSibling(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
modelit.layout.Node or []

Public Sealed Method: getNextSibling

DESCRIPTION:

Returns the next sibling of this node. Returns [] if this node has no parent or if it is the parent's last child.

CALL:

value = getNextSibling(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
modelit.layout.Node or []

Public Sealed Method: getSiblings

DESCRIPTION:

Gets the siblings (nodes with the same parent) of this node. Note that this node is its own sibling

CALL:

value = getSiblings(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
modelit.layout.Node

Public Sealed Method: moveChild

DESCRIPTION:

Move a child of this frame to another frame.

CALL:

moveChild(obj, child, newparent)

INPUT:

obj any
modelit.layout.Node
child any
modelit.layout.Node
newparent any
modelit.layout.Node

OUTPUT:

   Child is removed from this frame and add as a child to the
   new parent frame.

Public Sealed Method: removeAllChildren

DESCRIPTION:

Removes all of this node's children.

CALL:

removeAllChildren(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

   No output

Public Sealed Method: isRoot

DESCRIPTION:

Returns true if this node is the root of the tree.

CALL:

obj = isRoot(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
boolean, true if this node is a root node

Public Sealed Method: isLeaf

DESCRIPTION:

Returns true if this node is a leaf.

CALL:

value = isLeaf(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
boolean, true if this node is a leaf (has no children)

Public Sealed Method: getRoot

DESCRIPTION:

Returns the root of this node.

CALL:

obj = getRoot(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

obj any
modelit.layout.Node

Public Sealed Method: getIndex

DESCRIPTION:

Returns the index of this node in its parent's children.

CALL:

value = getIndex(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
integer with index of this node in its parent's children, 0 if this node is a root

Public Sealed Method: getChildCount

DESCRIPTION:

Returns the number of children of this node.

CALL:

value = getChildCount(obj)

INPUT:

obj any
modelit.layout.Node

OUTPUT:

value any
integer with number of children of this node

Public Sealed Method: getChildAt

DESCRIPTION:

Returns the child of obj at index childIndex.

CALL:

value = getChildAt(obj, childIndex)

INPUT:

obj any
modelit.layout.Node
childIndex any
integer

OUTPUT:

obj any
modelit.layout.Node or [] if index exceeds number of children

Public Sealed Method: getSortedChildren

DESCRIPTION:

Returns the childs in sorted order.

CALL:

value = getChildAt(obj, childIndex)

INPUT:

obj any
modelit.layout.Node
childIndex any
integer

OUTPUT:

obj any
modelit.layout.Node or [] if index exceeds number of children

Public Sealed Method: eq

DESCRIPTION:

Returns the objects whose property values match those passed as param-value pairs to the findobj command.

Public Sealed Method: findobj

DESCRIPTION:

Returns the objects whose property values match those passed as param-value pairs to the findobj command.

Public Sealed Method: ismember

DESCRIPTION:

Each node has its own unique numeric signature

Public Sealed Method: double

DESCRIPTION:

DOUBLE Convert to double precision. DOUBLE(X) returns the double precision value for X. If X is already a double precision array, DOUBLE has no effect. DOUBLE is called for the expressions in FOR, IF, and WHILE loops if the expression isn't already double precision. DOUBLE should be overloaded for all objects where it makes sense to convert it into a double precision value. See also SINGLE, DATATYPES, ISFLOAT, ISNUMERIC.

Public Method: remove

DESCRIPTION:

Removes this node and its children from the tree.

CALL:

remove(obj)

INPUT:

obj any
modelit.layout.Node, node to remove from tree

OUTPUT:

   No output

Public Method: add

DESCRIPTION:

Removes newChild from its parent and makes it a child of this node by adding it to the end of this node's child array.

CALL:

add(obj, newChild)

INPUT:

obj any
modelit.layout.Node
newChild any
modelit.layout.Node, node to be added as a child of obj

OUTPUT:

   No output