示例#1
0
        public void RemoveDependency(BitArray from, BitArray to)
        {
            if (from.Count != Keys.Count)
            {
                return;
            }
            if (to.Count != Keys.Count)
            {
                return;
            }
            to.And(Utils.Not(from));
            var index =
                DependencyList.FindIndex(tuple => tuple.Item1.EqualsTo(from));

            if (index == -1)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (to.EqualsTo(DependencyList[index].Item2))
            {
                DependencyList.RemoveAt(index);
            }
            else
            {
                DependencyList[index].Item2.And(Utils.Not(to));
            }
            _prepared = false;
        }
示例#2
0
        public void AddDependency(BitArray from, BitArray to)
        {
            if (from.Count != Keys.Count)
            {
                return;
            }
            if (to.Count != Keys.Count)
            {
                return;
            }
            to.And(Utils.Not(from));
            var index =
                DependencyList.FindIndex(tuple => tuple.Item1.EqualsTo(from));

            if (index != -1)
            {
                DependencyList[index].Item2.Or(to);
            }
            else
            {
                DependencyList.Add(new Tuple <BitArray, BitArray>(from, to));
            }
            _prepared = false;
        }