public ReductionResult withBound(Bound bound) { ReductionResult newInstance = new ReductionResult(); newInstance.boundSet = this.boundSet.withBound(bound); newInstance.constraintFormulas = this.constraintFormulas; return newInstance; }
public static ReductionResult falseResult() { return empty().withBound(Bound.falseBound()); }
private boolean hasInstantiationFor(InferenceVariable v) { for (Bound b : bounds) { if (b.isAnInstantiationFor(v)) { return true; } } return false; }
Optional<ProperLowerBound> isProperLowerBoundFor(InferenceVariable inferenceVariable) { Optional<ProperLowerBound> partial = isProperLowerBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
Optional<ProperUpperBound> isProperUpperBoundFor(InferenceVariable inferenceVariable) { Optional<ProperUpperBound> partial = isProperUpperBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
/** * Maintains a set of inference variable bounds, ensuring that these are consistent as new bounds are added. * Because the bounds on one variable can sometimes impact the possible choices for another variable, this process * propagates bounds between such interdependent variables. */ public BoundSet incorporate(BoundSet otherBounds, TypeSolver typeSolver) { BoundSet newBoundSet = this; for (Bound b : otherBounds.bounds) { newBoundSet = newBoundSet.withBound(b); } return newBoundSet.deriveImpliedBounds(typeSolver); }
@Override public Boolean visit(AssertStmt n, Void arg) { // An assert statement can complete normally iff it is reachable. return isReachable(n); }
public static ReductionResult bounds(BoundSet bounds) { ReductionResult reductionResult = new ReductionResult(); reductionResult.boundSet = bounds; return reductionResult; } }
Optional<ProperLowerBound> isProperLowerBoundFor(InferenceVariable inferenceVariable) { Optional<ProperLowerBound> partial = isProperLowerBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
Optional<ProperUpperBound> isProperUpperBoundFor(InferenceVariable inferenceVariable) { Optional<ProperUpperBound> partial = isProperUpperBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
public static ReductionResult falseResult() { return empty().withBound(Bound.falseBound()); }
public ReductionResult withBound(Bound bound) { ReductionResult newInstance = new ReductionResult(); newInstance.boundSet = this.boundSet.withBound(bound); newInstance.constraintFormulas = this.constraintFormulas; return newInstance; }
/** * Maintains a set of inference variable bounds, ensuring that these are consistent as new bounds are added. * Because the bounds on one variable can sometimes impact the possible choices for another variable, this process * propagates bounds between such interdependent variables. */ public BoundSet incorporate(BoundSet otherBounds, TypeSolver typeSolver) { BoundSet newBoundSet = this; for (Bound b : otherBounds.bounds) { newBoundSet = newBoundSet.withBound(b); } return newBoundSet.deriveImpliedBounds(typeSolver); }
private boolean hasInstantiationFor(InferenceVariable v) { for (Bound b : bounds) { if (b.isAnInstantiationFor(v)) { return true; } } return false; }
@Override public Boolean visit(LocalClassDeclarationStmt n, Void arg) { // A local class declaration statement can complete normally iff it is reachable. return isReachable(n); }
Optional<ProperLowerBound> isProperLowerBoundFor(InferenceVariable inferenceVariable) { Optional<ProperLowerBound> partial = isProperLowerBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
Optional<ProperUpperBound> isProperUpperBoundFor(InferenceVariable inferenceVariable) { Optional<ProperUpperBound> partial = isProperUpperBound(); if (partial.isPresent() && partial.get().getInferenceVariable().equals(inferenceVariable)) { return partial; } else { return Optional.empty(); } }
public static ReductionResult falseResult() { return empty().withBound(Bound.falseBound()); }
public ReductionResult withBound(Bound bound) { ReductionResult newInstance = new ReductionResult(); newInstance.boundSet = this.boundSet.withBound(bound); newInstance.constraintFormulas = this.constraintFormulas; return newInstance; }
private boolean hasInstantiationFor(InferenceVariable v) { for (Bound b : bounds) { if (b.isAnInstantiationFor(v)) { return true; } } return false; }