Esempio n. 1
0
 public void calculateLogic()
 {
     foreach (char[] charArray in ValuesEachLine)
     {
         string rawString = logicProposition.getRawString();
         for (int i = 0; i < label.Length; i++)
         {
             rawString = rawString.Replace(label[i], charArray[i]);
         }
         ProcessLogicClass processTable = new ProcessLogicClass(rawString);
         bool result = processTable.getProposition().CalculateFinalTruthValue();
         results.Add(Convert.ToInt32(result));
     }
 }
Esempio n. 2
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;
        }
Esempio n. 3
0
 public GenerateGraph(ProcessLogicClass _logic)
 {
     this.logicProposition = _logic;
 }