Class ConstraintSet
java.lang.Object
org.checkerframework.framework.util.typeinference8.constraint.ConstraintSet
- All Implemented Interfaces:
ReductionResult
A set of constraints and the operations that can be performed on them.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.checkerframework.framework.util.typeinference8.constraint.ReductionResult
ReductionResult.ReductionResultPair -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final @InternedDistinct ReductionResultThe result given when a constraint set reduces to false.static final @InternedDistinct ConstraintSetThe result given when a constraint set reduces to true.static final @InternedDistinct ConstraintSetThe Java types are correct, but the qualifiers are not in the correct relationship.Fields inherited from interface org.checkerframework.framework.util.typeinference8.constraint.ReductionResult
UNCHECKED_CONVERSION -
Constructor Summary
ConstructorsConstructorDescriptionConstraintSet(Constraint... constraints) Creates a constraint set withconstraints. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(Constraint c) Addscto this set, if c isn't already in the list.voidaddAll(Collection<? extends Constraint> constraintSet) Adds all constraints inconstraintSetto this constraint set.voidaddAll(ConstraintSet constraintSet) Adds all constraints inconstraintSetto this constraint set.voidApplies the instantiations to all the constraints in this set.Return all variables mentioned by any constraint in this set.Return all input variables for all constraints in this set.getClosedSubset(Dependencies dependencies) A subset of constraints is selected in this constraint set, satisfying the property that, for each constraint, no input variable can influence an output variable of another constraint in this constraint set.booleanisEmpty()Return whether or not this constraint set is empty.pop()Removes and returns the first constraint that was added to this set.reduce(Java8InferenceContext context) Reduces all the constraints in this set.reduceOneStep(Java8InferenceContext context) Reduce one constraint in this set.voidremove(ConstraintSet subset) Remove all constraints insubsetfrom this constraint set.toString()
-
Field Details
-
TRUE
The result given when a constraint set reduces to true. -
TRUE_ANNO_FAIL
The Java types are correct, but the qualifiers are not in the correct relationship. Return this rather than throwing an exception so that type arguments with the correct Java type are still inferred. -
FALSE
The result given when a constraint set reduces to false.
-
-
Constructor Details
-
ConstraintSet
Creates a constraint set withconstraints.- Parameters:
constraints- constraints to add to the newly created set
-
-
Method Details
-
add
Addscto this set, if c isn't already in the list.- Parameters:
c- a constraint to add to this set
-
addAll
Adds all constraints inconstraintSetto this constraint set.- Parameters:
constraintSet- a set of constraints to add to this set
-
addAll
Adds all constraints inconstraintSetto this constraint set.- Parameters:
constraintSet- a collection of constraints to add to this set
-
isEmpty
public boolean isEmpty()Return whether or not this constraint set is empty.- Returns:
- whether or not this constraint set is empty
-
pop
Removes and returns the first constraint that was added to this set.- Returns:
- first constraint that was added to this set
-
remove
Remove all constraints insubsetfrom this constraint set.- Parameters:
subset- the set of constraints to remove from this set
-
getClosedSubset
A subset of constraints is selected in this constraint set, satisfying the property that, for each constraint, no input variable can influence an output variable of another constraint in this constraint set. (See JLS 18.5.2.2)- Parameters:
dependencies- an object describing the dependencies of inference variables- Returns:
- s a subset of constraints is this constraint set
-
getAllInferenceVariables
Return all variables mentioned by any constraint in this set.- Returns:
- all variables mentioned by any constraint in this set
-
getAllInputVariables
Return all input variables for all constraints in this set.- Returns:
- all input variables for all constraints in this set
-
applyInstantiations
public void applyInstantiations()Applies the instantiations to all the constraints in this set. -
toString
-
reduce
Reduces all the constraints in this set. (See JLS 18.2)- Parameters:
context- the context- Returns:
- the bound set produced by reducing this constraint set
-
reduceOneStep
Reduce one constraint in this set.- Parameters:
context- the context- Returns:
- the result of reducing one constraint in this set
-