示例#1
0
        internal void Update(AssertionBase assertion)
        {
            // 2015-11-21-thu-update latex
            AssertType assertType = AssertType.NONE;
            string     non = "deadlockfree", channel = "_";
            string     assertion_text = assertion.ToString();

            if (assertion_text.Contains(non))
            {
                assertType = AssertType.DEADLOCK_FREE;
            }
            else if (assertion_text.Contains(channel))
            {
                assertType = AssertType.CONGESTION_CHANNEL;
            }
            else
            {
                assertType = AssertType.CONGESTION_SENSOR;
            }

            string result      = assertion.getResult();
            string resultlatex = "";

            // Get result of assersion
            do
            {
                if (assertType.Equals(AssertType.DEADLOCK_FREE))
                {
                    if (result.Equals("VALID"))
                    {
                        resultlatex = "\\vl";
                    }
                    else if (result.Equals("INVALID"))
                    {
                        resultlatex = "\\nv";
                    }
                    else
                    {
                        resultlatex = "\\unk";
                    }
                    break;
                }

                if (result.Equals("VALID"))
                {
                    resultlatex = "\\nv";
                }
                else if (result.Equals("INVALID"))
                {
                    resultlatex = "\\vl";
                }
                else
                {
                    resultlatex = "\\unk";
                }
            } while (false);

            // Mapping record to variable
            do
            {
                int posType = -1;
                if (assertType.Equals(AssertType.DEADLOCK_FREE))
                {
                    posType = 0;
                }
                else if (assertType.Equals(AssertType.CONGESTION_CHANNEL))
                {
                    posType = 1;
                }
                else if (assertType.Equals(AssertType.CONGESTION_SENSOR))
                {
                    posType = 2;
                }

                if (posType < 0)
                {
                    break;
                }

                mParseRes[posType].mTime       = assertion.getTimes();
                mParseRes[posType].mMemo       = (float)assertion.getMems();
                mParseRes[posType].mTransition = assertion.getTransitions();
                mParseRes[posType].mState      = assertion.getStates();
                mParseRes[posType].mClicked    = true;
                mParseRes[posType].mRes        = resultlatex;
            } while (false);
        }