From 390c32d53969ea7b3162be08a5f4ad3992a89b42 Mon Sep 17 00:00:00 2001 From: agudys Date: Tue, 20 Feb 2024 09:38:34 +0100 Subject: [PATCH] Update in preferredAttributesPerRule/preferredConditionsPerRule parameters: the value of 0 interpreted as the infinity. --- adaa.analytics.rules/build.gradle | 2 +- .../rules/logic/representation/Knowledge.java | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/adaa.analytics.rules/build.gradle b/adaa.analytics.rules/build.gradle index c3562583..acc7b923 100644 --- a/adaa.analytics.rules/build.gradle +++ b/adaa.analytics.rules/build.gradle @@ -27,7 +27,7 @@ codeQuality { } sourceCompatibility = 1.8 -version = '1.7.4' +version = '1.7.5' jar { diff --git a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/representation/Knowledge.java b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/representation/Knowledge.java index 108a3369..a555fb4b 100644 --- a/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/representation/Knowledge.java +++ b/adaa.analytics.rules/src/main/java/adaa/analytics/rules/logic/representation/Knowledge.java @@ -138,13 +138,17 @@ public class Knowledge implements Serializable { /** Gets {@link #preferredConditionsPerRule}. */ public int getPreferredConditionsPerRule() { return preferredConditionsPerRule; } - /** Sets {@link #preferredConditionsPerRule}. */ - public void setPreferredConditionsPerRule(int preferredConditionsPerRule) { this.preferredConditionsPerRule = preferredConditionsPerRule; } + /** Sets {@link #preferredConditionsPerRule}. The value of 0 is translated to the infinity.*/ + public void setPreferredConditionsPerRule(int v) { + this.preferredConditionsPerRule = (v == 0) ? Integer.MAX_VALUE : v; + } /** Gets {@link #preferredAttributesPerRule}. */ public int getPreferredAttributesPerRule() { return preferredAttributesPerRule; } - /** Sets {@link #preferredAttributesPerRule}. */ - public void setPreferredAttributesPerRule(int preferredAttributesPerRule) { this.preferredAttributesPerRule = preferredAttributesPerRule; } + /** Sets {@link #preferredAttributesPerRule}. The value of 0 is translated to the infinity.*/ + public void setPreferredAttributesPerRule(int v) { + this.preferredAttributesPerRule = (v == 0) ? Integer.MAX_VALUE : v; + } /** * Initializes knowledge from collections of initial rules, preferred/forbidden conditions and attributes.