ArrayList<Integer> knot;
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[] endAs = new EndlicherAutomat[endAuts.length];
LinkedList<Transition> trans;
Transition tran;
String[] args = {"log 4"};
if (conds == null
|| endAuts.length != conds.length
|| endAuts.length == 0) {
ParCollection parColl = GlobalVariables.getPrematureParameters();
parColl.overwriteParameterList(args);
StaticMethods.log(StaticMethods.LOG_ERROR,
"Gesamtautomat konnte nicht erzeugt werden.",
parColl);
}
for (int i = 0; i < endAs.length; i++) {
endAs[i] = new EndlicherAutomat();
if (params.getParValueBoolean("UseTranslatorWITHCompletingTransitions")) {
endAs[i].generateFromSequence(
endAuts[i].erzeugeStringSeq(),
eas.simulation.spatial.sim2D.marbSimulation.translator.ConstantsTranslator.getStdTranslatorBE(params),
false, params);
} else {
endAs[i].generateFromSequence(
endAuts[i].erzeugeStringSeq(),
ConstantsTranslatorWOC.getStdTranslatorBE(params),
false, params);
}
if (endAs[i].istLeer()) {
endAs[i].einfuegenKnoten(Integer.MAX_VALUE,
StaticMethods.posSuch(
eas.simulation.ConstantsSimulation.getBefehlNamenArray(params),
"stp"),
1,
1);
endAs[i].setStart(endAs[i].holeKnoten(Integer.MAX_VALUE));
}
}
// Neue Knoten zuordnen.
for (int i = 0; i < endAs.length; i++) {
knotZuord[i] = new HashMap<Integer, Integer>();
knot = new ArrayList<Integer>(endAs[i].holAdj().keySet());
it = knot.iterator();
while (it.hasNext()) {
aktKnNum = it.next();
aktKn = endAs[i].holeKnoten(aktKnNum);
info = aktKn.getInfo();
neu.einfuegenKnoten(lfdNr,
info.getAktion(),
info.getParam(),
info.getAlter());
knotZuord[i].put(aktKnNum, lfdNr);
lfdNr++;
}
}
// Neue Kanten INTER Automaten zuordnen.
for (int i = 0; i < endAs.length; i++) {
zielKn = endAs[i].holeStartzustand();
if (zielKn != null) {
zielKnNum = (Integer) knotZuord[i].get(zielKn.holeName());
neuBed = StaticMethods.ausFormatBed(conds[i].formatted());
for (int j = 0; j < i; j++) {
zwischBed = StaticMethods.ausFormatBed(conds[j].formatted());
zwischBed.negiere();
neuBed = new InnerNode(neuBed,
zwischBed,
eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UND);
}
for (int j = 0; j < endAs.length; j++) {
if (j != i) {
knot = new ArrayList<Integer>(
endAs[j].holAdj().keySet());
it = knot.iterator();
while (it.hasNext()) {
aktKnNum = (Integer) knotZuord[j].get(it.next());
neu.einfuegKante(aktKnNum, zielKnNum, neuBed, 1);
}
}
}
}
}
// Neue Kanten INTRA Automaten zuordnen.
for (int i = 0; i < endAs.length; i++) {
knot1 = new ArrayList<Integer>(endAs[i].holAdj().keySet());
it1 = knot1.iterator();
while (it1.hasNext()) {
numOrig1 = it1.next();
aktKnNum = (Integer) knotZuord[i].get(numOrig1);
aktKn = endAs[i].holeKnoten(numOrig1);
if (aktKn.getInfo() != null
&& aktKn.getInfo().getBedingungen() != null) {
trans = aktKn.getInfo().getBedingungen();
it3 = trans.iterator();
while (it3.hasNext()) {
tran = it3.next();
numOrig2 = tran.getFolgezustand();
zielKnNum = (Integer) knotZuord[i].get(numOrig2);
aktBed = tran.getCond();
if (aktBed != null) {
neu.einfuegKante(aktKnNum, zielKnNum, aktBed, 1);
}
}
}
}
}
// true - Kanten zu den einzelnen Startknoten einfügen.
for (int i = 0; i < endAs.length; i++) {
zielKn = endAs[i].holeStartzustand();
if (zielKn != null) {
zielKnNum = (Integer) knotZuord[i].get(zielKn.holeName());
knot = new ArrayList<Integer>(endAs[i].holAdj().keySet());
it = knot.iterator();
while (it.hasNext()) {