org.eclipse.viatra.query.runtime.base.api

## Interface IQueryResultSetter<KeyType,ValueType>

- Type Parameters:
    `KeyType` -
    `ValueType` -

      public interface IQueryResultSetter<KeyType,ValueType>

  Setter interface for query result multimaps that allow modifications of the model through the multimap.

  The model modifications should ensure that the multimap changes exactly as required (i.e. a put results in only one new key-value pair and remove results in only one removed pair).

  The input parameters of both put and remove can be validated by implementing the `validate(Object, Object)` method.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `put(KeyType key, ValueType value)` Modify the underlying model of the query in order to have the given key-value pair as a new result of the query.
    `boolean` | `remove(KeyType key, ValueType value)` Modify the underlying model of the query in order to remove the given key-value pair from the results of the query.
    `boolean` | `validate(KeyType key, ValueType value)` Validates a given key-value pair for the query result.

- - ### Method Detail

    - #### put

          boolean put(KeyType key,
                      ValueType value)

      Modify the underlying model of the query in order to have the given key-value pair as a new result of the query.
      Parameters:
        `key` - the key for which a new value is added to the query results
        `value` - the new value that should be added to the query results for the given key
      Returns:
        true, if the query result changed

    - #### remove

          boolean remove(KeyType key,
                         ValueType value)

      Modify the underlying model of the query in order to remove the given key-value pair from the results of the query.
      Parameters:
        `key` - the key for which the value is removed from the query results
        `value` - the value that should be removed from the query results for the given key
      Returns:
        true, if the query result changed

    - #### validate

          boolean validate(KeyType key,
                           ValueType value)

      Validates a given key-value pair for the query result. The validation has to ensure that (1) if the pair does not exist in the result, it can be added safely (2) if the pair already exists in the result, it can be removed safely
      Parameters:
        `key` - the key of the pair that is validated
        `value` - the value of the pair that is validated
      Returns:
        true, if the pair does not exists but can be added or the pair exists and can be removed