Esempio n. 1
0
        /// <summary>
        /// Checks whether 'r' matches this instance of RowCombination
        /// </summary>
        /// <param name="r">Row combination to compare with</param>
        /// <returns></returns>
        public bool Matches(RowCombination r)
        {
            // 0001     =>   1
            // 1111     =>   1
            // 0101     =>   1

            if (_nodeValues.Length != r._nodeValues.Length)
            {
                return(false);
            }

            var length = _nodeValues.Length;

            for (int i = 0; i < length; i++)
            {
                var ourValue       = _nodeValues[i];
                var valueToCompare = r._nodeValues[i];

                if (!(ourValue.Value is String || valueToCompare.Value is String))
                {
                    if ((int)ourValue.Value != (int)valueToCompare.Value)
                    {
                        return(false);
                    }
                }
            }


            return(true);
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a truth-table consisting only of *
        /// </summary>
        private void SimplifyTautology()
        {
            Dictionary <RowCombination, int> simplifiedTruth = new Dictionary <RowCombination, int>();

            simplifiedTruth.Add(
                RowCombination.InstantiateRowCombinationOnlyWithStars(RowResultPairs.First().Key.GetNames()
                                                                      .ToCharArray()), 1);
            RowResultPairs = simplifiedTruth;
        }