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:
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. 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 java.util.Set<E>
backingSet
double
weight
-
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 boolean
add(E v)
boolean
addAll(java.util.Collection<? extends E> c)
void
clear()
boolean
contains(java.lang.Object o)
boolean
containsAll(java.util.Collection<?> c)
boolean
equals(java.lang.Object o)
double
getWeight()
Returns the weight of the set.int
hashCode()
boolean
isEmpty()
java.util.Iterator<E>
iterator()
boolean
remove(java.lang.Object o)
boolean
removeAll(java.util.Collection<?> c)
boolean
retainAll(java.util.Collection<?> c)
int
size()
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)
-
-