Fixing a few things and testing more. Not useable atm.
This commit is contained in:
parent
54aae530a1
commit
cdcf5dc087
2612
ModulSettings.json
2612
ModulSettings.json
File diff suppressed because it is too large
Load Diff
|
@ -128,10 +128,12 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
for(int i = 0,m=modules.size();i<m;i++) {
|
for(int i = 0,m=modules.size();i<m;i++) {
|
||||||
modules.get(i).setManager(manager);
|
modules.get(i).setManager(manager);
|
||||||
}
|
}
|
||||||
|
manager.resolve();
|
||||||
for(int i = 0,m=modules.size();i<m;i++) {
|
for(int i = 0,m=modules.size();i<m;i++) {
|
||||||
biPackages.forEach(modules.get(i)::init);
|
biPackages.forEach(modules.get(i)::init);
|
||||||
}
|
}
|
||||||
modules.forEach(BaseModule::cleanup);
|
modules.forEach(BaseModule::cleanup);
|
||||||
|
manager.printModuleSettings(Arrays.asList(MapModule.INSTANCE));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void finishPackages() {
|
private void finishPackages() {
|
||||||
|
@ -212,7 +214,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
boolean force = flags.contains("force");
|
boolean force = flags.contains("force");
|
||||||
boolean tests = flags.contains("tests");
|
boolean tests = flags.contains("tests");
|
||||||
boolean forceTests = flags.contains("force-tests");
|
boolean forceTests = flags.contains("force-tests");
|
||||||
boolean load = flags.contains("load");
|
boolean load = !flags.contains("load");
|
||||||
boolean save = flags.contains("save");
|
boolean save = flags.contains("save");
|
||||||
int flag = (load ? LOAD : 0) | (save ? SAVE : 0);
|
int flag = (load ? LOAD : 0) | (save ? SAVE : 0);
|
||||||
new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force);
|
new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force);
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package speiger.src.builder;
|
package speiger.src.builder;
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.OutputStreamWriter;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Paths;
|
import java.nio.file.Paths;
|
||||||
|
import java.util.LinkedHashSet;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.TreeSet;
|
import java.util.TreeSet;
|
||||||
|
|
||||||
|
@ -11,6 +15,7 @@ import com.google.gson.JsonParser;
|
||||||
import com.google.gson.internal.Streams;
|
import com.google.gson.internal.Streams;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
import speiger.src.builder.modules.BaseModule;
|
import speiger.src.builder.modules.BaseModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
|
@ -19,36 +24,43 @@ public class SettingsManager
|
||||||
boolean loaded;
|
boolean loaded;
|
||||||
JsonObject data = new JsonObject();
|
JsonObject data = new JsonObject();
|
||||||
Set<String> moduleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
Set<String> moduleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
|
||||||
|
Set<IDependency> allDependencies = new LinkedHashSet<>();
|
||||||
|
|
||||||
public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType) {
|
public void resolve() {
|
||||||
if(!loaded) return true;
|
boolean valid = true;
|
||||||
if(!isEnabled(data, base.getModuleName())) return false;
|
for(int i = 0;i<10000 && valid;i++) {
|
||||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
boolean result = false;
|
||||||
if(!isEnabled(result, "Enabled")) return false;
|
for(IDependency entry : allDependencies) {
|
||||||
if(base.isBiModule()) {
|
result |= entry.resolveDependencies();
|
||||||
result = getObject(result, valueType.getClassPath(), false);
|
|
||||||
if(!isEnabled(result, "Enabled")) return false;
|
|
||||||
}
|
}
|
||||||
result = getObject(result, base.getModuleName(), false);
|
valid = result;
|
||||||
return (result.size() <= 0 || isEnabled(result, "Enabled")) && base.areDependenciesLoaded();
|
|
||||||
}
|
}
|
||||||
|
if(valid) throw new RuntimeException("Couldn't resolve dependencies!");
|
||||||
public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry)
|
|
||||||
{
|
|
||||||
if(!loaded) return true;
|
|
||||||
if(!isEnabled(data, base.getModuleName())) return false;
|
|
||||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
|
||||||
if(!isEnabled(result, "Enabled")) return false;
|
|
||||||
if(base.isBiModule()) {
|
|
||||||
result = getObject(result, valueType.getClassPath(), false);
|
|
||||||
if(!isEnabled(result, "Enabled")) return false;
|
|
||||||
}
|
|
||||||
result = getObject(result, base.getModuleName(), false);
|
|
||||||
return (result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry))) && base.areDependenciesLoaded();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addModule(BaseModule module) {
|
public void addModule(BaseModule module) {
|
||||||
if(loaded) return;
|
if(loaded) {
|
||||||
|
if(module.isBiModule()) {
|
||||||
|
for(ClassType keyType : ModulePackage.TYPE) {
|
||||||
|
for(ClassType valueType : ModulePackage.TYPE) {
|
||||||
|
if(!module.isModuleValid(keyType, valueType)) continue;
|
||||||
|
for(IDependency dependency : module.getDependencies(keyType, valueType)) {
|
||||||
|
dependency.load(data, keyType, valueType);
|
||||||
|
allDependencies.add(dependency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(ClassType keyType : ModulePackage.TYPE) {
|
||||||
|
if(!module.isModuleValid(keyType, keyType)) continue;
|
||||||
|
for(IDependency dependency : module.getDependencies(keyType, keyType)) {
|
||||||
|
dependency.load(data, keyType, keyType);
|
||||||
|
allDependencies.add(dependency);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
String moduleName = module.getModuleName();
|
String moduleName = module.getModuleName();
|
||||||
moduleNames.add(moduleName);
|
moduleNames.add(moduleName);
|
||||||
data.addProperty(moduleName, true);
|
data.addProperty(moduleName, true);
|
||||||
|
@ -57,9 +69,10 @@ public class SettingsManager
|
||||||
for(ClassType valueType : ModulePackage.TYPE) {
|
for(ClassType valueType : ModulePackage.TYPE) {
|
||||||
if(!module.isModuleValid(keyType, valueType)) continue;
|
if(!module.isModuleValid(keyType, valueType)) continue;
|
||||||
JsonObject obj = new JsonObject();
|
JsonObject obj = new JsonObject();
|
||||||
obj.addProperty("Enabled", true);
|
for(IDependency dependency : module.getDependencies(keyType, valueType)) {
|
||||||
for(String key : module.getModuleKeys(keyType, valueType)) {
|
String key = dependency.getName();
|
||||||
obj.addProperty(key, true);
|
if(key != null) obj.addProperty(key, true);
|
||||||
|
dependency.setLoaded();
|
||||||
}
|
}
|
||||||
addModule(keyType, valueType, true, moduleName, obj);
|
addModule(keyType, valueType, true, moduleName, obj);
|
||||||
}
|
}
|
||||||
|
@ -69,14 +82,55 @@ public class SettingsManager
|
||||||
for(ClassType keyType : ModulePackage.TYPE) {
|
for(ClassType keyType : ModulePackage.TYPE) {
|
||||||
if(!module.isModuleValid(keyType, keyType)) continue;
|
if(!module.isModuleValid(keyType, keyType)) continue;
|
||||||
JsonObject obj = new JsonObject();
|
JsonObject obj = new JsonObject();
|
||||||
obj.addProperty("Enabled", true);
|
for(IDependency dependency : module.getDependencies(keyType, keyType)) {
|
||||||
for(String key : module.getModuleKeys(keyType, keyType)) {
|
String key = dependency.getName();
|
||||||
obj.addProperty(key, true);
|
if(key != null) obj.addProperty(key, true);
|
||||||
|
dependency.setLoaded();
|
||||||
}
|
}
|
||||||
addModule(keyType, keyType, false, moduleName, obj);
|
addModule(keyType, keyType, false, moduleName, obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void printModuleSettings(List<BaseModule> modules) {
|
||||||
|
JsonObject data = new JsonObject();
|
||||||
|
for(BaseModule module : modules) {
|
||||||
|
String moduleName = module.getModuleName();
|
||||||
|
if(module.isBiModule()) {
|
||||||
|
for(ClassType keyType : ModulePackage.TYPE) {
|
||||||
|
for(ClassType valueType : ModulePackage.TYPE) {
|
||||||
|
if(!module.isModuleValid(keyType, valueType)) continue;
|
||||||
|
JsonObject obj = new JsonObject();
|
||||||
|
for(IDependency dependency : module.getDependencies(keyType, valueType)) {
|
||||||
|
String key = dependency.getName();
|
||||||
|
if(key != null) obj.addProperty(key, dependency.getState(keyType, valueType).getJsonResult());
|
||||||
|
}
|
||||||
|
addModule(data, keyType, valueType, true, moduleName, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
for(ClassType keyType : ModulePackage.TYPE) {
|
||||||
|
if(!module.isModuleValid(keyType, keyType)) continue;
|
||||||
|
JsonObject obj = new JsonObject();
|
||||||
|
for(IDependency dependency : module.getDependencies(keyType, keyType)) {
|
||||||
|
String key = dependency.getName();
|
||||||
|
if(key != null) obj.addProperty(key, dependency.getState(keyType, keyType).getJsonResult());
|
||||||
|
}
|
||||||
|
addModule(data, keyType, keyType, false, moduleName, obj);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
System.out.println();
|
||||||
|
JsonWriter writer = new JsonWriter(new OutputStreamWriter(System.out));
|
||||||
|
writer.setIndent("\t");
|
||||||
|
Streams.write(data, writer);
|
||||||
|
writer.flush();
|
||||||
|
System.out.println();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void load() {
|
public void load() {
|
||||||
try(BufferedReader reader = Files.newBufferedReader(Paths.get("ModulSettings.json"))) {
|
try(BufferedReader reader = Files.newBufferedReader(Paths.get("ModulSettings.json"))) {
|
||||||
data = JsonParser.parseReader(reader).getAsJsonObject();
|
data = JsonParser.parseReader(reader).getAsJsonObject();
|
||||||
|
@ -100,6 +154,14 @@ public class SettingsManager
|
||||||
catch(Exception e) { e.printStackTrace(); }
|
catch(Exception e) { e.printStackTrace(); }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addModule(JsonObject data, ClassType keyType, ClassType valueType, boolean bi, String moduleName, JsonObject obj) {
|
||||||
|
JsonObject result = getObject(data, keyType.getClassPath(), true);
|
||||||
|
if(bi) {
|
||||||
|
result = getObject(result, valueType.getClassPath(), true);
|
||||||
|
}
|
||||||
|
result.add(moduleName, obj);
|
||||||
|
}
|
||||||
|
|
||||||
private void addModule(ClassType keyType, ClassType valueType, boolean bi, String moduleName, JsonObject obj) {
|
private void addModule(ClassType keyType, ClassType valueType, boolean bi, String moduleName, JsonObject obj) {
|
||||||
JsonObject result = getObject(data, keyType.getClassPath(), true);
|
JsonObject result = getObject(data, keyType.getClassPath(), true);
|
||||||
if(bi) {
|
if(bi) {
|
||||||
|
@ -117,9 +179,4 @@ public class SettingsManager
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isEnabled(JsonObject obj, String key) {
|
|
||||||
if(obj.has(key)) return obj.getAsJsonPrimitive(key).getAsBoolean();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,6 @@ public abstract class DependencyBase implements IDependency {
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract boolean resolveDependencies();
|
|
||||||
|
|
||||||
protected LoadingState getChildState(ClassType keyType, ClassType valueType) {
|
protected LoadingState getChildState(ClassType keyType, ClassType valueType) {
|
||||||
LoadingState state = LoadingState.UNDEFINED;
|
LoadingState state = LoadingState.UNDEFINED;
|
||||||
for(IDependency child : children) {
|
for(IDependency child : children) {
|
||||||
|
|
|
@ -60,6 +60,16 @@ public abstract class DependencyFunction extends DependencyBase {
|
||||||
}
|
}
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return functionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
Arrays.fill(state, LoadingState.LOADED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BiTypeFunction extends DependencyFunction {
|
public static class BiTypeFunction extends DependencyFunction {
|
||||||
|
@ -105,5 +115,17 @@ public abstract class DependencyFunction extends DependencyBase {
|
||||||
}
|
}
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return functionName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
for(int i = 0;i<state.length;i++) {
|
||||||
|
Arrays.fill(state[i], LoadingState.LOADED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,16 @@ public abstract class DependencyModule extends DependencyBase {
|
||||||
}
|
}
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Enabled";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
Arrays.fill(state, LoadingState.LOADED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static class BiTypeModule extends DependencyModule {
|
public static class BiTypeModule extends DependencyModule {
|
||||||
|
@ -106,37 +116,41 @@ public abstract class DependencyModule extends DependencyBase {
|
||||||
}
|
}
|
||||||
return returnType;
|
return returnType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Enabled";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
for(int i = 0;i<state.length;i++) {
|
||||||
|
Arrays.fill(state[i], LoadingState.LOADED);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LoadingState isModuleEnabled(JsonObject data, ClassType keyType, ClassType valueType) {
|
protected LoadingState isModuleEnabled(JsonObject data, ClassType keyType, ClassType valueType) {
|
||||||
LoadingState state = isEnabled(data, owner.getModuleName());
|
LoadingState state = isEnabled(data, owner.getModuleName());
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
||||||
state = isEnabled(result, "Enabled");
|
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
if(owner.isBiModule()) {
|
if(owner.isBiModule()) {
|
||||||
result = getObject(result, valueType.getClassPath(), false);
|
result = getObject(result, valueType.getClassPath(), false);
|
||||||
state = isEnabled(result, "Enabled");
|
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||||
if (state != LoadingState.UNDEFINED) return state;
|
|
||||||
}
|
}
|
||||||
return isEnabled(getObject(result, owner.getModuleName(), false), "Enabled");
|
return state = state.replaceIfDefined(isEnabled(getObject(result, owner.getModuleName(), false), "Enabled"));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LoadingState isModuleEnabled(JsonObject data, ClassType keyType, ClassType valueType, String entry) {
|
protected LoadingState isModuleEnabled(JsonObject data, ClassType keyType, ClassType valueType, String entry) {
|
||||||
LoadingState state = isEnabled(data, owner.getModuleName());
|
LoadingState state = isEnabled(data, owner.getModuleName());
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
||||||
state = isEnabled(result, "Enabled");
|
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
if(owner.isBiModule()) {
|
if(owner.isBiModule()) {
|
||||||
result = getObject(result, valueType.getClassPath(), false);
|
result = getObject(result, valueType.getClassPath(), false);
|
||||||
state = isEnabled(result, "Enabled");
|
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
}
|
}
|
||||||
result = getObject(result, owner.getModuleName(), false);
|
result = getObject(result, owner.getModuleName(), false);
|
||||||
state = isEnabled(result, "Enabled");
|
return state.replaceIfDefined(isEnabled(result, "Enabled")).replaceIfDefined(isEnabled(result, entry));
|
||||||
if(state != LoadingState.UNDEFINED) return state;
|
|
||||||
return isEnabled(result, entry);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private JsonObject getObject(JsonObject data, String name, boolean create) {
|
private JsonObject getObject(JsonObject data, String name, boolean create) {
|
||||||
|
@ -144,15 +158,13 @@ public abstract class DependencyModule extends DependencyBase {
|
||||||
if(obj == null) {
|
if(obj == null) {
|
||||||
obj = new JsonObject();
|
obj = new JsonObject();
|
||||||
data.add(name, obj);
|
data.add(name, obj);
|
||||||
if (create)
|
if(create) obj.addProperty("Enabled", true);
|
||||||
obj.addProperty("Enabled", true);
|
|
||||||
}
|
}
|
||||||
return obj;
|
return obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
private LoadingState isEnabled(JsonObject obj, String key) {
|
private LoadingState isEnabled(JsonObject obj, String key) {
|
||||||
if (obj.has(key))
|
if (obj.has(key)) return LoadingState.of(obj.getAsJsonPrimitive(key).getAsBoolean());
|
||||||
return LoadingState.of(obj.getAsJsonPrimitive(key).getAsBoolean());
|
|
||||||
return LoadingState.UNDEFINED;
|
return LoadingState.UNDEFINED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,8 @@ public class DependencyType extends DependencyBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
return owner.getState(myType, myType);
|
if(keyType != myType || valueType != myType) return LoadingState.UNDEFINED;
|
||||||
|
return owner.getState(keyType, valueType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -28,4 +29,14 @@ public class DependencyType extends DependencyBase {
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return owner.getState(myType, myType) == LoadingState.LOADED;
|
return owner.getState(myType, myType) == LoadingState.LOADED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,4 +29,13 @@ public class DependencyValue extends DependencyBase {
|
||||||
public boolean isEnabled() {
|
public boolean isEnabled() {
|
||||||
return owner.isEnabled();
|
return owner.isEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setLoaded() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,10 @@ import speiger.src.builder.ClassType;
|
||||||
public interface IDependency {
|
public interface IDependency {
|
||||||
public void load(JsonObject obj, ClassType keyType, ClassType valueType);
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType);
|
||||||
public LoadingState getState(ClassType keyType, ClassType valueType);
|
public LoadingState getState(ClassType keyType, ClassType valueType);
|
||||||
|
public boolean resolveDependencies();
|
||||||
public boolean isEnabled();
|
public boolean isEnabled();
|
||||||
|
public void setLoaded();
|
||||||
|
public String getName();
|
||||||
|
|
||||||
public static enum LoadingState {
|
public static enum LoadingState {
|
||||||
UNDEFINED,
|
UNDEFINED,
|
||||||
|
@ -23,6 +26,10 @@ public interface IDependency {
|
||||||
return ordinal() > merge.ordinal() ? this : merge;
|
return ordinal() > merge.ordinal() ? this : merge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LoadingState replaceIfDefined(LoadingState state) {
|
||||||
|
return state == UNDEFINED ? this : state;
|
||||||
|
}
|
||||||
|
|
||||||
public LoadingState mergeDown(LoadingState merge) {
|
public LoadingState mergeDown(LoadingState merge) {
|
||||||
if(merge == UNLOADED || ordinal() > merge.ordinal()) {
|
if(merge == UNLOADED || ordinal() > merge.ordinal()) {
|
||||||
return this;
|
return this;
|
||||||
|
@ -36,5 +43,9 @@ public interface IDependency {
|
||||||
}
|
}
|
||||||
return merge;
|
return merge;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean getJsonResult() {
|
||||||
|
return this == LOADED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class AsyncModule extends BaseModule
|
public class AsyncModule extends BaseModule
|
||||||
|
@ -21,7 +26,7 @@ public class AsyncModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadFunctions() {}
|
protected void loadFunctions() {}
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE); }
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades() {
|
protected void loadBlockades() {
|
||||||
if(MODULE.isEnabled()) {
|
if(MODULE.isEnabled()) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.ModulePackage;
|
import speiger.src.builder.ModulePackage;
|
||||||
import speiger.src.builder.RequiredType;
|
import speiger.src.builder.RequiredType;
|
||||||
import speiger.src.builder.SettingsManager;
|
import speiger.src.builder.SettingsManager;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
import speiger.src.builder.mappers.ArgumentMapper;
|
import speiger.src.builder.mappers.ArgumentMapper;
|
||||||
import speiger.src.builder.mappers.InjectMapper;
|
import speiger.src.builder.mappers.InjectMapper;
|
||||||
import speiger.src.builder.mappers.LineMapper;
|
import speiger.src.builder.mappers.LineMapper;
|
||||||
|
@ -57,32 +58,12 @@ public abstract class BaseModule
|
||||||
|
|
||||||
public abstract String getModuleName();
|
public abstract String getModuleName();
|
||||||
public boolean isBiModule() { return false; }
|
public boolean isBiModule() { return false; }
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Collections.emptyList(); }
|
||||||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; }
|
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; }
|
||||||
|
|
||||||
public ClassType keyType() { return keyType; }
|
public ClassType keyType() { return keyType; }
|
||||||
public ClassType valueType() { return valueType; }
|
public ClassType valueType() { return valueType; }
|
||||||
|
|
||||||
protected boolean isModuleEnabled() {
|
|
||||||
return manager == null || manager.isModuleEnabled(this, keyType, valueType);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isModuleEnabled(String name) {
|
|
||||||
return manager == null || manager.isModuleEnabled(this, keyType, valueType, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isDependencyLoaded(BaseModule module) {
|
|
||||||
return isDependencyLoaded(module, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected boolean isDependencyLoaded(BaseModule module, boolean key) {
|
|
||||||
return manager == null || (module.isBiModule() ? manager.isModuleEnabled(module, keyType, valueType) : (key ? manager.isModuleEnabled(module, keyType, keyType) : manager.isModuleEnabled(module, valueType, valueType)));
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean areDependenciesLoaded() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected void addFlag(String name) {
|
protected void addFlag(String name) {
|
||||||
entry.addFlag(name);
|
entry.addFlag(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class CollectionModule extends BaseModule
|
public class CollectionModule extends BaseModule
|
||||||
|
@ -24,12 +24,7 @@ public class CollectionModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadVariables() {}
|
protected void loadVariables() {}
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(JavaModule.INSTANCE); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, STREAMS, SPLIT_ITERATORS, IARRAY, STRATEGY); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
|
||||||
return new TreeSet<>(Arrays.asList("Streams", "Splititerators", "IArray", "Strategy"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.RequiredType;
|
import speiger.src.builder.RequiredType;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
|
@ -22,6 +26,11 @@ public class FunctionModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadTestClasses() {}
|
protected void loadTestClasses() {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
|
||||||
|
return Arrays.asList(MODULE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades()
|
protected void loadBlockades()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyBase;
|
import speiger.src.builder.dependency.DependencyBase;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
|
@ -20,6 +24,11 @@ public class JavaModule extends BaseModule
|
||||||
loadBaseVariables();
|
loadBaseVariables();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
|
||||||
|
return Arrays.asList(MODULE);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags()
|
protected void loadFlags()
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class ListModule extends BaseModule
|
public class ListModule extends BaseModule
|
||||||
|
@ -24,6 +24,8 @@ public class ListModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "List"; }
|
public String getModuleName() { return "List"; }
|
||||||
@Override
|
@Override
|
||||||
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, IMPLEMENTATION, WRAPPERS, ARRAY_LIST, LINKED_LIST, IMMUTABLE_LIST, COPY_ON_WRITE_LIST); }
|
||||||
|
@Override
|
||||||
protected void loadVariables() {}
|
protected void loadVariables() {}
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
|
@ -45,19 +47,12 @@ public class ListModule extends BaseModule
|
||||||
if(!COPY_ON_WRITE_LIST.isEnabled()) addBlockedFiles("CopyOnWriteList");
|
if(!COPY_ON_WRITE_LIST.isEnabled()) addBlockedFiles("CopyOnWriteList");
|
||||||
if(!MODULE.isEnabled()) addBlockedFiles("List", "AbstractList");
|
if(!MODULE.isEnabled()) addBlockedFiles("List", "AbstractList");
|
||||||
|
|
||||||
|
|
||||||
if(keyType.isObject()) addBlockedFiles("ListFillBufferTester");
|
if(keyType.isObject()) addBlockedFiles("ListFillBufferTester");
|
||||||
if(keyType == ClassType.BOOLEAN) addBlockedFiles("ListFillBufferTester", "ListReplaceAllTester");
|
if(keyType == ClassType.BOOLEAN) addBlockedFiles("ListFillBufferTester", "ListReplaceAllTester");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
|
||||||
return new TreeSet<>(Arrays.asList("Implementations", "Wrappers", "ArrayList", "LinkedList", "ImmutableList", "CopyOnWriteList"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean areDependenciesLoaded() {
|
|
||||||
return isDependencyLoaded(CollectionModule.INSTANCE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadRemappers()
|
protected void loadRemappers()
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
|
@ -10,6 +9,7 @@ import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
||||||
import speiger.src.builder.dependency.DependencyType;
|
import speiger.src.builder.dependency.DependencyType;
|
||||||
import speiger.src.builder.dependency.DependencyValue;
|
import speiger.src.builder.dependency.DependencyValue;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class MapModule extends BaseModule
|
public class MapModule extends BaseModule
|
||||||
|
@ -22,8 +22,8 @@ public class MapModule extends BaseModule
|
||||||
});
|
});
|
||||||
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
||||||
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
||||||
public static final DependencyFunction ORDERED_MAP = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction ORDERED_MAP = MODULE.createFunction("OrderedMap");
|
||||||
public static final DependencyFunction SORTED_MAP = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction SORTED_MAP = MODULE.createFunction("SortedMap");
|
||||||
public static final DependencyFunction ARRAY_MAP = ORDERED_MAP.addChild(IMPLEMENTATION.createSubFunction("ArrayMap"));
|
public static final DependencyFunction ARRAY_MAP = ORDERED_MAP.addChild(IMPLEMENTATION.createSubFunction("ArrayMap"));
|
||||||
public static final DependencyFunction IMMUTABLE_MAP = IMPLEMENTATION.createSubFunction("ImmutableMap");
|
public static final DependencyFunction IMMUTABLE_MAP = IMPLEMENTATION.createSubFunction("ImmutableMap");
|
||||||
public static final DependencyFunction HASH_MAP = IMPLEMENTATION.createSubFunction("HashMap");
|
public static final DependencyFunction HASH_MAP = IMPLEMENTATION.createSubFunction("HashMap");
|
||||||
|
@ -45,20 +45,7 @@ public class MapModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, ORDERED_MAP, SORTED_MAP, IMPLEMENTATION, WRAPPERS, ARRAY_MAP, IMMUTABLE_MAP, HASH_MAP, LINKED_MAP, CUSTOM_MAP, LINKED_CUSTOM_MAP, ENUM_MAP, LINKED_ENUM_MAP, CONCURRENT_MAP, AVL_TREE_MAP, RB_TREE_MAP); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
|
||||||
Set<String> sets = new TreeSet<>();
|
|
||||||
sets.addAll(Arrays.asList("Wrappers", "Implementations"));
|
|
||||||
sets.addAll(Arrays.asList("OrderedMap", "SortedMap"));
|
|
||||||
sets.addAll(Arrays.asList("ArrayMap", "ConcurrentMap", "ImmutableMap"));
|
|
||||||
sets.addAll(Arrays.asList("HashMap", "LinkedHashMap"));
|
|
||||||
sets.addAll(Arrays.asList("CustomHashMap", "LinkedCustomHashMap"));
|
|
||||||
sets.addAll(Arrays.asList("EnumMap", "LinkedEnumMap"));
|
|
||||||
sets.addAll(Arrays.asList("AVLTreeMap", "RBTreeMap"));
|
|
||||||
return sets;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags()
|
protected void loadFlags()
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class PairModule extends BaseModule
|
public class PairModule extends BaseModule
|
||||||
|
@ -28,7 +28,7 @@ public class PairModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadTestClasses() {}
|
protected void loadTestClasses() {}
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { return new TreeSet<>(Arrays.asList("Mutable", "Immutable")); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, IMMUTABLE, MUTABLE); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class PrioQueueModule extends BaseModule
|
public class PrioQueueModule extends BaseModule
|
||||||
|
@ -28,12 +28,7 @@ public class PrioQueueModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadFunctions() {}
|
protected void loadFunctions() {}
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, WRAPPERS, IMPLEMENTATION, DEQUEUE, FIFO_QUEUE, HEAP_QUEUE, ARRAY_PRIO_QUEUE); }
|
||||||
|
|
||||||
@Override
|
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
|
||||||
return new TreeSet<>(Arrays.asList("Wrappers", "Implementations", "Dequeue", "FiFoQueue", "HeapQueue", "ArrayPrioQueue"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Set;
|
import java.util.List;
|
||||||
import java.util.TreeSet;
|
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
import speiger.src.builder.dependency.DependencyFunction;
|
import speiger.src.builder.dependency.DependencyFunction;
|
||||||
import speiger.src.builder.dependency.DependencyModule;
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
import speiger.src.builder.dependency.IDependency;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class SetModule extends BaseModule
|
public class SetModule extends BaseModule
|
||||||
|
@ -16,8 +16,8 @@ public class SetModule extends BaseModule
|
||||||
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||||
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
||||||
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
||||||
public static final DependencyFunction ORDERED_SET = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction ORDERED_SET = MODULE.createFunction("OrderedSet");
|
||||||
public static final DependencyFunction SORTED_SET = MODULE.createFunction("Wrappers");
|
public static final DependencyFunction SORTED_SET = MODULE.createFunction("SortedSet");
|
||||||
public static final DependencyFunction ARRAY_SET = ORDERED_SET.addChild(IMPLEMENTATION.createSubFunction("ArraySet"));
|
public static final DependencyFunction ARRAY_SET = ORDERED_SET.addChild(IMPLEMENTATION.createSubFunction("ArraySet"));
|
||||||
public static final DependencyFunction IMMUTABLE_SET = IMPLEMENTATION.createSubFunction("ImmutableSet");
|
public static final DependencyFunction IMMUTABLE_SET = IMPLEMENTATION.createSubFunction("ImmutableSet");
|
||||||
public static final DependencyFunction HASH_SET = IMPLEMENTATION.createSubFunction("HashSet");
|
public static final DependencyFunction HASH_SET = IMPLEMENTATION.createSubFunction("HashSet");
|
||||||
|
@ -35,18 +35,7 @@ public class SetModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, WRAPPERS, ORDERED_SET, SORTED_SET, IMPLEMENTATION, ARRAY_SET, IMMUTABLE_SET, HASH_SET, LINKED_SET, CUSTOM_SET, LINKED_CUSTOM_SET, AVL_TREE_SET, RB_TREE_SET); }
|
||||||
@Override
|
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
|
||||||
Set<String> sets = new TreeSet<>();
|
|
||||||
sets.addAll(Arrays.asList("Wrappers", "Implementations"));
|
|
||||||
sets.addAll(Arrays.asList("OrderedSet", "SortedSet"));
|
|
||||||
sets.addAll(Arrays.asList("ArraySet", "ImmutableSet"));
|
|
||||||
sets.addAll(Arrays.asList("HashSet", "LinkedHashSet"));
|
|
||||||
sets.addAll(Arrays.asList("CustomHashSet", "LinkedCustomHashSet"));
|
|
||||||
sets.addAll(Arrays.asList("AVLTreeSet", "RBTreeSet"));
|
|
||||||
return sets;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags()
|
protected void loadFlags()
|
||||||
|
|
Loading…
Reference in New Issue