Пример #1
0
 static ServiceController CreateServiceController(StateVariable stateVariable1, StateVariable stateVariable2)
 {
     return(new ServiceController(
                new[] {
         new ServiceAction(
             "Foo",
             new[] {
             new Argument("bar", "X_ARG_bar", ArgumentDirection.In),
             new Argument("result", "X_ARG_result", ArgumentDirection.Out)
         },
             arguments => {
             var out_arguments = new Dictionary <string, string> (1);
             out_arguments["result"] = string.Format("You said {0}", arguments["bar"]);
             return out_arguments;
         }
             )
     },
                new[] {
         new StateVariable("X_ARG_bar", "string"),
         new StateVariable("X_ARG_result", "string"),
         stateVariable1,
         stateVariable2
     }
                ));
 }
Пример #2
0
 public static void AssertEquality(StateVariable sourceStateVariable, StateVariable targetStateVariable)
 {
     Assert.AreEqual(sourceStateVariable.Name, targetStateVariable.Name);
     Assert.AreEqual(sourceStateVariable.DataType, targetStateVariable.DataType);
     Assert.AreEqual(sourceStateVariable.SendsEvents, targetStateVariable.SendsEvents);
     Assert.AreEqual(sourceStateVariable.IsMulticast, targetStateVariable.IsMulticast);
     Assert.AreEqual(sourceStateVariable.DefaultValue, targetStateVariable.DefaultValue);
     if (sourceStateVariable.AllowedValues != null)
     {
         var source_values = sourceStateVariable.AllowedValues.GetEnumerator();
         var target_values = targetStateVariable.AllowedValues.GetEnumerator();
         while (source_values.MoveNext())
         {
             Assert.IsTrue(target_values.MoveNext());
             Assert.AreEqual(source_values.Current, target_values.Current);
         }
         Assert.IsFalse(target_values.MoveNext());
     }
     if (sourceStateVariable.AllowedValueRange != null)
     {
         Assert.AreEqual(sourceStateVariable.AllowedValueRange.Minimum, targetStateVariable.AllowedValueRange.Minimum);
         Assert.AreEqual(sourceStateVariable.AllowedValueRange.Maximum, targetStateVariable.AllowedValueRange.Maximum);
         Assert.AreEqual(sourceStateVariable.AllowedValueRange.Step, targetStateVariable.AllowedValueRange.Step);
     }
 }
Пример #3
0
 public void QueueUpdate(StateVariable stateVariable)
 {
     lock (this) {
         if (!updated_state_variables.Contains(stateVariable))
         {
             updated_state_variables.Add(stateVariable);
             Monitor.Pulse(this);
         }
     }
 }
Пример #4
0
        public override object ParseFromStorage(StorageManager storageManager, StorageLocation storageLocation, IJsonRpcClient rpcClient = null)
        {
            // Create our result array
            var results = new List <MappingKeyValuePair>();

            // We'll want to loop for every key in storage at this point
            var storage = storageManager.ExecutionTrace.Tracepoints[storageManager.TraceIndex].Storage;

            foreach (Memory <byte> storageKey in storage.Keys)
            {
                // Define our current key (in case we must iterate upward through children to reach this mapping).
                Memory <byte> currentStorageKey = storageKey;

                // The point from which we will iterate/recursive upwards on.
IterateNested:

                // Try to obtain a preimage from this key
                var storageKeyPreimage = rpcClient?.GetHashPreimage(currentStorageKey.ToArray())?.Result;
                if (storageKeyPreimage != null)
                {
                    // Verify our pre-image is 2 WORDs in length.
                    if (storageKeyPreimage.Length == UInt256.SIZE * 2)
                    {
                        // If so, slice the latter WORD (parent location) and compare it to our current storage location
                        var derivedBaseLocation = storageKeyPreimage.Slice(UInt256.SIZE);
                        if (storageLocation.SlotKey.Span.SequenceEqual(derivedBaseLocation))
                        {
                            // Obtain our value hashed with our parent location (original key to our mapping).
                            byte[] originalStorageKeyData = storageKeyPreimage.Slice(0, UInt256.SIZE);

                            // Obtain our key and value's variable-value-pair.
                            StateVariable storageKeyVariable   = new StateVariable($"K[{results.Count}]", KeyTypeString);
                            StateVariable storageValueVariable = new StateVariable($"V[{results.Count}]", ValueTypeString);

                            // Obtain our resulting key-value pair.
                            var keyValuePair = new MappingKeyValuePair(
                                new VariableValuePair(storageKeyVariable, storageKeyVariable.ValueParser.ParseData(originalStorageKeyData)),
                                new VariableValuePair(storageValueVariable, storageValueVariable.ValueParser.ParseFromStorage(storageManager, new StorageLocation(currentStorageKey, 0), rpcClient)));

                            // Add our key-value pair to the results.
                            results.Add(keyValuePair);
                        }
                        else
                        {
                            // This derived location is not referencing this location. Iterate upward on it to determine if it's a child.
                            currentStorageKey = derivedBaseLocation;
                            goto IterateNested;
                        }
                    }
                }
            }

            // Return our results array.
            return(results.ToArray());
        }
