Class Index | File Index

## Classes

- _global_
- comb
- comb.array
- comb.characters
- comb.collections
- comb.collections.AnderssonTree
- comb.collections.AVLTree
- comb.collections.BinaryTree
- comb.collections.Collection
- comb.collections.HashTable
- comb.collections.Heap
- comb.collections.Iterable
- comb.collections.MaxHeap
- comb.collections.MinHeap
- comb.collections.Pool
- comb.collections.PriorityQueue
- comb.collections.Queue
- comb.collections.RedBlackTree
- comb.collections.Stack
- comb.collections.Tree
- comb.date
- comb.logging
- comb.logging.appenders
- comb.logging.appenders.Appender
- comb.logging.appenders.ConsoleAppender
- comb.logging.appenders.FileAppender
- comb.logging.appenders.JSONAppender
- comb.logging.appenders.RollingFileAppender
- comb.logging.BasicConfigurator
- comb.logging.Level
- comb.logging.Logger
- comb.logging.PropertyConfigurator
- comb.number
- comb.plugins
- comb.plugins.Broadcaster
- comb.plugins.Middleware
- comb.Promise
- comb.PromiseList
- comb.regexp
- comb.string

# Class comb.collections.HashTable

Extends comb.collections.Collection.

Implementation of a HashTable for javascript. This HashTable implementation allows one to use anything as a key.

NOTE: THIS IS ~ 3 times slower than javascript native objects

A use case for this collection is when one needs to store items in which the key will not be a string, or number

Defined in: HashTable.js.

Class Summary
Constructor Attributes | Constructor Name and Description
--- | ---
| comb.collections.HashTable()

Field Summary
Field Attributes | Field Name and Description
--- | ---
| entrySet an array of objects.
| keys all keys contained in the table
| values all values contained in the table

Method Summary
Method Attributes | Method Name and Description
--- | ---
| clear() Clears out all items from the table.
| concat(hashTable) Returns a new HashTable containing the values of this HashTable, and the other table.
| contains(key) Tests if the table contains a particular key
| every(cb, scope) Determines if every item meets the condition returned by the callback.
| filter(cb, scope) Creates a new HashTable containg values that passed the filtering function.
| forEach(cb, scope) Loop through each value in the hashtable
| map(cb, scope) Loop through each value in the hashtable, collecting the value returned by the callback function.
| put(key, value) Put a key, value pair into the table NOTE : the collection will not check if the key previously existed.
| reduce(callback, initialValue) Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.
| reduceRight(callback, initialValue) Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.
| remove(key) Remove a key value pair from the table.
| some(cb, scope) Determines if some items meet the condition returned by the callback.

Methods borrowed from class comb.collections.Collection:
  indexOf, join, lastIndexOf, slice, toString

Class Detail
comb.collections.HashTable()
Field Detail
{Array} entrySet
an array of objects. Each object contains a key, and value property.

{Array} keys
all keys contained in the table

{Array} values
all values contained in the table
Method Detail
clear()
Clears out all items from the table.

{comb.collections.HashTable} concat(hashTable)
Returns a new HashTable containing the values of this HashTable, and the other table. DOES NOT CHANGE THE ORIGINAL!

Parameters:
{comb.collections.HashTable} hashTable
  the hash table to concat with this.

Returns:
  {comb.collections.HashTable} a new HashTable containing all values from both tables.

{Boolean} contains(key)
Tests if the table contains a particular key

Parameters:
key
  the key to test

Returns:
  {Boolean} true if it exitsts false otherwise.

{Boolean} every(cb, scope)
Determines if every item meets the condition returned by the callback.

Parameters:
{Function} cb
  Function to callback with each item, the first aruguments is an object containing a key and value field
{Object} scope Optional, Default: this
  scope to call the function in

Returns:
  {Boolean} True if every item passed false otherwise

{comb.collections.HashTable} filter(cb, scope)
Creates a new HashTable containg values that passed the filtering function.

Parameters:
{Function} cb
  Function to callback with each item, the first aruguments is an object containing a key and value field
{Object} scope
  the scope to call the function.

Returns:
  {comb.collections.HashTable} the HashTable containing the values that passed the filter.

forEach(cb, scope)
Loop through each value in the hashtable

Parameters:
{Function} cb
  the function to call with an object containing a key and value field
{Object} scope
  the scope to call the funciton in

{Array} map(cb, scope)
Loop through each value in the hashtable, collecting the value returned by the callback function.

Parameters:
{Function} cb
  Function to callback with each item, the first aruguments is an object containing a key and value field
{Object} scope Optional, Default: this
  scope to call the function in

Returns:
  {Array} an array containing the mapped values.

put(key, value)
Put a key, value pair into the table NOTE : the collection will not check if the key previously existed.

Parameters:
{Anything} key
  the key to look up the object.
{Anything} value
  the value that corresponds to the key.

Returns:
  the value

reduce(callback, initialValue)
Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value.

Parameters:
{Function} callback
  Function to execute on each value in the array.
initialValue
  Value to use as the first argument to the first call of the callback..

reduceRight(callback, initialValue)
Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value.

Parameters:
{Function} callback
  Function to execute on each value in the array.
initialValue
  Value to use as the first argument to the first call of the callback..

remove(key)
Remove a key value pair from the table.

Parameters:
key
  the key of the key value pair to remove.

Returns:
  the removed value.

{Boolean} some(cb, scope)
Determines if some items meet the condition returned by the callback.

Parameters:
{Function} cb
  Function to callback with each item, the first aruguments is an object containing a key and value field
{Object} scope Optional, Default: this
  scope to call the function in

Returns:
  {Boolean} True if some items passed false otherwise

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Oct 25 2011 13:20:06 GMT-0500 (CDT)