Example #1
0
        public MainViewModel(IFileService fileService,
                             IGraphVizService graphVizService,
                             IDfaService dfaService,
                             ILanguageCheckService languageCheckService,
                             IRegularExpressionParserService regularExpressionParserService)
        {
            _fileService                    = fileService;
            _graphVizService                = graphVizService;
            _dfaService                     = dfaService;
            _languageCheckService           = languageCheckService;
            _regularExpressionParserService = regularExpressionParserService;

            _words = new ObservableCollection <string>();
            _file  = new GraphVizFileModel();

            OpenFileCommand               = new RelayCommand(OpenFile, () => true);
            ParseFileCommand              = new RelayCommand(ParseFile, ParseFileCanExecute);
            ShowAutomatonCommand          = new RelayCommand(ShowAutomaton, ShowAutomatonCanExecute);
            VerifyStringCommmand          = new RelayCommand(VerifyString, VerifyStringCanExecute);
            ParseRegularExpressionCommand = new RelayCommand(ParseRegularExpression, ParseRegularExpressionCanExecute);
            CopyRELinesCommand            = new RelayCommand(CopyRELines, () => true);
            ShowAllWordsCommand           = new RelayCommand(ShowAllWords, ShowAutomatonCanExecute);
            ConvertToDfaCommand           = new RelayCommand(ConvertToDfa, ConvertToDfaCanExecute);
            CopyConvertLinesCommand       = new RelayCommand(CopyConvertLines, () => true);

            RegularExpressionInput = "|(a,*b)";
            //|(.(a,*(b)),*(c))
            //|(*(a),.(b,c))
            //"*(|(*(.(a,b)),c))"
            //|(a,*b)
        }
Example #2
0
        //"&((|(A,~(B)),C)"
        //&(|(A,B),>(C,~(&(|(D,E),>(&(|(F,G),>(H,~(&(|(I,J),>(K,~(L)))))),~(M))))))
        //"&(=(A,B),|(C,D))"
        //"&((|(A,~(B)),C)"
        //"=( >(A,B), |( ~(A) ,B) )
        //&(A, ~(B))
        //~(&(>(&(A,C)),~(&(~(B),C))))
        //|((|(A,(B)),C)
        //&(>(|(A,~(B)),C),A)
        //&(>(|(A,~(B)),C),B)
        //=(a,b)
        //>(a,b)
        //~a
        //|(a,b)
        //&(a,b)
        //|(|(a,b),c)
        //&(|(a,~b),c)

        //tautology
        //|(>(p,q),>(q,p))
        //>(&(p,q),&(q,p))
        //= ( > (A, B), | (~(A), B))
        //|(a,~a)

        //contradiction
        //&(~p,p)
        ////&(&(p,q),~(p))

        //use for simplification of truth table
        //&(=(A,B),|(C,D))
        //&(|(a, b),c)
        //|(|(a,b),c)
        public MainViewModel(IFixConversionService fixConversionService, ITruthTableService truthTableService,
                             IGraphVizService graphVizService, IFileService fileService)
        {
            ParsePrefixCommand = new RelayCommand(ParsePrefix, ParseCanExecute);

            _expressionModelDisjunctiveNormalForm           = new ExpressionModel();
            _expressionModelSimplifiedDisjunctiveNormalForm = new ExpressionModel();
            _expressionModelNand = new ExpressionModel();

            //FOR DEBUGGING
            _expressionModel = new ExpressionModel();
            //Prefix = "|(a,~a)";
            //_expressionModel.Prefix = "|(a,~a)";

            _fixConversionService = fixConversionService;
            _truthTableService    = truthTableService;
            _graphVizService      = graphVizService;
            _fileService          = fileService;
        }