Package fmg.fmg8.endlAutomat

Examples of fmg.fmg8.endlAutomat.ZInfo


     *          aktuellen Zustand keine Scriptinstruktion decodiert wurde.
     */
    private String naechsterZustand() {
        String inst = "";
        Knoten aktZust = this.holeKnoten(this.aktZustand);
        ZInfo info;
        LinkedList<Transition> bedingungen;
        int aktion;
        int par, parStand;
        int zusatz, zusatzStand;
        int regNumZiel;
        int regNumQuelle;
        int scrAktion;
        int k;
        int zwisch;
       
        if (this.boc || this.eoc) {
            return null;
        }
       
        if (aktZust == null) {
            aktZust = this.holeStartzustand();
           
            if (aktZust == null) {
                return null;
            }
           
            this.aktZustand = aktZust.holeName();
        }
       
        info = aktZust.getInfo();
        aktion = info.getAktion();
       
        // Aktion ermitteln und zusammenstellen.
        if (aktion == Konstanten.AUT_ADD_EDGE
                || aktion == Konstanten.AUT_ADD_NODE
                || aktion == Konstanten.AUT_CHANGE_ACT
                || aktion == Konstanten.AUT_CHANGE_AGE
                || aktion == Konstanten.AUT_CHANGE_PAR
                || aktion == Konstanten.AUT_EXTEND_COND_H
                || aktion == Konstanten.AUT_EXTEND_COND_C
                || aktion == Konstanten.AUT_EXTEND_COND_O
                || aktion == Konstanten.AUT_ERGAENZ_COND) {
            // Topologische Aktionen:
           
            parStand = info.getParam();
            parStand = SonstMeth.modZwischen(
                    parStand,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
           
            if (aktion == Konstanten.AUT_EXTEND_COND_H) {
                k = 255;
            } else if (aktion == Konstanten.AUT_EXTEND_COND_O) {
                // F�r Konstanten siehe Konstanten.autTOscript()
                zwisch = SonstMeth.modZwischen(this.getH(parStand), 4, 16);
                if (zwisch == 12) {
                    zwisch++;
                }
               
                k = Konstanten.autTOscript(zwisch) - zwisch;
//                k = Konstanten.autTOscript(
//                        this.getH(parStand))
//                        - this.getH(parStand);
            } else {
                k = 0;
            }
           
            scrAktion = Konstanten.scrBefNum(aktion);
            inst += scrAktion;
            inst += "," + (this.getH(parStand) + k);
           
            // Zusatzparameter vorhanden?
            if (Const.BEF_PAR[scrAktion] == 2) {
                zusatzStand = info.getAlter();
                zusatzStand = SonstMeth.modZwischen(
                        zusatzStand,
                        SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                        SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
               
                inst += "," + this.getH(zusatzStand);

                // Speichere automatisch den Zusatzparameter in Reg2 (= H102).
                if (aktion != Konstanten.AUT_EXTEND_COND_C
                        && aktion != Konstanten.AUT_EXTEND_COND_H
                        && aktion != Konstanten.AUT_EXTEND_COND_O) {
                    this.setH(
                            Konstanten.SENS_REG_MIN + 1,
                            this.getH(zusatzStand));
                }
            }
           
            // Speichere automatisch den Parameter in Reg1 (= H101).
            if (aktion != Konstanten.AUT_EXTEND_COND_C
                    && aktion != Konstanten.AUT_EXTEND_COND_H
                    && aktion != Konstanten.AUT_EXTEND_COND_O) {
                this.setH(Konstanten.SENS_REG_MIN, this.getH(parStand));
            }
        } else if (aktion == Konstanten.AUT_REG_CONST) {
            // Register-Aktion (Konstante setzen):
           
            par = info.getParam();
            zusatz = info.getAlter();
            regNumZiel = SonstMeth.modZwischen(
                    par,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
            this.setH(regNumZiel, zusatz);
        } else if (aktion == Konstanten.AUT_REG_VAR) {
            // Register-Aktion (anderes Register kopieren):

            par = info.getParam();
            zusatz = info.getAlter();
            regNumQuelle = SonstMeth.modZwischen(
                    par,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
            regNumZiel = SonstMeth.modZwischen(
                    zusatz,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
           
            this.setH(regNumZiel, this.getH(regNumQuelle));
        }
       
        /*
         * IDLE-Aktion (NXT): Bedeutet, dass nur der Code-Zeiger verschoben
         * wird; wird nicht explizit behandelt.
         */

        SonstMeth.log(
                SonstMeth.LOG_STAGE1,
                "Translator: Zustand "
                    + this.aktZustand
                    + ", Token "
                    + this.getAktToken()
                    + " / "
                    + this.getLookAheadToken()
                    + ": "
                    + new Script(inst),
                this.pars);
       
        // Folgezustand festlegen, Code-Zeiger verschieben.
        bedingungen = info.getBeds();
        this.aktZustand = -1;
        for (Transition aktBed : bedingungen) {
            if (aktBed.evaluiere(this)) {
                this.aktZustand = aktBed.getFolgezustand();
                break;
View Full Code Here


     */
    public void selKn(final Knoten knot) {
        String bed;
        int folgeZustand;
        int kantAlter;
        ZInfo zusatz;
        Iterator<Transition> it;
        Transition bedingung;
        String istStart = "";

        this.loescheSelKnot();
        this.aktKnot = knot;

        if (this.aktKnot != null) {
            zusatz = (ZInfo) this.aktKnot.getInfo();

            it = zusatz.getBeds().iterator();
            while (it.hasNext()) {
                bedingung = (Transition) it.next();
                bed = bedingung.getCond().toString();
                folgeZustand = bedingung.getFolgezustand();
                kantAlter = bedingung.getAlter();
                this.ktList.add(bed
                                  + "-"
                                  + folgeZustand
                                  + " ("
                                  + kantAlter
                                  + ")");
            }

            this.aktion.setText("" + zusatz.getAktion());
            this.param.setText("" + zusatz.getParam());
            this.alter.setText("" + zusatz.getAlter());
            if (zusatz.istStartZ()) {
                istStart = Messages.getString("SteuerFenster.IstStart");
            }
            this.zustName.setText("" + knot.holeName() + istStart);
        }
    }
View Full Code Here

     *
     * @param event  Das Event.
     */
    public void itemStateChanged(final ItemEvent event) {
        int pos;
        ZInfo zusatz;
        Transition bed;

        if (event.getSource() == this.ktList) {
            pos = ((Integer) event.getItem()).intValue();
            this.kantenEinstell.setEnabled(true);

            if (this.ktList.getSelectedItem() != null) {
                if (this.ktList.getSelectedItem().equals(
                        Messages.getString("SteuerFenster.KanteNeu"))) {
                    this.beding.setText(
                        Messages.getString("SteuerFenster.Bedingung"));
                    this.folgeZust.setText(
                        Messages.getString("SteuerFenster.FolgeZ"));
                    this.ktAlter.setText(
                        Messages.getString("SteuerFenster.KantAlter"));
                } else {
                    zusatz = (ZInfo) this.aktKnot.getInfo();
                    bed = (Transition) zusatz.getBeds().get(pos);
                    this.beding.setText(bed.getCond().toString());
                    this.folgeZust.setText("" + bed.getFolgezustand());
                    this.ktAlter.setText("" + bed.getAlter());
                }
            }
View Full Code Here

    public void actionPerformed(final ActionEvent event) {
        Object obj = event.getSource();
        String cmd = event.getActionCommand();
        String neueBed;
        int pos;
        ZInfo neuerZusatz;
        String neuFlZst;
        String neuKtAl;
        String[] elemente;
        boolean grammOk = true;
        Iterator<Vis> itG;
        String[] altSeq = this.aktGrph.getRob().erzeugeStrSeqs();
        Condition[] altCond = this.aktGrph.getRob().getConds();
        String befehl;

        befehl = ""
            + SonstMeth.posSuch(Konstanten.BEF,
                                this.aktion.getText());

        this.setCursor(new Cursor(Cursor.WAIT_CURSOR));

        itG = this.graphen.iterator();
        while (itG.hasNext()) {
            ((Vis) itG.next()).setCursor(new Cursor(Cursor.WAIT_CURSOR));
        }

        try {
            if (obj instanceof Button) {
                if (cmd.equals(Messages.getString(
                        "SteuerFenster.Autoanordnung"))) {
                    this.aktGrph.zuruecksetzen();
                } else if (cmd.equals(Messages.getString(
                        "SteuerFenster.Beenden"))) {
                    WindowClosingAdapter ende
                        = new WindowClosingAdapter(true, this);
                    ende.schliesseExt(this);
                } else if (cmd.equals(Messages.getString(
                        "SteuerFenster.Uebernehmen"))
                           && this.aktKnot != null) {
                    AllgemeinerDialog dia;
                    ArrayList<String> buttons = new ArrayList<String>();
                    buttons.add(Messages.getString("SteuerFenster.OK"));

                    if (!this.byteErk.erkenne(befehl)) {
                        dia = new AllgemeinerDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + befehl
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (!this.byteErk.erkenne(this.param.getText())) {
                        dia = new AllgemeinerDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + this.param.getText()
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (!this.byteErk.erkenne(this.alter.getText())) {
                        dia = new AllgemeinerDialog(this,
                                        null,
                                        Messages.getString(
                                           "SteuerFenster.Earley"),
                                        buttons,
                                        "<"
                                        + this.alter.getText()
                                        + ">\n\n\n"
                                        + this.byteErk.toString());
                        dia.setVisible(true);
                        grammOk = grammOk & false;
                    }
                    if (this.ktList.getSelectedItems().length > 0) {
                        this.beding.setText(
                                EndlicherAutomat.formatBed(
                                        this.beding.getText()));
                       
                        if (!this.bedgErk.erkenne(this.beding.getText())) {
                            dia = new AllgemeinerDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.beding.getText()
                                            + ">\n\n\n"
                                            + this.bedgErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                        if (!this.byteErk.erkenne(this.folgeZust.getText())) {
                            dia = new AllgemeinerDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.folgeZust.getText()
                                            + ">\n\n\n"
                                            + this.byteErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                        if (!this.byteErk.erkenne(this.ktAlter.getText())) {
                            dia = new AllgemeinerDialog(this,
                                            null,
                                            Messages.getString(
                                               "SteuerFenster.Earley"),
                                            buttons,
                                            "<"
                                            + this.ktAlter.getText()
                                            + ">\n\n\n"
                                            + this.byteErk.toString());
                            dia.setVisible(true);
                            grammOk = grammOk & false;
                        }
                    } else {
                        grammOk = grammOk & true;
                    }

                    if (grammOk) {
                        boolean istStart
                            = this.aktGrph.getRob().istStartZ(
                                    this.aktGrph.getAktAut(),
                                    this.aktKnot);
                        if (this.ktList.getSelectedItem() != null
                            && !this.beding.getText().equals(
                                Messages.getString("SteuerFenster.Bedingung"))
                            && !this.folgeZust.getText().equals(
                                Messages.getString("SteuerFenster.FolgeZ"))
                            && !this.ktAlter.getText().equals(
                                Messages.getString("SteuerFenster.KantAlter"))
                            && !this.beding.getText().equals("")
                            && !this.folgeZust.getText().equals("")
                            && !this.ktAlter.getText().equals("")) {
                            pos = this.ktList.getSelectedIndex();
                            neueBed = SonstMeth.ausFormatBed(
                                          this.beding.getText())
                                      + "-"
                                      + this.folgeZust.getText()
                                      + " ("
                                      + this.ktAlter.getText()
                                      + ")";
                            this.ktList.replaceItem(neueBed, pos);
                        }
                        this.aktKnot.loescheAlleNachfolger();
                        if (this.alter.getText().equals("")) {
                            this.alter.setText("1");
                        }
                        neuerZusatz = new ZInfo(
                                Integer.parseInt(befehl),
                                Integer.parseInt(this.param.getText()),
                                null,
                                istStart,
                                Integer.parseInt(this.alter.getText()));
View Full Code Here

        ArrayList<Integer> knot1;
        Iterator<Integer> it, it1;
        Iterator<Transition> it3;
        Integer aktKnNum;
        Knoten aktKn;
        ZInfo info;
        Knoten zielKn;
        Integer zielKnNum;
        Condition aktBed;
        Condition neuBed = null;
        Condition zwischBed;
        int numOrig1, numOrig2;
        int idlBefehl;
        EndlicherAutomat[] eas = new EndlicherAutomat[endAuts.length];
        LinkedList<Transition> trans;
        Transition tran;
        String[] args = {"log 4"};
       
        if (endAuts == null
                || conds == null
                || endAuts.length != conds.length
                || endAuts.length == 0) {
            SonstMeth.log(SonstMeth.LOG_ERROR,
                          "Gesamtautomat konnte nicht erzeugt werden.",
                          new Parametersatz(args));
        }
       
        for (int i = 0; i < eas.length; i++) {
            eas[i] = new EndlicherAutomat();
            eas[i].erzeugeAusSequenz(
                    endAuts[i].erzeugeStringSeq(),
                    fmg.fmg8.endlAutomat.translator.Konstanten.STD_TRANSL_BE,
                    false);
           
            if (eas[i].istLeer()) {
                eas[i].einfuegenKnoten(Integer.MAX_VALUE,
                        SonstMeth.posSuch(
                                fmg.fmg8.umgebung2D.Konstanten.BEF,
                                "stp"),
                        1,
                        1);
               
                eas[i].setStart(eas[i].holeKnoten(Integer.MAX_VALUE));
            }
        }
       
        // Neue Knoten zuordnen.
        for (int i = 0; i < eas.length; i++) {
            knotZuord[i] = new HashMap<Integer, Integer>();
           
            knot = new ArrayList<Integer>(eas[i].holAdj().keySet());
            it = knot.iterator();

            while (it.hasNext()) {
                aktKnNum = it.next();
                aktKn = eas[i].holeKnoten(aktKnNum);
                info = aktKn.getInfo();
                neu.einfuegenKnoten(lfdNr,
                                    info.getAktion(),
                                    info.getParam(),
                                    info.getAlter());
               
                knotZuord[i].put(aktKnNum, lfdNr);
                lfdNr++;
            }
        }
View Full Code Here

     *          aktuellen Zustand keine Scriptinstruktion decodiert wurde.
     */
    private String naechsterZustand() {
        String inst = "";
        Knoten aktZust = this.holeKnoten(this.aktZustand);
        ZInfo info;
        LinkedList<Transition> bedingungen;
        int aktion;
        int par, parStand;
        int zusatz, zusatzStand;
        int regNumZiel;
        int regNumQuelle;
        int scrAktion;
        int k;
       
        if (this.boc || this.eoc) {
            return null;
        }
       
        if (aktZust == null) {
            aktZust = this.holeStartzustand();
           
            if (aktZust == null) {
                return null;
            }
           
            this.aktZustand = aktZust.holeName();
        }
       
        info = aktZust.getInfo();
       
        aktion = info.getAktion();
       
        // Aktion ermitteln und zusammenstellen.
        if (aktion == Konstanten.AUT_ADD_EDGE
                || aktion == Konstanten.AUT_ADD_NODE
                || aktion == Konstanten.AUT_CHANGE_ACT
                || aktion == Konstanten.AUT_CHANGE_AGE
                || aktion == Konstanten.AUT_CHANGE_PAR
                || aktion == Konstanten.AUT_EXTEND_COND_H
                || aktion == Konstanten.AUT_EXTEND_COND_C
                || aktion == Konstanten.AUT_EXTEND_COND_O) {
            // Topologische Aktionen:
           
            if (aktion == Konstanten.AUT_EXTEND_COND_H) {
                k = 255;
            } else if (aktion == Konstanten.AUT_EXTEND_COND_O) {
                k = Konstanten.autTOscript(
                        this.getH(info.getParam()))
                        - this.getH(info.getParam());
            } else {
                k = 0;
            }
           
            parStand = info.getParam();
            parStand = SonstMeth.modZwischen(
                    parStand,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
           
            scrAktion = Konstanten.scrBefNum(aktion);
            inst += scrAktion;
            inst += "," + (this.getH(parStand) + k);
           
            if (Const.BEF_PAR[scrAktion] == 2) {
                zusatzStand = info.getAlter();
                zusatzStand = SonstMeth.modZwischen(
                        zusatzStand,
                        SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                        SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));

                inst += "," + this.getH(zusatzStand);

                // Speichere automatisch den Zusatzparameter in Reg2 (= H102).
                if (aktion != Konstanten.AUT_EXTEND_COND_C
                        && aktion != Konstanten.AUT_EXTEND_COND_H
                        && aktion != Konstanten.AUT_EXTEND_COND_O) {
                    this.setH(
                            Konstanten.SENS_REG_MIN + 1,
                            this.getH(zusatzStand));
                }
            }
           
            // Speichere automatisch den Parameter in Reg1 (= H101).
            if (aktion != Konstanten.AUT_EXTEND_COND_C
                    && aktion != Konstanten.AUT_EXTEND_COND_H
                    && aktion != Konstanten.AUT_EXTEND_COND_O) {
                this.setH(Konstanten.SENS_REG_MIN, this.getH(parStand));
            }
        } else if (aktion == Konstanten.AUT_REG_CONST) {
            // Register-Aktion (Konstante setzen):
           
            par = info.getParam();
            zusatz = info.getAlter();
            regNumZiel = SonstMeth.modZwischen(
                    par,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
            this.setH(regNumZiel, zusatz);
        } else if (aktion == Konstanten.AUT_REG_VAR) {
            // Register-Aktion (anderes Register kopieren):

            par = info.getParam();
            zusatz = info.getAlter();
            regNumQuelle = SonstMeth.modZwischen(
                    par,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
            regNumZiel = SonstMeth.modZwischen(
                    zusatz,
                    SonstMeth.minVar(SonstMeth.MODUS_TRANSLATOR),
                    SonstMeth.maxVar(SonstMeth.MODUS_TRANSLATOR));
           
            this.setH(regNumZiel, this.getH(regNumQuelle));
        }
       
        /*
         * IDLE-Aktion (NXT): Bedeutet, dass nur der Code-Zeiger verschoben
         * wird; wird nicht explizit behandelt.
         */

        SonstMeth.log(
                SonstMeth.LOG_STAGE1,
                "Translator: Zustand "
                    + this.aktZustand
                    + ", Token "
                    + this.getAktToken()
                    + " / "
                    + this.getLookAheadToken()
                    + ": "
                    + new Script(inst),
                this.pars);
       
        // Folgezustand festlegen, Code-Zeiger verschieben.
        bedingungen = info.getBeds();
        this.aktZustand = -1;
        for (Transition aktBed : bedingungen) {
            if (aktBed.evaluiere(this)) {
                this.aktZustand = aktBed.getFolgezustand();
                break;
View Full Code Here

                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);
View Full Code Here

     *            Der Zusatzparameter.
     */
    public void update(final Observable o, final Object arg) {
        Knoten k;
        AutomatenNummer aN;
        ConditionNummer cN;
        int autNum;

        if (arg == null) {
            return;
        }

        if (arg.getClass().equals(Integer.class)) {
            // Neuer Automat wurde ausgew�hlt.
            autNum = ((Integer) arg).intValue();
            this.benutztAut = autNum;
            this.selectAktAut(false, autNum);
        } else if (arg.getClass().equals(Knoten.class)) {
            // Neuer Knoten wurde ausgew�hlt.
            k = (Knoten) arg;
            this.selKnoten(k, this.benutztAut);
        } else if (arg.getClass().equals(AutomatenNummer.class)) {
            // Sequenz wurde ver�ndert.
            aN = (AutomatenNummer) arg;
            this.erzeugeAusSequenz(aN.getAutNum(),
                                   aN.getSequenz(),
                                   null,
                                   false);
        } else if (arg.getClass().equals(ConditionNummer.class)) {
            // Bedingungen wurden ver�ndert.
            cN = (ConditionNummer) arg;
            this.setzeCond(cN.getAutNum(), cN.getSequenz());
           
            for (VisTrans v : this.aktVisTrans) {
                v.neuZeichnen();
            }
        }
View Full Code Here

        for (int i = 0; i < this.conds.length; i++) {
            this.conds[i] = this.mut.mutiere(this.conds[i]);
            if (this.isSelektiert()) {
                this.vAut[i].setzeChanged();
                this.vAut[i].notifyObservers(
                        new ConditionNummer(this.conds[i].toString(),
                                            i));
            }
        }
    }
View Full Code Here

            this.conds[autNum] = cond;
           
            if (this.isSelektiert()) {
                this.vAut[autNum].setzeChanged();
                this.vAut[autNum].notifyObservers(
                        new ConditionNummer(this.conds[autNum].toString(),
                                            autNum));
            }
        }
       
        if (this.isSelektiert()) {
View Full Code Here

TOP

Related Classes of fmg.fmg8.endlAutomat.ZInfo

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.