* 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;