Exemplo n.º 1
0
        private void InsertFromParameter(Parameter parameter, bool insertIfMissing)
        {
            if (parameter == null || string.IsNullOrEmpty(parameter.Name))
            {
                return;
            }

            int index = GetIndexOf(parameter.Name);

            if (index == -1)
            {
                if (HasRuntime)
                {
                    index = Runtime.Count;
                    IValue val = parameter.Value.CreateValue();
                    val.GetFrom(parameter.Value);
                    Runtime.Add(val);
                }
                else if (insertIfMissing)
                {
                    index = Serialized.Count;
                    Serialized.Add(parameter);
                }

                Index[parameter.Name] = index;
            }
        }
Exemplo n.º 2
0
        public void InsertFromParameter(GenericParameter parameter)
        {
            int index = GetIndexOf(parameter.Name);

            if (index == -1)
            {
                if (HasRuntime)
                {
                    index = Runtime.Count;
                    IValue val = parameter.CreateValue();
                    val.GetFrom(parameter);
                    Runtime.Add(val);
                }
                else
                {
                    index = Serialized.Count;
                    Serialized.Add(parameter);
                }

                Index[parameter.Name] = index;
            }
        }
Exemplo n.º 3
0
        public List <Pair <string, IValue> > GetPairs()
        {
            List <Pair <string, IValue> > pairs = new List <Pair <string, IValue> >();

            if (HasRuntime)
            {
                for (int i = 0; i < Runtime.Count; i++)
                {
                    pairs.Add(new Pair <string, IValue>(Serialized[i].Name, Runtime[i]));
                }
            }
            else
            {
                for (int i = 0; i < Serialized.Count; i++)
                {
                    IValue val = Serialized[i].CreateValue();
                    val.GetFrom(Serialized[i]);
                    pairs.Add(new Pair <string, IValue>(Serialized[i].Name, val));
                }
            }

            return(pairs);
        }