Class GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
- java.lang.Object
-
- org.eclipse.viatra.query.runtime.rete.aggregation.GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
-
- All Implemented Interfaces:
java.lang.Iterable<WholeKeyType>
,java.util.Collection<WholeKeyType>
,java.util.Set<WholeKeyType>
public class GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType> extends java.lang.Object implements java.util.Set<WholeKeyType>
An optimizedSet
implementation where each contained value is produced by combining together a grouping value and some other (key) object. The way of combining together these two values is specified by the closure passed to the constructor. Only a select fewSet
operations are supported. This collection is unmodifiable.- Since:
- 2.4
-
-
Field Summary
Fields Modifier and Type Field Description protected GroupingValueType
group
protected java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType>
valueFunc
protected java.util.Collection<GroupedKeyType>
values
-
Constructor Summary
Constructors Constructor Description GroupedSet(GroupingValueType group, java.util.Collection<GroupedKeyType> values, java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
add(WholeKeyType tuple)
boolean
addAll(java.util.Collection<? extends WholeKeyType> coll)
void
clear()
boolean
contains(java.lang.Object obj)
boolean
containsAll(java.util.Collection<?> c)
boolean
isEmpty()
java.util.Iterator<WholeKeyType>
iterator()
boolean
remove(java.lang.Object obj)
boolean
removeAll(java.util.Collection<?> coll)
boolean
retainAll(java.util.Collection<?> coll)
int
size()
java.lang.Object[]
toArray()
<T> T[]
toArray(T[] arr)
-
-
-
Field Detail
-
group
protected final GroupingValueType group
-
values
protected final java.util.Collection<GroupedKeyType> values
-
valueFunc
protected final java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc
-
-
Constructor Detail
-
GroupedSet
public GroupedSet(GroupingValueType group, java.util.Collection<GroupedKeyType> values, java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType> valueFunc)
-
-
Method Detail
-
size
public int size()
- Specified by:
size
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
size
in interfacejava.util.Set<GroupingValueType>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmpty
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
isEmpty
in interfacejava.util.Set<GroupingValueType>
-
contains
public boolean contains(java.lang.Object obj)
- Specified by:
contains
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
contains
in interfacejava.util.Set<GroupingValueType>
-
iterator
public java.util.Iterator<WholeKeyType> iterator()
- Specified by:
iterator
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
iterator
in interfacejava.lang.Iterable<GroupingValueType>
- Specified by:
iterator
in interfacejava.util.Set<GroupingValueType>
-
toArray
public java.lang.Object[] toArray()
- Specified by:
toArray
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
toArray
in interfacejava.util.Set<GroupingValueType>
-
toArray
public <T> T[] toArray(T[] arr)
- Specified by:
toArray
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
toArray
in interfacejava.util.Set<GroupingValueType>
-
add
public boolean add(WholeKeyType tuple)
- Specified by:
add
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
add
in interfacejava.util.Set<GroupingValueType>
-
remove
public boolean remove(java.lang.Object obj)
- Specified by:
remove
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
remove
in interfacejava.util.Set<GroupingValueType>
-
containsAll
public boolean containsAll(java.util.Collection<?> c)
- Specified by:
containsAll
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
containsAll
in interfacejava.util.Set<GroupingValueType>
-
addAll
public boolean addAll(java.util.Collection<? extends WholeKeyType> coll)
- Specified by:
addAll
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
addAll
in interfacejava.util.Set<GroupingValueType>
-
retainAll
public boolean retainAll(java.util.Collection<?> coll)
- Specified by:
retainAll
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
retainAll
in interfacejava.util.Set<GroupingValueType>
-
removeAll
public boolean removeAll(java.util.Collection<?> coll)
- Specified by:
removeAll
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
removeAll
in interfacejava.util.Set<GroupingValueType>
-
clear
public void clear()
- Specified by:
clear
in interfacejava.util.Collection<GroupingValueType>
- Specified by:
clear
in interfacejava.util.Set<GroupingValueType>
-
-