## Program Base Library

## pblSet - Set Implementation

Set in C, C hash set, C-HashSet, hash set in C, HashSet in C,
C tree set, C-TreeSet, tree set in C, TreeSet in C.

## Documentation

Open source C implementation of a collection that contains no duplicate elements.
More formally, sets contain no pair of elements e1 and e2 such that e1.equals(e2).
This C implementation is
similar to the
Java Set
interface.
This implementations of sets do not allow NULL elements.

As implied by its name, this module models the mathematical set abstraction and
allows very efficient access to their elements.

The Set module provides two implementations of sets,
an open source C hash set implementation equivalent to the
Java HashSet class
and
a sorted open source C avl-tree-based balanced tree set implementation equivalent to the
Java TreeSet
class.

Hash sets make no guarantees as to the iteration order of the set;
in particular, they do not guarantee that the order will remain constant over time.
Hash sets offer constant time performance for the basic operations (add, remove, contains and size),
assuming the hash function disperses the elements properly among the buckets.
Iterating over hash sets requires time proportional to the sum of the hash set
instance's size (the number of elements) plus the "capacity" of the set (the number of buckets).
Thus, it's very important not to set the initial capacity too
high (or the load factor too low) if iteration performance is important.

Tree sets being sorted guarantee that the set can be iterated in ascending element order, according to the
compare function specified for the set.
The implementation provides guaranteed log(n) time cost for the basic operations (add, remove and contains).
Iterating over tree sets requires time proportional to the tree set
instance's size.

The user can also access elements by their integer index (position in the set).
From a performance standpoint, these methods should be used with caution.
They will perform costly linear searches.
Thus, iterating over the elements in a set is
preferable to indexing through it.

The Set module provides an iterator, called a
pblIterator,
that allows bidirectional access in addition to the normal operations iterators provide.

All set functions described below work on hash sets as well as on tree sets,
they of course will show different runtime and memory complexities depending on the type of
set used.

## Constructors and Destructors

pblSetNewHashSet * Creates a new hash set.*
pblSetNewTreeSet * Creates a new tree set.*
pblSetClone * Returns a shallow copy of this set instance.*
pblSetCloneRange * Returns a shallow copy from this set of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.*
pblSetFree * Free the set's memory from heap.*

## Adding to a Set

pblSetAdd * Adds the specified element to this set.*
pblSetAddAll * Adds all of the elements in the specified Collection to this set.*
pblSetReplaceElement * Replaces the element of the set that matches the given element with the given element.*

## Accessing Set Elements

pblSetContains * Returns true if this set contains the specified element.*
pblSetContainsAll * Returns a value > 0 if this set contains all of the elements in the specified collection.*
pblSetElement * Retrieves, but does not remove, the head (first element) of this set.*
pblSetGet * Returns the element at the specified position in this set.*
pblSetGetElement * Returns the element of this set that matches the given element.*
pblSetGetFirst * Returns the first element in this set.*
pblSetGetLast * Returns the last element in this set.*
pblSetHead * Retrieves, but does not remove, the head (first element) of this set.*
pblSetIndexOf * Returns the index of the given argument in the set.*
pblSetLastIndexOf * Returns the index of the given argument in the set.*
pblSetPeek * Retrieves, but does not remove, the head (first element) of this set.*
pblSetTail * Retrieves, but does not remove, the tail (last element) of this set.*
pblSetTop * Retrieves, but does not remove, the tail (last element) of this set.*

## Mathematical Set Functions

pblSetContains * Returns true if this set contains the specified element.*
pblSetContainsAll * Returns a value > 0 if this set contains all of the elements in the specified collection.*
pblSetDifference * Creates a new set containing the difference of the elements of the two sets passed as parameters.*
pblSetEquals * Compares the specified collection with this set for equality.*
pblSetIntersection * Creates a new set containing the intersection of the elements of the two sets passed as parameters.*
pblSetIsEmpty * Tests if this set has no elements.*
pblSetIsSubset * Returns a value > 0 if the set passed as second parameter is a subset of the set passed as first parameter, ie.*
pblSetSize * Returns the number of elements in this set.*
pblSetSymmectricDifference * Creates a new set containing all elements of the two sets passed as parameters that are contained in either of the sets but not in both of them.*
pblSetUnion * Creates a new set containing the union of the elements of both sets passed as parameters.*