Пример #5
0
        private void zReadTableResult(DataReaderHelper reader)
        {
            TableResultMapping tableResultMapping = (TableResultMapping)m_Step.ResultMapping;

            ListStateVariable listStateVariable = null;

            if (tableResultMapping.ObjectSetListName != null && tableResultMapping.ObjectSetClassName != null)
            {
                //TODO: there is similar logic in GroupStepExecutor.zCreateElementSetIterator - refactor into common method on DataScope.
                listStateVariable = (ListStateVariable)CurrentScope.DataScope.GetStateVariable(tableResultMapping.ObjectSetListName);
                if (listStateVariable == null)
                {
                    listStateVariable = new ListStateVariable(DataUtils.GetUnscopedVariableName(tableResultMapping.ObjectSetListName), tableResultMapping.PersistenceMode, new List <IStateVariable>());
                    CurrentScope.DataScope.SetStateVariable(tableResultMapping.ObjectSetListName, listStateVariable);
                }
                listStateVariable.IncludeInXML = tableResultMapping.IncludeInXML;
            }

            int resultCount = 1;

            while (reader.Read())
            {
                ObjectStateVariable objectStateVariable = null;
                if (listStateVariable != null)
                {
                    string listItemName = String.Format("{0}{1}", tableResultMapping.ObjectSetClassName, resultCount);
                    objectStateVariable = new ObjectStateVariable(listItemName, tableResultMapping.ObjectSetClassName, tableResultMapping.PersistenceMode, new Dictionary <string, IStateVariable>());
                    listStateVariable.Value.Add(objectStateVariable);
                }

                foreach (TableResultMap tableMap in tableResultMapping.TableMapping)
                {
                    //TODO: for now all data is being converted to string. Once we are doing something with the variable type system,
                    //      type the variables appropriately when reading them in.
                    object         value         = reader.GetNullableValue(tableMap.ColumnName);
                    IStateVariable stateVariable = new StateVariable <string>(DataUtils.GetUnscopedVariableName(tableMap.StateVariable),
                                                                              DataType.String,
                                                                              tableMap.XMLFieldOutputMode,
                                                                              tableMap.PersistenceMode,
                                                                              Convert.ToString(value));
                    if (objectStateVariable != null && stateVariable.Name == tableMap.StateVariable)
                    {
                        //stateVariable.Name == tableMap.StateVariable checks that tableMap.StateVariable has no explicit scope.
                        //If it has an explicit scope, stateVariable has to be set through CurrentScope.DataScope in the else block.
                        objectStateVariable.Value.Add(tableMap.StateVariable, stateVariable);
                    }
                    else
                    {
                        CurrentScope.DataScope.SetStateVariable(tableMap.StateVariable, stateVariable);
                    }
                }

                resultCount++;
            }
        }
Пример #6
0
        public void Validator_ReservedKeywordStateVariableInvalidTest()
        {
            Graph         graph         = new Graph();
            StateVariable stateVariable = graph.AddStateVariable("new", VariableValueType.Integer);

            graph.AddVertex("RUN", true);

            List <ValidationError> expectedErrors = new List <ValidationError>
            {
                new ReservedKeywordStateVariableValidationError(graph, stateVariable)
            };

            Validator_InvalidTest(graph, expectedErrors);
        }
Пример #7
0
        public HiddenMarkovModel GetModel(object owner, IContextLookup globalVars)
        {
            var randomVar  = StateVariable.GetRandomVariable(owner, globalVars);
            var transition = TransitionModel.GetMatrix();
            var sensor     = new HashMap();

            foreach (SensorMapRowInfo row in SensorModel)
            {
                var value        = row.Value.Evaluate(owner, globalVars);
                var distribution = row.SensorModel.GetMatrix();
                sensor.put(value, distribution);
            }
            var objPrior = Prior.GetMatrix();

            return(new HMM(randomVar, transition, sensor, objPrior));
        }
