The goog.ds.BasicNodeList Class

goog.ds.BasicNodeList
> goog.ds.DataNodeList
> goog.ds.DataNode

goog.ds.BasicNodeList(opt_nodes)

Simple node list implementation with underlying array and map implements goog.ds.DataNodeList. Names that are reserved for system use and shouldn't be used for data node names: eval, toSource, toString, unwatch, valueOf, watch. Behavior is undefined if these names are used.

opt_nodes {Array.<goog.ds.DataNode>=}
optional nodes to add to list.

.add(node)

Add a node to the node list. If the node has a dataName, uses this for the key in the map. TODO(user) Remove function as well

node {goog.ds.DataNode}
The node to add.

.get(key)

Get a node by string key. Returns null if node doesn't exist.

key {string}
String lookup key.
returns {goog.ds.DataNode}
The node, or null if doesn't exist.

.getByIndex(index)

Get a node by index Returns null if the index is out of range

index {number}
The index of the node.
returns {goog.ds.DataNode}
The node, or null if doesn't exist.

.getChildNode(name, opt_canCreate)

Inherited from goog.ds.DataNode .

Gets a named child node of the current node

name {string}
The node name.
opt_canCreate {boolean=}
Whether to create a child node if it does not exist.
returns {goog.ds.DataNode}
The child node, or null if no node of this name exists.

.getChildNodeValue(name)

Inherited from goog.ds.DataNode .

Gets the value of a child node

name {string}
The node name.
returns {*}
The value of the node, or null if no value or the child node doesn't exist.

.getChildNodes(opt_selector)

Inherited from goog.ds.DataNode .

Gets all of the child nodes of the current node. Should return an empty DataNode list if no child nodes.

opt_selector {string=}
String selector to choose child nodes.
returns {goog.ds.DataNodeList}
The child nodes.

.getCount()

Gets the size of the node list

returns {number}
The size of the list.

.getDataName()

Inherited from goog.ds.DataNode .

Get the name of the node relative to the parent node

returns {string}
The name of the node.

.getDataPath()

Inherited from goog.ds.DataNode .

Gets the a qualified data path to this node

returns {string}
The data path.

.getLoadState()

Inherited from goog.ds.DataNode .

Gets the state of the backing data for this node

returns {goog.ds.LoadState}
The state.

.indexOf(name)

Get the index of a named node

name {string}
The name of the node to get the index of.
returns {number|undefined}
The index.

.isList()

Inherited from goog.ds.DataNode .

Whether the value of this node is a homogeneous list of data

returns {boolean}
True if a list.

.load()

Inherited from goog.ds.DataNode .

Load or reload the backing data for this node

.removeNode(name)

Removes a node in the list of a given name

name {string}
Name of the node.
returns {boolean}
True if node existed and was deleted.

.set(value)

Inherited from goog.ds.DataNode .

Set the value of the node

value {*}
The new value of the node.

.setChildNode(name, value)

Inherited from goog.ds.DataNode .

Sets a named child node of the current node.

name {string}
The node name.
value {Object}
The value to set, can be DataNode, object, property, or null. If value is null, removes the child node.
returns {Object}
The child node, if the node was set.

.setDataName(name)

Inherited from goog.ds.DataNode .

Set the name of the node relative to the parent node

name {string}
The name of the node.

.setNode(name, node)

Sets a node in the list of a given name

name {string}
Name of the node.
node {goog.ds.DataNode}
The node.