示例#1
0
        /*
         * Is current string a reference to another key's value in inputs dictionary.
         */

        private int isReference(string key)
        {
            InputVal current = inputs[key];

            if (inputs.ContainsKey(current.valOne) && inputs.ContainsKey(current.valTwo))
            {
                return(3);
            }
            else if (inputs.ContainsKey(current.valOne))
            {
                return(1);
            }
            else if (inputs.ContainsKey(current.valTwo))
            {
                return(2);
            }

            return(0);
        }
示例#2
0
        /*
         * Returns a Input based on the given Key
         */

        public InputVal getInput(string key)
        {
            InputVal current = inputs[key];
            int      isRef   = isReference(key);

            switch (isRef)
            {
            case 1:
                return(new InputVal(inputs[current.valOne].valOne, current.valTwo));

            case 2:
                return(new InputVal(current.valOne, inputs[current.valTwo].valOne));

            case 3:
                return(new InputVal(inputs[current.valOne].valOne, inputs[current.valTwo].valTwo));

            default:
                break;
            }

            return(inputs[key]);
        }
示例#3
0
        /*
         * sets key's value in a dictionary
         */

        public void setInput(string key, InputVal value)
        {
            inputs[key] = value;
        }