Пример #8
0
        private void WriteStateVariable(CodeMonkey monkey, StateVariable state_variable)
        {
            string type = GetTypeName(state_variable.Type);

            monkey.WriteLine(@"[UpnpStateVariable (""{0}"")]", state_variable.Name);
            monkey.WriteLine("public event EventHandler<StateVariableChangedArgs<{0}>> {1}Changed;", type, state_variable.Name);

            monkey.StartWriteBlock("protected {0} {1}", type, state_variable.Name, false);
            monkey.StartWriteBlock("set", false);
            monkey.WriteLine("EventHandler<StateVariableChangedArgs<{0}>> handler = {1}Changed;", type, state_variable.Name);
            monkey.StartWriteBlock("if (handler != null)", false);
            monkey.WriteLine("handler (this, new StateVariableChangedArgs<{0}> (value));", type);
            monkey.EndWriteBlock();
            monkey.EndWriteBlock();
            monkey.EndWriteBlock();
            monkey.WriteLine();
        }
Пример #9
0
        public void Validator_DuplicateStateVariableNamesInvalidTest()
        {
            Graph         graph          = new Graph();
            StateVariable stateVariable1 = graph.AddStateVariable("test", VariableValueType.Integer);
            StateVariable stateVariable2 = graph.AddStateVariable("test", VariableValueType.Integer);

            graph.AddVertex("RUN", true);

            List <ValidationError> expectedErrors = new List <ValidationError>
            {
                new DuplicateStateVariableNamesValidationError(graph, new List <StateVariable>()
                {
                    stateVariable1, stateVariable2
                })
            };

            Validator_InvalidTest(graph, expectedErrors);
        }
