Package org.olat.ims.qti.process.elements

Examples of org.olat.ims.qti.process.elements.ScoreBooleanEvaluable


    int size = elems.size();
    boolean ev = false;
    for (int i = 0; i < size; i++) {
      Element child = (Element)elems.get(i);
      String name = child.getName();
      ScoreBooleanEvaluable bev = QTIHelper.getSectionBooleanEvaluableInstance(name);
      boolean res = bev.eval(child, score);
      ev = ev || res;
      if (ev) return true;
    }
    return false;
  }
View Full Code Here


        // must exist: dtd
        //<!ELEMENT test_variable (variable_test | and_test | or_test |
        // not_test)>
        Element el_varandornot = (Element) el_testvar.selectSingleNode("variable_test|and_test|or_test|not_test");
        String elname = el_varandornot.getName();
        ScoreBooleanEvaluable sbe = QTIHelper.getSectionBooleanEvaluableInstance(elname);
        float totalscore = getScore();
        boolean fulfilled = sbe.eval(el_varandornot, totalscore);
        if (fulfilled) {
          // get feedback
          Element el_displayfeedback = (Element) el_oft.selectSingleNode("displayfeedback");
          String linkRefId = el_displayfeedback.attributeValue("linkrefid");
          // must exist (dtd)
View Full Code Here

    int size = elems.size();
    boolean ev = true;
    for (int i = 0; i < size; i++) {
      Element child = (Element)elems.get(i);
      String name = child.getName();
      ScoreBooleanEvaluable bev = QTIHelper.getSectionBooleanEvaluableInstance(name);
      boolean res = bev.eval(child, score);
      ev = ev && res;
      if (!ev) return false;
    }
    return true;
  }
View Full Code Here

   */
  public boolean eval(Element boolElement, float score) {
    // since the dom is validated against the dtd, we know the not element has exactly one child element.
    Element child = (Element) boolElement.elements().get(0);
    String name = child.getName();
    ScoreBooleanEvaluable bev = QTIHelper.getSectionBooleanEvaluableInstance(name);
    boolean res = !bev.eval(child, score);
    return res;
  }
View Full Code Here

      // must exist: dtd
      //<!ELEMENT test_variable (variable_test | and_test | or_test |
      // not_test)>
      Element el_varandornot = (Element) el_testvar.selectSingleNode("variable_test|and_test|or_test|not_test");
      String elname = el_varandornot.getName();
      ScoreBooleanEvaluable sbe = QTIHelper.getSectionBooleanEvaluableInstance(elname);
      float totalscore = getScore();
      boolean fulfilled = sbe.eval(el_varandornot, totalscore);
      if (fulfilled) {
        // get feedback
        Element el_displayfeedback = (Element) el_oft.selectSingleNode("displayfeedback");
        String linkRefId = el_displayfeedback.attributeValue("linkrefid");
        // must exist (dtd)
View Full Code Here

  /**
   * @param name
   * @return
   */
  public static ScoreBooleanEvaluable getSectionBooleanEvaluableInstance(String name) {
    ScoreBooleanEvaluable sbev = (ScoreBooleanEvaluable) scoreBooleanEvals.get(name);
    if (sbev == null) throw new RuntimeException("no section bev for " + name);
    return sbev;
  }
View Full Code Here

TOP

Related Classes of org.olat.ims.qti.process.elements.ScoreBooleanEvaluable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.