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); }
public static BooleanPattern operator !(BooleanPattern pattern1) { var result = new BooleanPattern(pattern1.Count); foreach (var t in pattern1) { result.PatternValues.Add(!t); } return(result); }
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); }
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); }
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); }