コード例 #1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn public void RecordOrderChange(List<int> permutations, int sourceProcess)
        ///
        /// \brief Record order change.
        ///
        /// \par Description.
        ///
        /// \par Algorithm.
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 27/05/2018
        ///
        /// \param permutations   (List&lt;int&gt;) - The permutations.
        /// \param sourceProcess  (int) - Source process.
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void RecordOrderChange(List <int> permutations, int sourceProcess)
        {
            // Extract messages of the channel from the messageQ
            MessageQ      messageQ = Element.or[bp.ork.MessageQ];
            AttributeList channelMessages;

            messageQ.ExstractChannelMessages(sourceProcess, out channelMessages);
            AttributeDictionary changeRecord = new AttributeDictionary();

            changeRecord.Add(Comps.SourceProcess, new Attribute {
                Value = sourceProcess, Editable = false
            });
            changeRecord.Add(Comps.MessageQ, new Attribute {
                Value = channelMessages, Editable = false
            });
            changeRecord.Add(Comps.Permutations, new Attribute {
                Value = permutations.ToAttributeList(), Editable = false
            });
            Add(new Attribute {
                Value = changeRecord, Editable = false
            });
        }
コード例 #2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// \fn public void CheckAndChange()
        ///
        /// \brief Check and change.
        ///
        /// \par Description.
        ///      -  For each entry in the list:
        ///         -#  Extract the methods from the MessageQ of the sourceProcess (attribute in the entry)
        ///         -#  Compare this list with the list in the entry
        ///         -#  if they are identical
        ///             -#  Ask the user if to perform the change
        ///         -#  If the answer is yes perform the order change using a method of the MessageQ class
        ///
        /// \par Algorithm.
        ///
        ///
        /// \par Usage Notes.
        ///
        /// \author Ilanh
        /// \date 14/05/2018
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void CheckAndChange()
        {
            MessageQ messageQ = Element.or[bp.ork.MessageQ];

            if (Count > 0)
            {
                for (int idx = 0; idx < Count; idx++)
                {
                    AttributeList channelMessages;
                    int           sourceProcess = this[idx][Comps.SourceProcess];
                    List <int>    messageIdxs   = messageQ.ExstractChannelMessages(sourceProcess, out channelMessages);
                    if (channelMessages.CheckEqual(0, "", (AttributeList)this[idx][Comps.MessageQ]))
                    {
                        List <int> permutations = this[idx][Comps.Permutations].AsList();
                        if (PerformQuestion(this[idx], messageIdxs))
                        {
                            messageQ.ChangeOrder(permutations, sourceProcess);
                        }
                    }
                }
            }
        }