From f53d61a5bca169924af52f45d898b63776d83392 Mon Sep 17 00:00:00 2001 From: Speiger Date: Sun, 4 Dec 2022 08:00:31 +0100 Subject: [PATCH] Fixed bug in the module generator config. --- ModulSettings.json | 81 +++++++++++++++++++ .../speiger/src/builder/SettingsManager.java | 3 +- .../src/builder/modules/BaseModule.java | 1 + .../src/builder/modules/MapModule.java | 2 + 4 files changed, 86 insertions(+), 1 deletion(-) diff --git a/ModulSettings.json b/ModulSettings.json index 1a48122c..0fc6dbba 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -13,6 +13,87 @@ "Base": { "enabled": true }, + "Boolean": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, "Collection": { "enabled": true }, diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index d97e63d8..df08e47b 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -54,8 +54,8 @@ public class SettingsManager data.addProperty(moduleName, true); if(module.isBiModule()) { for(ClassType keyType : ModulePackage.TYPE) { - if(keyType == ClassType.BOOLEAN) continue; for(ClassType valueType : ModulePackage.TYPE) { + if(!module.isModuleValid(keyType, valueType)) continue; JsonObject obj = new JsonObject(); obj.addProperty("enabled", true); for(String key : module.getModuleKeys(keyType, valueType)) { @@ -67,6 +67,7 @@ public class SettingsManager return; } for(ClassType keyType : ModulePackage.TYPE) { + if(!module.isModuleValid(keyType, keyType)) continue; JsonObject obj = new JsonObject(); obj.addProperty("enabled", true); for(String key : module.getModuleKeys(keyType, keyType)) { diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 8523dfa1..8aadcab1 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -57,6 +57,7 @@ public abstract class BaseModule public abstract String getModuleName(); public boolean isBiModule() { return false; } public Set getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); } + public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; } protected boolean isModuleEnabled() { return manager == null || manager.isModuleEnabled(this, keyType, valueType); diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index b0d11da7..e57124fb 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -13,6 +13,8 @@ public class MapModule extends BaseModule protected void loadVariables() {} @Override protected void loadFlags() {} + @Override + public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } @Override protected void loadBlockades()