V - is the class of the mapped elementspublic class EquivalenceClassesMapImpl<V> extends Object implements EquivalenceClassesMap<V>
| Constructor and Description |
|---|
EquivalenceClassesMapImpl() |
| 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) |
V |
getRepresentative(V element) |
Collection<V> |
getXKeys() |
V |
map(V element) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetMappedRepresentatives, getRepresentatives, getRepresentativesOrSelfpublic EquivalenceClassesMapImpl()
public void add(Collection<V> xClass, Collection<V> yClass)
EquivalenceClassesMapadd in interface EquivalenceClassesMap<V>xClass - not null, not empty equivalence class at x sideyClass - not null, not empty equivalence class at y sideEquivalenceClassesMap.add(java.util.Collection, java.util.Collection)public final void add(V x, V y) throws IllegalArgumentException
EquivalenceClassesMapadd in interface EquivalenceClassesMap<V>x - not null, conditionally named keyy - not null, conditionally named valueIllegalArgumentException - when mapping x,y that have already mapped representatives that do not matchEquivalenceClassesMap.add(java.lang.Object, java.lang.Object)public final Collection<V> getXKeys()
getXKeys in interface EquivalenceClassesMap<V>EquivalenceClassesMap.getXKeys()public final Collection<V> getEquivalents(V element)
getEquivalents in interface EquivalenceClassesMap<V>element - is non-nullEquivalenceClassesMap.getEquivalents(java.lang.Object)public final V getRepresentative(V element)
getRepresentative in interface EquivalenceClassesMap<V>EquivalenceClassesMap.getRepresentative(java.lang.Object)public final V map(V element)
map in interface EquivalenceClassesMap<V>EquivalenceClassesMap.map(java.lang.Object)Copyright © 2001–2018 MDA Tools. All rights reserved.