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)); } }
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; }
public GenerateGraph(ProcessLogicClass _logic) { this.logicProposition = _logic; }