* @param ea Der zu mutierende Automat.
* @return Ob eine Bedingung mutiert wurde.
*/
public final boolean mutationBedA(final EndlicherAutomat ea) {
ArrayList<Transition> bedingungen = ea.getBedListe();
Transition aktBed;
String aktString;
String neuString = "";
int pos;
int zufallsindex;
ArrayList<Character> zeichen = new ArrayList<Character>(2);
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.FALSE));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GL));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UNGF));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KLGL));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GRGL));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KL));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GR));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.NUNGF));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UGL));
zeichen.add(new Character(eas.simulation.spatial.sim2D.marbSimulation.Konstanten.TRUE));
boolean links = this.rand.nextBoolean();
boolean oben = this.rand.nextBoolean();
boolean var1 = this.rand.nextBoolean();
boolean var2 = !var1 || this.rand.nextBoolean();
String string1;
String string2;
if (bedingungen.size() > 0) {
zufallsindex = this.rand.nextInt(bedingungen.size());
aktBed = bedingungen.get(zufallsindex);
aktString = aktBed.getCond().formatted();
pos = this.indexZeichen(aktString,
zeichen);
if (aktString.charAt(pos)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.FALSE) {
if (var1) {
int variable1 = StaticMethods.glVertZwischen(
StaticMethods.minVar(this.modus),
StaticMethods.maxVar(this.modus),
this.rand);
string1 = " "
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING + " "
+ eas.miscellaneous.StaticMethods.normZahl(variable1);
} else {
int nummer1 = this.rand.nextInt(255) + 1;
string1 = eas.miscellaneous.StaticMethods.normZahl(nummer1);
}
if (var2) {
int variable2 = StaticMethods.glVertZwischen(
StaticMethods.minVar(this.modus),
StaticMethods.maxVar(this.modus),
this.rand);
string2 = " "
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING + " "
+ eas.miscellaneous.StaticMethods.normZahl(variable2);
} else {
int nummer2 = this.rand.nextInt(255) + 1;
string2 = eas.miscellaneous.StaticMethods.normZahl(nummer2);
}
neuString = aktString.substring(0, pos - 1)
+ string1
+ " " + eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GL + " "
+ string2
+ aktString.substring(pos + 2);
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GL) {
if (links) {
int lGrenze;
int rGrenze;
if (pos >= 6 && aktString.charAt(pos - 6)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING) {
lGrenze = pos - 7;
} else {
lGrenze = pos - 4;
}
if (aktString.charAt(pos + 3)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING) {
rGrenze = pos + 8;
} else {
rGrenze = pos + 5;
}
neuString = aktString.substring(0, lGrenze)
+ " " + eas.simulation.spatial.sim2D.marbSimulation.Konstanten.FALSE + " "
+ aktString.substring(rGrenze);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UNGF
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UNGF) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GL
+ aktString.substring(pos + 1);
} else {
if (oben) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KLGL
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GRGL
+ aktString.substring(pos + 1);
}
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KLGL) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UNGF
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KL
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GRGL) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UNGF
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GR
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KL) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KLGL
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.NUNGF
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GR) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GRGL
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.NUNGF
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.NUNGF) {
if (links) {
if (oben) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.KL
+ aktString.substring(pos + 1);
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.GR
+ aktString.substring(pos + 1);
}
} else {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UGL
+ aktString.substring(pos + 1);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UGL) {
if (links) {
neuString = aktString.substring(0, pos)
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.NUNGF
+ aktString.substring(pos + 1);
} else {
int lGrenze;
int rGrenze;
if (pos >= 6 && aktString.charAt(pos - 6)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING) {
lGrenze = pos - 7;
} else {
lGrenze = pos - 4;
}
if (aktString.charAt(pos + 3)
== eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING) {
rGrenze = pos + 8;
} else {
rGrenze = pos + 5;
}
neuString = aktString.substring(0, lGrenze)
+ " "
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.TRUE
+ " "
+ aktString.substring(rGrenze);
}
}
if (aktString.charAt(pos) == eas.simulation.spatial.sim2D.marbSimulation.Konstanten.TRUE) {
if (var1) {
int variable1 = StaticMethods.glVertZwischen(
StaticMethods.minVar(this.modus),
StaticMethods.maxVar(this.modus),
this.rand);
string1 = " "
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING
+ " "
+ eas.miscellaneous.StaticMethods.normZahl(variable1);
} else {
int nummer1 = this.rand.nextInt(255) + 1;
string1 = eas.miscellaneous.StaticMethods.normZahl(nummer1);
}
if (var2) {
int variable2 = StaticMethods.glVertZwischen(
StaticMethods.minVar(this.modus),
StaticMethods.maxVar(this.modus),
this.rand);
string2 = " "
+ eas.simulation.spatial.sim2D.marbSimulation.Konstanten.EING
+ " "
+ eas.miscellaneous.StaticMethods.normZahl(variable2);
} else {
int nummer2 = this.rand.nextInt(255) + 1;
string2 = eas.miscellaneous.StaticMethods.normZahl(nummer2);
}
neuString = aktString.substring(0, pos - 1)
+ string1
+ " " + eas.simulation.spatial.sim2D.marbSimulation.Konstanten.UGL + " "
+ string2
+ aktString.substring(pos + 2);
}
aktBed.setBedingung(neuString);
return true;
}
return false;
}