forked from Speiger/Primitive-Collections
Improving Dependency Checks to be more recursive.
This commit is contained in:
parent
cc92ef953a
commit
1b1ec4b87a
|
@ -30,7 +30,7 @@ public class SettingsManager
|
|||
if(!isEnabled(result, "Enabled")) return false;
|
||||
}
|
||||
result = getObject(result, base.getModuleName(), false);
|
||||
return result.size() <= 0 || isEnabled(result, "Enabled");
|
||||
return (result.size() <= 0 || isEnabled(result, "Enabled")) && base.areDependenciesLoaded();
|
||||
}
|
||||
|
||||
public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry)
|
||||
|
@ -44,7 +44,7 @@ public class SettingsManager
|
|||
if(!isEnabled(result, "Enabled")) return false;
|
||||
}
|
||||
result = getObject(result, base.getModuleName(), false);
|
||||
return result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry));
|
||||
return (result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry))) && base.areDependenciesLoaded();
|
||||
}
|
||||
|
||||
public void addModule(BaseModule module) {
|
||||
|
|
|
@ -16,7 +16,7 @@ public class AsyncModule extends BaseModule
|
|||
@Override
|
||||
protected void loadFunctions() {}
|
||||
@Override
|
||||
protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
@Override
|
||||
protected void loadBlockades() {
|
||||
if(!isModuleEnabled()) {
|
||||
|
|
|
@ -60,11 +60,11 @@ public abstract class BaseModule
|
|||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; }
|
||||
|
||||
protected boolean isModuleEnabled() {
|
||||
return manager == null || (manager.isModuleEnabled(this, keyType, valueType) && areDependenciesLoaded());
|
||||
return manager == null || manager.isModuleEnabled(this, keyType, valueType);
|
||||
}
|
||||
|
||||
protected boolean isModuleEnabled(String name) {
|
||||
return manager == null || (manager.isModuleEnabled(this, keyType, valueType, name) && areDependenciesLoaded());
|
||||
return manager == null || manager.isModuleEnabled(this, keyType, valueType, name);
|
||||
}
|
||||
|
||||
protected boolean isDependencyLoaded(BaseModule module) {
|
||||
|
@ -75,7 +75,7 @@ public abstract class BaseModule
|
|||
return manager == null || (module.isBiModule() ? manager.isModuleEnabled(module, keyType, valueType) : (key ? manager.isModuleEnabled(module, keyType, keyType) : manager.isModuleEnabled(module, valueType, valueType)));
|
||||
}
|
||||
|
||||
protected boolean areDependenciesLoaded() {
|
||||
public boolean areDependenciesLoaded() {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,8 @@ public class CollectionModule extends BaseModule
|
|||
protected void loadVariables() {}
|
||||
@Override
|
||||
protected void loadFlags() {}
|
||||
|
||||
@Override
|
||||
public boolean areDependenciesLoaded(){ return isDependencyLoaded(JavaModule.INSTANCE); }
|
||||
@Override
|
||||
protected void loadBlockades()
|
||||
{
|
||||
|
|
|
@ -45,7 +45,7 @@ public class ListModule extends BaseModule
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean areDependenciesLoaded() {
|
||||
public boolean areDependenciesLoaded() {
|
||||
return isDependencyLoaded(CollectionModule.INSTANCE);
|
||||
}
|
||||
|
||||
|
|
|
@ -19,6 +19,8 @@ public class MapModule extends BaseModule
|
|||
protected void loadVariables() {}
|
||||
@Override
|
||||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
||||
@Override
|
||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); }
|
||||
|
||||
@Override
|
||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType)
|
||||
|
@ -34,11 +36,6 @@ public class MapModule extends BaseModule
|
|||
return sets;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean areDependenciesLoaded() {
|
||||
return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadFlags()
|
||||
{
|
||||
|
|
|
@ -16,7 +16,7 @@ public class PrioQueueModule extends BaseModule
|
|||
@Override
|
||||
protected void loadFunctions() {}
|
||||
@Override
|
||||
protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
@Override
|
||||
protected void loadBlockades()
|
||||
{
|
||||
|
|
|
@ -19,7 +19,7 @@ public class SetModule extends BaseModule
|
|||
@Override
|
||||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
||||
@Override
|
||||
protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||
@Override
|
||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
||||
Set<String> sets = new HashSet<>();
|
||||
|
|
Loading…
Reference in New Issue