コード例 #1
0
        /**********************************************************************************************//**
        * Adjust for other elements breakpoints.
        *
        * \author  Ilan Hindy
        * \date    29/09/2016
        *
        * \param   parametersList  List of parameters.
        * \param   network         The network.
        *
        **************************************************************************************************/

        private void AdjustForOtherElementsBreakpoints(AttributeList parametersList, BaseNetwork network)
        {
            // If the breakpoint is on other elements it has 4 parameters
            // 1. List of processors
            // 2. List of channels
            // 3. message handling mode
            // 4. breakpoint
            // The first 2 elements stayes and the other parameters are stored in member variables
            // Save the network in member
            // If the list of the channels is empty add -1 to the list - this will cause the evaluation method
            //    to evaluate with channel = null.
            // The -1 is inserted in a new list in order not effect the original list

            Operators o = or[brp.ork.Operator];

            if (o == Operators.OperationsOnOtherElements)
            {
                breakpointForOtherElements = ((Attribute)parametersList[3]).Value;
                messageHandlingForOtherElementOperation = ((Attribute)parametersList[2]).Value;
                networkForOtherElementOperation         = network;
                parametersList.RemoveAt(3);
                parametersList.RemoveAt(2);
                if (((Attribute)parametersList[1]).Value.Count == 0)
                {
                    parametersList[1] = new Attribute()
                    {
                        Value = new List <int>()
                        {
                            -1
                        }
                    };
                }
            }
        }
コード例 #2
0
        //
        // Helper method that walks through an attribute list and expands all callbacks
        // within it.
        //
        private void ExpandAttributes(Type type, AttributeList attributes)
        {
            Fx.Assert(!attributes.IsExpanded, "Should not call expand attributes with an expanded list.");

            // First, expand all the callbacks.  This may add more attributes
            // into our list
            //
            for (int idx = 0; idx < attributes.Count; idx++)
            {
                AttributeCallback callback = attributes[idx] as AttributeCallback;
                while (callback != null)
                {
                    attributes.RemoveAt(idx);
                    AttributeCallbackBuilder builder = new AttributeCallbackBuilder(this, type);
                    callback(builder);

                    if (idx < attributes.Count)
                    {
                        callback = attributes[idx] as AttributeCallback;
                    }
                    else
                    {
                        callback = null;
                    }
                }
            }
        }