selenium-webdriver
Version:
The official WebDriver JavaScript bindings from the Selenium project
28 lines • 17.2 kB
HTML
<meta charset="UTF-8"><meta http-equiv="Content-Language" content="en" /><title>goog.structs.Set</title><link href="dossier.css" rel="stylesheet" type="text/css"><div id="main-wrapper"><input type="checkbox" id="sidenav-toggle" /><main><header><h1>Class goog.structs.Set.<code class="type"><T></code></h1><a class="source" href="source/lib/goog/structs/set.js.src.html#l52">code »</a><dl><dt>All implemented interfaces:<dd><code><a href="">goog.structs.Collection.<(T|null)></a></code></dl></header><section><p>A 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.<h2>Constructor</h2><div class="ctor wrap-details public"><div><div class="ctor"><span class="member">goog.structs.Set <span class="args">( opt_values )</span></span></div><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_values: <code class="type">(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)=</code><dd>Initial values to start with.</dl></table></div></div></div></section><div id="visibility-controls"><b>Show:</b><label for="show-public"><span><input type="checkbox" id="show-public" checked/></span>Public</label><label for="show-protected"><span><input type="checkbox" id="show-protected"/></span>Protected</label><label for="show-private"><span><input type="checkbox" id="show-private"/></span>Private</label></div><section id="instance-methods"><h2>Instance Methods</h2><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l278">code »</a><span class="member"><a name="__iterator__">__iterator__</a> <span class="args">( opt_keys )</span> ⇒ <code class="type">!<a href="class_goog_iter_Iterator.html">goog.iter.Iterator</a></code></span></div><p>Returns an iterator that iterates over the elements in this set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>opt_keys: <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a>=</code><dd>This argument is ignored.</dl><tr><th>Returns<tr><td><dl>An iterator over the elements in this set.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l92">code »</a><span class="member"><a name="add">add</a> <span class="args">( element )</span></span></div><p>Add a primitive or an object to the set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">T</code><dd>The primitive or object to add.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l102">code »</a><span class="member"><a name="addAll">addAll</a> <span class="args">( col )</span></span></div><p>Adds all the values in the given collection to this set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<T>|<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection
containing the elements to add.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l139">code »</a><span class="member"><a name="clear">clear</a> <span class="args">( )</span></span></div><p>Removes all elements from this set.</summary></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l228">code »</a><span class="member"><a name="clone">clone</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="class_goog_structs_Set.html">goog.structs.Set</a>.<T></code></span></div><p>Creates a shallow clone of this set.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>A new set containing all the same elements as
this set.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l159">code »</a><span class="member"><a name="contains">contains</a> <span class="args">( element )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether this set contains the given element.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">T</code><dd>The primitive or object to test for.</dl><tr><th>Returns<tr><td><dl>True if this set contains the given element.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l171">code »</a><span class="member"><a name="containsAll">containsAll</a> <span class="args">( col )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether this set contains all the values in a given collection.
Repeated elements in the collection are ignored, e.g. (new
goog.structs.Set([1, 2])).containsAll([1, 1]) is True.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection-like object.</dl><tr><th>Returns<tr><td><dl>True if the set contains all elements.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l207">code »</a><span class="member"><a name="difference">difference</a> <span class="args">( col )</span> ⇒ <code class="type">!<a href="class_goog_structs_Set.html">goog.structs.Set</a></code></span></div><p>Finds all values that are present in this set and not in the given
collection.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<T>|<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection.</dl><tr><th>Returns<tr><td><dl>A new set containing all the values
(primitives or objects) present in this set but not in the given
collection.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l242">code »</a><span class="member"><a name="equals">equals</a> <span class="args">( col )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether the given collection consists of the same elements as this set,
regardless of order, without repetition. Primitives are treated as equal if
they have the same type and convert to the same string; objects are treated
as equal if they are references to the same object. This operation is O(n).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection.</dl><tr><th>Returns<tr><td><dl>True if the given collection consists of the same elements
as this set, regardless of order, without repetition.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l82">code »</a><span class="member"><a name="getCount">getCount</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></code></span></div></summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>The number of elements in the set.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l218">code »</a><span class="member"><a name="getValues">getValues</a> <span class="args">( )</span> ⇒ <code class="type">!<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<T></code></span></div><p>Returns an array containing all the elements in this set.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>An array containing all the elements in this set.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l184">code »</a><code class="type"><S></code> <span class="member"><a name="intersection">intersection</a> <span class="args">( col )</span> ⇒ <code class="type">!<a href="class_goog_structs_Set.html">goog.structs.Set</a></code></span></div><p>Finds all values that are present in both this set and the given collection.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<S>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection.</dl><tr><th>Returns<tr><td><dl>A new set containing all the values
(primitives or objects) present in both this set and the given
collection.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l148">code »</a><span class="member"><a name="isEmpty">isEmpty</a> <span class="args">( )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether this set is empty.</summary><div class="info"><table><tbody><tr><th>Returns<tr><td><dl>True if there are no elements in this set.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l255">code »</a><span class="member"><a name="isSubsetOf">isSubsetOf</a> <span class="args">( col )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Tests whether the given collection contains all the elements in this set.
Primitives are treated as equal if they have the same type and convert to the
same string; objects are treated as equal if they are references to the same
object. This operation is O(n).</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection.</dl><tr><th>Returns<tr><td><dl>True if this set is a subset of the given collection.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l131">code »</a><span class="member"><a name="remove">remove</a> <span class="args">( element )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></code></span></div><p>Removes the given element from this set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>element: <code class="type">T</code><dd>The primitive or object to remove.</dl><tr><th>Returns<tr><td><dl>Whether the element was found and removed.</dl></table></div></details></div></div><div class="wrap-details public"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l116">code »</a><span class="member"><a name="removeAll">removeAll</a> <span class="args">( col )</span></span></div><p>Removes all values in the given collection from this set.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>col: <code class="type">(<a href="http://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array">Array</a>.<T>|<a href="interface_goog_structs_Collection.html">goog.structs.Collection</a>.<T>|<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a>)</code><dd>A collection
containing the elements to remove.</dl></table></div></details></div></div></section><section id="instance-properties"><h2>Instance Properties</h2><div class="wrap-details public"><div><details><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l53">code »</a><span class="member"><a name="goog.structs.Set.prototype.map_">goog.structs.Set.prototype.map_</a> : <code class="type"><a href="class_goog_structs_Map.html">goog.structs.Map</a></code></span></div><p>Class for Hash Map datastructure.</summary></details></div></div></section><section id="static-functions"><h2>Static Functions</h2><div class="wrap-details private"><div><details class="function"><summary><div><a class="source" href="source/lib/goog/structs/set.js.src.html#l68">code »</a><span class="member"><a name="goog.structs.Set.getKey_">goog.structs.Set.getKey_</a> <span class="args">( val )</span> ⇒ <code class="type"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></code></span></div><p>Obtains a unique key for an element of the set. Primitives will yield the
same key if they have the same type and convert to the same string. Object
references will yield the same key only if they refer to the same object.</summary><div class="info"><table><tbody><tr><th>Parameters<tr><td><dl><dt>val: <code class="type">*</code><dd>Object or primitive value to get a key for.</dl><tr><th>Returns<tr><td><dl>A unique key for this value/object.</dl></table></div></details></div></div></section></main><nav id="topnav"><div><div id="menubutton"><label for="sidenav-toggle">Menu</label></div><form id="searchbox"><div><input type="search" placeholder="Search" tabindex="1"></div></form></div></nav><nav id="sidenav"><input type="checkbox" id="sidenav-types-ctrl" /><input type="checkbox" id="sidenav-files-ctrl" /><input type="checkbox" id="sidenav-modules-ctrl" /><a id="sidenav-overview"><div><h4>Overview</h4></div></a><div id="sidenav-types"><label for="sidenav-types-ctrl"><h4>Types</h4></label><i>Loading</i></div><div id="sidenav-modules"><label for="sidenav-modules-ctrl"><h4>Modules</h4></label><i>Loading</i></div><div id="sidenav-files"><label for="sidenav-files-ctrl"><h4>Files</h4></label><i>Loading</i></div><a href="license.html"><div><h4>License</h4></div></a></nav><div id="push-footer"></div></div><footer><a href="https://github.com/jleyba/js-dossier">Generated by dossier</a></footer><script src="types.js"></script><script src="dossier.js"></script>