Package fmg.fmg8.graphVis.graph

Examples of fmg.fmg8.graphVis.graph.Graph


        "000, 008, 001, 000, 012, 099, 001, 000, 004, 000, 000, 005, " +
        "001, 000, 000, 000, 002, 101, 101, 100, 000, 012, 099, 001, " +
        "000, 007, 000, 000, 003, 001, 000, 012, 099, 001, 000, 004, " +
        "000, 000, 005, 001, 000, 000, 000";
       
        Translator trans = new Translator(
                transCode,
                new ScriptInterpreter(params, SonstMeth.MODUS_TRANSLATOR),
                params);
        Script s = trans.translate(new EndlicherAutomat().bereinige(seqCode));
        ScriptInterpreter sInt = new ScriptInterpreter(params, SonstMeth.MODUS_TRANSLATOR);
        EndlicherAutomat ea = new EndlicherAutomat();
        sInt.generateAutomaton(ea, s);
//        System.out.println(ea.erzeugeSequenz().size());
        System.exit(0);
View Full Code Here


     *
     * @return  Darstellung des Graphen g.
     */
    public DargestellterGraph erzeuge(final EndlicherAutomat g,
                                      final Object ausgKn) {
        DargestellterGraph darstellung = new DargestellterGraph();
        Iterator<Knoten> it;
        Iterator<Knoten> it1;
        Iterator<Integer> it2;
        Iterator<Transition> it3;
        Knoten knot;
        Knoten knot1;
        Knoten knot2;
        Vektor2D koord1;
        Vektor2D koord2;

        if (!g.istLeer()) {
            final ArrayList<Knoten> knotenListe
                = new ArrayList<Knoten>(g.holAdj().values());
            int knAnzahl = knotenListe.size();
           
            if (knAnzahl < 2) {
                knAnzahl = 2;
            }
           
            int gitterX = Math.abs(this.rechts - this.links)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);
            int gitterY = Math.abs(this.unten - this.oben)
                          / (int) ((Math.ceil(Math.sqrt(knAnzahl))) - 1);

            int koordX = this.links;
            int koordY = this.oben;
           
            int kX;
            int kY;
            Transition bed;
            int folgeZustand;
            String bedingung;
            int xAusgleich;
            int zaehler = 0;
           
            // Knoten
            it = knotenListe.iterator();
            while (it.hasNext()) {
                knot = it.next();

                if (this.gesetzteKn.containsKey(knot.holeName())) {
                    kX = (int) this.gesetzteKn.get(knot.holeName()).x;
                    kY = (int) this.gesetzteKn.get(knot.holeName()).y;
                    this.setzeKnoten(knot,
                                     darstellung,
                                     kX,
                                     kY,
                                     (Knoten) ausgKn);

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(kX - 60,
                                               kY - 60,
                                               kX - 45,
                                               kY - 45,
                                               0.5,
                                               false);
                    }
                } else {
                    this.setzeKnoten(knot,
                                     darstellung,
                                     koordX,
                                     koordY,
                                     (Knoten) ausgKn);

                    this.gesetzteKn.put(knot.holeName(),
                                        new Vektor2D(koordX, koordY));

                    if (g.istStartZ(knot)) {
                        darstellung.hinzuPfeil(koordX - 60,
                                               koordY - 60,
                                               koordX - 45,
                                               koordY - 45,
                                               0.5,
                                               false);
                    }

                    zaehler++;
                   
                    if (zaehler < Math.ceil(Math.sqrt(knAnzahl))) {
                        koordX = koordX + gitterX;
                    } else {
                        koordX = this.links;
                        koordY = koordY + gitterY;
                        zaehler = 0;
                    }
                }
            }

            // Kanten
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                knot1 = (Knoten) it1.next();
                koord1 = (Vektor2D) this.gesetzteKn.get(knot1.holeName());

                it2 = (new ArrayList<Integer>(
                                knot1.holeNachfolger().keySet())).iterator();
                while (it2.hasNext()) {
                    boolean gebogen = true;
                   
                    knot2 = g.holeKnoten((Integer) it2.next());
                    koord2 = (Vektor2D) this.gesetzteKn.get(knot2.holeName());
                    Condition cond
                        = knot1.getInfo().getTransZuZustand(
                                knot2.holeName()).get(0).getCond();
                    double staerke = SonstMeth.condStrength(cond,
                                                   Konstanten.STAERKE_ERST,
                                                   Konstanten.STAERKE_ZWEIT);
                   
                    if (koord1.distanz(koord2) < 140
                            && !koord1.equals(koord2)) {
                        gebogen = false;
                    }
                   
                    darstellung.hinzuPfeil(
                            (int) koord1.x,
                            (int) koord1.y,
                            (int) koord2.x,
                            (int) koord2.y,
                            staerke,
                            gebogen);
                }
            }

            // Kantenbeschriftungen
            it1 = knotenListe.iterator();
            while (it1.hasNext()) {
                int kantNum = 1;
                knot1 = (Knoten) it1.next();
                koord1 = this.gesetzteKn.get(knot1.holeName());

                it3 = ((ZInfo) knot1.getInfo()).getBeds().iterator();
                while (it3.hasNext()) {
                    Polygon p = new Polygon();
                    bed = it3.next();
                    folgeZustand = bed.getFolgezustand();
                    bedingung = bed.getCond().toString();
                    knot2 = g.holeKnoten(new Integer(folgeZustand));
                    koord2 = this.gesetzteKn.get(knot2.holeName());

                    p.addPoint((int) koord1.x, (int) koord1.y);
                    p.addPoint((int) koord2.x, (int) koord2.y);

                    if (koord1.equals(koord2)) {
                        xAusgleich = 95;
                    } else {
                        xAusgleich = 0;
                    }

                    darstellung.hinzuBeschr(
                            (int) ((koord1.x + koord2.x) / 2) + xAusgleich,
                            (int) ((koord1.y + koord2.y) / 2),
                            kantNum + ".)  " + bedingung,
                            p);
                   
View Full Code Here

        this.setLayout(new BorderLayout(borderX, borderY));
        this.setResizable(false);
        this.setLocation(locationX, locationY);

        //Message
        MultiLineLabel lab = new MultiLineLabel(msg);
        lab.setLeftRightMargin(lrMargin);
        lab.setTopBottomMargin(tbMargin);
        this.add(lab, BorderLayout.NORTH);

        //Buttons
        Panel panel = new Panel();
        panel.setLayout(new FlowLayout(FlowLayout.CENTER));
View Full Code Here

        this.setLayout(new BorderLayout(borderX, borderY));
        this.setResizable(true);
        this.setLocation(locationX, locationY);
        //Message
        if (textBox == null) {
            MultiLineLabel lab = new MultiLineLabel(msg);
            lab.setLeftRightMargin(lrMargin);
            lab.setTopBottomMargin(tbMargin);
            this.add(lab, BorderLayout.CENTER);
        } else {
            if (einzeilig) {
                this.text = new TextField(textBox,
                                     textBoxWidth);
View Full Code Here

       
        this.result = "";
        this.liste = new java.awt.List(elemente.size(), multi);
        Button but1 = new Button(button1);
        Button but2 = new Button(button2);
        MultiLineLabel lab = new MultiLineLabel(message);

        this.setLayout(new GridLayout(2, 2));
        this.add(this.liste);
        if (this.zusatzText == null) {
            this.add(lab);
        } else {
            this.add(this.zusatzText);
            this.setTitle(this.getTitle() + " (" + message + ")");
        }
        lab.setLeftRightMargin(50);
       
        this.add(but1);
        this.add(but2);

        but1.addActionListener(this);
View Full Code Here

        File verz = new File(this.pars.getStdPfad());
        String endung = fmg.fmg8.graphVis.Konstanten.GRAPH_ENDUNG;
        String[] gespGr = verz.list(new DateiFilter(endung));
        String grNam;
        VisMantel visRob = null;
        Vis obs = null;
        boolean sel = false;
       
        if (gespGr != null) {
            for (int i = 0; i < gespGr.length; i++) {
                grNam = gespGr[i].substring(
View Full Code Here

                                       + "und Vis-Objekten.");
        }
       
        String grNam;
        VisMantel visRob = null;
        Vis obsVis = null;
        boolean sel = false;
       
        for (int i = 0; i < visObs.length; i++) {
            grNam = visObs[i].getGraphName();
           
View Full Code Here

     * Initialisierungsmethode (Roboter und Darstellung).
     */
    private void init() {
        this.setSize(200, 200);
        this.setLocation(new Point(400, 100));
        this.darstArt = new DarstModEA(
                50,
                Konstanten.OBEN,
                this.getWidth() - 50,
                this.getHeight() - 50);

View Full Code Here

        this.addWindowListener(new WindHideAdapt());
       
        this.darstArten = new DarstModEA[autAnz];
       
        for (int i = 0; i < autAnz; i++) {
            this.darstArten[i] = new DarstModEA(
                    50,
                    Konstanten.OBEN,
                    this.getWidth() - 50,
                    this.getHeight() - 50);
        }
View Full Code Here

        buttons.add(ja);
        buttons.add(nein);
        buttons.add(alle);
        buttons.add(keiner);
        buttons.add(abbrechen);
        AllgemeinerDialog nachfrage;
        nachfrage = new AllgemeinerDialog(this, Messages
                .getString("Vis.SollDerEndlicheAutomat")
                + this.robName + Messages.getString("Vis.GespeichertWerden"),
                Messages.getString("Vis.saveGraph"), buttons, null);

        if (!anweisung.equals(alle) && !anweisung.equals(keiner)) {
            nachfrage.setVisible(true);
        }

        if (anweisung.equals(alle) || nachfrage.getResult().equals(ja)
                || nachfrage.getResult().equals(alle)) {

            this.rob.speichereAuts(this.robName);

            if (this.pars.getpngAutSp()) {
                this.savePNG(this.robName);
            }
           
            try {
                FileOutputStream fs = new FileOutputStream(pfad + this.robName
                        + "." + fmg.fmg8.graphVis.Konstanten.KOORD_ENDUNG);
                ObjectOutputStream os = new ObjectOutputStream(fs);
                os.writeObject(this.darstArten);
                os.close();
            } catch (Exception e) {
                throw new RuntimeException(e);
            }
        }

        if (anweisung.equals(alle) || anweisung.equals(keiner)) {
            return anweisung;
        } else {
            return nachfrage.getResult();
        }
    }
View Full Code Here

TOP

Related Classes of fmg.fmg8.graphVis.graph.Graph

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.