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 ReductionResult
The result given when a constraint set reduces to false.static final @InternedDistinct ConstraintSet
The result given when a constraint set reduces to true.static final @InternedDistinct ConstraintSet
The 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 TypeMethodDescriptionvoid
add
(Constraint c) Addsc
to this set, if c isn't already in the list.void
addAll
(Collection<? extends Constraint> constraintSet) Adds all constraints inconstraintSet
to this constraint set.void
addAll
(ConstraintSet constraintSet) Adds all constraints inconstraintSet
to this constraint set.void
Applies 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.static ConstraintSet
getClosedSubset
(ConstraintSet c, Dependencies dependencies) Returns a subset ofc
; for each constraint in the subset, no input variable can influence an output variable of another constraint in C.boolean
isEmpty()
Return whether or not this constraint set is empty.pop()
Removes and returns the first constraint that was added to this set.void
push
(Constraint constraint) Adds the constraint to the beginning of this set.void
pushAll
(ConstraintSet constraints) Adds the constraints to the beginning of this set and maintains the order of the constraints.reduce
(Java8InferenceContext context) Reduces all the constraints in this set.Reduces all the constraints in this set.reduceOneStep
(Java8InferenceContext context) Reduce one constraint in this set.void
remove
(ConstraintSet subset) Remove all constraints insubset
from 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
Addsc
to this set, if c isn't already in the list.- Parameters:
c
- a constraint to add to this set
-
addAll
Adds all constraints inconstraintSet
to this constraint set.- Parameters:
constraintSet
- a set of constraints to add to this set
-
addAll
Adds all constraints inconstraintSet
to 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
-
push
Adds the constraint to the beginning of this set.- Parameters:
constraint
- a constraint
-
pushAll
Adds the constraints to the beginning of this set and maintains the order of the constraints.- Parameters:
constraints
- constraints
-
remove
Remove all constraints insubset
from this constraint set.- Parameters:
subset
- the set of constraints to remove from this set
-
getClosedSubset
Returns a subset ofc
; for each constraint in the subset, no input variable can influence an output variable of another constraint in C. If that subset is empty, returns a set containing a single constraint that participates in a constraint cycle. (See JLS 18.5.2.2)- Parameters:
c
- a constraint setdependencies
- an object describing the dependencies of inference variables- Returns:
- s a subset of constraints in
c
whose inputs do not affectc
's outputs, or a singleton constraint from a constraint cycle
-
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
-
reduceAdditionalArgOnce
Reduces all the constraints in this set. (See JLS 18.2) If anAdditionalArgument
is found it is reduced one step and then this method returns.- 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
-