コード例 #1
0
        public ReducedBooleanExpression(ExpandedBooleanExpression bexpr)
        {
            _sortedVariables = bexpr.GetAllVariables();
            ushort index = 0;

            foreach (char c in _sortedVariables)
            {
                _alphabet[c] = index;
                index++;
            }
            Implicant i = null;

            foreach (string factor in bexpr.AsString.Split('+'))
            {
                i = new Implicant(this, factor);
                if ((i == null) || (i.IsContradiction))
                {
                    continue;
                }
                _implicants.Add(i);
            }
            //
            CalculatePrimeImplicants();
            BuildMintermToPrimeImplicantTable();
            _mintermCount = _primeImplicantTable.Count();
            PickFinalImplicants();
        }
コード例 #2
0
 public void TestVariableParsing()
 {
     foreach (ExpressionTestCase te in validCases)
     {
         expr = new ExpandedBooleanExpression(te.inputExpression);
         CollectionAssert.AreEqual(expr.GetAllVariables(), te.variables);
     }
 }