|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objecttip.util.EqualitySet<E>
E
- the type of the elements in the setpublic class EqualitySet<E>
EqualitySet
implements a Set
where equality of elements can
be abstracted using an Equalitor
, i.e. elements in the set are
regarded as equal based on Equalitor.equals(Object, Object)
.
Constructor Summary | |
---|---|
EqualitySet()
Creates a new empty EqualitySet using the
IdentityEqualitor as equalitor. |
|
EqualitySet(Collection<E> c)
Create a new EqualitySet using the IdentityEqualitor as
equalitor, initially containing the elements in c . |
|
EqualitySet(Collection<E> c,
Equalitor<E> equalitor)
Creates a new EqualitySet using equalitor as the
equalitor, initially containing the elements in c . |
|
EqualitySet(Equalitor<E> equalitor)
Creates a new empty EqualitySet using equalitor as the
equalitor. |
|
EqualitySet(Set<EqualityElement<E>> set,
Equalitor<E> equalitor)
Create an EqualitySet containing the elements of set with
equalitor as the equalitor. |
Method Summary | ||
---|---|---|
boolean |
add(E o)
Adds the element o to this set. |
|
boolean |
add(EqualityElement<E> e)
Adds the element held by the EqualityElement e to this
set. |
|
boolean |
addAll(Collection<? extends E> c)
Adds all elements of the collection c to this set |
|
boolean |
addAll(EqualitySet<E> c)
Adds all elements in c to the set. |
|
void |
clear()
|
|
EqualitySet<E> |
clone()
Returns a shallow clone of this set. |
|
boolean |
contains(Object o)
Returns true if this set contains the element o . |
|
boolean |
containsAll(Collection<?> c)
|
|
boolean |
equals(Object o)
|
|
Equalitor<E> |
getEqualitor()
Returns the Equalitor used for element equality. |
|
int |
hashCode()
Returns the hashcode for this EqualitySet . |
|
boolean |
isEmpty()
|
|
Iterator<E> |
iterator()
|
|
boolean |
remove(Object o)
|
|
boolean |
removeAll(Collection<?> c)
Removes all element in the collection c from this set. |
|
boolean |
retainAll(Collection<?> c)
|
|
int |
size()
|
|
Object[] |
toArray()
|
|
|
toArray(T[] a)
|
|
String |
toString()
|
|
String |
toString(Stringifier<E> stringifier)
Returns a text representation of the set using the stringifier . |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public EqualitySet()
EqualitySet
using the
IdentityEqualitor
as equalitor.
public EqualitySet(Collection<E> c)
EqualitySet
using the IdentityEqualitor
as
equalitor, initially containing the elements in c
.
c
- the initial setpublic EqualitySet(Equalitor<E> equalitor)
EqualitySet
using equalitor
as the
equalitor.
equalitor
- the equalitor used for element equality
IllegalArgumentException
- if no Equalitor
was providedpublic EqualitySet(Collection<E> c, Equalitor<E> equalitor)
EqualitySet
using equalitor
as the
equalitor, initially containing the elements in c
.
equalitor
- the equalitor used for element equalityc
- the initial set
IllegalArgumentException
- if no Equalitor
was providedpublic EqualitySet(Set<EqualityElement<E>> set, Equalitor<E> equalitor)
EqualitySet
containing the elements of set
with
equalitor
as the equalitor.
set
- the initial set of elementsequalitor
- the equalitor used for element equality
IllegalArgumentException
- if no Equalitor
was providedMethod Detail |
---|
public boolean add(E o)
o
to this set.
add
in interface Collection<E>
add
in interface Set<E>
o
- the element added to this set
true
is the element o
was added to this setpublic boolean add(EqualityElement<E> e)
EqualityElement
e
to this
set. If the equalitor of e
is not the same as the equalitor used
in the set, an IllegalArgumentException
is thrown.
e
- the element added to this set
true
if this set was changed
IllegalArgumentException
- if the equalitors mismatchpublic boolean addAll(Collection<? extends E> c)
c
to this set
addAll
in interface Collection<E>
addAll
in interface Set<E>
c
- the collection in question
true
if this set was changedpublic boolean addAll(EqualitySet<E> c)
c
to the set. If the equalitor of e
is not the same as the equalitor used in the set, an
IllegalArgumentException
is thrown.
c
- the set of elements added to this set
true
if this set was changed
IllegalArgumentException
- if the equalitors mismatchpublic void clear()
clear
in interface Collection<E>
clear
in interface Set<E>
public EqualitySet<E> clone()
clone
in class Object
public boolean contains(Object o)
true
if this set contains the element o
.
contains
in interface Collection<E>
contains
in interface Set<E>
o
- the element in question
true
if this set contains the element o
.public boolean containsAll(Collection<?> c)
containsAll
in interface Collection<E>
containsAll
in interface Set<E>
public boolean equals(Object o)
equals
in interface Collection<E>
equals
in interface Set<E>
equals
in class Object
public Equalitor<E> getEqualitor()
Equalitor
used for element equality.
Equalitor
used for element equalitypublic int hashCode()
EqualitySet
.
hashCode
in interface Collection<E>
hashCode
in interface Set<E>
hashCode
in class Object
EqualitySet
public boolean isEmpty()
isEmpty
in interface Collection<E>
isEmpty
in interface Set<E>
public Iterator<E> iterator()
iterator
in interface Iterable<E>
iterator
in interface Collection<E>
iterator
in interface Set<E>
public boolean remove(Object o)
remove
in interface Collection<E>
remove
in interface Set<E>
public boolean removeAll(Collection<?> c)
c
from this set.
removeAll
in interface Collection<E>
removeAll
in interface Set<E>
c
- the collection in question
true
if this set was changedpublic boolean retainAll(Collection<?> c)
retainAll
in interface Collection<E>
retainAll
in interface Set<E>
public int size()
size
in interface Collection<E>
size
in interface Set<E>
public Object[] toArray()
toArray
in interface Collection<E>
toArray
in interface Set<E>
public <T> T[] toArray(T[] a)
toArray
in interface Collection<E>
toArray
in interface Set<E>
public String toString()
toString
in class Object
public String toString(Stringifier<E> stringifier)
stringifier
.
toString
in interface Stringifiable<E>
stringifier
- the Stringifier
used for elements
stringifier
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |