/*
     * @Override
     * public Object clone() throws CloneNotSupportedException
     * {
     *
     *  TimedAssessmentRule tar = (TimedAssessmentRule) super.clone( );
     *  tar.effectIndex = effectIndex;
     *  if( effects != null ) {
     *      tar.effects = new List<TimedAssessmentEffect>();
     *      for (TimedAssessmentEffect tae : effects)
     *          tar.effects.add((TimedAssessmentEffect)tae.clone());
     *  }
     *  tar.startTime = startTime;
     *  tar.elapsedTime = elapsedTime;
     *  tar.endConditions = ( endConditions != null ? (Conditions) endConditions.clone( ) : null );
     *  tar.isDone = isDone;
     *  tar.usesEndConditions = usesEndConditions;
     *  return tar;
     * }*/

    public override object Clone()
    {
        TimedAssessmentRule tar = (TimedAssessmentRule)base.Clone();

        tar.effectIndex = effectIndex;
        if (effects != null)
        {
            tar.effects = new List <TimedAssessmentEffect>();
            foreach (TimedAssessmentEffect tae in effects)
            {
                tar.effects.Add((TimedAssessmentEffect)tae.Clone());
            }
        }
        tar.startTime         = startTime;
        tar.elapsedTime       = elapsedTime;
        tar.endConditions     = (endConditions != null ? (Conditions)endConditions.Clone() : null);
        tar.isDone            = isDone;
        tar.usesEndConditions = usesEndConditions;
        return(tar);
    }
    /*
     *  (non-Javadoc)
     * @see org.xml.sax.ContentHandler#startElement(java.lang.string, java.lang.string, java.lang.string, org.xml.sax.Attributes)
     */
    public override void startElement(string namespaceURI, string sName, string qName, Dictionary <string, string> attrs)
    {
        if (qName.Equals("assessment-rules"))
        {
            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("show-report-at-end"))
                {
                    profile.setShowReportAtEnd(entry.Value.ToString().Equals("yes"));
                }
                if (entry.Key.Equals("send-to-email"))
                {
                    if (entry.Value.ToString() == null || entry.Value.ToString().ToString().Length < 1)
                    {
                        profile.setEmail("");
                        profile.setSendByEmail(false);
                    }
                    else
                    {
                        profile.setEmail(entry.Value.ToString());
                        profile.setSendByEmail(true);
                    }
                }
                if (entry.Key.Equals("scorm12"))
                {
                    profile.setScorm12(entry.Value.ToString().Equals("yes"));
                }
                if (entry.Key.Equals("scorm2004"))
                {
                    profile.setScorm2004(entry.Value.ToString().Equals("yes"));
                }
            }
        }
        else if (qName.Equals("smtp-config"))
        {
            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("smtp-ssl"))
                {
                    profile.setSmtpSSL(entry.Value.ToString().Equals("yes"));
                }
                if (entry.Key.Equals("smtp-server"))
                {
                    profile.setSmtpServer(entry.Value.ToString());
                }
                if (entry.Key.Equals("smtp-port"))
                {
                    profile.setSmtpPort(entry.Value.ToString());
                }
                if (entry.Key.Equals("smtp-user"))
                {
                    profile.setSmtpUser(entry.Value.ToString());
                }
                if (entry.Key.Equals("smtp-pwd"))
                {
                    profile.setSmtpPwd(entry.Value.ToString());
                }
            }
        }

        else if (qName.Equals("assessment-rule"))
        {
            string id         = null;
            int    importance = 0;
            bool   repeatRule = false;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("id"))
                {
                    id = entry.Value.ToString();
                }
                if (entry.Key.Equals("importance"))
                {
                    for (int j = 0; j < AssessmentRule.N_IMPORTANCE_VALUES; j++)
                    {
                        if (entry.Value.ToString().Equals(AssessmentRule.IMPORTANCE_VALUES[j]))
                        {
                            importance = j;
                        }
                    }
                }
                if (entry.Key.Equals("repeatRule"))
                {
                    repeatRule = entry.Value.ToString().Equals("yes");
                }
            }

            currentAssessmentRule = new AssessmentRule(id, importance, repeatRule);
        }

        else if (qName.Equals("timed-assessment-rule"))
        {
            string id                = null;
            int    importance        = 0;
            bool   usesEndConditions = false;
            bool   has               = false;
            bool   repeatRule        = false;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("id"))
                {
                    id = entry.Value.ToString();
                }
                if (entry.Key.Equals("importance"))
                {
                    for (int j = 0; j < AssessmentRule.N_IMPORTANCE_VALUES; j++)
                    {
                        if (entry.Value.ToString().Equals(AssessmentRule.IMPORTANCE_VALUES[j]))
                        {
                            importance = j;
                        }
                    }
                }
                if (entry.Key.Equals("usesEndConditions"))
                {
                    has = true;
                    usesEndConditions = entry.Value.ToString().Equals("yes");
                }
                if (entry.Key.Equals("repeatRule"))
                {
                    repeatRule = entry.Value.ToString().Equals("yes");
                }
            }

            currentAssessmentRule = new TimedAssessmentRule(id, importance, repeatRule);
            if (has)
            {
                ((TimedAssessmentRule)currentAssessmentRule).setUsesEndConditions(usesEndConditions);
            }
        }

        else if (qName.Equals("condition") || qName.Equals("init-condition") || qName.Equals("end-condition"))
        {
            currentConditions = new Conditions();
        }

        // If it is an either tag, create a new either conditions and switch the state
        else if (qName.Equals("either"))
        {
            currentEitherCondition = new Conditions();
            reading = READING_EITHER;
        }

        // If it is an active tag
        else if (qName.Equals("active"))
        {
            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("flag"))
                {
                    // Store the active flag in the conditions or either conditions
                    if (reading == READING_NONE)
                    {
                        currentConditions.add(new FlagCondition(entry.Value.ToString()));
                    }
                    if (reading == READING_EITHER)
                    {
                        currentEitherCondition.add(new FlagCondition(entry.Value.ToString()));
                    }
                    addFlag(entry.Value.ToString());
                }
            }
        }

        // If it is an inactive tag
        else if (qName.Equals("inactive"))
        {
            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("flag"))
                {
                    // Store the inactive flag in the conditions or either conditions
                    if (reading == READING_NONE)
                    {
                        currentConditions.add(new FlagCondition(entry.Value.ToString(), FlagCondition.FLAG_INACTIVE));
                    }
                    if (reading == READING_EITHER)
                    {
                        currentEitherCondition.add(new FlagCondition(entry.Value.ToString(), FlagCondition.FLAG_INACTIVE));
                    }
                    addFlag(entry.Value.ToString());
                }
            }
        }

        // If it is a greater-than tag
        else if (qName.Equals("greater-than"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_GREATER_THAN, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_THAN, value));
            }
            addVar(var);
        }

        // If it is a greater-equals-than tag
        else if (qName.Equals("greater-equals-than"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_GREATER_EQUALS_THAN, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_GREATER_EQUALS_THAN, value));
            }
            addVar(var);
        }

        // If it is a less-than tag
        else if (qName.Equals("less-than"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_LESS_THAN, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_LESS_THAN, value));
            }
            addVar(var);
        }

        // If it is a less-equals-than tag
        else if (qName.Equals("less-equals-than"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_LESS_EQUALS_THAN, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_LESS_EQUALS_THAN, value));
            }
            addVar(var);
        }

        // If it is a equals-than tag
        else if (qName.Equals("equals"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_EQUALS, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_EQUALS, value));
            }
            addVar(var);
        }

        // If it is a not-equals-than tag
        else if (qName.Equals("not-equals"))
        {
            // The var
            string var = null;
            // The value
            int value = 0;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("var"))
                {
                    var = entry.Value.ToString();
                }
                else if (entry.Key.Equals("value"))
                {
                    value = int.Parse(entry.Value.ToString());
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new VarCondition(var, VarCondition.VAR_NOT_EQUALS, value));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new VarCondition(var, VarCondition.VAR_NOT_EQUALS, value));
            }
            addVar(var);
        }


        // If it is a global-state-reference tag
        else if (qName.Equals("global-state-ref"))
        {
            // Id
            string id = null;
            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("id"))
                {
                    id = entry.Value.ToString();
                }
            }
            // Store the inactive flag in the conditions or either conditions
            if (reading == READING_NONE)
            {
                currentConditions.add(new GlobalStateCondition(id));
            }
            if (reading == READING_EITHER)
            {
                currentEitherCondition.add(new GlobalStateCondition(id));
            }
        }

        else if (qName.Equals("set-property"))
        {
            string id    = null;
            string value = null;

            foreach (KeyValuePair <string, string> entry in attrs)
            {
                if (entry.Key.Equals("id"))
                {
                    id = entry.Value.ToString();
                }
                if (entry.Key.Equals("value"))
                {
                    value = entry.Value.ToString();
                }
            }

            currentAssessmentRule.addProperty(new AssessmentProperty(id, value));
        }

        else if (qName.Equals("effect"))
        {
            if (currentAssessmentRule is TimedAssessmentRule)
            {
                int timeMin = int.MinValue;
                int timeMax = int.MinValue;
                foreach (KeyValuePair <string, string> entry in attrs)
                {
                    if (entry.Key.Equals("time-min"))
                    {
                        timeMin = int.Parse(entry.Value.ToString());
                    }
                    if (entry.Key.Equals("time-max"))
                    {
                        timeMax = int.Parse(entry.Value.ToString());
                    }
                }

                TimedAssessmentRule tRule = (TimedAssessmentRule)currentAssessmentRule;
                if (timeMin != int.MinValue && timeMax != int.MaxValue)
                {
                    tRule.addEffect(timeMin, timeMax);
                }
                else
                {
                    tRule.addEffect();
                }
            }
        }
    }
        /**
         * Returns the DOM element for the chapter
         *
         * @param chapter
         *            Chapter data to be written
         * @return DOM element with the chapter data
         */

        public static XmlElement buildDOM(AssessmentProfile profile, XmlDocument doc)
        {
            List <AssessmentRule> rules = profile.getRules();

            XmlElement assessmentNode = null;

            // Create the root node
            assessmentNode = doc.CreateElement("assessment");
            if (profile.isShowReportAtEnd())
            {
                assessmentNode.SetAttribute("show-report-at-end", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("show-report-at-end", "no");
            }
            if (!profile.isShowReportAtEnd() || !profile.isSendByEmail())
            {
                assessmentNode.SetAttribute("send-to-email", "");
            }
            else
            {
                if (profile.getEmail() == null || !profile.getEmail().Contains("@"))
                {
                    assessmentNode.SetAttribute("send-to-email", "");
                }
                else
                {
                    assessmentNode.SetAttribute("send-to-email", profile.getEmail());
                }
            }
            // add scorm attributes
            if (profile.isScorm12())
            {
                assessmentNode.SetAttribute("scorm12", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("scorm12", "no");
            }
            if (profile.isScorm2004())
            {
                assessmentNode.SetAttribute("scorm2004", "yes");
            }
            else
            {
                assessmentNode.SetAttribute("scorm2004", "no");
            }
            //add the profile's name
            assessmentNode.SetAttribute("name", profile.getName());

            XmlElement smtpConfigNode = doc.CreateElement("smtp-config");

            smtpConfigNode.SetAttribute("smtp-ssl", (profile.isSmtpSSL() ? "yes" : "no"));
            smtpConfigNode.SetAttribute("smtp-server", profile.getSmtpServer());
            smtpConfigNode.SetAttribute("smtp-port", profile.getSmtpPort());
            smtpConfigNode.SetAttribute("smtp-user", profile.getSmtpUser());
            smtpConfigNode.SetAttribute("smtp-pwd", profile.getSmtpPwd());

            assessmentNode.AppendChild(smtpConfigNode);

            // Append the assessment rules
            foreach (AssessmentRule rule in rules)
            {
                if (rule is TimedAssessmentRule)
                {
                    TimedAssessmentRule tRule = (TimedAssessmentRule)rule;
                    //Create the rule node and set attributes
                    XmlElement ruleNode = doc.CreateElement("timed-assessment-rule");
                    ruleNode.SetAttribute("id", tRule.getId());
                    ruleNode.SetAttribute("importance", AssessmentRule.IMPORTANCE_VALUES[tRule.getImportance()]);
                    ruleNode.SetAttribute("usesEndConditions", (tRule.isUsesEndConditions() ? "yes" : "no"));
                    ruleNode.SetAttribute("repeatRule", (tRule.isRepeatRule() ? "yes" : "no"));

                    //Append concept
                    if (tRule.getConcept() != null && !tRule.getConcept().Equals(""))
                    {
                        XmlNode conceptNode = doc.CreateElement("concept");
                        conceptNode.AppendChild(doc.CreateTextNode(tRule.getConcept()));
                        ruleNode.AppendChild(conceptNode);
                    }

                    //Append conditions (always required at least one)
                    if (!tRule.getInitConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, tRule.getInitConditions(), DOMWriterUtility.Name(ConditionsDOMWriter.INIT_CONDITIONS));
                    }

                    //Append conditions (always required at least one)
                    if (!tRule.getEndConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, tRule.getEndConditions(), DOMWriterUtility.Name(ConditionsDOMWriter.END_CONDITIONS));
                    }

                    // Create effects
                    for (int i = 0; i < tRule.getEffectsCount(); i++)
                    {
                        //Create effect element and append it
                        XmlElement effectNode = doc.CreateElement("assessEffect");

                        // Append time attributes
                        effectNode.SetAttribute("time-min", tRule.getMinTime(i).ToString());
                        effectNode.SetAttribute("time-max", tRule.getMaxTime(i).ToString());

                        //Append set-text when appropriate
                        TimedAssessmentEffect currentEffect = tRule.getEffects()[i];
                        if (currentEffect.getText() != null && !currentEffect.getText().Equals(""))
                        {
                            XmlNode textNode = doc.CreateElement("set-text");
                            textNode.AppendChild(doc.CreateTextNode(currentEffect.getText()));
                            effectNode.AppendChild(textNode);
                        }
                        //Append properties
                        foreach (AssessmentProperty property in currentEffect.getAssessmentProperties())
                        {
                            XmlElement propertyElement = doc.CreateElement("set-property");
                            propertyElement.SetAttribute("id", property.getId());
                            propertyElement.SetAttribute("value", property.getValue().ToString());
                            effectNode.AppendChild(propertyElement);
                        }
                        //Append the effect
                        ruleNode.AppendChild(effectNode);
                    }

                    //Append the rule
                    assessmentNode.AppendChild(ruleNode);
                }
                else
                {
                    //Create the rule node and set attributes
                    XmlElement ruleNode = doc.CreateElement("assessment-rule");
                    ruleNode.SetAttribute("id", rule.getId());
                    ruleNode.SetAttribute("importance", AssessmentRule.IMPORTANCE_VALUES[rule.getImportance()]);
                    ruleNode.SetAttribute("repeatRule", (rule.isRepeatRule() ? "yes" : "no"));

                    //Append concept
                    if (rule.getConcept() != null && !rule.getConcept().Equals(""))
                    {
                        XmlNode conceptNode = doc.CreateElement("concept");
                        conceptNode.AppendChild(doc.CreateTextNode(rule.getConcept()));
                        ruleNode.AppendChild(conceptNode);
                    }

                    //Append conditions (always required at least one)
                    if (!rule.getConditions().isEmpty())
                    {
                        DOMWriterUtility.DOMWrite(ruleNode, rule.getConditions());
                    }

                    //Create effect element and append it
                    XmlNode effectNode = doc.CreateElement("assessEffect");
                    //Append set-text when appropriate
                    if (rule.getText() != null && !rule.getText().Equals(""))
                    {
                        XmlNode textNode = doc.CreateElement("set-text");
                        textNode.AppendChild(doc.CreateTextNode(rule.getText()));
                        effectNode.AppendChild(textNode);
                    }
                    //Append properties
                    foreach (AssessmentProperty property in rule.getAssessmentProperties())
                    {
                        XmlElement propertyElement = doc.CreateElement("set-property");
                        propertyElement.SetAttribute("id", property.getId());
                        propertyElement.SetAttribute("value", property.getValue());
                        if (property.getVarName() != null)
                        {
                            propertyElement.SetAttribute("varName", property.getVarName());
                        }
                        effectNode.AppendChild(propertyElement);
                    }
                    //Append the effect
                    ruleNode.AppendChild(effectNode);

                    //Append the rule
                    assessmentNode.AppendChild(ruleNode);
                }
            }

            return(assessmentNode);
        }
