Esempio n. 1
0
        private void Button1_Click(object sender, EventArgs e)
        {
            //clear all the inputs as well as outputs
            BtnClearAll_Click(sender, e);

            processObject    = new ProcessLogicClass(txtInput.Text);
            truthTableObject = new TruthTable(processObject);

            //Convert from prefix to infix
            txtOutput.Text = processObject.GetInfix();

            //setup the truth table as well as the simplified version
            //full truth table
            string SetUplable = truthTableObject.setUpLabel();
            string printTable = truthTableObject.printTable();
            string List0and1  = truthTableObject.getList0and1();

            truthTable.Text = SetUplable + printTable;
            //////////////////////////simplified truth table
            SimplifiedTruthTable.Text = SetUplable + List0and1;

            //Generate DNF for the full truth table
            List <char[]> ValuesAllLines = truthTableObject.returnValuesEachLine();
            List <int>    allResults     = truthTableObject.returnLogicResult();

            DNFobject   = new DNF(allResults, ValuesAllLines, new String(truthTableObject.returnLabel()));
            txtDNF.Text = DNFobject.returnDNFString();

            //generate NAND String
            if (txtDNF.Text == "Cannot generate a DNF with a contradiction!")
            {
                txtNAND.Text = "Cannot generate a NAND with a contradiction";
            }
            else
            {
                txtNAND.Text = processObject.GetNANDString(txtDNF.Text);
            }

            string hash = truthTableObject.returnHexHashCode();

            txtHashtruthTable.Text = hash;
        }