Package org.jgrapht.util
Class WeightedUnmodifiableSet<E>
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractSet<E>
-
- org.jgrapht.util.WeightedUnmodifiableSet<E>
-
- Type Parameters:
E
- element type
- All Implemented Interfaces:
Serializable
,Iterable<E>
,Collection<E>
,Set<E>
- Direct Known Subclasses:
CliqueAlgorithm.CliqueImpl
,IndependentSetAlgorithm.IndependentSetImpl
,SpannerAlgorithm.SpannerImpl
,VertexCoverAlgorithm.VertexCoverImpl
public class WeightedUnmodifiableSet<E> extends AbstractSet<E> implements Serializable
Implementation of a weighted, unmodifiable set. This class can for instance be used to store a weighted vertex cover. ThehashCode()
andequals()
methods are identical to those of a normal set, i.e. they are independent of theweight
of this class. All methods are delegated to the underlying set.- Author:
- Joris Kinable
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description Set<E>
backingSet
double
weight
-
Constructor Summary
Constructors Constructor Description WeightedUnmodifiableSet(Set<E> backingSet)
Constructs a WeightedUnmodifiableSet instanceWeightedUnmodifiableSet(Set<E> backingSet, double weight)
Constructs a WeightedUnmodifiableSet instance
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(E v)
boolean
addAll(Collection<? extends E> c)
void
clear()
boolean
contains(Object o)
boolean
containsAll(Collection<?> c)
boolean
equals(Object o)
double
getWeight()
Returns the weight of the set.int
hashCode()
boolean
isEmpty()
Iterator<E>
iterator()
boolean
remove(Object o)
boolean
removeAll(Collection<?> c)
boolean
retainAll(Collection<?> c)
int
size()
Object[]
toArray()
<T> T[]
toArray(T[] a)
-
Methods inherited from class java.util.AbstractCollection
toString
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.Set
spliterator
-
-
-
-
Method Detail
-
getWeight
public double getWeight()
Returns the weight of the set.- Returns:
- weight of the set
-
size
public int size()
- Specified by:
size
in interfaceCollection<E>
- Specified by:
size
in interfaceSet<E>
- Specified by:
size
in classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfaceCollection<E>
- Specified by:
isEmpty
in interfaceSet<E>
- Overrides:
isEmpty
in classAbstractCollection<E>
-
contains
public boolean contains(Object o)
- Specified by:
contains
in interfaceCollection<E>
- Specified by:
contains
in interfaceSet<E>
- Overrides:
contains
in classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceSet<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArray
in interfaceCollection<E>
- Specified by:
toArray
in interfaceSet<E>
- Overrides:
toArray
in classAbstractCollection<E>
-
add
public boolean add(E v)
- Specified by:
add
in interfaceCollection<E>
- Specified by:
add
in interfaceSet<E>
- Overrides:
add
in classAbstractCollection<E>
-
remove
public boolean remove(Object o)
- Specified by:
remove
in interfaceCollection<E>
- Specified by:
remove
in interfaceSet<E>
- Overrides:
remove
in classAbstractCollection<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAll
in interfaceCollection<E>
- Specified by:
containsAll
in interfaceSet<E>
- Overrides:
containsAll
in classAbstractCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAll
in interfaceCollection<E>
- Specified by:
addAll
in interfaceSet<E>
- Overrides:
addAll
in classAbstractCollection<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAll
in interfaceCollection<E>
- Specified by:
retainAll
in interfaceSet<E>
- Overrides:
retainAll
in classAbstractCollection<E>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAll
in interfaceCollection<E>
- Specified by:
removeAll
in interfaceSet<E>
- Overrides:
removeAll
in classAbstractSet<E>
-
clear
public void clear()
- Specified by:
clear
in interfaceCollection<E>
- Specified by:
clear
in interfaceSet<E>
- Overrides:
clear
in classAbstractCollection<E>
-
equals
public boolean equals(Object o)
- Specified by:
equals
in interfaceCollection<E>
- Specified by:
equals
in interfaceSet<E>
- Overrides:
equals
in classAbstractSet<E>
-
hashCode
public int hashCode()
- Specified by:
hashCode
in interfaceCollection<E>
- Specified by:
hashCode
in interfaceSet<E>
- Overrides:
hashCode
in classAbstractSet<E>
-
-