Opus5
Class PartitionAsForestV2
java.lang.Object
|
+--Opus5.AbstractObject
|
+--Opus5.AbstractContainer
|
+--Opus5.AbstractSearchableContainer
|
+--Opus5.AbstractSet
|
+--Opus5.PartitionAsForest
|
+--Opus5.PartitionAsForestV2
- All Implemented Interfaces:
- Comparable, Container, Partition, SearchableContainer, Set
- Direct Known Subclasses:
- PartitionAsForestV3
- public class PartitionAsForestV2
- extends PartitionAsForest
A partition implemented as a forest of trees.
Implements "collapsing find" and "union-by-size".
- Version:
- $Id: PartitionAsForestV2.java,v 3.2 1998/07/28 19:14:43 brpreiss Exp $
- Author:
- Bruno R. Preiss, P.Eng.
|
Constructor Summary |
PartitionAsForestV2(int n)
Constructs a PartitionAsForestV2
with the specified size of universal set. |
|
Method Summary |
Set |
find(int item)
Finds the element of this partition that
contains the specified element of the universal set. |
void |
join(Set s,
Set t)
Joins the specified elements of this partition. |
| Methods inherited from class Opus5.PartitionAsForest |
accept, checkArguments, compareTo, difference, find, getEnumeration, insert, intersection, isEQ, isMember, isMember, isSubset, purge, union, withdraw |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
PartitionAsForestV2
public PartitionAsForestV2(int n)
- Constructs a
PartitionAsForestV2
with the specified size of universal set.
- Parameters:
n - The size of the universal set.
find
public Set find(int item)
- Finds the element of this partition that
contains the specified element of the universal set.
Implements "collapsing find".
- Overrides:
find in class PartitionAsForest
- Parameters:
item - The element of the universal set to find.- Returns:
- The element of this parition that
contains the specified element of the universal set.
join
public void join(Set s,
Set t)
- Joins the specified elements of this partition.
Implements "union-by-size".
- Overrides:
join in class PartitionAsForest
- Parameters:
s - An element of this parition.t - An element of this parition.