Fixing a few things and testing more. Not useable atm.

This commit is contained in:
Speiger 2023-07-04 17:07:02 +02:00
parent 54aae530a1
commit cdcf5dc087
19 changed files with 247 additions and 2738 deletions

File diff suppressed because it is too large Load Diff

View File

@ -128,10 +128,12 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
for(int i = 0,m=modules.size();i<m;i++) {
modules.get(i).setManager(manager);
}
manager.resolve();
for(int i = 0,m=modules.size();i<m;i++) {
biPackages.forEach(modules.get(i)::init);
}
modules.forEach(BaseModule::cleanup);
manager.printModuleSettings(Arrays.asList(MapModule.INSTANCE));
}
private void finishPackages() {
@ -212,7 +214,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
boolean force = flags.contains("force");
boolean tests = flags.contains("tests");
boolean forceTests = flags.contains("force-tests");
boolean load = flags.contains("load");
boolean load = !flags.contains("load");
boolean save = flags.contains("save");
int flag = (load ? LOAD : 0) | (save ? SAVE : 0);
new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force);

View File

@ -1,8 +1,12 @@
package speiger.src.builder;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
@ -11,6 +15,7 @@ import com.google.gson.JsonParser;
import com.google.gson.internal.Streams;
import com.google.gson.stream.JsonWriter;
import speiger.src.builder.dependency.IDependency;
import speiger.src.builder.modules.BaseModule;
@SuppressWarnings("javadoc")
@ -19,36 +24,43 @@ public class SettingsManager
boolean loaded;
JsonObject data = new JsonObject();
Set<String> moduleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
Set<IDependency> allDependencies = new LinkedHashSet<>();
public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType) {
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;
public void resolve() {
boolean valid = true;
for(int i = 0;i<10000 && valid;i++) {
boolean result = false;
for(IDependency entry : allDependencies) {
result |= entry.resolveDependencies();
}
valid = result;
}
result = getObject(result, base.getModuleName(), false);
return (result.size() <= 0 || isEnabled(result, "Enabled")) && base.areDependenciesLoaded();
}
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();
if(valid) throw new RuntimeException("Couldn't resolve dependencies!");
}
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();
moduleNames.add(moduleName);
data.addProperty(moduleName, true);
@ -57,9 +69,10 @@ public class SettingsManager
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)) {
obj.addProperty(key, true);
for(IDependency dependency : module.getDependencies(keyType, valueType)) {
String key = dependency.getName();
if(key != null) obj.addProperty(key, true);
dependency.setLoaded();
}
addModule(keyType, valueType, true, moduleName, obj);
}
@ -69,14 +82,55 @@ public class SettingsManager
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)) {
obj.addProperty(key, true);
for(IDependency dependency : module.getDependencies(keyType, keyType)) {
String key = dependency.getName();
if(key != null) obj.addProperty(key, true);
dependency.setLoaded();
}
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() {
try(BufferedReader reader = Files.newBufferedReader(Paths.get("ModulSettings.json"))) {
data = JsonParser.parseReader(reader).getAsJsonObject();
@ -100,6 +154,14 @@ public class SettingsManager
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) {
JsonObject result = getObject(data, keyType.getClassPath(), true);
if(bi) {
@ -117,9 +179,4 @@ public class SettingsManager
}
return obj;
}
private boolean isEnabled(JsonObject obj, String key) {
if(obj.has(key)) return obj.getAsJsonPrimitive(key).getAsBoolean();
return true;
}
}

View File

@ -29,8 +29,6 @@ public abstract class DependencyBase implements IDependency {
return children;
}
public abstract boolean resolveDependencies();
protected LoadingState getChildState(ClassType keyType, ClassType valueType) {
LoadingState state = LoadingState.UNDEFINED;
for(IDependency child : children) {

View File

@ -45,7 +45,7 @@ public abstract class DependencyFunction extends DependencyBase {
public LoadingState getState(ClassType keyType, ClassType valueType) {
return state[keyType.ordinal()];
}
@Override
public boolean resolveDependencies() {
boolean returnType = false;
@ -60,6 +60,16 @@ public abstract class DependencyFunction extends DependencyBase {
}
return returnType;
}
@Override
public String getName() {
return functionName;
}
@Override
public void setLoaded() {
Arrays.fill(state, LoadingState.LOADED);
}
}
public static class BiTypeFunction extends DependencyFunction {
@ -105,5 +115,17 @@ public abstract class DependencyFunction extends DependencyBase {
}
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);
}
}
}
}

View File

