コード例 #1
0
        private void FillPresentData()
        {
            for (int idx = 0; idx < existList.Count; idx++)
            {
                existPresentation.Add(new PresentData(existList.GetAttribute(idx), idx));
            }

            for (int idx = 0; idx < newList.Count; idx++)
            {
                newPresentation.Add(new PresentData(newList.GetAttribute(idx), -1, idx));
            }
        }
コード例 #2
0
        /**********************************************************************************************//**
        * Evaluates.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \param   evaluationMode  The evaluation mode.
        * \param   network         The network.
        * \param   process         The process.
        * \param   channel         The channel.
        * \param   message         The message.
        *
        * \return  true if it succeeds, false if it fails.
        *  .
        **************************************************************************************************/

        public bool Evaluate(EvaluationMode evaluationMode, BaseNetwork network, BaseProcess process, BaseChannel channel, BaseMessage message)
        {
            string resultString;
            bool   result;

            if (or[brp.ork.Enable] == false)
            {
                resultString = "False : The breakpoint is enabeled";
                result       = false;
            }
            else
            {
                try
                {
                    //Duplicate the list of parameters because it can change for the evaluation (in AdjustForOtherElementsBreakpoints)
                    //and the original list have to stay as the original
                    AttributeList parametersList = new AttributeList(or[brp.ork.Parameters]);
                    AdjustForOtherElementsBreakpoints(parametersList, network);
                    AttributeList parameters = new AttributeList();

                    for (int idx = 0; idx < parametersList.Count; idx++)
                    {
                        parameters.Add(EvaluateParameter(evaluationMode, network, process, channel, message, parametersList.GetAttribute(idx)));
                    }
                    if (parameters.Count == 0)
                    {
                        resultString = "False : There are no parameters";
                        result       = false;
                    }
                    else
                    {
                        if (parameters.Count == 1)
                        {
                            //If unary value the operator will work on the first
                            //argument only the first argument is duplicatted
                            //for comaptibillity
                            parameters.Add(parameters.GetAttribute(0));
                        }

                        result       = Evaluate(parameters);
                        resultString = result.ToString();
                    }
                }
                catch (EvaluationException exception)
                {
                    resultString = "False : " + exception.Message;
                    result       = false;
                }
            }
            int processId = process.ea[ne.eak.Id];

            CreateResultsLists(network.Processes);
            if (evaluationMode == EvaluationMode.Running)
            {
                or[brp.ork.LastRunningResult][processId] = resultString;
            }
            else if (evaluationMode == EvaluationMode.Checking)
            {
                or[brp.ork.LastCheckResult][processId] = resultString;
            }
            return(result);
        }