## Removing from a Set

pblSetPoll * Retrieves and removes the head (first element) of this set.*
pblSetPop * Retrieves and removes the tail (last element) of this set.*
pblSetRemove * Retrieves and removes the head (first element) of this set.*
pblSetRemoveAll * Removes from this set all of its elements that are contained in the specified collection.*
pblSetRemoveAt * Removes the element at the specified position in this set.*
pblSetRemoveElement * Removes the specified element from this set if it is present.*
pblSetRemoveFirst * Removes and returns the first element in this set.*
pblSetRemoveLast * Removes and returns the last element of this set.*
pblSetRetainAll * Retains only the elements in this set that are contained in the specified collection.*

## Functions on Sets

pblSetByteBufferHashValue * Creates a hash value of byte buffer and its length.*
pblSetClear * Removes all of the elements from this set.*
pblSetDefaultCompare * Default compare function used if no application specific compare function is specified by the user.*
pblSetDefaultHashValue * Default hash value function used if no application specific function is specified by the user.*
pblSetEnsureCapacity * Increases the capacity of this set instance, if necessary.*
pblSetEquals * Compares the specified collection with this set for equality.*
pblSetFree * Free the set's memory from heap.*
pblSetGetCapacity * Returns the capacity of this set instance.*
pblSetGetCompareFunction * Gets the application specific compare function for the elements of the set.*
pblSetGetHashValueFunction * Gets the application specific hash value function for the elements of the set.*
pblSetIsHashSet * Tests if the object is a hash set.*
pblSetIsSet * Tests if the object is a set.*
pblSetIsTreeSet * Tests if the object is a tree set.*
pblSetIterator * Returns an iterator over the elements in this set.*
pblSetReverseIterator * Returns a reverse iterator over the elements in this set.*
pblSetSetCompareFunction * Sets an application specific compare function for the elements of the set.*
pblSetSetHashValueFunction * Sets an application specific hash value function for the elements of the hash set.*
pblSetSetLoadFactor * Sets an application specific load factor for a hash set.*
pblSetSize * Returns the number of elements in this set.*
pblSetStringHashValue * Creates a hash value of a '\0' terminated string.*
pblSetToArray * Returns an array containing all of the elements in this set.*
pblSetTrimToSize * Trims the capacity of this set instance to the set's current size divided by the load factor of the set.*

## Collection Functions

Each pblSet is also a pblCollection, therefore all collection functions can be used on sets.

pblCollectionAggregate * Aggregates a collection by calling the aggregation function on every element of the collection while running through the collection with an iterator.*
pblCollectionContains * Returns true if this collection contains the specified element.*
pblCollectionConvertToArrayList * Returns a pblArrayList with a shallow copy of this collection instance.*
pblCollectionConvertToHashSet * Returns a pblHashSet with a shallow copy of this collection instance.*
pblCollectionConvertToLinkedList * Returns a pblLinkedList with a shallow copy of this collection instance.*
pblCollectionConvertToTreeSet * Returns a pblTreeSet with a shallow copy of this collection instance.*
pblCollectionElementCompare * Compare two elements of a collection.*
pblCollectionIsCollection * Tests if the object is a collection.*
pblCollectionSetCompareFunction * Sets an application specific compare function for the elements of the collection.*
pblCollectionStringCompareFunction * Compares two '\0' terminated strings.*

## Alphabetic List of Set Functions