@ -63,6 +63,16 @@ public abstract class DependencyModule extends DependencyBase {
}
return returnType;
}
@Override
public String getName() {
return "Enabled";
}
@Override
public void setLoaded() {
Arrays.fill(state, LoadingState.LOADED);
}
}
public static class BiTypeModule extends DependencyModule {
@ -106,53 +116,55 @@ public abstract class DependencyModule extends DependencyBase {
}
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) {
LoadingState state = isEnabled(data, owner.getModuleName());
if(state != LoadingState.UNDEFINED) return state;
JsonObject result = getObject(data, keyType.getClassPath(), false);
state = isEnabled(result, "Enabled");
if(state != LoadingState.UNDEFINED) return state;
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
if(owner.isBiModule()) {
result = getObject(result, valueType.getClassPath(), false);
state = isEnabled(result, "Enabled");
if (state != LoadingState.UNDEFINED) return state;
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
}
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) {
LoadingState state = isEnabled(data, owner.getModuleName());
if(state != LoadingState.UNDEFINED) return state;
JsonObject result = getObject(data, keyType.getClassPath(), false);
state = isEnabled(result, "Enabled");
if(state != LoadingState.UNDEFINED) return state;
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
if(owner.isBiModule()) {
result = getObject(result, valueType.getClassPath(), false);
state = isEnabled(result, "Enabled");
if(state != LoadingState.UNDEFINED) return state;
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
}
result = getObject(result, owner.getModuleName(), false);
state = isEnabled(result, "Enabled");
if(state != LoadingState.UNDEFINED) return state;
return isEnabled(result, entry);
return state.replaceIfDefined(isEnabled(result, "Enabled")).replaceIfDefined(isEnabled(result, entry));
}
private JsonObject getObject(JsonObject data, String name, boolean create) {
JsonObject obj = data.getAsJsonObject(name);
if (obj == null) {
if(obj == null) {
obj = new JsonObject();
data.add(name, obj);
if (create)
obj.addProperty("Enabled", true);
if(create) obj.addProperty("Enabled", true);
}
return obj;
}
private LoadingState isEnabled(JsonObject obj, String key) {
if (obj.has(key))
return LoadingState.of(obj.getAsJsonPrimitive(key).getAsBoolean());
if (obj.has(key)) return LoadingState.of(obj.getAsJsonPrimitive(key).getAsBoolean());
return LoadingState.UNDEFINED;
}
}

View File

