- 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.SerializableImplementation 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 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
All Methods Instance Methods Concrete Methods 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 Detail
-
backingSet
public final java.util.Set<E> backingSet
-
weight
public final double weight
-
-
Constructor Detail
-
WeightedUnmodifiableSet
public WeightedUnmodifiableSet(java.util.Set<E> backingSet)
Constructs a WeightedUnmodifiableSet instance- Parameters:
backingSet- underlying set
-
WeightedUnmodifiableSet
public WeightedUnmodifiableSet(java.util.Set<E> backingSet, double weight)
Constructs a WeightedUnmodifiableSet instance- Parameters:
backingSet- underlying setweight- weight of the set
-
-
Method Detail
-
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
public java.util.Iterator<E> iterator()
-
toArray
public java.lang.Object[] toArray()
-
toArray
public <T> T[] toArray(T[] a)
-
add
public boolean add(E v)
-
remove
public boolean remove(java.lang.Object o)
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
-
addAll
public boolean addAll(java.util.Collection<? extends E> c)
-
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)
-
-