comments
This commit is contained in:
parent
263ffa8a79
commit
881f453854
|
|
@ -521,11 +521,13 @@ public class Simulator extends Thread {
|
||||||
int valueHighestNear = table.highestNear(x,y);
|
int valueHighestNear = table.highestNear(x,y);
|
||||||
if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() ==0 &&
|
if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() ==0 &&
|
||||||
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() ==0) {
|
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() ==0) {
|
||||||
|
//both conditions lists are empty, directly take if value
|
||||||
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
||||||
|
|
||||||
|
|
||||||
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() !=0 &&
|
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() !=0 &&
|
||||||
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() == 0) {
|
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() == 0) {
|
||||||
|
//only countnear condition
|
||||||
if (ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().contains(valueCountNear)){
|
if (ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().contains(valueCountNear)){
|
||||||
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -534,16 +536,21 @@ public class Simulator extends Thread {
|
||||||
|
|
||||||
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() ==0 &&
|
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() ==0 &&
|
||||||
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() != 0) {
|
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() != 0) {
|
||||||
|
//only highest near condition
|
||||||
if (ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().contains(valueHighestNear)){
|
if (ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().contains(valueHighestNear)){
|
||||||
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getIfValue());
|
||||||
}else{
|
}else{
|
||||||
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getElseValue());
|
tempTable.getCell(x, y).setValue(ruleArrayList.get(table.getCell(x, y).getValue()).getElseValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear() !=null &&
|
} else if ( ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().size() !=0 &&
|
||||||
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear() != null) {
|
ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().size() != 0) {
|
||||||
|
//both conditions
|
||||||
|
if (ruleArrayList.get(table.getCell(x, y).getValue()).getConditionHighestNear().contains(valueHighestNear)
|
||||||
|
&& ruleArrayList.get(table.getCell(x, y).getValue()).getConditionCountNear().contains(valueCountNear)){
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//DEBUG:
|
//DEBUG:
|
||||||
//System.out.println("applying rule to cell: "+x+", "+y + " | countnear = " + valueCountNear + " | new cell value = " + tempTable.getCell(x,y).getValue());
|
//System.out.println("applying rule to cell: "+x+", "+y + " | countnear = " + valueCountNear + " | new cell value = " + tempTable.getCell(x,y).getValue());
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue