@Test public void testResolvingReferencedConditionalsForBoundedVariable() { String conditionText = "if (question) { question2: \"Label\" boolean }"; Form form = FormBuilder.build(TestHelper.buildForm("form1", conditionText)); Conditional conditionForQuestion = (Conditional) form.getStatements().get(0); ReferenceResolver referencesResolver = new ReferenceResolver(form); assertThat(referencesResolver.getReferencedConditionals(QUESTION)).containsOnly(conditionForQuestion); }
public Collection<Conditional> getReferencedConditionals(final Identifier variableName) { return conditionalReferences.get(variableName); }
ReferenceResolver implements FormVisitor<Void>, StatementVisitor<Void> { public Collection<Conditional> getReferencedConditionals(final Identifier variableName) { return conditionalReferences.get(variableName); } }
ReferenceResolver implements FormVisitor<Void>, StatementVisitor<Void> { public Collection<Conditional> getReferencedConditionals(final Identifier variableName) { return conditionalReferences.get(variableName); } ReferenceResolver(final Form form); }
ReferenceResolver implements FormVisitor<Void>, StatementVisitor<Void> { public Collection<Conditional> getReferencedConditionals(final Identifier variableName) { return conditionalReferences.get(variableName); } ReferenceResolver(final Form form); Collection<ComputedQuestion> getReferencedQuestions(final Identifier variableName); Collection<Conditional> getReferencedConditionals(final Identifier variableName); @Override Void visit(final Form form); @Override Void visit(final ComputedQuestion question); @Override Void visit(final Question statement); @Override Void visit(final Conditional conditional); }
ReferenceResolver implements FormVisitor<Void>, StatementVisitor<Void> { public Collection<Conditional> getReferencedConditionals(final Identifier variableName) { return conditionalReferences.get(variableName); } ReferenceResolver(final Form form); Collection<ComputedQuestion> getReferencedQuestions(final Identifier variableName); Collection<Conditional> getReferencedConditionals(final Identifier variableName); @Override Void visit(final Form form); @Override Void visit(final ComputedQuestion question); @Override Void visit(final Question statement); @Override Void visit(final Conditional conditional);  }