pblSetAdd * Adds the specified element to this set.*
pblSetAddAll * Adds all of the elements in the specified Collection to this set.*
pblSetByteBufferHashValue * Creates a hash value of byte buffer and its length.*
pblSetClear * Removes all of the elements from this set.*
pblSetClone * Returns a shallow copy of this set instance.*
pblSetCloneRange * Returns a shallow copy from this set of all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.*
pblSetContains * Returns true if this set contains the specified element.*
pblSetContainsAll * Returns a value > 0 if this set contains all of the elements in the specified collection.*
pblSetDefaultHashValue * Default hash value function used if no application specific function is specified by the user.*
pblSetDifference * Creates a new set containing the difference of the elements of the two sets passed as parameters.*
pblSetElement * Retrieves, but does not remove, the head (first element) of this set.*
pblSetEnsureCapacity * Increases the capacity of this set instance, if necessary.*
pblSetEquals * Compares the specified collection with this set for equality.*
pblSetFree * Free the set's memory from heap.*
pblSetGet * Returns the element at the specified position in this set.*
pblSetGetCapacity * Returns the capacity of this set instance.*
pblSetGetCompareFunction * Gets the application specific compare function for the elements of the set.*
pblSetGetElement * Returns the element of this set that matches the given element.*
pblSetGetFirst * Returns the first element in this set.*
pblSetGetHashValueFunction * Gets the application specific hash value function for the elements of the set.*
pblSetGetLast * Returns the last element in this set.*
pblSetHead * Retrieves, but does not remove, the head (first element) of this set.*
pblSetIndexOf * Returns the index of the given argument in the set.*
pblSetIntersection * Creates a new set containing the intersection of the elements of the two sets passed as parameters.*
pblSetIsEmpty * Tests if this set has no elements.*
pblSetIsHashSet * Tests if the object is a hash set.*
pblSetIsSet * Tests if the object is a set.*
pblSetIsSubset * Returns a value > 0 if the set passed as second parameter is a subset of the set passed as first parameter, ie.*
pblSetIsTreeSet * Tests if the object is a tree set.*
pblSetIterator * Returns an iterator over the elements in this set.*
pblSetLastIndexOf * Returns the index of the given argument in the set.*
pblSetNewHashSet * Creates a new hash set.*
pblSetNewTreeSet * Creates a new tree set.*
pblSetPeek * Retrieves, but does not remove, the head (first element) of this set.*
pblSetPoll * Retrieves and removes the head (first element) of this set.*
pblSetPop * Retrieves and removes the tail (last element) of this set.*
pblSetRemove * Retrieves and removes the head (first element) of this set.*
pblSetRemoveAll * Removes from this set all of its elements that are contained in the specified collection.*
pblSetRemoveAt * Removes the element at the specified position in this set.*
pblSetRemoveElement * Removes the specified element from this set if it is present.*
pblSetRemoveFirst * Removes and returns the first element in this set.*
pblSetRemoveLast * Removes and returns the last element of this set.*
pblSetReplaceElement * Replaces the element of the set that matches the given element with the given element.*
pblSetRetainAll * Retains only the elements in this set that are contained in the specified collection.*
pblSetReverseIterator * Returns a reverse iterator over the elements in this set.*
pblSetSetCompareFunction * Sets an application specific compare function for the elements of the set.*
pblSetSetHashValueFunction * Sets an application specific hash value function for the elements of the hash set.*
pblSetSetLoadFactor * Sets an application specific load factor for a hash set.*
pblSetSize * Returns the number of elements in this set.*
pblSetStringHashValue * Creates a hash value of a '\0' terminated string.*
pblSetSymmectricDifference * Creates a new set containing all elements of the two sets passed as parameters that are contained in either of the sets but not in both of them.*
pblSetTail * Retrieves, but does not remove, the tail (last element) of this set.*
pblSetToArray * Returns an array containing all of the elements in this set.*
pblSetTop * Retrieves, but does not remove, the tail (last element) of this set.*
pblSetTrimToSize * Trims the capacity of this set instance to the set's current size divided by the load factor of the set.*
pblSetUnion * Creates a new set containing the union of the elements of both sets passed as parameters.*

*Alphabetic index*

## GET PBL:

Copyright(C) 2003 - 2015 Peter Graf,
this software is distributed under the
MIT License.

This page was generated with the help of DOC++.