コード例 #1
0
        public void AddFunctionVector(FunctionVector vector)
        {
            if (vector.Count != inputs.Length + outputs.Length)
            {
                throw new InvalidVectorSizeException();
            }

            FunctionVector key, value;

            vector.Split(inputs.Length, out key, out value);
            if (key.Count != inputs.Length)
            {
                throw new MyException();
            }

            if (value.Count != outputs.Length)
            {
                throw new MyException();
            }

            if (function.ContainsKey(key))
            {
                throw new DuplicityException();
            }

            function.Add(key, value);
        }
コード例 #2
0
        // TODO: Check validity and assign error message possibly
        // TODO: Function logic, vector comparison

        public void Split(int length, out FunctionVector key, out FunctionVector value)
        {
            if (length > Count)
            {
                throw new MyException();
            }
            key = new FunctionVector {
                operands = new Charge[length]
            };
            value = new FunctionVector {
                operands = new Charge[Count - length]
            };
            for (int i = 0; i < Count; i++)
            {
                if (i < length)
                {
                    key.operands[i] = operands[i];
                }
                else
                {
                    value.operands[i - length] = operands[i];
                }
            }
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Fassty/c-sharp
        static void Main(string[] args)
        {
            FunctionVector vector = new FunctionVector();

            vector.GetHashCode();
        }