Drools 4를 사용 중이고 두 개의 해시 맵 값을 == 비교하면 작동하지 않습니다. > =, < =, <,>,! = 같은 다른 모든 연산자는 정상적으로 작동합니다. 나는 아래와 같이 비교하고있다. 나는지도를 사용하고있다. 이 진술에 잘못된 점이 있습니까? 지도 값은 규칙 작업에서 업데이트됩니다. 지도에서 업데이트 된 값을 볼 수 있지만 값 비교는 실패합니다. 나는 값을 업데이트하기 위해 업데이트 (abc)를 사용하고있다.Drools 조건 일치 실패
평가 (. (abc.getValue ("123"))있는 intValue() == (abc.getValue ("456"))있는 intValue()).
규칙 :
rule "008"
salience -18
agenda-group "CAP"
auto-focus true
when
testObj: TestObj(eval(fireNextPriority==true), categoryCount==18,
eval(!firedRules.contains(Integer.valueOf(23449)))
&& (date >= 1263925800000)
&& (date <= 4102338600000) && (date >= 1263925800000) && (date <= 4102338600000)
&& eval(1 == 1)
&& eval(testObj.getVariableValue("C1TC") == testObj.getVariableValue("Y1TC")))
then
System.out.println("Firing rule: CAP - 008");
testObj.setStatus(true);
testObj.setPriority(1);
testObj.addToFiredRules(23449);
update(testObj);
testObj.addVariableValue("C1PC", testObj.getVariableValue("C1PC")-
testObj.getVariableValue("C1OF"));
end
우리가 사용하는
대상 : 사전에
public class TestObj{
Long date;
Integer categoryCount;
boolean status = false;
boolean executeFinalRule = false;
boolean executeFinalRuleForCatg = true;
boolean fireNextPriority = true;
Set<Integer> firedRules = new HashSet<Integer>();
private int priority;
Map<String, Integer> variableValues = new HashMap<String, Integer>();
public Integer getCategoryCount() {
return categoryCount;
}
public void setCategoryCount(Integer categoryCount) {
this.categoryCount = categoryCount;
}
public void increaseCategoryCount(){
this.categoryCount++;
}
public void addVariableValue(String variableCode, Integer count){
if (count < 0) count = 0;
this.variableValues.put(variableCode, count);
}
public Integer getVariableValue(String variableCode){
Integer value = this.variableValues.get(variableCode);
return value == null? 0 : value;
}
public boolean isStatus() {
return status;
}
public Set<Integer> getFiredRules() {
return firedRules;
}
public void setFiredRules(Set<Integer> firedRules) {
this.firedRules = firedRules;
}
public void addToFiredRules(int l){
this.firedRules.add(l);
}
}
감사합니다.
Drools 4는 극히 오래되었고 지원되지 않습니다. - 예상되는 결과를 얻지 못하는 데에는 많은 이유가있을 수 있지만 완전한 규칙 없이는 더 많은 것을 말할 수는 없습니다. abc는 어떻게 선언됩니까? 언급 한지도는 어디에 있습니까? 또한 업데이트가 수행되는 규칙을 표시하십시오! – laune
안녕하세요 Laune, 빠른 응답에 감사드립니다. 내 질문에 세부 사항을 업데이트했습니다. 규칙은 객체의지도 값을 업데이트하고 다음 규칙의 입력 값입니다. == 상태가 실패했습니다. – ravi