Start of a Advanced Dependency System.
The idea behind this system is that you can select systems a lot easier. So if a custom system isn't required it can be disabled and all the subsystems that require it either get disabled too. it also allows you to set systems as: Only if they are required. Meaning if only a specific system is required its dependencies can still load.
This commit is contained in:
parent
6afed5e174
commit
54aae530a1
|
@ -0,0 +1,51 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public abstract class DependencyBase implements IDependency {
|
||||||
|
protected List<IDependency> children = new ArrayList<>();
|
||||||
|
protected List<IDependency> parents = new ArrayList<>();
|
||||||
|
|
||||||
|
public <T extends DependencyBase> T addChild(T child) {
|
||||||
|
children.add(child);
|
||||||
|
child.addParent(this);
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T extends DependencyBase> T addParent(DependencyBase parent) {
|
||||||
|
parents.add(parent);
|
||||||
|
return (T) this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IDependency> getParents() {
|
||||||
|
return parents;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<IDependency> getChildren() {
|
||||||
|
return children;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract boolean resolveDependencies();
|
||||||
|
|
||||||
|
protected LoadingState getChildState(ClassType keyType, ClassType valueType) {
|
||||||
|
LoadingState state = LoadingState.UNDEFINED;
|
||||||
|
for(IDependency child : children) {
|
||||||
|
if(state == LoadingState.LOADED) return LoadingState.LOADED;
|
||||||
|
state = state.mergeDown(child.getState(keyType, valueType));
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected LoadingState getParentState(ClassType keyType, ClassType valueType) {
|
||||||
|
LoadingState state = LoadingState.UNDEFINED;
|
||||||
|
for(IDependency parent : parents) {
|
||||||
|
if(state == LoadingState.UNLOADED) return LoadingState.UNLOADED;
|
||||||
|
state = state.mergeUp(parent.getState(keyType, valueType));
|
||||||
|
}
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,109 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public abstract class DependencyFunction extends DependencyBase {
|
||||||
|
protected DependencyModule owner;
|
||||||
|
|
||||||
|
public DependencyFunction(DependencyModule owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return getState(owner.owner.keyType(), owner.owner.valueType()) == LoadingState.LOADED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public abstract DependencyFunction createSubFunction(String function);
|
||||||
|
|
||||||
|
public static class SingleFunction extends DependencyFunction {
|
||||||
|
LoadingState[] state = new LoadingState[ClassType.values().length];
|
||||||
|
String functionName;
|
||||||
|
|
||||||
|
public SingleFunction(DependencyModule owner, String functionName) {
|
||||||
|
super(owner);
|
||||||
|
this.functionName = functionName;
|
||||||
|
Arrays.fill(state, LoadingState.UNDEFINED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyFunction createSubFunction(String function) {
|
||||||
|
return addChild(new SingleFunction(owner, function));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {
|
||||||
|
state[keyType.ordinal()] = owner.isFunctionLoaded(obj, keyType, valueType, functionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return state[keyType.ordinal()];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() {
|
||||||
|
boolean returnType = false;
|
||||||
|
for(ClassType type : ClassType.values()) {
|
||||||
|
LoadingState state = this.state[type.ordinal()];
|
||||||
|
if(state == LoadingState.UNLOADED) continue;
|
||||||
|
state = state.merge(getChildState(type, type)).merge(getParentState(type, type));
|
||||||
|
if(state != this.state[type.ordinal()]) {
|
||||||
|
this.state[type.ordinal()] = state;
|
||||||
|
returnType = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BiTypeFunction extends DependencyFunction {
|
||||||
|
LoadingState[][] state = new LoadingState[ClassType.values().length][ClassType.values().length];
|
||||||
|
String functionName;
|
||||||
|
|
||||||
|
BiTypeFunction(DependencyModule owner, String functionName) {
|
||||||
|
super(owner);
|
||||||
|
this.functionName = functionName;
|
||||||
|
for(int i = 0;i<state.length;i++) {
|
||||||
|
Arrays.fill(state[i], LoadingState.UNDEFINED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyFunction createSubFunction(String function) {
|
||||||
|
return new BiTypeFunction(owner, function);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {
|
||||||
|
state[keyType.ordinal()][valueType.ordinal()] = owner.isFunctionLoaded(obj, keyType, valueType, functionName);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return state[keyType.ordinal()][valueType.ordinal()];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() {
|
||||||
|
boolean returnType = false;
|
||||||
|
for(ClassType keyType : ClassType.values()) {
|
||||||
|
for(ClassType valueType : ClassType.values()) {
|
||||||
|
LoadingState state = this.state[keyType.ordinal()][valueType.ordinal()];
|
||||||
|
if(state == LoadingState.UNLOADED) continue;
|
||||||
|
state = state.merge(getChildState(keyType, valueType)).merge(getParentState(keyType, valueType));
|
||||||
|
if(state != this.state[keyType.ordinal()][valueType.ordinal()]) {
|
||||||
|
this.state[keyType.ordinal()][valueType.ordinal()] = state;
|
||||||
|
returnType = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,158 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
import speiger.src.builder.dependency.DependencyFunction.BiTypeFunction;
|
||||||
|
import speiger.src.builder.dependency.DependencyFunction.SingleFunction;
|
||||||
|
import speiger.src.builder.modules.BaseModule;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public abstract class DependencyModule extends DependencyBase {
|
||||||
|
protected BaseModule owner;
|
||||||
|
|
||||||
|
public DependencyModule(BaseModule owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingState isFunctionLoaded(JsonObject obj, ClassType keyType, ClassType valueType, String function) { return isModuleEnabled(obj, keyType, valueType, function); }
|
||||||
|
|
||||||
|
public abstract DependencyFunction createFunction(String functionName);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return getState(owner.keyType(), owner.valueType()) == LoadingState.LOADED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class SingleTypeModule extends DependencyModule {
|
||||||
|
LoadingState[] state = new LoadingState[ClassType.values().length];
|
||||||
|
|
||||||
|
public SingleTypeModule(BaseModule owner) {
|
||||||
|
super(owner);
|
||||||
|
Arrays.fill(state, LoadingState.UNDEFINED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyFunction createFunction(String functionName) {
|
||||||
|
return addChild(new SingleFunction(this, functionName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {
|
||||||
|
state[keyType.ordinal()] = isModuleEnabled(obj, keyType, valueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return state[keyType.ordinal()];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() {
|
||||||
|
boolean returnType = false;
|
||||||
|
for(ClassType type : ClassType.values()) {
|
||||||
|
LoadingState state = this.state[type.ordinal()];
|
||||||
|
if(state == LoadingState.UNLOADED) continue;
|
||||||
|
state = state.merge(getChildState(type, type)).merge(getParentState(type, type));
|
||||||
|
if(state != this.state[type.ordinal()]) {
|
||||||
|
this.state[type.ordinal()] = state;
|
||||||
|
returnType = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class BiTypeModule extends DependencyModule {
|
||||||
|
LoadingState[][] state = new LoadingState[ClassType.values().length][ClassType.values().length];
|
||||||
|
|
||||||
|
public BiTypeModule(BaseModule owner) {
|
||||||
|
super(owner);
|
||||||
|
for(int i = 0;i<state.length;i++) {
|
||||||
|
Arrays.fill(state[i], LoadingState.UNDEFINED);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DependencyFunction createFunction(String functionName) {
|
||||||
|
return addChild(new BiTypeFunction(this, functionName));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {
|
||||||
|
state[keyType.ordinal()][valueType.ordinal()] = isModuleEnabled(obj, keyType, valueType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return state[keyType.ordinal()][valueType.ordinal()];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() {
|
||||||
|
boolean returnType = false;
|
||||||
|
for(ClassType keyType : ClassType.values()) {
|
||||||
|
for(ClassType valueType : ClassType.values()) {
|
||||||
|
LoadingState state = this.state[keyType.ordinal()][valueType.ordinal()];
|
||||||
|
if(state == LoadingState.UNLOADED) continue;
|
||||||
|
state = state.merge(getChildState(keyType, valueType)).merge(getParentState(keyType, valueType));
|
||||||
|
if(state != this.state[keyType.ordinal()][valueType.ordinal()]) {
|
||||||
|
this.state[keyType.ordinal()][valueType.ordinal()] = state;
|
||||||
|
returnType = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return returnType;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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;
|
||||||
|
if(owner.isBiModule()) {
|
||||||
|
result = getObject(result, valueType.getClassPath(), false);
|
||||||
|
state = isEnabled(result, "Enabled");
|
||||||
|
if (state != LoadingState.UNDEFINED) return state;
|
||||||
|
}
|
||||||
|
return 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;
|
||||||
|
if(owner.isBiModule()) {
|
||||||
|
result = getObject(result, valueType.getClassPath(), false);
|
||||||
|
state = isEnabled(result, "Enabled");
|
||||||
|
if(state != LoadingState.UNDEFINED) return state;
|
||||||
|
}
|
||||||
|
result = getObject(result, owner.getModuleName(), false);
|
||||||
|
state = isEnabled(result, "Enabled");
|
||||||
|
if(state != LoadingState.UNDEFINED) return state;
|
||||||
|
return isEnabled(result, entry);
|
||||||
|
}
|
||||||
|
|
||||||
|
private JsonObject getObject(JsonObject data, String name, boolean create) {
|
||||||
|
JsonObject obj = data.getAsJsonObject(name);
|
||||||
|
if (obj == null) {
|
||||||
|
obj = new JsonObject();
|
||||||
|
data.add(name, obj);
|
||||||
|
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());
|
||||||
|
return LoadingState.UNDEFINED;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,31 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public class DependencyType extends DependencyBase {
|
||||||
|
DependencyBase owner;
|
||||||
|
ClassType myType;
|
||||||
|
|
||||||
|
public DependencyType(DependencyBase owner, ClassType myType) {
|
||||||
|
this.owner = owner;
|
||||||
|
this.myType = myType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return owner.getState(myType, myType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() { return false; }
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return owner.getState(myType, myType) == LoadingState.LOADED;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public class DependencyValue extends DependencyBase {
|
||||||
|
DependencyBase owner;
|
||||||
|
|
||||||
|
public DependencyValue(DependencyBase owner) {
|
||||||
|
this.owner = owner;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType) {}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType) {
|
||||||
|
return owner.getState(valueType, keyType);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean resolveDependencies() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled() {
|
||||||
|
return owner.isEnabled();
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,40 @@
|
||||||
|
package speiger.src.builder.dependency;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
|
||||||
|
import speiger.src.builder.ClassType;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
|
public interface IDependency {
|
||||||
|
public void load(JsonObject obj, ClassType keyType, ClassType valueType);
|
||||||
|
public LoadingState getState(ClassType keyType, ClassType valueType);
|
||||||
|
public boolean isEnabled();
|
||||||
|
|
||||||
|
public static enum LoadingState {
|
||||||
|
UNDEFINED,
|
||||||
|
LOADED,
|
||||||
|
UNLOADED;
|
||||||
|
|
||||||
|
public static LoadingState of(boolean value) {
|
||||||
|
return value ? LOADED : UNLOADED;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingState merge(LoadingState merge) {
|
||||||
|
return ordinal() > merge.ordinal() ? this : merge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingState mergeDown(LoadingState merge) {
|
||||||
|
if(merge == UNLOADED || ordinal() > merge.ordinal()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return merge;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LoadingState mergeUp(LoadingState merge) {
|
||||||
|
if(merge == LOADED || ordinal() > merge.ordinal()) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
return merge;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,14 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
|
import speiger.src.builder.dependency.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class AsyncModule extends BaseModule
|
public class AsyncModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new AsyncModule();
|
public static final BaseModule INSTANCE = new AsyncModule();
|
||||||
|
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Async"; }
|
public String getModuleName() { return "Async"; }
|
||||||
|
@ -19,13 +24,13 @@ public class AsyncModule extends BaseModule
|
||||||
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades() {
|
protected void loadBlockades() {
|
||||||
if(!isModuleEnabled()) {
|
if(MODULE.isEnabled()) {
|
||||||
addBlockedFiles("AsyncBuilder", "Task");
|
addBlockedFiles("AsyncBuilder", "Task");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
if(isModuleEnabled()) {
|
if(MODULE.isEnabled()) {
|
||||||
addKeyFlag("ASYNC_MODULE");
|
addKeyFlag("ASYNC_MODULE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package speiger.src.builder.modules;
|
||||||
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
|
@ -205,4 +206,9 @@ public abstract class BaseModule
|
||||||
entry.addMapper(mapper);
|
entry.addMapper(mapper);
|
||||||
return mapper;
|
return mapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static <T> T make(T input, Consumer<T> processor) {
|
||||||
|
processor.accept(input);
|
||||||
|
return input;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,48 +5,57 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class CollectionModule extends BaseModule
|
public class CollectionModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new CollectionModule();
|
public static final BaseModule INSTANCE = new CollectionModule();
|
||||||
|
public static final DependencyModule MODULE = JavaModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||||
|
public static final DependencyFunction STREAMS = MODULE.createFunction("Streams");
|
||||||
|
public static final DependencyFunction SPLIT_ITERATORS = MODULE.createFunction("Splititerators");
|
||||||
|
public static final DependencyFunction IARRAY = MODULE.createFunction("IArray");
|
||||||
|
public static final DependencyFunction STRATEGY = MODULE.createFunction("Strategy");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Collection"; }
|
public String getModuleName() { return "Collection"; }
|
||||||
@Override
|
@Override
|
||||||
protected void loadVariables() {}
|
protected void loadVariables() {}
|
||||||
@Override
|
@Override
|
||||||
public boolean areDependenciesLoaded(){ return isDependencyLoaded(JavaModule.INSTANCE); }
|
public boolean areDependenciesLoaded() { return isDependencyLoaded(JavaModule.INSTANCE); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType)
|
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
|
||||||
{
|
|
||||||
return new TreeSet<>(Arrays.asList("Streams", "Splititerators", "IArray", "Strategy"));
|
return new TreeSet<>(Arrays.asList("Streams", "Splititerators", "IArray", "Strategy"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
if(isModuleEnabled()) addKeyFlag("COLLECTION_MODULE");
|
if(MODULE.isEnabled()) addKeyFlag("COLLECTION_MODULE");
|
||||||
if(isModuleEnabled("Streams")) addKeyFlag("STREAM_FEATURE");
|
if(STREAMS.isEnabled()) addKeyFlag("STREAM_FEATURE");
|
||||||
if(isModuleEnabled("Splititerators")) addKeyFlag("SPLIT_ITERATOR_FEATURE");
|
if(SPLIT_ITERATORS.isEnabled()) addKeyFlag("SPLIT_ITERATOR_FEATURE");
|
||||||
if(isModuleEnabled("IArray")) addKeyFlag("IARRAY_FEATURE");
|
if(IARRAY.isEnabled()) addKeyFlag("IARRAY_FEATURE");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades() {
|
protected void loadBlockades() {
|
||||||
if(!isModuleEnabled()) {
|
if(!MODULE.isEnabled()) {
|
||||||
addBlockedFiles("Iterable", "Iterables", "Iterator", "Iterators", "BidirectionalIterator", "ListIterator");
|
addBlockedFiles("Iterable", "Iterables", "Iterator", "Iterators", "BidirectionalIterator", "ListIterator");
|
||||||
addBlockedFiles("Arrays", "Collection", "AbstractCollection", "Collections", "Stack");
|
addBlockedFiles("Arrays", "Collection", "AbstractCollection", "Collections", "Stack");
|
||||||
}
|
}
|
||||||
if(!isModuleEnabled("Splititerators")) addBlockedFiles("Splititerator", "Splititerators");
|
if(!SPLIT_ITERATORS.isEnabled()) addBlockedFiles("Splititerator", "Splititerators");
|
||||||
if(!isModuleEnabled("IArray")) addBlockedFiles("IArray");
|
if(!IARRAY.isEnabled()) addBlockedFiles("IArray");
|
||||||
if(!isModuleEnabled("Strategy")) addBlockedFiles("Strategy");
|
if(!STRATEGY.isEnabled()) addBlockedFiles("Strategy");
|
||||||
|
|
||||||
if(keyType.isObject()) {
|
if(keyType.isObject())
|
||||||
|
{
|
||||||
addBlockedFiles("Stack");
|
addBlockedFiles("Stack");
|
||||||
addBlockedFiles("CollectionStreamTester");
|
addBlockedFiles("CollectionStreamTester");
|
||||||
}
|
}
|
||||||
if(keyType == ClassType.BOOLEAN) {
|
if(keyType == ClassType.BOOLEAN)
|
||||||
|
{
|
||||||
addBlockedFiles("CollectionRemoveIfTester", "CollectionStreamTester");
|
addBlockedFiles("CollectionRemoveIfTester", "CollectionStreamTester");
|
||||||
addBlockedFilter(T -> T.endsWith("Tester") && T.startsWith("Iterable"));
|
addBlockedFilter(T -> T.endsWith("Tester") && T.startsWith("Iterable"));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,11 +2,14 @@ package speiger.src.builder.modules;
|
||||||
|
|
||||||
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.BiTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class FunctionModule extends BaseModule
|
public class FunctionModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new FunctionModule();
|
public static final BaseModule INSTANCE = new FunctionModule();
|
||||||
|
public static final DependencyModule MODULE = new BiTypeModule(INSTANCE);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Function"; }
|
public String getModuleName() { return "Function"; }
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
package speiger.src.builder.modules;
|
package speiger.src.builder.modules;
|
||||||
|
|
||||||
import speiger.src.builder.ClassType;
|
import speiger.src.builder.ClassType;
|
||||||
|
import speiger.src.builder.dependency.DependencyBase;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class JavaModule extends BaseModule
|
public class JavaModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new JavaModule();
|
public static final BaseModule INSTANCE = new JavaModule();
|
||||||
|
public static final DependencyBase MODULE = new SingleTypeModule(INSTANCE);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Base"; }
|
public String getModuleName() { return "Base"; }
|
||||||
|
|
|
@ -5,11 +5,21 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class ListModule extends BaseModule
|
public class ListModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new ListModule();
|
public static final BaseModule INSTANCE = new ListModule();
|
||||||
|
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||||
|
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
||||||
|
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
||||||
|
public static final DependencyFunction ARRAY_LIST = IMPLEMENTATION.createSubFunction("ArrayList");
|
||||||
|
public static final DependencyFunction LINKED_LIST = IMPLEMENTATION.createSubFunction("LinkedList");
|
||||||
|
public static final DependencyFunction IMMUTABLE_LIST = IMPLEMENTATION.createSubFunction("ImmutableList");
|
||||||
|
public static final DependencyFunction COPY_ON_WRITE_LIST = IMPLEMENTATION.createSubFunction("CopyOnWriteList");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "List"; }
|
public String getModuleName() { return "List"; }
|
||||||
|
@ -17,25 +27,23 @@ public class ListModule extends BaseModule
|
||||||
protected void loadVariables() {}
|
protected void loadVariables() {}
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
if(isModuleEnabled()) addKeyFlag("LIST_MODULE");
|
if(MODULE.isEnabled()) addKeyFlag("LIST_MODULE");
|
||||||
if(isModuleEnabled("Wrappers")) addKeyFlag("LISTS_FEATURE");
|
if(WRAPPERS.isEnabled()) addKeyFlag("LISTS_FEATURE");
|
||||||
boolean implementations = isModuleEnabled("Implementations");
|
if(ARRAY_LIST.isEnabled()) addKeyFlag("ARRAY_LIST_FEATURE");
|
||||||
if(implementations && isModuleEnabled("ArrayList")) addKeyFlag("ARRAY_LIST_FEATURE");
|
if(LINKED_LIST.isEnabled()) addKeyFlag("LINKED_LIST_FEATURE");
|
||||||
if(implementations && isModuleEnabled("LinkedList")) addKeyFlag("LINKED_LIST_FEATURE");
|
if(IMMUTABLE_LIST.isEnabled()) addKeyFlag("IMMUTABLE_LIST_FEATURE");
|
||||||
if(implementations && isModuleEnabled("ImmutableList")) addKeyFlag("IMMUTABLE_LIST_FEATURE");
|
if(COPY_ON_WRITE_LIST.isEnabled()) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE");
|
||||||
if(implementations && isModuleEnabled("CopyOnWriteList")) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades()
|
protected void loadBlockades()
|
||||||
{
|
{
|
||||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Lists");
|
if(!WRAPPERS.isEnabled()) addBlockedFiles("Lists");
|
||||||
boolean implementations = !isModuleEnabled("Implementations");
|
if(!ARRAY_LIST.isEnabled()) addBlockedFiles("ArrayList");
|
||||||
if(implementations || !isModuleEnabled("ArrayList")) addBlockedFiles("ArrayList");
|
if(!LINKED_LIST.isEnabled()) addBlockedFiles("LinkedList");
|
||||||
if(implementations || !isModuleEnabled("LinkedList")) addBlockedFiles("LinkedList");
|
if(!IMMUTABLE_LIST.isEnabled()) addBlockedFiles("ImmutableList");
|
||||||
if(implementations || !isModuleEnabled("ImmutableList")) addBlockedFiles("ImmutableList");
|
if(!COPY_ON_WRITE_LIST.isEnabled()) addBlockedFiles("CopyOnWriteList");
|
||||||
if(implementations || !isModuleEnabled("CopyOnWriteList")) addBlockedFiles("CopyOnWriteList");
|
if(!MODULE.isEnabled()) addBlockedFiles("List", "AbstractList");
|
||||||
if(!isModuleEnabled()) 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");
|
||||||
|
|
|
@ -5,11 +5,36 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyType;
|
||||||
|
import speiger.src.builder.dependency.DependencyValue;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class MapModule extends BaseModule
|
public class MapModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new MapModule();
|
public static final BaseModule INSTANCE = new MapModule();
|
||||||
|
public static final DependencyModule MODULE = make(new BiTypeModule(INSTANCE), T -> {
|
||||||
|
CollectionModule.MODULE.addChild(new DependencyValue(T));
|
||||||
|
CollectionModule.MODULE.addChild(new DependencyType(T, ClassType.OBJECT));
|
||||||
|
SetModule.MODULE.addChild(T);
|
||||||
|
});
|
||||||
|
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 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");
|
||||||
|
public static final DependencyFunction LINKED_MAP = HASH_MAP.addChild(ORDERED_MAP.addChild(IMPLEMENTATION.createSubFunction("LinkedHashMap")));
|
||||||
|
public static final DependencyFunction CUSTOM_MAP = IMPLEMENTATION.createSubFunction("CustomHashMap");
|
||||||
|
public static final DependencyFunction LINKED_CUSTOM_MAP = CUSTOM_MAP.addChild(ORDERED_MAP.addChild(IMPLEMENTATION.createSubFunction("LinkedCustomHashMap")));
|
||||||
|
public static final DependencyFunction ENUM_MAP = IMPLEMENTATION.createSubFunction("EnumMap");
|
||||||
|
public static final DependencyFunction LINKED_ENUM_MAP = ENUM_MAP.addChild(ORDERED_MAP.addChild(IMPLEMENTATION.createSubFunction("LinkedEnumMap")));
|
||||||
|
public static final DependencyFunction CONCURRENT_MAP = IMPLEMENTATION.createSubFunction("ConcurrentMap");
|
||||||
|
public static final DependencyFunction AVL_TREE_MAP = SORTED_MAP.addChild(IMPLEMENTATION.createSubFunction("AVLTreeMap"));
|
||||||
|
public static final DependencyFunction RB_TREE_MAP = SORTED_MAP.addChild(IMPLEMENTATION.createSubFunction("RBTreeMap"));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Map"; }
|
public String getModuleName() { return "Map"; }
|
||||||
|
@ -38,61 +63,43 @@ public class MapModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags()
|
protected void loadFlags()
|
||||||
{
|
{
|
||||||
if(isModuleEnabled()) addFlag("MAP_MODULE");
|
if(MODULE.isEnabled()) addFlag("MAP_MODULE");
|
||||||
if(isModuleEnabled("Wrappers")) addFlag("MAPS_FEATURE");
|
if(WRAPPERS.isEnabled()) addFlag("MAPS_FEATURE");
|
||||||
boolean implementations = isModuleEnabled("Implementations");
|
if(ORDERED_MAP.isEnabled()) addFlag("ORDERED_MAP_FEATURE");
|
||||||
boolean hashMap = implementations && isModuleEnabled("HashMap");
|
if(ARRAY_MAP.isEnabled()) addFlag("ARRAY_MAP_FEATURE");
|
||||||
boolean customHashMap = implementations && isModuleEnabled("CustomHashMap");
|
if(LINKED_MAP.isEnabled()) addFlag("LINKED_MAP_FEATURE");
|
||||||
boolean enumMap = implementations && isModuleEnabled("EnumMap");
|
if(LINKED_CUSTOM_MAP.isEnabled()) addFlag("LINKED_CUSTOM_MAP_FEATURE");
|
||||||
|
if(LINKED_ENUM_MAP.isEnabled()) addFlag("LINKED_ENUM_MAP_FEATURE");
|
||||||
|
|
||||||
if(isModuleEnabled("OrderedMap")) {
|
if(SORTED_MAP.isEnabled()) addFlag("SORTED_MAP_FEATURE");
|
||||||
addFlag("ORDERED_MAP_FEATURE");
|
if(AVL_TREE_MAP.isEnabled()) addFlag("AVL_TREE_MAP_FEATURE");
|
||||||
if(isModuleEnabled("ArrayMap")) addFlag("ARRAY_MAP_FEATURE");
|
if(RB_TREE_MAP.isEnabled()) addFlag("RB_TREE_MAP_FEATURE");
|
||||||
if(hashMap && isModuleEnabled("LinkedHashMap")) addFlag("LINKED_MAP_FEATURE");
|
|
||||||
if(customHashMap && isModuleEnabled("LinkedCustomHashMap")) addFlag("LINKED_CUSTOM_MAP_FEATURE");
|
if(CONCURRENT_MAP.isEnabled()) addFlag("CONCURRENT_MAP_FEATURE");
|
||||||
if(enumMap && isModuleEnabled("LinkedEnumMap")) addFlag("LINKED_ENUM_MAP_FEATURE");
|
if(IMMUTABLE_MAP.isEnabled()) addFlag("IMMUTABLE_MAP_FEATURE");
|
||||||
}
|
if(HASH_MAP.isEnabled()) addFlag("MAP_FEATURE");
|
||||||
if(isModuleEnabled("SortedMap")) {
|
if(CUSTOM_MAP.isEnabled()) addFlag("CUSTOM_MAP_FEATURE");
|
||||||
addFlag("SORTED_MAP_FEATURE");
|
if(ENUM_MAP.isEnabled()) addFlag("ENUM_MAP_FEATURE");
|
||||||
if(implementations && isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE");
|
|
||||||
if(implementations && isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE");
|
|
||||||
}
|
|
||||||
if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE");
|
|
||||||
if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE");
|
|
||||||
if(hashMap) addFlag("MAP_FEATURE");
|
|
||||||
if(customHashMap) addFlag("CUSTOM_MAP_FEATURE");
|
|
||||||
if(enumMap) addFlag("ENUM_MAP_FEATURE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades()
|
protected void loadBlockades()
|
||||||
{
|
{
|
||||||
if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap");
|
if(!MODULE.isEnabled()) addBlockedFiles("Map", "AbstractMap");
|
||||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Maps");
|
if(!WRAPPERS.isEnabled()) addBlockedFiles("Maps");
|
||||||
boolean implementations = !isModuleEnabled("Implementations");
|
if(!IMMUTABLE_MAP.isEnabled()) addBlockedFiles("ImmutableOpenHashMap");
|
||||||
if(implementations || !isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap");
|
if(!CONCURRENT_MAP.isEnabled()) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
|
||||||
if(implementations || !isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
|
if(!ORDERED_MAP.isEnabled()) addBlockedFiles("OrderedMap");
|
||||||
|
if(!HASH_MAP.isEnabled()) addBlockedFiles("OpenHashMap");
|
||||||
boolean ordered = !isModuleEnabled("OrderedMap");
|
if(!LINKED_MAP.isEnabled()) addBlockedFiles("LinkedOpenHashMap");
|
||||||
if(ordered) addBlockedFiles("OrderedMap");
|
if(CUSTOM_MAP.isEnabled()) addBlockedFiles("OpenCustomHashMap");
|
||||||
boolean hashMap = implementations || !isModuleEnabled("HashMap");
|
if(!LINKED_CUSTOM_MAP.isEnabled()) addBlockedFiles("LinkedOpenCustomHashMap");
|
||||||
if(hashMap) addBlockedFiles("OpenHashMap");
|
if(!ENUM_MAP.isEnabled()) addBlockedFiles("EnumMap");
|
||||||
if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap");
|
if(!LINKED_ENUM_MAP.isEnabled()) addBlockedFiles("LinkedEnumMap");
|
||||||
|
if(!ARRAY_MAP.isEnabled()) addBlockedFiles("ArrayMap");
|
||||||
boolean customHashMap = implementations || !isModuleEnabled("CustomHashMap");
|
if(!SORTED_MAP.isEnabled()) addBlockedFiles("SortedMap", "NavigableMap");
|
||||||
if(customHashMap) addBlockedFiles("OpenCustomHashMap");
|
if(!AVL_TREE_MAP.isEnabled()) addBlockedFiles("AVLTreeMap");
|
||||||
if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap");
|
if(!RB_TREE_MAP.isEnabled()) addBlockedFiles("RBTreeMap");
|
||||||
|
|
||||||
boolean enumMap = implementations || !isModuleEnabled("EnumMap");
|
|
||||||
if(enumMap) addBlockedFiles("EnumMap");
|
|
||||||
if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap");
|
|
||||||
|
|
||||||
if(ordered || !isModuleEnabled("ArrayMap")) addBlockedFiles("ArrayMap");
|
|
||||||
|
|
||||||
boolean sorted = !isModuleEnabled("SortedMap");
|
|
||||||
if(sorted) addBlockedFiles("SortedMap", "NavigableMap");
|
|
||||||
if(implementations || sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap");
|
|
||||||
if(implementations || sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap");
|
|
||||||
|
|
||||||
if(keyType == ClassType.BOOLEAN)
|
if(keyType == ClassType.BOOLEAN)
|
||||||
{
|
{
|
||||||
|
|
|
@ -5,11 +5,18 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.BiTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class PairModule extends BaseModule
|
public class PairModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new PairModule();
|
public static final BaseModule INSTANCE = new PairModule();
|
||||||
|
public static final DependencyModule MODULE = new BiTypeModule(INSTANCE);
|
||||||
|
public static final DependencyFunction IMMUTABLE = MODULE.createFunction("Immutable");
|
||||||
|
public static final DependencyFunction MUTABLE = MODULE.createFunction("Mutable");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Pair"; }
|
public String getModuleName() { return "Pair"; }
|
||||||
@Override
|
@Override
|
||||||
|
@ -25,16 +32,16 @@ public class PairModule extends BaseModule
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
if(isModuleEnabled()) addFlag("PAIR_MODULE");
|
if(MODULE.isEnabled()) addFlag("PAIR_MODULE");
|
||||||
if(isModuleEnabled("Mutable")) addFlag("MUTABLE_PAIR");
|
if(MUTABLE.isEnabled()) addFlag("MUTABLE_PAIR");
|
||||||
if(isModuleEnabled("Immutable")) addFlag("IMMUTABLE_PAIR");
|
if(IMMUTABLE.isEnabled()) addFlag("IMMUTABLE_PAIR");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades() {
|
protected void loadBlockades() {
|
||||||
if(!isModuleEnabled()) addBlockedFiles("Pair");
|
if(!MODULE.isEnabled()) addBlockedFiles("Pair");
|
||||||
if(!isModuleEnabled("Mutable")) addBlockedFiles("MutablePair");
|
if(!MUTABLE.isEnabled()) addBlockedFiles("MutablePair");
|
||||||
if(!isModuleEnabled("Immutable")) addBlockedFiles("ImmutablePair");
|
if(!IMMUTABLE.isEnabled()) addBlockedFiles("ImmutablePair");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,11 +5,21 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class PrioQueueModule extends BaseModule
|
public class PrioQueueModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new PrioQueueModule();
|
public static final BaseModule INSTANCE = new PrioQueueModule();
|
||||||
|
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||||
|
public static final DependencyFunction IMPLEMENTATION = MODULE.createFunction("Implementations");
|
||||||
|
public static final DependencyFunction WRAPPERS = MODULE.createFunction("Wrappers");
|
||||||
|
public static final DependencyFunction DEQUEUE = MODULE.createFunction("Dequeue");
|
||||||
|
public static final DependencyFunction FIFO_QUEUE = DEQUEUE.addChild(IMPLEMENTATION.createSubFunction("FiFoQueue"));
|
||||||
|
public static final DependencyFunction HEAP_QUEUE = IMPLEMENTATION.createSubFunction("HeapQueue");
|
||||||
|
public static final DependencyFunction ARRAY_PRIO_QUEUE = IMPLEMENTATION.createSubFunction("ArrayPrioQueue");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "PriorityQueue"; }
|
public String getModuleName() { return "PriorityQueue"; }
|
||||||
|
@ -27,27 +37,22 @@ public class PrioQueueModule extends BaseModule
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags() {
|
protected void loadFlags() {
|
||||||
if(isModuleEnabled()) addFlag("QUEUE_MODULE");
|
if(MODULE.isEnabled()) addFlag("QUEUE_MODULE");
|
||||||
if(isModuleEnabled("Wrappers")) addKeyFlag("QUEUES_FEATURE");
|
if(WRAPPERS.isEnabled()) addKeyFlag("QUEUES_FEATURE");
|
||||||
boolean implementations = isModuleEnabled("Implementations");
|
if(DEQUEUE.isEnabled()) addKeyFlag("DEQUEUE_FEATURE");
|
||||||
if(isModuleEnabled("Dequeue")) {
|
if(FIFO_QUEUE.isEnabled()) addKeyFlag("FIFO_QUEUE_FEATURE");
|
||||||
addKeyFlag("DEQUEUE_FEATURE");
|
if(HEAP_QUEUE.isEnabled()) addKeyFlag("HEAP_QUEUE_FEATURE");
|
||||||
if(implementations && isModuleEnabled("FiFoQueue")) addKeyFlag("FIFO_QUEUE_FEATURE");
|
if(ARRAY_PRIO_QUEUE.isEnabled()) addKeyFlag("ARRAY_QUEUE_FEATURE");
|
||||||
}
|
|
||||||
if(implementations && isModuleEnabled("HeapQueue")) addKeyFlag("HEAP_QUEUE_FEATURE");
|
|
||||||
if(implementations && isModuleEnabled("ArrayPrioQueue")) addKeyFlag("ARRAY_QUEUE_FEATURE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades() {
|
protected void loadBlockades() {
|
||||||
if(!isModuleEnabled()) addBlockedFiles("PriorityQueue", "AbstractPriorityQueue");
|
if(!MODULE.isEnabled()) addBlockedFiles("PriorityQueue", "AbstractPriorityQueue");
|
||||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("PriorityQueues");
|
if(!WRAPPERS.isEnabled()) addBlockedFiles("PriorityQueues");
|
||||||
boolean implementations = !isModuleEnabled("Implementations");
|
if(!DEQUEUE.isEnabled()) addBlockedFiles("PriorityDequeue");
|
||||||
boolean dequeue = !isModuleEnabled("Dequeue");
|
if(!FIFO_QUEUE.isEnabled()) addBlockedFiles("ArrayFIFOQueue");
|
||||||
if(dequeue) addBlockedFiles("PriorityDequeue");
|
if(!HEAP_QUEUE.isEnabled()) addBlockedFiles("HeapPriorityQueue");
|
||||||
if(dequeue || implementations || !isModuleEnabled("FiFoQueue")) addBlockedFiles("ArrayFIFOQueue");
|
if(!ARRAY_PRIO_QUEUE.isEnabled()) addBlockedFiles("ArrayPriorityQueue");
|
||||||
if(implementations || !isModuleEnabled("HeapQueue")) addBlockedFiles("HeapPriorityQueue");
|
|
||||||
if(implementations || !isModuleEnabled("ArrayPrioQueue")) addBlockedFiles("ArrayPriorityQueue");
|
|
||||||
|
|
||||||
if(keyType == ClassType.BOOLEAN) {
|
if(keyType == ClassType.BOOLEAN) {
|
||||||
addBlockedFiles("QueueTests");
|
addBlockedFiles("QueueTests");
|
||||||
|
|
|
@ -5,11 +5,27 @@ import java.util.Set;
|
||||||
import java.util.TreeSet;
|
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.DependencyModule;
|
||||||
|
import speiger.src.builder.dependency.DependencyModule.SingleTypeModule;
|
||||||
|
|
||||||
@SuppressWarnings("javadoc")
|
@SuppressWarnings("javadoc")
|
||||||
public class SetModule extends BaseModule
|
public class SetModule extends BaseModule
|
||||||
{
|
{
|
||||||
public static final BaseModule INSTANCE = new SetModule();
|
public static final BaseModule INSTANCE = new SetModule();
|
||||||
|
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 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");
|
||||||
|
public static final DependencyFunction LINKED_SET = HASH_SET.addChild(ORDERED_SET.addChild(IMPLEMENTATION.createSubFunction("LinkedHashSet")));
|
||||||
|
public static final DependencyFunction CUSTOM_SET = IMPLEMENTATION.createSubFunction("CustomHashSet");
|
||||||
|
public static final DependencyFunction LINKED_CUSTOM_SET = CUSTOM_SET.addChild(ORDERED_SET.addChild(IMPLEMENTATION.createSubFunction("LinkedCustomHashSet")));
|
||||||
|
public static final DependencyFunction AVL_TREE_SET = SORTED_SET.addChild(IMPLEMENTATION.createSubFunction("AVLTreeSet"));
|
||||||
|
public static final DependencyFunction RB_TREE_SET = SORTED_SET.addChild(IMPLEMENTATION.createSubFunction("RBTreeSet"));
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getModuleName() { return "Set"; }
|
public String getModuleName() { return "Set"; }
|
||||||
|
@ -35,52 +51,35 @@ public class SetModule extends BaseModule
|
||||||
@Override
|
@Override
|
||||||
protected void loadFlags()
|
protected void loadFlags()
|
||||||
{
|
{
|
||||||
if(isModuleEnabled()) addFlag("SET_MODULE");
|
if(MODULE.isEnabled()) addFlag("SET_MODULE");
|
||||||
if(isModuleEnabled("Wrappers")) addFlag("SETS_FEATURE");
|
if(WRAPPERS.isEnabled()) addFlag("SETS_FEATURE");
|
||||||
boolean implementations = isModuleEnabled("Implementations");
|
if(ORDERED_SET.isEnabled()) addFlag("ORDERED_SET_FEATURE");
|
||||||
boolean hashSet = implementations && isModuleEnabled("HashSet");
|
if(SORTED_SET.isEnabled()) addFlag("SORTED_SET_FEATURE");
|
||||||
boolean customHashSet = implementations && isModuleEnabled("CustomHashSet");
|
if(IMMUTABLE_SET.isEnabled()) addFlag("IMMUTABLE_SET_FEATURE");
|
||||||
|
if(ARRAY_SET.isEnabled()) addFlag("ARRAY_SET_FEATURE");
|
||||||
if(isModuleEnabled("OrderedSet")) {
|
if(HASH_SET.isEnabled()) addFlag("HASH_SET_FEATURE");
|
||||||
addFlag("ORDERED_SET_FEATURE");
|
if(LINKED_SET.isEnabled()) addFlag("LINKED_SET_FEATURE");
|
||||||
if(implementations && isModuleEnabled("ArraySet")) addFlag("ARRAY_SET_FEATURE");
|
if(CUSTOM_SET.isEnabled()) addFlag("CUSTOM_HASH_SET_FEATURE");
|
||||||
if(hashSet && isModuleEnabled("LinkedHashSet")) addFlag("LINKED_SET_FEATURE");
|
if(LINKED_CUSTOM_SET.isEnabled()) addFlag("LINKED_CUSTOM_SET_FEATURE");
|
||||||
if(customHashSet && isModuleEnabled("LinkedCustomHashSet")) addFlag("LINKED_CUSTOM_SET_FEATURE");
|
if(AVL_TREE_SET.isEnabled()) addFlag("AVL_TREE_SET_FEATURE");
|
||||||
}
|
if(RB_TREE_SET.isEnabled()) addFlag("RB_TREE_SET_FEATURE");
|
||||||
if(isModuleEnabled("SortedSet")) {
|
|
||||||
addFlag("SORTED_SET_FEATURE");
|
|
||||||
if(implementations && isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE");
|
|
||||||
if(implementations && isModuleEnabled("RBTreeSet")) addFlag("RB_TREE_SET_FEATURE");
|
|
||||||
}
|
|
||||||
if(implementations && isModuleEnabled("ImmutableSet")) addFlag("IMMUTABLE_SET_FEATURE");
|
|
||||||
if(hashSet) addFlag("HASH_SET_FEATURE");
|
|
||||||
if(customHashSet) addFlag("CUSTOM_HASH_SET_FEATURE");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void loadBlockades()
|
protected void loadBlockades()
|
||||||
{
|
{
|
||||||
if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet");
|
if(!MODULE.isEnabled()) addBlockedFiles("Set", "AbstractSet");
|
||||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Sets");
|
if(!WRAPPERS.isEnabled()) addBlockedFiles("Sets");
|
||||||
boolean implementations = !isModuleEnabled("Implementations");
|
if(!IMMUTABLE_SET.isEnabled()) addBlockedFiles("ImmutableOpenHashSet");
|
||||||
if(implementations || !isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet");
|
if(!ORDERED_SET.isEnabled()) addBlockedFiles("OrderedSet");
|
||||||
|
if(!HASH_SET.isEnabled()) addBlockedFiles("OpenHashSet");
|
||||||
boolean ordered = !isModuleEnabled("OrderedSet");
|
if(!LINKED_SET.isEnabled()) addBlockedFiles("LinkedOpenHashSet");
|
||||||
if(ordered) addBlockedFiles("OrderedSet");
|
if(!CUSTOM_SET.isEnabled()) addBlockedFiles("OpenCustomHashSet");
|
||||||
boolean hashSet = implementations || !isModuleEnabled("HashSet");
|
if(!LINKED_CUSTOM_SET.isEnabled()) addBlockedFiles("LinkedOpenCustomHashSet");
|
||||||
if(hashSet) addBlockedFiles("OpenHashSet");
|
if(!ARRAY_SET.isEnabled()) addBlockedFiles("ArraySet");
|
||||||
if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet");
|
if(!SORTED_SET.isEnabled()) addBlockedFiles("SortedSet", "NavigableSet");
|
||||||
|
if(!AVL_TREE_SET.isEnabled()) addBlockedFiles("AVLTreeSet");
|
||||||
boolean customHashSet = implementations || !isModuleEnabled("CustomHashSet");
|
if(!RB_TREE_SET.isEnabled()) addBlockedFiles("RBTreeSet");
|
||||||
if(customHashSet) addBlockedFiles("OpenCustomHashSet");
|
|
||||||
if(customHashSet || ordered || !isModuleEnabled("LinkedCustomHashSet")) addBlockedFiles("LinkedOpenCustomHashSet");
|
|
||||||
|
|
||||||
if(implementations || ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet");
|
|
||||||
|
|
||||||
boolean sorted = !isModuleEnabled("SortedSet");
|
|
||||||
if(sorted) addBlockedFiles("SortedSet", "NavigableSet");
|
|
||||||
if(implementations || sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet");
|
|
||||||
if(implementations || sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet");
|
|
||||||
|
|
||||||
if(keyType == ClassType.BOOLEAN)
|
if(keyType == ClassType.BOOLEAN)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue