Commit 9c197ba2 authored by Falko Schumann's avatar Falko Schumann

Kleine Refaktorierungen

parent 3f2aaab4
......@@ -59,14 +59,14 @@ public final class FuzzyVariable {
Objects.requireNonNull(term, "term");
List<Term> terme = new ArrayList<>(this.terme);
boolean found = false;
boolean gefunden = false;
for (int i = 0; i < terme.size(); i++) {
if (term.getName().equals(terme.get(i).getName())) {
terme.set(i, term);
found = true;
gefunden = true;
}
}
if (!found) {
if (!gefunden) {
terme.add(term);
}
return new FuzzyVariable(name, terme);
......
......@@ -70,14 +70,14 @@ public final class LinguistischeVariable {
Objects.requireNonNull(fuzzySet, "fuzzySet");
List<FuzzySet> fuzzySets = new ArrayList<>(this.fuzzySets);
boolean found = false;
boolean gefunden = false;
for (int i = 0; i < fuzzySets.size(); i++) {
if (fuzzySet.getName().equals(fuzzySets.get(i).getName())) {
fuzzySets.set(i, fuzzySet);
found = true;
gefunden = true;
}
}
if (!found) {
if (!gefunden) {
fuzzySets.add(fuzzySet);
}
return new LinguistischeVariable(name, wertebereich, fuzzySets);
......
......@@ -72,10 +72,11 @@ public final class Regel implements Ausdruck<TermLiteral> {
@Override
public TermLiteral interpretiere(Map<String, ?> kontext) {
Zugehoerigkeit z = Zugehoerigkeit.NULL;
Zugehoerigkeit z;
try {
z = implikation.apply(praemisse.interpretiere(kontext), Zugehoerigkeit.von(sicherheitsgrad.getWert()));
} catch (RuntimeException ignored) {
z = Zugehoerigkeit.NULL;
}
Term term = new Term(konklusion.getTerm(), z);
return new TermLiteral(konklusion.getFuzzyVariable(), term);
......@@ -118,7 +119,7 @@ public final class Regel implements Ausdruck<TermLiteral> {
}
public Regel erzeuge() {
Objects.requireNonNull(konklusion, "konklusion ");
Objects.requireNonNull(konklusion, "konklusion");
return new Regel(praemisse, konklusion, sicherheitsgrad, operator);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment