public class Union
extends java.lang.Object
Constructor and Description |
---|
Union(int K)
Constructor: Initialize an empty Union data struct with K Sets/Components indexed 0 to K-1.
|
Modifier and Type | Method and Description |
---|---|
boolean |
areSitesConnected(int s, int r)
This method determines whether the Set/Component containing Site/Element "s" is the same as the Set/Component containing Site/Element "r".
|
int |
countElements()
Returns the number of Sites/Elements (i.e., size of id Array).
|
int |
countSets()
Returns the number of Sets/Components.
|
int |
findSetIdentifier(int item)
Returns the Set/Component Identifier in id Array for the Set/Component containing the Site/Element "s".
|
java.util.ArrayList |
getAllSetIdentifiersforParents()
This method returns the Set/Component Identifiers for Parent Sites/Elements.
|
static void |
main(java.lang.String[] args) |
void |
unionSets(int s, int r)
This method merges the Set/Component containing Site/Element "s" with the Set/Component containing the Site/Element "r".
|
public Union(int K)
K
- the number of objects (such as Geometries represented by a label).public int findSetIdentifier(int item)
item
- the integer which represents the Site/Elementpublic int countSets()
public int countElements()
public void unionSets(int s, int r)
s
- the integer value for first Site/Elementr
- the integer value for second Site/Elementpublic boolean areSitesConnected(int s, int r)
s
- the integer value for first Site/Elementr
- the integer value for second Site/Elementpublic java.util.ArrayList getAllSetIdentifiersforParents()
public static void main(java.lang.String[] args)