示例#1
0
        //GET NAND CONNECTIVE HOLDER
        public ConnectiveHolder GetNandHolder()
        {
            Connective       startCon = startConnective.GetNandProposition();
            ConnectiveHolder temp     = new ConnectiveHolder(startCon);

            return(temp);
        }
示例#2
0
        private bool createAllConHoldersAndTruthtables(string proposition)
        {
            try
            {
                //CREATING PROPOSITION
                Connective con = PropositionReader.ReadPropositionString(proposition);

                if (con.IsNormalProposition())
                {
                    conHolder = new ConnectiveHolder(con);
                    table     = new Truthtable(conHolder);
                    printDisjunctive();

                    conHolderDisjunctive = new ConnectiveHolder(tbDisjunctiveParse.Text);
                    tableDisjunctive     = new Truthtable(conHolderDisjunctive);

                    conHolderDisjunctiveSimple = new ConnectiveHolder(tbDisjunctiveSimpleParse.Text);
                    tableDisjunctiveSimple     = new Truthtable(conHolderDisjunctiveSimple);

                    conHolderNand = conHolder.GetNandHolder();
                    tableNand     = new Truthtable(conHolderNand);

                    conHolderNandSimple = conHolderDisjunctiveSimple.GetNandHolder();
                    tableNandSimple     = new Truthtable(conHolderNandSimple);

                    tbInfix.Text      = conHolder.GetInfixString();
                    tbNand.Text       = conHolderNand.GetParseString();
                    tbNandSimple.Text = conHolderNandSimple.GetParseString();
                    showTableauxTree  = false;

                    //DRAWING AND PRINTING TABLE INFORMATION
                    printVisualTruthtables(table);
                    printTablesInformation();
                }
                else
                {
                    if (!con.AreLocalArgumentsMatching(new List <char>(), new List <char>()))
                    {
                        throw new Exception("Local Arguments are mismatching or there are quantifiers with the same Local Argument");
                    }
                    conHolder        = new ConnectiveHolder(con);
                    tbInfix.Text     = conHolder.GetInfixString();
                    showTableauxTree = false;
                }
                Console.WriteLine("Succesfully parsed proposition: " + proposition);
            }
            catch (NullReferenceException)
            {
                MessageBox.Show("Parsing failed: please make sure that you wrote a proposition");
                Console.WriteLine("Failed to parse proposition: " + proposition);
                return(false);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Parsing failed: " + ex.Message);
                Console.WriteLine("Failed to parse proposition: " + proposition);
                return(false);
            }
            return(true);
        }
示例#3
0
 public Truthtable(ConnectiveHolder ConHolder)
 {
     conHolder     = ConHolder;
     argumentsChar = ConHolder.GetListOfAllArguments();
     rows          = new List <TruthtableRow>();
     createTruthtableRows();
     fillTruthtableRowsWithAnswers();
 }