The goog.ds.FastDataNode Class

goog.ds.FastDataNode
> goog.ds.AbstractFastDataNode
> goog.ds.DataNodeList
> goog.ds.DataNode

goog.ds.FastDataNode(root, dataName, opt_parent)

Creates a new fast data node, using the properties of root.

root {Object}
JSON-like object to initialize data node from.
dataName {string}
Name of this data node.
opt_parent {goog.ds.DataNode=}
Parent of this data node.

.add(value)

Adds a child to this data node.

value {goog.ds.DataNode}
Child node to add.

.clone()

Creates a deep copy of this data node.

returns {goog.ds.FastDataNode}
Clone of this data node.

.fromJs(object, dataName, opt_parent)

Creates a new FastDataNode structure initialized from object. This will return an instance of the most suitable sub-class of FastDataNode. You should not modify object after creating a fast data node from it or assume that changing object changes the data node. Doing so results in undefined behaviour.

object {Object|number|boolean|string}
Object to initialize data node from.
dataName {string}
Name of data node.
opt_parent {goog.ds.DataNode=}
Parent of data node.
returns {goog.ds.AbstractFastDataNode}
Data node representing object.

.get(opt_key)

Gets the value of this data node (if called without opt_key) or gets a child node (if called with opt_key).

opt_key {string=}
Name of child node.
returns {*}
This data node or a child node.

.getByIndex(index)

Gets a child node by index. This method has a complexity of O(n) where n is the number of children. If you need a faster implementation of this method, you should use goog.ds.FastListNode.

index {number}
Index of child node (starting from 0).
returns {goog.ds.DataNode}
Child node at specified index.

.getChildNode(name, opt_create)

Get a child node by name.

name {string}
Name of child node.
opt_create {boolean=}
Whether to create the child if it does not exist.
returns {goog.ds.DataNode}
Child node.

.getChildNodeValue(name)

Returns the value of a child node. By using this method you can avoid the need to create PrimitiveFastData nodes.

name {string}
Name of child node.
returns {Object}
Value of child node.

.getChildNodes()

.getCount()

Gets the number of child nodes. This method has a complexity of O(n) where n is the number of children. If you need a faster implementation of this method, you should use goog.ds.FastListNode.

returns {number}
Number of child nodes.

.getDataName()

Inherited from goog.ds.AbstractFastDataNode .

Return the name of this data node.

returns {string}
Name of this data noden.

.getDataPath()

Inherited from goog.ds.AbstractFastDataNode .

Get the path leading to this data node.

returns {string}
Data path.

.getJsObject()

Returns a javascript object representation of this data node. You should not modify the object returned by this function.

returns {Object}
Javascript object representation of this data node.

.getLoadState()

Inherited from goog.ds.DataNode .

Gets the state of the backing data for this node

returns {goog.ds.LoadState}
The state.

.isList()

Returns whether this data node is a list. Always returns false for instances of FastDataNode but may return true for subclasses.

returns {boolean}
Whether this data node is array-like.

.load()

Inherited from goog.ds.DataNode .

Load or reload the backing data for this node

.removeNode()

Removes a child node.

.set(value)

Not supported for normal FastDataNodes.

value {*}
Value to set data node to.

.setChildNode()

Sets a child node. Creates the child if it does not exist. Calling this function makes any child nodes previously obtained for name invalid. You should not use these child nodes but instead obtain a new instance by calling getChildNode.

.setDataName(value)

Inherited from goog.ds.AbstractFastDataNode .

Set the name of this data node.

value {string}
Name.

.setNode(name, value)

Sets a child node.

name {string}
Name of child node.
value {Object}
Value of child node.