|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jgrapht.experimental.equivalence.EquivalenceSet<E,C>
E
- the type of the elements in the setC
- the type of the context the element is compared against, e.g. a
Graphpublic class EquivalenceSet<E,C>
EquivalenceSet is a Set of elements which have been determined to be equivalent using EquivalenceComparator. The class makes sure the set size will be one or more.
Field Summary | |
---|---|
protected C |
comparatorContext
|
protected Set<E> |
elementsSet
Contains the current elements of the group |
protected EquivalenceComparator<? super E,? super C> |
eqComparator
The comparator used to define the group |
Constructor Summary | |
---|---|
EquivalenceSet(E aElement,
EquivalenceComparator<? super E,? super C> aEqComparator,
C aComparatorContext)
Constructs a new EquivalenceSet, filled with the aElement parameter and a reference to the comparator which is used. |
Method Summary | |
---|---|
void |
add(E element)
Adds an element to the group. |
boolean |
equals(Object other)
Uses the equivalenceCompare() of the comparator to compare a representation of this group, taken using this.getRepresentative(), and a representation of the other object, which may be the object itself, or, if it is an equivalence group too, other.getRepresentative() |
boolean |
equivalentTo(E aOther,
C aOtherContext)
|
C |
getContext()
|
E |
getRepresentative()
Returns an arbitrary object from the group. |
int |
hashCode()
Uses a representative to calculate the group hashcode using equivalenceHashcode(). |
int |
size()
|
Object[] |
toArray()
Returns the elements of the group. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
protected EquivalenceComparator<? super E,? super C> eqComparator
protected C comparatorContext
protected Set<E> elementsSet
Constructor Detail |
---|
public EquivalenceSet(E aElement, EquivalenceComparator<? super E,? super C> aEqComparator, C aComparatorContext)
Method Detail |
---|
public E getRepresentative()
public C getContext()
public int size()
public void add(E element)
public boolean equivalentTo(E aOther, C aOtherContext)
public boolean equals(Object other)
public int hashCode()
Object.hashCode()
public String toString()
public Object[] toArray()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |