示例#1
0
        public static BooleanPattern CreateFromFalseIndexes(int size, IEnumerable <int> indexes)
        {
            var result = new BooleanPattern(size, true);

            foreach (var i in indexes)
            {
                result.PatternValues[i] = false;
            }

            return(result);
        }
示例#2
0
        public static BooleanPattern operator !(BooleanPattern pattern1)
        {
            var result = new BooleanPattern(pattern1.Count);

            foreach (var t in pattern1)
            {
                result.PatternValues.Add(!t);
            }

            return(result);
        }
示例#3
0
        public MutableBooleanPattern XorWith(BooleanPattern pattern)
        {
            if (Count != pattern.Count)
            {
                throw new InvalidOperationException();
            }

            for (var i = 0; i < Count; i++)
            {
                PatternValues[i] = PatternValues[i] ^ pattern[i];
            }

            return(this);
        }
示例#4
0
        public static BooleanPattern CreateFromUInt64(int size, UInt64 pattern)
        {
            if (size > UInt64BlockSize)
            {
                throw new InvalidOperationException();
            }

            var result = new BooleanPattern(size);

            for (var i = 0; i < size; i++)
            {
                result.PatternValues.Add((pattern & (1UL << i)) != 0);
            }

            return(result);
        }
示例#5
0
        public static BooleanPattern operator ^(BooleanPattern pattern1, BooleanPattern pattern2)
        {
            if (pattern1.Count != pattern2.Count)
            {
                throw new InvalidOperationException("Pattern lengths mismatch");
            }

            var result = new BooleanPattern(pattern1.Count);

            for (var i = 0; i < pattern1.Count; i++)
            {
                result.PatternValues.Add(pattern1[i] ^ pattern2[i]);
            }

            return(result);
        }