Set<InferenceVariable> (Set<ConstraintFormula> constraintFormulas) { final Set<InferenceVariable> outputVariables = new HashSet<>(); for (ConstraintFormula constraint : constraintFormulas) { if (constraint instanceof InputOutputConstraintFormula) { final Set<InferenceVariable> inputVariables = ((InputOutputConstraintFormula)constraint).getInputVariables(this); final Set<InferenceVariable> outputVars = ((InputOutputConstraintFormula)constraint).getOutputVariables(inputVariables, this); if (outputVars != null) { outputVariables.addAll(outputVars); } } } return outputVariables; }