Search in sources :

Example 56 with BaseValue

use of uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue in project openolat by klemens.

the class TestFeedbackBuilder method findFeedbackRuleInExpression.

private boolean findFeedbackRuleInExpression(Expression expression, Identifier feedbackIdentifier) {
    if (expression instanceof BaseValue) {
        BaseValue bValue = (BaseValue) expression;
        SingleValue sValue = bValue.getSingleValue();
        if (sValue instanceof IdentifierValue) {
            IdentifierValue iValue = (IdentifierValue) sValue;
            if (feedbackIdentifier.equals(iValue.identifierValue())) {
                return true;
            }
        }
    } else {
        List<Expression> childExpressions = expression.getExpressions();
        for (Expression childExpression : childExpressions) {
            if (findFeedbackRuleInExpression(childExpression, feedbackIdentifier)) {
                return true;
            }
        }
    }
    return false;
}
Also used : SingleValue(uk.ac.ed.ph.jqtiplus.value.SingleValue) Expression(uk.ac.ed.ph.jqtiplus.node.expression.Expression) BaseValue(uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue) IdentifierValue(uk.ac.ed.ph.jqtiplus.value.IdentifierValue)

Aggregations

BaseValue (uk.ac.ed.ph.jqtiplus.node.expression.general.BaseValue)56 SetOutcomeValue (uk.ac.ed.ph.jqtiplus.node.item.response.processing.SetOutcomeValue)42 Variable (uk.ac.ed.ph.jqtiplus.node.expression.general.Variable)40 ResponseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseIf)38 Match (uk.ac.ed.ph.jqtiplus.node.expression.operator.Match)24 Sum (uk.ac.ed.ph.jqtiplus.node.expression.operator.Sum)24 ResponseElse (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElse)20 IdentifierValue (uk.ac.ed.ph.jqtiplus.value.IdentifierValue)20 Correct (uk.ac.ed.ph.jqtiplus.node.expression.general.Correct)18 ResponseCondition (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseCondition)18 IsNull (uk.ac.ed.ph.jqtiplus.node.expression.operator.IsNull)16 MapResponse (uk.ac.ed.ph.jqtiplus.node.expression.general.MapResponse)14 And (uk.ac.ed.ph.jqtiplus.node.expression.operator.And)14 ComplexReferenceIdentifier (uk.ac.ed.ph.jqtiplus.types.ComplexReferenceIdentifier)14 FloatValue (uk.ac.ed.ph.jqtiplus.value.FloatValue)12 ResponseElseIf (uk.ac.ed.ph.jqtiplus.node.item.response.processing.ResponseElseIf)10 Expression (uk.ac.ed.ph.jqtiplus.node.expression.Expression)8 Multiple (uk.ac.ed.ph.jqtiplus.node.expression.operator.Multiple)8 SingleValue (uk.ac.ed.ph.jqtiplus.value.SingleValue)8 Equal (uk.ac.ed.ph.jqtiplus.node.expression.operator.Equal)6