|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface PartitionElement<T>
A partition
is a division of a group of objects into disjoint sets that we call components.
We view a partition abstractly
as a collection of disjoint components whose union is
the total collection.
However, the actual data type we use to represent the partition
is not the partition as a whole but rather the individual components
of the collection.
Each component in the partition is defined by an (arbitrary) element of that component
known as the representative element, or simply the representative.
So the data type that we implement for the
Partition ADT is simply that of a
PartitionElement
that represents one element of the partition.
Method Summary | |
---|---|
PartitionElement<T> |
findRepresentative()
Returns the representative element for the component that includes this partition element. |
T |
get()
Returns the data associated with this partition element. |
boolean |
sameComponent(PartitionElement<T> x)
Returns true if and only if this partition element and x are in the same component. |
void |
set(T applicationData)
Returns a string that describes the data associated with this partition element. |
String |
toString()
|
PartitionElement<T> |
union(PartitionElement<T> x)
Combines the components holding this partition element and x into a single
component. |
Method Detail |
---|
PartitionElement<T> findRepresentative()
T get()
boolean sameComponent(PartitionElement<T> x)
x
are in the same component.
void set(T applicationData)
String toString()
toString
in class Object
PartitionElement<T> union(PartitionElement<T> x)
x
into a single
component. It returns the representative element for the resulting component.
If this element and x
are already in the same component, no mutation occurs and
their representative is returned.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |