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 -
Method Summary
Modifier and TypeMethodDescriptionvoidand(MethodNode methodNode, T assertion) Adds the given assertion to the method entry using logical conjunction.booleancontains(MethodNode methodNode) Indicates whether an assertion has already been recorded for the given method.get(MethodNode methodNode) Returns the assertion associated with the supplied method.iterator()Returns an iterator over the stored method/assertion pairs.voidjoin(MethodNode methodNode, T assertion) Joins the assertion into the method entry using the default merge strategy.voidor(MethodNode methodNode, T assertion) Adds the given assertion to the method entry using logical disjunction.intsize()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, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Constructor Details
-
AssertionMap
public AssertionMap()Creates an empty assertion map.
-
-
Method Details
-
and
Adds the given assertion to the method entry using logical conjunction.- Parameters:
methodNode- the method whose assertion should be updatedassertion- the assertion to merge
-
or
Adds the given assertion to the method entry using logical disjunction.- Parameters:
methodNode- the method whose assertion should be updatedassertion- the assertion to merge
-
join
Joins the assertion into the method entry using the default merge strategy.- Parameters:
methodNode- the method whose assertion should be updatedassertion- the assertion to merge
-
contains
Indicates whether an assertion has already been recorded for the given method.- Parameters:
methodNode- the method to look up- Returns:
trueif an assertion is present
-
iterator
Returns an iterator over the stored method/assertion pairs. -
size
public int size()Returns the number of method entries currently stored.- Returns:
- the assertion entry count
-
get
Returns the assertion associated with the supplied method.- Parameters:
methodNode- the method to look up- Returns:
- the matching assertion, or
nullif none has been stored
-