goog.structs
Namespacegoog.structs.AvlTree
ClassConstructs an AVL-Tree, which uses the specified comparator to order its values. The values can be accessed efficiently in their sorted order since the tree enforces a O(logn) maximum height. … more
goog.structs.CircularBuffer
ClassClass for CircularBuffer. … more
goog.structs.Collection
InterfaceAn interface for a collection of values. @interface … more
goog.structs.Heap
ClassClass for a Heap datastructure. … more
goog.structs.InversionMap
ClassMaps ranges to values using goog.structs.Inversion. … more
goog.structs.LinkedMap
ClassClass for a LinkedMap datastructure, which combines O(1) map access for key/value pairs with a linked list for a consistent iteration order. Sample usage:
var m = new LinkedMap(); m.set('param1', 'A'); m.set('param2', 'B'); m.set('param3', 'C'); alert(m.getKeys()); // param1, param2, param3 var c = new LinkedMap(5, true); for (var i = 0; i < 10; i++) { c.set('entry' + i, false); } alert(c.getKeys()); // entry9, entry8, entry7, entry6, entry5 c.set('entry5', true); c.set('entry1', false); alert(c.getKeys()); // entry1, entry5, entry9, entry8, entry7… more
goog.structs.Map
ClassClass for Hash Map datastructure. … more
goog.structs.Node
ClassA generic immutable node. This can be used in various collections that require a node object for its item (such as a heap). … more
goog.structs.Pool
ClassA generic pool class. If min is greater than max, an error is thrown. … more
goog.structs.PriorityPool
ClassA generic pool class. If max is greater than min, an error is thrown. … more
goog.structs.PriorityQueue
ClassClass for Priority Queue datastructure. … more
goog.structs.QuadTree
ClassConstructs a new quad tree. … more
goog.structs.Queue
ClassClass for FIFO Queue data structure. … more
goog.structs.Set
ClassA set that can contain both primitives and objects. Adding and removing elements is O(1). Primitives are treated as identical if they have the same type and convert to the same string. Objects are treated as identical only if they are references to the same object. WARNING: A goog.structs.Set can contain both 1 and (new Number(1)), because they are not the same. WARNING: Adding (new Number(1)) twice will yield two distinct elements, because they are two different objects. WARNING: Any object that is added to a goog.structs.Set will be modified! Because goog.getUid() is used to identify objects, every object in the set will be mutated. … more
goog.structs.SimplePool
ClassA generic pool class. Simpler and more efficient than goog.structs.Pool because it doesn't maintain a list of objects that are in use. This class has constant overhead and doesn't create any additional objects as part of the pool management after construction time. IMPORTANT: If the objects being pooled are arrays or maps that can have unlimited number of properties, they need to be cleaned before being returned to the pool. Also note that {@see goog.object.clean} actually allocates an array to clean the object passed to it, so simply using this function would defy the purpose of using the pool. … more
goog.structs.StringSet
ClassCreates a set of strings. … more
goog.structs.TreeNode
ClassGeneric tree node data structure with arbitrary number of child nodes. It is possible to create a dynamic tree structure by overriding {@link #getParent} and {@link #getChildren} in a subclass. All other getters will automatically work. … more
goog.structs.Trie
ClassClass for a Trie datastructure. Trie data structures are made out of trees of Trie classes. … more
.clear(col)
Removes all the elements from the collection.
col
{Object
}
.contains(col, val)
Whether the collection contains the given value. This is O(n) and uses equals (==) to test the existence.
col
{Object
}
val
{*}
boolean
}
.every(col, f, opt_obj)
Calls f for each value in a collection. If all calls return true this return true this returns true. If any returns false this returns false at this point and does not continue to check the remaining values.
col
{Object
}
f
{Function
}
opt_obj
{Object
=}
boolean
}
.filter(col, f, opt_obj)
Calls a function for every value in the collection. When a call returns true, adds the value to a new collection (Array is returned by default).
col
{Object
}
f
{Function
}
opt_obj
{Object
=}
Object
|!Array
}
.forEach(col, f, opt_obj)
Calls a function for each value in a collection. The function takes three arguments; the value, the key and the collection.
col
{Object
}
f
{Function
}
opt_obj
{Object
=}
.getCount(col)
Returns the number of values in the collection-like object.
col
{Object
}
number
}
.getKeys(col)
Returns the keys of the collection. Some collections have no notion of keys/indexes and this function will return undefined in those cases.
col
{Object
}
Array
|undefined
}
.getValues(col)
Returns the values of the collection-like object.
col
{Object
}
Array
}
.isEmpty(col)
Whether the collection is empty.
col
{Object
}
boolean
}
.map(col, f, opt_obj)
Calls a function for every value in the collection and adds the result into a new collection (defaults to creating a new Array).
col
{Object
}
f
{Function
}
opt_obj
{Object
=}
Object
|!Array
}
.some(col, f, opt_obj)
Calls f for each value in a collection. If any call returns true this returns true (without checking the rest). If all returns false this returns false.
col
{Object
|Array
|string
}
f
{Function
}
opt_obj
{Object
=}
boolean
}