Ejemplo n.º 4
0
    public override void ParseElement(XmlElement element)
    {
        XmlNodeList
            smtpsconfigs         = element.SelectNodes("smtp-config"),
            assessmentsrule      = element.SelectNodes("assessment-rule"),
            timedsssessmentsrule = element.SelectNodes("timed-assessment-rule"),
            conditions,
            initsconditions,
            endsconditions,
            setpropertys,
            assessEffects;

        string tmpArgVal;

        tmpArgVal = element.GetAttribute("show-report-at-end");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setShowReportAtEnd(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("send-to-email");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal == null || tmpArgVal.Length < 1)
            {
                profile.setEmail("");
                profile.setSendByEmail(false);
            }
            else
            {
                profile.setEmail(tmpArgVal);
                profile.setSendByEmail(true);
            }
        }

        tmpArgVal = element.GetAttribute("scorm12");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setScorm12(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("scorm2004");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setScorm2004(tmpArgVal.Equals("yes"));
        }

        tmpArgVal = element.GetAttribute("name");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            profile.setName(tmpArgVal);
        }

        foreach (XmlElement ell in smtpsconfigs)
        {
            tmpArgVal = element.GetAttribute("smtp-ssl");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpSSL(tmpArgVal.Equals("yes"));
            }
            tmpArgVal = element.GetAttribute("smtp-server");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpServer(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-port");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpPort(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-user");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpUser(tmpArgVal);
            }
            tmpArgVal = element.GetAttribute("smtp-pwd");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                profile.setSmtpPwd(tmpArgVal);
            }
        }

        foreach (XmlElement ell in assessmentsrule)
        {
            string id         = null;
            int    importance = 0;
            bool   repeatRule = false;

            tmpArgVal = element.GetAttribute("id");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                id = tmpArgVal;
            }
            tmpArgVal = element.GetAttribute("importance");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                for (int j = 0; j < AssessmentRule.N_IMPORTANCE_VALUES; j++)
                {
                    if (tmpArgVal.Equals(AssessmentRule.IMPORTANCE_VALUES[j]))
                    {
                        importance = j;
                    }
                }
            }
            tmpArgVal = element.GetAttribute("repeatRule");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                repeatRule = tmpArgVal.Equals("yes");
            }

            currentAssessmentRule = new AssessmentRule(id, importance, repeatRule);

            conditions = element.SelectNodes("condition");
            foreach (XmlElement ell_ in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                currentAssessmentRule.setConditions(currentConditions);
            }

            initsconditions = element.SelectNodes("init-condition");
            foreach (XmlElement ell_ in initsconditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                ((TimedAssessmentRule)currentAssessmentRule).setInitConditions(currentConditions);
            }

            endsconditions = element.SelectNodes("end-condition");
            foreach (XmlElement ell_ in endsconditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                ((TimedAssessmentRule)currentAssessmentRule).setEndConditions(currentConditions);
            }

            if (ell.SelectSingleNode("concept") != null)
            {
                currentAssessmentRule.setConcept(ell.SelectSingleNode("concept").InnerText.ToString().Trim());
            }
            if (ell.SelectSingleNode("set-text") != null)
            {
                currentAssessmentRule.setText(ell.SelectSingleNode("set-text").InnerText.ToString().Trim());
            }

            assessEffects = element.SelectNodes("assessEffect");
            foreach (XmlElement ell_ in assessEffects)
            {
                int timeMin = int.MinValue;
                int timeMax = int.MinValue;
                tmpArgVal = element.GetAttribute("time-min");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    timeMin = int.Parse(tmpArgVal);
                }
                tmpArgVal = element.GetAttribute("time-max");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    timeMax = int.Parse(tmpArgVal);
                }

                TimedAssessmentRule tRule = (TimedAssessmentRule)currentAssessmentRule;
                if (timeMin != int.MinValue && timeMax != int.MaxValue)
                {
                    tRule.addEffect(timeMin, timeMax);
                }
                else
                {
                    tRule.addEffect();
                }
            }

            profile.addRule(currentAssessmentRule);
        }

        foreach (XmlElement ell in timedsssessmentsrule)
        {
            string id                = null;
            int    importance        = 0;
            bool   usesEndConditions = false;
            bool   has               = false;
            bool   repeatRule        = false;

            tmpArgVal = element.GetAttribute("id");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                id = tmpArgVal;
            }
            tmpArgVal = element.GetAttribute("importance");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                for (int j = 0; j < AssessmentRule.N_IMPORTANCE_VALUES; j++)
                {
                    if (tmpArgVal.Equals(AssessmentRule.IMPORTANCE_VALUES[j]))
                    {
                        importance = j;
                    }
                }
            }
            tmpArgVal = element.GetAttribute("usesEndConditions");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                has = true;
                usesEndConditions = tmpArgVal.Equals("yes");
            }
            tmpArgVal = element.GetAttribute("repeatRule");
            if (!string.IsNullOrEmpty(tmpArgVal))
            {
                has        = true;
                repeatRule = tmpArgVal.Equals("yes");
            }
            currentAssessmentRule = new TimedAssessmentRule(id, importance, repeatRule);
            if (has)
            {
                ((TimedAssessmentRule)currentAssessmentRule).setUsesEndConditions(usesEndConditions);
            }

            conditions = element.SelectNodes("condition");
            foreach (XmlElement ell_ in conditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                currentAssessmentRule.setConditions(currentConditions);
            }

            initsconditions = element.SelectNodes("init-condition");
            foreach (XmlElement ell_ in initsconditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                ((TimedAssessmentRule)currentAssessmentRule).setInitConditions(currentConditions);
            }

            endsconditions = element.SelectNodes("end-condition");
            foreach (XmlElement ell_ in endsconditions)
            {
                currentConditions = new Conditions();
                new ConditionSubParser_(currentConditions, chapter).ParseElement(ell_);
                ((TimedAssessmentRule)currentAssessmentRule).setEndConditions(currentConditions);
            }

            if (ell.SelectSingleNode("concept") != null)
            {
                currentAssessmentRule.setConcept(ell.SelectSingleNode("concept").InnerText.ToString().Trim());
            }
            if (ell.SelectSingleNode("set-text") != null)
            {
                currentAssessmentRule.setText(ell.SelectSingleNode("set-text").InnerText.ToString().Trim());
            }

            assessEffects = element.SelectNodes("assessEffect");
            foreach (XmlElement ell_ in assessEffects)
            {
                int timeMin = int.MinValue;
                int timeMax = int.MinValue;
                tmpArgVal = element.GetAttribute("time-min");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    timeMin = int.Parse(tmpArgVal);
                }
                tmpArgVal = element.GetAttribute("time-max");
                if (!string.IsNullOrEmpty(tmpArgVal))
                {
                    timeMax = int.Parse(tmpArgVal);
                }

                TimedAssessmentRule tRule = (TimedAssessmentRule)currentAssessmentRule;
                if (timeMin != int.MinValue && timeMax != int.MaxValue)
                {
                    tRule.addEffect(timeMin, timeMax);
                }
                else
                {
                    tRule.addEffect();
                }
            }

            profile.addRule(currentAssessmentRule);
        }

        chapter.addAssessmentProfile(profile);
    }