- 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 theweightof 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>backingSetdoubleweight
-
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 booleanadd(E v)booleanaddAll(Collection<? extends E> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)booleanequals(Object o)doublegetWeight()Returns the weight of the set.inthashCode()booleanisEmpty()Iterator<E>iterator()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()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:
sizein interfaceCollection<E>- Specified by:
sizein interfaceSet<E>- Specified by:
sizein classAbstractCollection<E>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<E>- Specified by:
isEmptyin interfaceSet<E>- Overrides:
isEmptyin classAbstractCollection<E>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceCollection<E>- Specified by:
containsin interfaceSet<E>- Overrides:
containsin classAbstractCollection<E>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
toArray
public <T> T[] toArray(T[] a)
- Specified by:
toArrayin interfaceCollection<E>- Specified by:
toArrayin interfaceSet<E>- Overrides:
toArrayin classAbstractCollection<E>
-
add
public boolean add(E v)
- Specified by:
addin interfaceCollection<E>- Specified by:
addin interfaceSet<E>- Overrides:
addin classAbstractCollection<E>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceCollection<E>- Specified by:
removein interfaceSet<E>- Overrides:
removein classAbstractCollection<E>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<E>- Specified by:
containsAllin interfaceSet<E>- Overrides:
containsAllin classAbstractCollection<E>
-
addAll
public boolean addAll(Collection<? extends E> c)
- Specified by:
addAllin interfaceCollection<E>- Specified by:
addAllin interfaceSet<E>- Overrides:
addAllin classAbstractCollection<E>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<E>- Specified by:
retainAllin interfaceSet<E>- Overrides:
retainAllin classAbstractCollection<E>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<E>- Specified by:
removeAllin interfaceSet<E>- Overrides:
removeAllin classAbstractSet<E>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<E>- Specified by:
clearin interfaceSet<E>- Overrides:
clearin classAbstractCollection<E>
-
equals
public boolean equals(Object o)
- Specified by:
equalsin interfaceCollection<E>- Specified by:
equalsin interfaceSet<E>- Overrides:
equalsin classAbstractSet<E>
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceCollection<E>- Specified by:
hashCodein interfaceSet<E>- Overrides:
hashCodein classAbstractSet<E>
-
-