Example #1
0
 private void printDisjunctive()
 {
     //GETTING DISJUNCTIVE AND IT'S PARSE
     string[] disjunctAndParse = PropositionReader.readDisjunctiveForm(table.Rows);
     tbDisjunctive.Text            = disjunctAndParse[0];
     tbDisjunctiveParse.Text       = disjunctAndParse[1];
     disjunctAndParse              = PropositionReader.readDisjunctiveForm(table.GetSimpleTable());
     tbDisjunctiveSimple.Text      = disjunctAndParse[0];
     tbDisjunctiveSimpleParse.Text = disjunctAndParse[1];
 }
Example #2
0
        private void printVisualTruthtables(Truthtable chosenTable)
        {
            //clear tables
            dgvTruthTable.Columns.Clear();
            dgvTruthTable.Rows.Clear();
            dgvSimpleTable.Columns.Clear();
            dgvSimpleTable.Rows.Clear();

            if (conHolder == null)
            {
                MessageBox.Show("No proposition has been parsed yet"); return;
            }

            //table = new Truthtable(conHolder);
            List <char>          arguments  = conHolder.GetListOfAllArguments();
            List <TruthtableRow> rows       = chosenTable.Rows;             //normal truthtable rows
            List <TruthtableRow> simpleRows = chosenTable.GetSimpleTable(); //simple truthtable rows

            //create form table's columns
            int counter = 0;

            foreach (char c in arguments)
            {
                dgvTruthTable.Columns.Add(c.ToString(), c.ToString());
                dgvTruthTable.Columns[counter].Width = 20;
                dgvSimpleTable.Columns.Add(c.ToString(), c.ToString());
                dgvSimpleTable.Columns[counter].Width = 20;
                counter++;
            }
            dgvTruthTable.Columns.Add("Result", "Result");
            dgvTruthTable.Columns[counter].Width = 50;
            dgvSimpleTable.Columns.Add("Result", "Result");
            dgvSimpleTable.Columns[counter].Width = 50;

            //provide form table's with rows
            DataGridViewRow row;

            foreach (TruthtableRow r in rows) //print normal table
            {
                row     = (DataGridViewRow)dgvTruthTable.Rows[0].Clone();
                counter = 0;
                foreach (char c in arguments)
                {
                    row.Cells[counter].Value = r.GetValueForArgument(c);
                    counter++;
                }
                row.Cells[counter].Value = r.RowValue;
                dgvTruthTable.Rows.Add(row);
            }
            foreach (TruthtableRow r in simpleRows) //print simple table
            {
                row     = (DataGridViewRow)dgvSimpleTable.Rows[0].Clone();
                counter = 0;
                foreach (char c in arguments)
                {
                    row.Cells[counter].Value = r.GetValueForArgument(c);
                    counter++;
                }
                row.Cells[counter].Value = r.RowValue;
                dgvSimpleTable.Rows.Add(row);
            }
        }