Package eas.math.fundamentalAlgorithms.graphBased.pdfProcessors

Examples of eas.math.fundamentalAlgorithms.graphBased.pdfProcessors.GraphViz


            graphVizString = tree234Integer.getDOT();
        } else {
            graphVizString = tree234String.getDOT();
        }

        GraphViz gv = new GraphViz(pdfPath);
        gv.addln(graphVizString);
        return gv;
    }
View Full Code Here


        this.code = code.substring(4);
    }

    @Override
    public GraphViz generatePDFcode(String pdfPath) {
        GraphViz gv = new GraphViz(pdfPath);

        gv.addln(code);
       
        return gv;
    }
View Full Code Here

    @Override
    public GraphViz generatePDFcode(String pdfPath) {
        String patTreeString = this.root.getStringRep();
        String graphVizString = "digraph PATTree {\n" + patTreeString + "}";
        GraphViz gv = new GraphViz(pdfPath);
        gv.addln(graphVizString);
        return gv;
    }
View Full Code Here

   
    private ParseTree[] parseTreesFromLastCalculation;
   
    @Override
    public GraphViz generatePDFcode(String pdfPath) {
        GraphViz gv = new GraphViz(pdfPath);
        this.numOfParseTrees = -1;
       
        GlobalVariables.getPrematureParameters().logDebug("I'm starting with the grammar tree creation.");
        if (this.wordToParse == null) {
            try {
                GrammTree tree = this.generateWords(this.cutNonTerminalBranches, this.cutTerminalDoubleBranches, false);
                GlobalVariables.getPrematureParameters().logDebug("Nodes in tree: " + tree.getSize());
                GlobalVariables.getPrematureParameters().logDebug("Terminal nodes in tree: " + tree.getTermNum());
               
                nodeNum = 0;
                gv.addln("digraph G {");
                traverseTree(gv, tree);
                gv.addln("};");
            } catch (Exception e) {}
        } else { // Parser type 2.
            gv.addln("digraph G {");
            if (this.getRules().stream().allMatch(r -> r.getRightSide().getWordLength() > 0)) {
                CtxtFreeGrammar gramm = new CtxtFreeGrammar(this);
                try {
                    if (this.parseTreesFromLastCalculation == null || this.dontRecalculateParseTrees == null) {
                        this.parseTreesFromLastCalculation = ChartParser.parse(gramm, this.wordToParse, null);
                    }
                    gv.addln(parseTreesFromLastCalculation[this.displayParseTreeNum % parseTreesFromLastCalculation.length].toString());
                    this.numOfParseTrees = parseTreesFromLastCalculation.length;
                } catch (Exception e) {
                    if (e.getMessage().toLowerCase().contains("user")) {
                        gv.addln("b [label=\"User aborted\"];");
                        gv.addln("b -> a;");
                    }
                    gv.addln("a [label=\"CANNOT PARSE\"];\n c [label=\""
                            + Arrays.toString(this.wordToParse)
                                    .replace("[", "").replace("]", "")
                                    .replace(", ", "")
                                    + "\"];");
                    gv.addln("a -> c;");
                }
            } else {
                gv.addln("SORRY EPSILON NOT ALLOWED \"USE <>\";");
            }
            gv.addln("};");
        }
       
        return gv;
    }
View Full Code Here

            graphVizString = redBlackTreeInteger.getDOT();
        } else {
            graphVizString = redBlackTreeString.getDOT();
        }

        GraphViz gv = new GraphViz(pdfPath);
        gv.addln(graphVizString);
        return gv;
    }
View Full Code Here

TOP

Related Classes of eas.math.fundamentalAlgorithms.graphBased.pdfProcessors.GraphViz

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.