Class GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
java.lang.Object
tools.refinery.interpreter.rete.aggregation.GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
- All Implemented Interfaces:
Iterable<WholeKeyType>,Collection<WholeKeyType>,Set<WholeKeyType>
public class GroupedSet<GroupingValueType,GroupedKeyType,WholeKeyType>
extends Object
implements Set<WholeKeyType>
An optimized
Set 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 few Set operations are supported. This collection is unmodifiable.- Since:
- 2.4
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final GroupingValueTypeprotected final BiFunction<GroupingValueType, GroupedKeyType, WholeKeyType> protected final Collection<GroupedKeyType> -
Constructor Summary
ConstructorsConstructorDescriptionGroupedSet(GroupingValueType group, Collection<GroupedKeyType> values, BiFunction<GroupingValueType, GroupedKeyType, WholeKeyType> valueFunc) -
Method Summary
Modifier and TypeMethodDescriptionbooleanadd(WholeKeyType tuple) booleanaddAll(Collection<? extends WholeKeyType> coll) voidclear()booleanbooleancontainsAll(Collection<?> c) booleanisEmpty()iterator()booleanbooleanremoveAll(Collection<?> coll) booleanretainAll(Collection<?> coll) intsize()Object[]toArray()<T> T[]toArray(T[] arr) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArrayMethods inherited from interface java.util.Set
equals, hashCode, spliterator
-
Field Details
-
group
-
values
-
valueFunc
-
-
Constructor Details
-
GroupedSet
public GroupedSet(GroupingValueType group, Collection<GroupedKeyType> values, BiFunction<GroupingValueType, GroupedKeyType, WholeKeyType> valueFunc)
-
-
Method Details
-
size
public int size()- Specified by:
sizein interfaceCollection<GroupingValueType>- Specified by:
sizein interfaceSet<GroupingValueType>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceCollection<GroupingValueType>- Specified by:
isEmptyin interfaceSet<GroupingValueType>
-
contains
- Specified by:
containsin interfaceCollection<GroupingValueType>- Specified by:
containsin interfaceSet<GroupingValueType>
-
iterator
- Specified by:
iteratorin interfaceCollection<GroupingValueType>- Specified by:
iteratorin interfaceIterable<GroupingValueType>- Specified by:
iteratorin interfaceSet<GroupingValueType>
-
toArray
- Specified by:
toArrayin interfaceCollection<GroupingValueType>- Specified by:
toArrayin interfaceSet<GroupingValueType>
-
toArray
public <T> T[] toArray(T[] arr) - Specified by:
toArrayin interfaceCollection<GroupingValueType>- Specified by:
toArrayin interfaceSet<GroupingValueType>
-
add
- Specified by:
addin interfaceCollection<GroupingValueType>- Specified by:
addin interfaceSet<GroupingValueType>
-
remove
- Specified by:
removein interfaceCollection<GroupingValueType>- Specified by:
removein interfaceSet<GroupingValueType>
-
containsAll
- Specified by:
containsAllin interfaceCollection<GroupingValueType>- Specified by:
containsAllin interfaceSet<GroupingValueType>
-
addAll
- Specified by:
addAllin interfaceCollection<GroupingValueType>- Specified by:
addAllin interfaceSet<GroupingValueType>
-
retainAll
- Specified by:
retainAllin interfaceCollection<GroupingValueType>- Specified by:
retainAllin interfaceSet<GroupingValueType>
-
removeAll
- Specified by:
removeAllin interfaceCollection<GroupingValueType>- Specified by:
removeAllin interfaceSet<GroupingValueType>
-
clear
public void clear()- Specified by:
clearin interfaceCollection<GroupingValueType>- Specified by:
clearin interfaceSet<GroupingValueType>
-