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.

Inner classes inherited from class Opus5.PartitionAsForest
PartitionAsForest.PartitionTree
 
Fields inherited from class Opus5.PartitionAsForest
array
 
Fields inherited from class Opus5.AbstractSet
universeSize
 
Fields inherited from class Opus5.AbstractContainer
count
 
Fields inherited from interface Opus5.Partition
copyright
 
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 Opus5.AbstractSet
insert, withdraw
 
Methods inherited from class Opus5.AbstractContainer
getCount, hashCode, isEmpty, isFull, toString
 
Methods inherited from class Opus5.AbstractObject
compare, equals, isEQ, isGE, isGT, isLE, isLT, isNE
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface Opus5.SearchableContainer
insert, withdraw
 
Methods inherited from interface Opus5.Container
getCount, isEmpty, isFull
 
Methods inherited from interface Opus5.Comparable
compare, isEQ, isGE, isGT, isLE, isLT, isNE
 

Constructor Detail

PartitionAsForestV2

public PartitionAsForestV2(int n)
Constructs a PartitionAsForestV2 with the specified size of universal set.
Parameters:
n - The size of the universal set.
Method Detail

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.