@ -19,7 +19,8 @@ public class DependencyType extends DependencyBase {
@Override
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
@ -28,4 +29,14 @@ public class DependencyType extends DependencyBase {
public boolean isEnabled() {
return owner.getState(myType, myType) == LoadingState.LOADED;
}
@Override
public String getName() {
return null;
}
@Override
public void setLoaded() {
}
}

View File

@ -29,4 +29,13 @@ public class DependencyValue extends DependencyBase {
public boolean isEnabled() {
return owner.isEnabled();
}
@Override
public String getName() {
return null;
}
@Override
public void setLoaded() {
}
}

View File

@ -8,7 +8,10 @@ import speiger.src.builder.ClassType;
public interface IDependency {
public void load(JsonObject obj, ClassType keyType, ClassType valueType);
public LoadingState getState(ClassType keyType, ClassType valueType);
public boolean resolveDependencies();
public boolean isEnabled();
public void setLoaded();
public String getName();
public static enum LoadingState {
UNDEFINED,
@ -23,6 +26,10 @@ public interface IDependency {
return ordinal() > merge.ordinal() ? this : merge;
}
public LoadingState replaceIfDefined(LoadingState state) {
return state == UNDEFINED ? this : state;
}
public LoadingState mergeDown(LoadingState merge) {
if(merge == UNLOADED || ordinal() > merge.ordinal()) {
return this;
@ -36,5 +43,9 @@ public interface IDependency {
}
return merge;
}
public boolean getJsonResult() {
return this == LOADED;
}
}
}

View File

@ -1,7 +1,12 @@
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.SingleTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
public class AsyncModule extends BaseModule
@ -21,7 +26,7 @@ public class AsyncModule extends BaseModule
@Override
protected void loadFunctions() {}
@Override
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE); }
@Override
protected void loadBlockades() {
if(MODULE.isEnabled()) {

View File

@ -1,7 +1,7 @@
package speiger.src.builder.modules;
import java.util.Collections;
import java.util.Set;
import java.util.List;
import java.util.function.Consumer;
import java.util.function.Predicate;
@ -9,6 +9,7 @@ import speiger.src.builder.ClassType;
import speiger.src.builder.ModulePackage;
import speiger.src.builder.RequiredType;
import speiger.src.builder.SettingsManager;
import speiger.src.builder.dependency.IDependency;
import speiger.src.builder.mappers.ArgumentMapper;
import speiger.src.builder.mappers.InjectMapper;
import speiger.src.builder.mappers.LineMapper;
@ -57,32 +58,12 @@ public abstract class BaseModule
public abstract String getModuleName();
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 ClassType keyType() { return keyType; }
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) {
entry.addFlag(name);
}

View File

@ -1,13 +1,13 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyFunction;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
public class CollectionModule extends BaseModule
@ -24,12 +24,7 @@ public class CollectionModule extends BaseModule
@Override
protected void loadVariables() {}
@Override
public boolean areDependenciesLoaded() { return isDependencyLoaded(JavaModule.INSTANCE); }
@Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
return new TreeSet<>(Arrays.asList("Streams", "Splititerators", "IArray", "Strategy"));
}
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, STREAMS, SPLIT_ITERATORS, IARRAY, STRATEGY); }
@Override
protected void loadFlags() {

View File

@ -1,8 +1,12 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.RequiredType;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.IDependency;
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
@SuppressWarnings("javadoc")
@ -22,6 +26,11 @@ public class FunctionModule extends BaseModule
@Override
protected void loadTestClasses() {}
@Override
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
return Arrays.asList(MODULE);
}
@Override
protected void loadBlockades()
{

View File

@ -1,7 +1,11 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyBase;
import speiger.src.builder.dependency.IDependency;
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
@SuppressWarnings("javadoc")
@ -20,6 +24,11 @@ public class JavaModule extends BaseModule
loadBaseVariables();
}
@Override
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) {
return Arrays.asList(MODULE);
}
@Override
protected void loadFlags()
{

View File

@ -1,13 +1,13 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyFunction;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
public class ListModule extends BaseModule
@ -24,6 +24,8 @@ public class ListModule extends BaseModule
@Override
public String getModuleName() { return "List"; }
@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() {}
@Override
protected void loadFlags() {
@ -45,19 +47,12 @@ public class ListModule extends BaseModule
if(!COPY_ON_WRITE_LIST.isEnabled()) addBlockedFiles("CopyOnWriteList");
if(!MODULE.isEnabled()) addBlockedFiles("List", "AbstractList");
if(keyType.isObject()) addBlockedFiles("ListFillBufferTester");
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
protected void loadRemappers()

View File

@ -1,8 +1,7 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
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.DependencyType;
import speiger.src.builder.dependency.DependencyValue;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
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 IMPLEMENTATION = MODULE.createFunction("Implementations");
public static final DependencyFunction ORDERED_MAP = MODULE.createFunction("Wrappers");
public static final DependencyFunction SORTED_MAP = MODULE.createFunction("Wrappers");
public static final DependencyFunction ORDERED_MAP = MODULE.createFunction("OrderedMap");
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 IMMUTABLE_MAP = IMPLEMENTATION.createSubFunction("ImmutableMap");
public static final DependencyFunction HASH_MAP = IMPLEMENTATION.createSubFunction("HashMap");
@ -45,20 +45,7 @@ public class MapModule extends BaseModule
@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) {
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;
}
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
protected void loadFlags()

View File

@ -1,13 +1,13 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyFunction;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
public class PairModule extends BaseModule
@ -28,7 +28,7 @@ public class PairModule extends BaseModule
@Override
protected void loadTestClasses() {}
@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
protected void loadFlags() {

View File

@ -1,13 +1,13 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyFunction;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
public class PrioQueueModule extends BaseModule
@ -28,12 +28,7 @@ public class PrioQueueModule extends BaseModule
@Override
protected void loadFunctions() {}
@Override
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
@Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
return new TreeSet<>(Arrays.asList("Wrappers", "Implementations", "Dequeue", "FiFoQueue", "HeapQueue", "ArrayPrioQueue"));
}
public List<IDependency> getDependencies(ClassType keyType, ClassType valueType) { return Arrays.asList(MODULE, WRAPPERS, IMPLEMENTATION, DEQUEUE, FIFO_QUEUE, HEAP_QUEUE, ARRAY_PRIO_QUEUE); }
@Override
protected void loadFlags() {

View File

@ -1,13 +1,13 @@
package speiger.src.builder.modules;
import java.util.Arrays;
import java.util.Set;
import java.util.TreeSet;
import java.util.List;
import speiger.src.builder.ClassType;
import speiger.src.builder.dependency.DependencyFunction;
import speiger.src.builder.dependency.DependencyModule;
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
import speiger.src.builder.dependency.IDependency;
@SuppressWarnings("javadoc")
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 DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
public static final DependencyFunction ORDERED_SET = MODULE.createFunction("Wrappers");
public static final DependencyFunction SORTED_SET = MODULE.createFunction("Wrappers");
public static final DependencyFunction ORDERED_SET = MODULE.createFunction("OrderedSet");
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 IMMUTABLE_SET = IMPLEMENTATION.createSubFunction("ImmutableSet");
public static final DependencyFunction HASH_SET = IMPLEMENTATION.createSubFunction("HashSet");
@ -35,18 +35,7 @@ public class SetModule extends BaseModule
@Override
public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; }
@Override
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
@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;
}
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
protected void loadFlags()