V - the class of the elements in the mapped sets.public interface EquivalenceClassesMap<V>
map(getRepresentative(a))=getRepresentative(b) map(getRepresentative(b))=getRepresentative(a)
| Modifier and Type | Method and Description |
|---|---|
void |
add(Collection<V> xClass,
Collection<V> yClass)
Register the X equivalence class mapped to Y equivalence class,
Any existing mappings of the equivalence classes' elements are overridden.
|
void |
add(V x,
V y)
This method guarantees that each x or y objects pertain to no more than a single set and there is
one-to-one mapping between these sets
If there is a set containing y and there is no set containing x, then {x} is put as the set that is mapped to y;
If there is a set containing x and there is no set containing y, then {y} is put as the set that is mapped to x;
If there is no set containing x and there is no set containing y, then a new set {x} is created and mapped to the new set {y}
If there is a set containing x A.K.A {x} and there is a set containing y A.K.A {y}, then if {x} not mapped to {y}, this method fails.
|
Collection<V> |
getEquivalents(V element) |
default Set<V> |
getMappedRepresentatives(Collection<V> elements) |
V |
getRepresentative(V element) |
default Set<V> |
getRepresentatives(Collection<V> elements) |
default Set<V> |
getRepresentativesOrSelf(Collection<V> elements) |
Collection<V> |
getXKeys() |
V |
map(V element) |
void add(Collection<V> xClass, Collection<V> yClass)
xClass - not null, not empty equivalence class at x sideyClass - not null, not empty equivalence class at y sidevoid add(V x, V y) throws IllegalArgumentException
x - not null, conditionally named keyy - not null, conditionally named valueIllegalArgumentException - when mapping x,y that have already mapped representatives that do not matchCollection<V> getXKeys()
Collection<V> getEquivalents(V element)
element - is non-nullV getRepresentative(V element)
element - V map(V element)
element - default Set<V> getRepresentativesOrSelf(Collection<V> elements)
elements - non null collectiondefault Set<V> getMappedRepresentatives(Collection<V> elements)
elements - not nulldefault Set<V> getRepresentatives(Collection<V> elements)
elements - non null collectionCopyright © 2001–2018 MDA Tools. All rights reserved.