Пример #10
0
        public void ScriptingHost_ValidBooleanVariableTest()
        {
            ScriptingHost host = new ScriptingHost();

            Assert.IsNotNull(host);

            bool[] expectedValues = VariableValueTest.ValidBooleanValues;

            for (int i = 0; i < expectedValues.Length; i++)
            {
                StateVariable sv = new StateVariable()
                {
                    Name = $"test{i}", Type = VariableValueType.Boolean
                };
                host.Create(sv);

                VariableValue defaultValue = host.Get(sv);
                Assert.AreEqual(VariableValueType.Boolean, defaultValue.Type);
                Assert.AreEqual(default, defaultValue.BooleanValue);
Пример #11
0
 public StateField(object model, FieldInfo field)
 {
     this.stateVariable = new StateVariable(GetStateVariableName(field));
     this.model = model;
     this.field = field;
 }
Пример #12
0
        /// <summary>
        /// Create an instance of LibraryModelProgram for a given assembly
        /// </summary>
        /// <param name="modAssembly">Loaded assembly</param>
        /// <param name="modelName">Name of the model namespace to be loaded. 
        /// Only classes in the model namespace will be loaded.</param>
        /// <param name="featureNames">The names of features to be loaded. If null, all
        /// features will be loaded for the given modelName. See <see cref="FeatureAttribute"/>.</param>
        /// <exception cref="ModelProgramUserException">Thrown if there is a usage error in the given assembly.</exception>
        public LibraryModelProgram(Assembly modAssembly, string modelName, Set<string>/*?*/ featureNames)
        {
            if (string.IsNullOrEmpty(modelName))
                throw new ArgumentNullException("modelName");

            InterpretationContext context = (null == featureNames ?
                new InterpretationContext() :
                new InterpretationContext(featureNames));

            Type/*?*/[]/*?*/ allTypes = modAssembly.GetTypes();
            List<Field> stateVars = new List<Field>();
            Dictionary<Symbol, ActionInfo> aInfoMap = new Dictionary<Symbol, ActionInfo>();
            Dictionary<Type, StatePredicate> acceptingStateConditions = new Dictionary<Type, StatePredicate>();
            Dictionary<Type, StatePredicate> stateInvariants = new Dictionary<Type, StatePredicate>();
            Dictionary<Type, StatePredicate> stateFilters = new Dictionary<Type, StatePredicate>();
            //Dictionary<Type, TransitionPropertyGenerator> transitionPropertyGenerators = new Dictionary<Type, TransitionPropertyGenerator>();
            bool modelIsEmpty = true;

            #region Get state variables, actions, invariants, accepting state conditions, and state filters

            abstractSorts = new Set<Symbol>();

            foreach (Type t in allTypes)
            {
                try
                {
                    // ignore any compiler-generated types, such as iterators.
                    if (ReflectionHelper.IsCompilerGenerated(t))
                        continue;

                    // Collect  state variables, actions, invariants and accepting state conditions.
                    if (ReflectionHelper.IsInModel(t, modelName, featureNames))
                    {
                        // Register the sort for this type
                        context.RegisterSortType(AbstractValue.TypeSort(t), t);

                        // Check if the sort is abstract
                        if (AbstractValue.IsTypeAbstractSort(t)) abstractSorts=abstractSorts.Add(AbstractValue.TypeSort(t));

                        // Only extract variables and actions from class types.
                        if (!t.IsClass)
                            continue;

                        // clear flag that detects model namespace spelling errors
                        modelIsEmpty = false;

                        // Collect state variables
                        foreach (FieldInfo field in ReflectionHelper.GetModelVariables(t))
                            stateVars.Add(new Field(field));

                        Set<string> actionMethodNames = Set<string>.EmptySet;  // used to detect duplicates

                        // Collect actions
                        foreach (MethodInfo methodInfo in ReflectionHelper.GetMethodsForActions(t))
                        {
                            try
                            {
                                if (actionMethodNames.Contains(methodInfo.Name))
                                    throw new ModelProgramUserException("Duplicate action method name '" + methodInfo.Name + "' found. Action methods may not use overloaded names.");

                                if (!methodInfo.IsStatic)
                                {
                                    //check that the the declaring class is a labeled instance
                                    //or else say that probably the static keyword is missing

                                    if (methodInfo.DeclaringType.BaseType == null ||
                                        methodInfo.DeclaringType.BaseType.Name != "LabeledInstance`1" ||
                                        methodInfo.DeclaringType.BaseType.GetGenericArguments()[0] != methodInfo.DeclaringType)
                                        throw new ModelProgramUserException("Since the action method '" + methodInfo.Name + "' is non-static, the class '" + methodInfo.DeclaringType.Name + "' must directly inherit from 'LabeledInstance<" + methodInfo.DeclaringType.Name + ">'." +
                                                                            "\nDid you perhaps forget to declare the method 'static'?");
                                }

                                //check that the action parameter types are valid modeling types
                                foreach (ParameterInfo pInfo in methodInfo.GetParameters())
                                        if (!(pInfo.ParameterType.IsPrimitive ||
                                             pInfo.ParameterType.IsEnum ||
                                             pInfo.ParameterType == typeof(string) ||
                                             ReflectionHelper.ImplementsIAbstractValue(pInfo.ParameterType)))
                                            throw new ModelProgramUserException(
                                                "\nThe parameter '" + pInfo.Name + "' of '" + methodInfo.Name + "' does not a have valid modeling type. " +
                                                "\nA valid modeling type is either: a primitive type, an enum, a string, or a type that implements 'NModel.Internals.IAbstractValue'." +
                                                "\nIn particular, collection types in 'System.Collections' and 'System.Collections.Generic' are not valid modeling types." +
                                                "\nValid modeling types are collection types like 'Set' and 'Map' defined in the 'NModel' namespace, " +
                                                "\nas well as user defined types that derive from 'CompoundValue'.");

                                actionMethodNames = actionMethodNames.Add(methodInfo.Name);

                                Method method = new Method(methodInfo);

                                #region RequirementsMetrics2

                                // Requirements metrics
                                // methodInfo is only actions
                                // Collect the requirements from the enabling-actions below (after this loop)
                                if (!allModeledRequirements.ContainsKey(methodInfo.Name))
                                    allModeledRequirements =
                                        allModeledRequirements.Add(methodInfo.Name,
                                        ReflectionHelper.GetRequirementsInMethod(methodInfo));

                                // Collect the requirements from the enabling-actions
                                foreach (MethodInfo enablingMethodInfo in ReflectionHelper.GetEnablingMethods(methodInfo))
                                {
                                    if (!allModeledRequirements.ContainsKey(enablingMethodInfo.Name))
                                    {
                                        Set<Pair<string, string>> requirements = new Set<Pair<string, string>>
                                            (ReflectionHelper.GetEnablingMethodsRequirements(enablingMethodInfo));
                                        allModeledRequirements =
                                            allModeledRequirements.Add(enablingMethodInfo.Name, requirements);
                                    }

                                }

                                #endregion

                                foreach (ActionAttribute actionAttribute in ReflectionHelper.GetModelActionAttributes(methodInfo))
                                {
                                    CompoundTerm/*?*/ startActionLabel;
                                    CompoundTerm/*?*/ finishActionLabel;
                                    ReflectionHelper.GetActionLabel(methodInfo, actionAttribute, out startActionLabel, out finishActionLabel);
                                    ActionMethodFinish/*?*/ finishActionMethod = null;
                                    if (finishActionLabel != null)
                                    {
                                        finishActionMethod = InsertActionMethodFinish(method, finishActionLabel, aInfoMap);
                                    }
                                    if (startActionLabel != null)
                                    {
                                        InsertActionMethodStart(method, startActionLabel, finishActionMethod, aInfoMap);
                                    }
                                }
                            }
                            catch (ModelProgramUserException e)
                            {
                                string msg = "method " + methodInfo.Name + ", " + e.Message;
                                throw new ModelProgramUserException(msg);
                            }
                        }

                        // to do: collect transition properties

                        // Collect state invariants
                        //StatePredicate sp1 = StatePredicate.GetPredicates(t, GetStateInvariantMethodNames(t));
                        //if (null != sp1)
                        //    stateInvariants.Add(t, sp1);

                        // Collect accepting state conditions
                        StatePredicate sp2 = StatePredicate.GetAcceptingStateCondition(t);
                        if (null != sp2)
                            acceptingStateConditions.Add(t, sp2);

                        // Collect state invariants
                        StatePredicate sp3 = StatePredicate.GetStateInvariant(t);
                        if (null != sp3)
                            stateInvariants.Add(t, sp3);

                        //collect state filters
                        StatePredicate sp4 = StatePredicate.GetStateFilter(t);
                        if (null != sp4)
                            stateFilters.Add(t, sp4);

                    }
                }
                catch (ModelProgramUserException e)
                {
                    string msg = "In class " + t.Name + ", " + e.Message;
                    throw new ModelProgramUserException(msg);
                }
            }

            if (modelIsEmpty)
                throw new ModelProgramUserException("No classes found in model namespace " + modelName + ". Did you misspell?");

            #endregion

            // todo: Collect "sorts" for each type. Walk type tree of state variables and
            // action arguments to do this.

            Symbol[] aSymbols = new Symbol[aInfoMap.Keys.Count];
            int j = 0;
            foreach (Symbol a in aInfoMap.Keys)
                aSymbols[j++] = a;

            Field[] sFields = stateVars.ToArray();
            StateVariable[] sVars = new StateVariable[sFields.Length];
            string[] lNames = new string[sVars.Length];
            ValueArray<string> locNames;
            for (int i = 0; i < sVars.Length; i++)
            {
                sVars[i] = sFields[i].stateVariable;
                lNames[i] = sFields[i].stateVariable.Name;
            }

            locNames = new ValueArray<string>(lNames);

            string nameExt = "";
            if (featureNames != null && featureNames.Count > 0)
            {
                nameExt += "[";
                for (int i = 0; i < featureNames.Count; i++)
                {
                    nameExt += featureNames.Choose(i);
                    if (i < featureNames.Count - 1)
                        nameExt += ",";
                }
                nameExt += "]";
            }

            this.name = modelName + nameExt;
            // this.generator = generator;
            this.stateFields = sFields;
            this.locationNames = locNames;
            this.stateVariables = sVars;
            this.actionSymbols = new Set<Symbol>(aSymbols);
            this.actionInfoMap = aInfoMap;
            this.finishActionSymbols = LibraryModelProgram.CreateStartFinishMap(aInfoMap);
            this.modelAssembly = modAssembly;
            this.context = context;
            this.currentState = GetInitialState();
            this.stateChangedPredicate = false;
            this.acceptingStateConditions = acceptingStateConditions;
            this.stateInvariants = stateInvariants;
            this.stateFilters = stateFilters;
        }
Пример #13
0
 public StateField(object model, FieldInfo field)
 {
     this.stateVariable = new StateVariable(GetStateVariableName(field));
     this.model         = model;
     this.field         = field;
 }
Пример #14
0
 public override void Init()
 {
     playerState = UIUpdater.singleton.playerState;
     text        = GetComponent <TextMeshProUGUI>();
     curWeapon   = playerState.value.inventory.curWeapon;
 }
Пример #15
0
 static ServiceController CreateServiceController(StateVariable stateVariable)
 {
     return(CreateServiceController(stateVariable, null));
 }
Пример #16
0
 protected virtual Argument CreateArgument(string name, ArgumentDirection direction, bool isRetVal, StateVariable relatedStateVariable)
 {
     return(new Argument(this, direction, isRetVal, relatedStateVariable));
 }
Пример #17
0
 protected virtual Argument CreateArgument(string name, ArgumentDirection direction, bool isRetVal, StateVariable relatedStateVariable)
 {
     return new Argument (this, direction, isRetVal, relatedStateVariable);
 }
        private void addNodeButton_Click(object sender, EventArgs e)
        {
            // Check for location
            TreeNode currentNode = subsystemTreeView.SelectedNode;

            if (currentNode == SubsystemNode)
            {
                // Do nothing to add to head node
                return;
            }
            if (currentNode.Parent != SubsystemNode)
            {
                // Shift to right level
                currentNode = currentNode.Parent;
            }
            if (currentNode.Text == "Scripted Functions")
            {
                // Create new function with name from textbox dialog
                ScriptedFunction newFunction = new ScriptedFunction();
                TextboxDialog    dialog      = new TextboxDialog("Create new function", "New function name");
                dialog.ShowDialog();
                if (dialog.Cancelled)
                {
                    return;
                }
                newFunction.Name = dialog.StringValue;

                // Add function node
                TreeNode newNode = new TreeNode(newFunction.Name + "()");
                newNode.Tag = newFunction;
                currentNode.Nodes.Add(newNode);
                currentNode.Expand();

                // Add function text at bottom, set cursor position to function parameters
                string header = "function " + newFunction.Name + "()";
                scriptingEditor.InsertLine("", -1);
                scriptingEditor.InsertLine(header, -1);
                scriptingEditor.InsertLine("end", -1);
                scriptingEditor.Focus();
                int focusCol = header.Length - 1;
                int focusRow = scriptingEditor.Lines.Length - 2;
                scriptingEditor.CursorPosition = new Point(focusCol, focusRow);

                // Add function to subsystem script
                Script.Functions.Add(newFunction);
            }
            if (currentNode.Text == "State Variables")
            {
                // Create new variable with name from textbox dialog
                StateVariable newVar = new StateVariable();
                TextboxDialog dialog = new TextboxDialog("Create new state variable", "New variable name");
                dialog.ShowDialog();
                if (dialog.Cancelled)
                {
                    return;
                }
                newVar.Name = dialog.StringValue;

                // Add variable node
                TreeNode newNode = new TreeNode(newVar.Name);
                newNode.Tag = newVar;
                currentNode.Nodes.Add(newNode);
                currentNode.Expand();

                // Add variable to global symbols
                ScriptingSymbol varSymb = new ScriptingSymbol();
                varSymb.Enabled = true;
                varSymb.Name    = newVar.Name;
                varSymb.Type    = LuaSymbolType.Global;
                scriptingEditor.ScriptingSymbolListbox.Symbols.Add(varSymb);
                scriptingEditor.ScriptingSymbolListbox.SortSymbols();

                // Add function to subsystem script
                Script.States.Add(newVar);
            }
            if (currentNode.Text == "Subsystem Parameters")
            {
                // Create new parameter with name from textbox dialog
                SubsystemParameter newParam = new SubsystemParameter();
                TextboxDialog      dialog   = new TextboxDialog("Create new parameter", "New parameter name");
                dialog.ShowDialog();
                if (dialog.Cancelled)
                {
                    return;
                }
                newParam.Name = dialog.StringValue;

                // Add parameter node
                TreeNode newNode = new TreeNode(newParam.Name);
                newNode.Tag = newParam;
                currentNode.Nodes.Add(newNode);
                currentNode.Expand();

                // Add parameter to global symbols
                ScriptingSymbol varSymb = new ScriptingSymbol();
                varSymb.Enabled = true;
                varSymb.Name    = newParam.Name;
                varSymb.Type    = LuaSymbolType.Global;
                scriptingEditor.ScriptingSymbolListbox.Symbols.Add(varSymb);
                scriptingEditor.ScriptingSymbolListbox.SortSymbols();

                // Add parameter to subsystem script
                Script.Parameters.Add(newParam);
            }
        }