java.lang.Object
java.util.AbstractCollection<E>
java.util.AbstractSet<E>
org.jgrapht.util.WeightedUnmodifiableSet<E>
- Type Parameters:
E- element type
- All Implemented Interfaces:
java.io.Serializable,java.lang.Iterable<E>,java.util.Collection<E>,java.util.Set<E>
- Direct Known Subclasses:
CliqueAlgorithm.CliqueImpl,IndependentSetAlgorithm.IndependentSetImpl,SpannerAlgorithm.SpannerImpl,VertexCoverAlgorithm.VertexCoverImpl
public class WeightedUnmodifiableSet<E>
extends java.util.AbstractSet<E>
implements java.io.Serializable
Implementation of a weighted, unmodifiable set. This class can for instance be used to store a
weighted vertex cover. The
hashCode() and equals() methods are identical to those
of a normal set, i.e. they are independent of the weight 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 java.util.Set<E>backingSetdoubleweight -
Constructor Summary
Constructors Constructor Description WeightedUnmodifiableSet(java.util.Set<E> backingSet)Constructs a WeightedUnmodifiableSet instanceWeightedUnmodifiableSet(java.util.Set<E> backingSet, double weight)Constructs a WeightedUnmodifiableSet instance -
Method Summary
Modifier and Type Method Description booleanadd(E v)booleanaddAll(java.util.Collection<? extends E> c)voidclear()booleancontains(java.lang.Object o)booleancontainsAll(java.util.Collection<?> c)booleanequals(java.lang.Object o)doublegetWeight()Returns the weight of the set.inthashCode()booleanisEmpty()java.util.Iterator<E>iterator()booleanremove(java.lang.Object o)booleanremoveAll(java.util.Collection<?> c)booleanretainAll(java.util.Collection<?> c)intsize()java.lang.Object[]toArray()<T> T[]toArray(T[] a)
-
Field Details
-
backingSet
-
weight
public final double weight
-
-
Constructor Details
-
WeightedUnmodifiableSet
Constructs a WeightedUnmodifiableSet instance- Parameters:
backingSet- underlying set
-
WeightedUnmodifiableSet
Constructs a WeightedUnmodifiableSet instance- Parameters:
backingSet- underlying setweight- weight of the set
-
-
Method Details
-
getWeight
public double getWeight()Returns the weight of the set.- Returns:
- weight of the set
-
size
public int size() -
isEmpty
public boolean isEmpty() -
contains
public boolean contains(java.lang.Object o) -
iterator
-
toArray
public java.lang.Object[] toArray() -
toArray
public <T> T[] toArray(T[] a) -
add
-
remove
public boolean remove(java.lang.Object o) -
containsAll
public boolean containsAll(java.util.Collection<?> c) -
addAll
-
retainAll
public boolean retainAll(java.util.Collection<?> c) -
removeAll
public boolean removeAll(java.util.Collection<?> c) -
clear
public void clear() -
equals
public boolean equals(java.lang.Object o) -
hashCode
public int hashCode()
-