Package org.apache.groovy.contracts.domain

# Class AssertionMap<T extends Assertion<T>>

java.lang.Object
org.apache.groovy.contracts.domain.AssertionMap<T>

Type Parameters:
  `T` - the assertion type stored for each method

All Implemented Interfaces:
  `Iterable<Map.Entry<MethodNode,T>>`

public class AssertionMap<T extends Assertion<T>> extends Object implements Iterable<Map.Entry<MethodNode,T>>
Maps methods to their accumulated contract assertions.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AssertionMap()`
  Creates an empty assertion map.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `and(MethodNode methodNode, T assertion)`
  Adds the given assertion to the method entry using logical conjunction.
  `boolean`
  `contains(MethodNode methodNode)`
  Indicates whether an assertion has already been recorded for the given method.
  `T`
  `get(MethodNode methodNode)`
  Returns the assertion associated with the supplied method.
  `Iterator<Map.Entry<MethodNode,T>>`
  `iterator()`
  Returns an iterator over the stored method/assertion pairs.
  `void`
  `join(MethodNode methodNode, T assertion)`
  Joins the assertion into the method entry using the default merge strategy.
  `void`
  `or(MethodNode methodNode, T assertion)`
  Adds the given assertion to the method entry using logical disjunction.
  `int`
  `size()`
  Returns the number of method entries currently stored.

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

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

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

  `forEach, spliterator`

- ## Constructor Details

  - ### AssertionMap

    public AssertionMap()
    Creates an empty assertion map.

- ## Method Details

  - ### and

    public void and(MethodNode methodNode, T assertion)
    Adds the given assertion to the method entry using logical conjunction.
    Parameters:
      `methodNode` - the method whose assertion should be updated
      `assertion` - the assertion to merge

  - ### or

    public void or(MethodNode methodNode, T assertion)
    Adds the given assertion to the method entry using logical disjunction.
    Parameters:
      `methodNode` - the method whose assertion should be updated
      `assertion` - the assertion to merge

  - ### join

    public void join(MethodNode methodNode, T assertion)
    Joins the assertion into the method entry using the default merge strategy.
    Parameters:
      `methodNode` - the method whose assertion should be updated
      `assertion` - the assertion to merge

  - ### contains

    public boolean contains(MethodNode methodNode)
    Indicates whether an assertion has already been recorded for the given method.
    Parameters:
      `methodNode` - the method to look up
    Returns:
      `true` if an assertion is present

  - ### iterator

    public Iterator<Map.Entry<MethodNode,T>> iterator()
    Returns an iterator over the stored method/assertion pairs.
    Specified by:
      `iterator` in interface `Iterable<T extends Assertion<T>>`
    Returns:
      an iterator across the current entries

  - ### size

    public int size()
    Returns the number of method entries currently stored.
    Returns:
      the assertion entry count

  - ### get

    public T get(MethodNode methodNode)
    Returns the assertion associated with the supplied method.
    Parameters:
      `methodNode` - the method to look up
    Returns:
      the matching assertion, or `null` if none has been stored