org.eclipse.viatra.query.runtime.rete.aggregation

## 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 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

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected GroupingValueType` | `group`
    `protected java.util.function.BiFunction<GroupingValueType,GroupedKeyType,WholeKeyType>` | `valueFunc`
    `protected java.util.Collection<GroupedKeyType>` | `values`

  - ### Constructor Summary

    Constructors
    Constructor and 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 and 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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface java.util.Set

      `equals, hashCode, spliterator`

    - ### Methods inherited from interface java.util.Collection

      `parallelStream, removeIf, stream`

    - ### Methods inherited from interface java.lang.Iterable

      `forEach`

- - ### 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 interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `size` in interface `java.util.Set<WholeKeyType>`

    - #### isEmpty

          public boolean isEmpty()

      Specified by:
        `isEmpty` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `isEmpty` in interface `java.util.Set<WholeKeyType>`

    - #### contains

          public boolean contains(java.lang.Object obj)

      Specified by:
        `contains` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `contains` in interface `java.util.Set<WholeKeyType>`

    - #### iterator

          public java.util.Iterator<WholeKeyType> iterator()

      Specified by:
        `iterator` in interface `java.lang.Iterable<WholeKeyType>`
      Specified by:
        `iterator` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `iterator` in interface `java.util.Set<WholeKeyType>`

    - #### toArray

          public java.lang.Object[] toArray()

      Specified by:
        `toArray` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `toArray` in interface `java.util.Set<WholeKeyType>`

    - #### toArray

          public <T> T[] toArray(T[] arr)

      Specified by:
        `toArray` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `toArray` in interface `java.util.Set<WholeKeyType>`

    - #### add

          public boolean add(WholeKeyType tuple)

      Specified by:
        `add` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `add` in interface `java.util.Set<WholeKeyType>`

    - #### remove

          public boolean remove(java.lang.Object obj)

      Specified by:
        `remove` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `remove` in interface `java.util.Set<WholeKeyType>`

    - #### containsAll

          public boolean containsAll(java.util.Collection<?> c)

      Specified by:
        `containsAll` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `containsAll` in interface `java.util.Set<WholeKeyType>`

    - #### addAll

          public boolean addAll(java.util.Collection<? extends WholeKeyType> coll)

      Specified by:
        `addAll` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `addAll` in interface `java.util.Set<WholeKeyType>`

    - #### retainAll

          public boolean retainAll(java.util.Collection<?> coll)

      Specified by:
        `retainAll` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `retainAll` in interface `java.util.Set<WholeKeyType>`

    - #### removeAll

          public boolean removeAll(java.util.Collection<?> coll)

      Specified by:
        `removeAll` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `removeAll` in interface `java.util.Set<WholeKeyType>`

    - #### clear

          public void clear()

      Specified by:
        `clear` in interface `java.util.Collection<WholeKeyType>`
      Specified by:
        `clear` in interface `java.util.Set<WholeKeyType>`