ds.FastDataNode Extends goog.ds.AbstractFastDataNode
Creates a new fast data node, using the properties of root.

Inheritance

Constructor

goog.ds.FastDataNode(rootdataNameopt_parent)

Parameters

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.

Instance Methods

Public Protected Private
add(value)
Adds a child to this data node.
Arguments:
value : goog.ds.DataNode
Child node to add.
code »
clone() goog.ds.FastDataNode
Creates a deep copy of this data node.
Returns: goog.ds.FastDataNode  Clone of this data node.
code »
extendWith(object)
Add all attributes of object to this data node.
Arguments:
object : Object
Object to add attributes from.
code »
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).
Arguments:
opt_key : string=
Name of child node.
Returns: *  This data node or a child node.
code »
getByIndex(index) goog.ds.DataNode
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.
Arguments:
index : number
Index of child node (starting from 0).
Returns: goog.ds.DataNode  Child node at specified index.
code »
getChildNode(nameopt_create) goog.ds.DataNode
Get a child node by name.
Arguments:
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.
code »
getChildNodeValue(name) Object
Returns the value of a child node. By using this method you can avoid the need to create PrimitiveFastData nodes.
Arguments:
name : string
Name of child node.
Returns: Object  Value of child node.
code »
getChildNodes()
No description.
code »
getCount() number
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.
code »
getJsObject() !Object
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.
code »
isList() boolean
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.
code »
removeNode()
Removes a child node.
code »
set(value)
Not supported for normal FastDataNodes.
Arguments:
value : *
Value to set data node to.
code »
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.
code »
setNode(namevalue)
Sets a child node.
Arguments:
name : string
Name of child node.
value : Object
Value of child node.
code »
wrapChild_(name)
Makes sure that a named child is wrapped in a data node structure.
Arguments:
name : string
Name of child to wrap.
code »
getDataName() string
Return the name of this data node.
Returns: string  Name of this data noden.
code »
getDataPath() string
Get the path leading to this data node.
Returns: string  Data path.
code »
setDataName(value)
Set the name of this data node.
Arguments:
value : string
Name.
code »
add(node)
Add a node to the node list. If the node has a dataName, uses this for the key in the map.
Arguments:
node : goog.ds.DataNode
The node to add.
code »
get(key) *
Get a node by string key. Returns null if node doesn't exist.
Arguments:
key : string
String lookup key.
Returns: *  The node, or null if doesn't exist.
code »
getByIndex(index) goog.ds.DataNode
Get a node by index Returns null if the index is out of range
Arguments:
index : number
The index of the node.
Returns: goog.ds.DataNode  The node, or null if doesn't exist.
code »
getCount() number
Gets the size of the node list
Returns: number  The size of the list.
code »
removeNode(name) boolean
Removes a node in the list of a given name
Arguments:
name : string
Name of the node.
Returns: boolean  True if node existed and was deleted.
code »
setNode(namenode)
Sets a node in the list of a given name
Arguments:
name : string
Name of the node.
node : goog.ds.DataNode
The node.
code »
get(var_args) *
Get the value of the node
Arguments:
var_args : ?...
Do not check arity of arguments, because some subclasses require args.
Returns: *  The value of the node, or null if no value.
code »
getChildNode(nameopt_canCreate) goog.ds.DataNode
Gets a named child node of the current node
Arguments:
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.
code »
getChildNodeValue(name) *
Gets the value of a child node
Arguments:
name : string
The node name.
Returns: *  The value of the node, or null if no value or the child node doesn't exist.
code »
getChildNodes(opt_selector) !goog.ds.DataNodeList
Gets all of the child nodes of the current node. Should return an empty DataNode list if no child nodes.
Arguments:
opt_selector : string=
String selector to choose child nodes.
Returns: !goog.ds.DataNodeList  The child nodes.
code »
getDataName() string
Get the name of the node relative to the parent node
Returns: string  The name of the node.
code »
getDataPath() string
Gets the a qualified data path to this node
Returns: string  The data path.
code »
getLoadState() goog.ds.LoadState
Gets the state of the backing data for this node
Returns: goog.ds.LoadState  The state.
code »
isList() boolean
Whether the value of this node is a homogeneous list of data
Returns: boolean  True if a list.
code »
set(value)
Set the value of the node
Arguments:
value : *
The new value of the node.
code »
setChildNode(namevalue) Object
Sets a named child node of the current node.
Arguments:
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.
code »
setDataName(name)
Set the name of the node relative to the parent node
Arguments:
name : string
The name of the node.
code »

Instance Properties

constructor :
No description.
Code »
load :
Load or reload the backing data for this node
Code »

Static Methods

goog.ds.FastDataNode.fromJs(objectdataNameopt_parent) !goog.ds.AbstractFastDataNode
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.
Arguments:
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.
code »

Static Properties

goog.ds.FastDataNode.emptyList_ : goog.ds.EmptyNodeList
Static instance of an empty list.
Code »
goog.ds.FastDataNode.superClass_ :
No description.
Code »

Package ds

Package Reference