Package 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 | 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)` |

    - ### 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.lang.Iterable

      `forEach`

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

      `equals, hashCode, spliterator`

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

    - #### isEmpty

          public boolean isEmpty()

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

    - #### contains

          public boolean contains​(java.lang.Object obj)

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

    - #### iterator

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

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

    - #### toArray

          public java.lang.Object[] toArray()

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

    - #### toArray

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

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

    - #### add

          public boolean add​(WholeKeyType tuple)

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

    - #### remove

          public boolean remove​(java.lang.Object obj)

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

    - #### containsAll

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

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

    - #### addAll

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

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

    - #### retainAll

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

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

    - #### removeAll

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

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

    - #### clear

          public void clear()

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