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 GroupingValueType
protected 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 TypeMethodDescriptionboolean
add
(WholeKeyType tuple) boolean
addAll
(Collection<? extends WholeKeyType> coll) void
clear()
boolean
boolean
containsAll
(Collection<?> c) boolean
isEmpty()
iterator()
boolean
boolean
removeAll
(Collection<?> coll) boolean
retainAll
(Collection<?> coll) int
size()
Object[]
toArray()
<T> T[]
toArray
(T[] arr) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
Methods 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:
size
in interfaceCollection<GroupingValueType>
- Specified by:
size
in interfaceSet<GroupingValueType>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmpty
in interfaceCollection<GroupingValueType>
- Specified by:
isEmpty
in interfaceSet<GroupingValueType>
-
contains
- Specified by:
contains
in interfaceCollection<GroupingValueType>
- Specified by:
contains
in interfaceSet<GroupingValueType>
-
iterator
- Specified by:
iterator
in interfaceCollection<GroupingValueType>
- Specified by:
iterator
in interfaceIterable<GroupingValueType>
- Specified by:
iterator
in interfaceSet<GroupingValueType>
-
toArray
- Specified by:
toArray
in interfaceCollection<GroupingValueType>
- Specified by:
toArray
in interfaceSet<GroupingValueType>
-
toArray
public <T> T[] toArray(T[] arr) - Specified by:
toArray
in interfaceCollection<GroupingValueType>
- Specified by:
toArray
in interfaceSet<GroupingValueType>
-
add
- Specified by:
add
in interfaceCollection<GroupingValueType>
- Specified by:
add
in interfaceSet<GroupingValueType>
-
remove
- Specified by:
remove
in interfaceCollection<GroupingValueType>
- Specified by:
remove
in interfaceSet<GroupingValueType>
-
containsAll
- Specified by:
containsAll
in interfaceCollection<GroupingValueType>
- Specified by:
containsAll
in interfaceSet<GroupingValueType>
-
addAll
- Specified by:
addAll
in interfaceCollection<GroupingValueType>
- Specified by:
addAll
in interfaceSet<GroupingValueType>
-
retainAll
- Specified by:
retainAll
in interfaceCollection<GroupingValueType>
- Specified by:
retainAll
in interfaceSet<GroupingValueType>
-
removeAll
- Specified by:
removeAll
in interfaceCollection<GroupingValueType>
- Specified by:
removeAll
in interfaceSet<GroupingValueType>
-
clear
public void clear()- Specified by:
clear
in interfaceCollection<GroupingValueType>
- Specified by:
clear
in interfaceSet<GroupingValueType>
-