HashSetJS
Loading...
Searching...
No Matches
HashSet Class Reference

Private Member Functions

 constructor (hash_func='sha512_str')
 
get size ()
 
 equals (other)
 
 add (x)
 
 delete (x)
 
 has (x)
 
 dump (fn=null)
 

Static Private Member Functions

static load (fn)
 

Detailed Description

Hash Set class (only stores hash values, not actual elements)

Member Function Documentation

◆ add()

HashSet::add ( )
private

Insert an element into this Hash Set.

Parameters
{Object}x - The element to insert.

◆ constructor()

HashSet::constructor ( hash_func  = 'sha512_str')
private

Initialize a new Hash Set. @constructor

Parameters
{String}hash_func - The hash function to use in this Hash Set.

◆ delete()

HashSet::delete ( )
private

Remove an element from this Hash Set.

Parameters
{object}x - The element to remove.

◆ dump()

HashSet::dump ( fn  = null)
private

Dump this Hash Set into a Buffer of bytes, and optionally write it to a file.

Parameters
{String}fn - The name of the file into which this Hash Set should be dumped, or null to not write to a file.
Returns
{Buffer} - The raw bytes of the dumped Hash Set.

◆ equals()

HashSet::equals ( other  )
private

Return true if this Hash Set is equivalent to the other, otherwise return false.

Parameters
{Object}other - The other Hash Set against which to compare this one.
Returns
{Boolean} true if this is equivalent to other, otherwise false.

◆ has()

HashSet::has ( )
private

Find an element in this Hash Set.

Parameters
{Object}x - The element to find.
Returns
{Boolean}

◆ load()

static HashSet::load ( fn  )
staticprivate

Load a Hash Set from a given file or Buffer.

Parameters
{String}fn - The name of the file from which to load a Hash Set, or the Buffer containing the file's contents.
Returns
{HashSet} - The loaded Hash Set.

◆ size()

get HashSet::size ( )
private

Return the total number of elements in this Hash Set (hash collisions will be treated as a single element).

Returns
{Number} The total number of elements in this Hash Set.

The documentation for this class was generated from the following file: