#include <set.h>
Inheritance diagram for ABA_SET:
Public Member Functions | |
ABA_SET (ABA_GLOBAL *glob, int size) | |
virtual | ~ABA_SET () |
The destructor. | |
void | makeSet (int x) |
bool | unionSets (int x, int y) |
int | findSet (int x) |
Protected Attributes | |
ABA_GLOBAL * | glob_ |
ABA_ARRAY< int > | parent_ |
The collection of sets is implemented by a collection of trees. parent [i] is the parent of node i in the tree representing the set containing i. If i is the root of a tree then parent [i] is i itself. |
Definition at line 41 of file set.h.
ABA_SET::ABA_SET | ( | ABA_GLOBAL * | glob, | |
int | size | |||
) |
The constructor.
glob | A pointer to the corresponding global object. | |
size | Only integers between 0 and size-1 can be inserted in the set. |
virtual ABA_SET::~ABA_SET | ( | ) | [virtual] |
The destructor.
void ABA_SET::makeSet | ( | int | x | ) |
Creates a set storing only one element and adds it to the collection of sets.
x | The single element of the new set. |
bool ABA_SET::unionSets | ( | int | x, | |
int | y | |||
) |
Unites the two sets which contain x and y, respectively.
This operation may only be performed if both x and y have earlier been added to the collection of sets by the function makeSet().
false otherwise.
x | An element of the first set of the union operation. | |
y | An element in the second set of the union operation. |
Reimplemented in ABA_FASTSET.
int ABA_SET::findSet | ( | int | x | ) |
Finds the representative of the set containing x.
This operation may be only performed if x has been earlier added to the collection of sets by the function makeSet().
x | An element of the searched set. |
ABA_GLOBAL* ABA_SET::glob_ [protected] |
ABA_ARRAY<int> ABA_SET::parent_ [protected] |