Compare commits
2 Commits
master
...
advanced_d
Author | SHA1 | Date |
---|---|---|
Speiger | cdcf5dc087 | |
Speiger | 54aae530a1 |
16
Changelog.md
16
Changelog.md
|
@ -1,21 +1,5 @@
|
|||
# Changelog of versions
|
||||
|
||||
### Version 0.9.0
|
||||
- Added: getFirst/getLast/removeFirst/removeLast to List.class.
|
||||
- Added: Dedicated Set toArray implementations.
|
||||
- Added: ToArray/pushTop functions to Stack.class.
|
||||
- Added: ComputeNonDefault functions which will contain the current behavior of the Compute function, while the Compute will be changed to be more java compliant!
|
||||
- Added: List.reversed, which returns a SubList that has all elements in reversed order and also inserts reversed.
|
||||
- Added: Iterators.infinite as an option that will create a Infinite Iterator based on the inputed one.
|
||||
- Added: List.indexedIterator which allows you to create a iterator with a customized iteration indecies. Useful if you want to transform lists output.
|
||||
- Added: PriorityQueue.contains is now a function
|
||||
- Added: Iterators/Async Builders now support MapToPrimitiveType function on the object variant. So more processing can be done. (Will be expanded upon later versions)
|
||||
- Fixed: SetValue wasn't working on forEach implementations.
|
||||
- Fixed: Compute functions now perform with primitives more java compliant. Meaning that getDefaultReturnValue function no longer is seen as null.
|
||||
- Fixed: Supplier was using the wrong dataType in their function name.
|
||||
- Updated: SimpleCodeGenerator 1.3.0 is now being used which allows for iterative code support.
|
||||
- Breaking Change: Map.compute/IfAbsent/Present and Map.supplyIfAbsent if the value is a primitive it will no longer accept the defaultReturnValue() as "null" if that functionality is desired then use: computeNonDefault which contains the functionality!
|
||||
|
||||
### Version 0.8.1
|
||||
- Added: getFirst/getLast/removeFirst/removeLast to List.class.
|
||||
- Added: Dedicated Set toArray implementations.
|
||||
|
|
2604
ModulSettings.json
2604
ModulSettings.json
File diff suppressed because it is too large
Load Diff
10
README.md
10
README.md
|
@ -1,6 +1,5 @@
|
|||
![build](https://github.com/Speiger/Primitive-Collections/actions/workflows/build_action.yml/badge.svg)
|
||||
[![Latest Release](https://jitpack.io/v/Speiger/Primitive-Collections.svg)](https://jitpack.io/#Speiger/Primitive-Collections)
|
||||
![Maven Central Version](https://img.shields.io/maven-central/v/io.github.speiger/Primitive-Collections)
|
||||
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
|
||||
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/Speiger/Primitive-Collections)
|
||||
![Unit Tests](https://github.com/Speiger/Primitive-Collections/actions/workflows/build_tests_action.yml/badge.svg)
|
||||
|
@ -44,7 +43,7 @@ To ensure that problems can be dealt with even if it is breaking the current API
|
|||
|
||||
# How to install
|
||||
Using Jitpack Gradle
|
||||
```groovy
|
||||
```gradle
|
||||
repositories {
|
||||
maven {
|
||||
url = "https://jitpack.io"
|
||||
|
@ -55,13 +54,6 @@ dependencies {
|
|||
}
|
||||
```
|
||||
|
||||
Using Maven Central
|
||||
```groovy
|
||||
dependencies {
|
||||
implementation 'io.github.speiger:Primitive-Collections:0.9.0'
|
||||
}
|
||||
```
|
||||
|
||||
# SourceCode
|
||||
The generated Sourcecode can be automatically build,
|
||||
but if you want to just browse around in it.
|
||||
|
|
15
SECURITY.md
15
SECURITY.md
|
@ -1,15 +0,0 @@
|
|||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
Due to how the releases work, only the latest versions will be supported.
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you have discovered a security vulnerability in this project, please report it privately.
|
||||
**Please refrain from posting in public issues.**
|
||||
This gives me time to process issues that are being found, and reduces the possiblity of abuse while patches are being created.
|
||||
Please disclose it [here](https://github.com/Speiger/Primitive-Collections/security/advisories/new).
|
||||
|
||||
Please consider that this project is developed by a single person.
|
||||
So please provide a reasonable timeframe when reporting.
|
108
build.gradle
108
build.gradle
|
@ -1,7 +1,6 @@
|
|||
plugins {
|
||||
id 'java-library'
|
||||
id "jacoco"
|
||||
// id "com.vanniktech.maven.publish" version "0.28.0"
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile) {
|
||||
|
@ -11,7 +10,6 @@ tasks.withType(JavaCompile) {
|
|||
apply plugin: 'java'
|
||||
apply plugin: 'eclipse'
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
|
@ -21,17 +19,12 @@ repositories {
|
|||
}
|
||||
|
||||
archivesBaseName = 'Primitive Collections'
|
||||
version = RELEASE_VERSION;
|
||||
version = '0.9.0';
|
||||
|
||||
sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = JavaVersion.current();
|
||||
|
||||
System.out.println("Java Version: "+compileJava.sourceCompatibility)
|
||||
|
||||
java {
|
||||
withJavadocJar()
|
||||
withSourcesJar()
|
||||
}
|
||||
|
||||
javadoc {
|
||||
options.tags = [ "implSpec", "note" ]
|
||||
}
|
||||
|
@ -106,12 +99,26 @@ task generateLimitSource(type: JavaExec) {
|
|||
args = ['silent', 'load']
|
||||
}
|
||||
|
||||
task javadocJar(type: Jar) {
|
||||
from javadoc
|
||||
archiveClassifier = 'javadoc'
|
||||
}
|
||||
|
||||
task srcJar(type: Jar) {
|
||||
from sourceSets.main.allSource
|
||||
archiveClassifier = 'sources'
|
||||
}
|
||||
|
||||
compileJava.dependsOn generateGithubSource
|
||||
|
||||
javadoc.failOnError = false
|
||||
javadoc.options.memberLevel = JavadocMemberLevel.PUBLIC
|
||||
javadoc.options.quiet()
|
||||
|
||||
artifacts {
|
||||
archives javadocJar
|
||||
archives srcJar
|
||||
}
|
||||
|
||||
task testBooleans(type: Test) {
|
||||
group 'tests'
|
||||
|
@ -261,10 +268,13 @@ jacocoTestReport {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
publishing {
|
||||
Properties props = new Properties()
|
||||
if(file("$buildDir/credentials.properties").exists()) {
|
||||
props.load(new FileInputStream("$buildDir/credentials.properties"))
|
||||
}
|
||||
publications {
|
||||
personal(MavenPublication) {
|
||||
mavenJava(MavenPublication) {
|
||||
pom {
|
||||
name = 'Primitive Collections'
|
||||
description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||
|
@ -273,6 +283,8 @@ publishing {
|
|||
artifactId = project.archivesBaseName.replace(" ", "-")
|
||||
groupId = 'de.speiger'
|
||||
from components.java
|
||||
artifact tasks.srcJar
|
||||
artifact tasks.javadocJar
|
||||
licenses {
|
||||
license {
|
||||
name = 'The Apache License, Version 2.0'
|
||||
|
@ -297,83 +309,11 @@ publishing {
|
|||
}
|
||||
repositories {
|
||||
maven {
|
||||
name = "Speiger_Maven"
|
||||
def auth = System.getenv("Speiger_Maven_Auth")?.split(';');
|
||||
url version.endsWith('SNAPSHOT') ? "https://maven.speiger.com/repository/debug" : "https://maven.speiger.com/repository/main"
|
||||
credentials(PasswordCredentials) {
|
||||
username auth?[0]
|
||||
password auth?[1]
|
||||
username props.mavenUser
|
||||
password props.mavenPassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(PublishToMavenRepository) {
|
||||
def predicate = provider {
|
||||
(repository == publishing.repositories.mavenCentral && publication == publishing.publications.maven) ||
|
||||
(repository != publishing.repositories.mavenCentral && publication != publishing.publications.maven)
|
||||
}
|
||||
onlyIf("publishing binary to the external repository, or binary and sources to the internal one") {
|
||||
predicate.get()
|
||||
}
|
||||
}
|
||||
|
||||
tasks.withType(PublishToMavenLocal) {
|
||||
def predicate = provider {
|
||||
publication == publishing.publications.personal
|
||||
}
|
||||
onlyIf("publishing binary and sources") {
|
||||
predicate.get()
|
||||
}
|
||||
}
|
||||
|
||||
//Maven central Start
|
||||
//Disabling due to java8 incompat, only needed to manually publishing anyways
|
||||
|
||||
//signing.useGpgCmd()
|
||||
//
|
||||
//import com.vanniktech.maven.publish.SonatypeHost
|
||||
//import com.vanniktech.maven.publish.JavaLibrary
|
||||
//import com.vanniktech.maven.publish.JavadocJar
|
||||
//
|
||||
//mavenPublishing {
|
||||
// configure(new JavaLibrary(new JavadocJar.None(), true))
|
||||
//}
|
||||
//
|
||||
//mavenPublishing {
|
||||
// publishToMavenCentral(SonatypeHost.CENTRAL_PORTAL)
|
||||
//
|
||||
// signAllPublications()
|
||||
// pom {
|
||||
// name = 'Primitive Collections'
|
||||
// description = 'A Primitive Collection library that reduces memory usage and improves performance'
|
||||
// url = 'https://github.com/Speiger/Primitive-Collections'
|
||||
// version = project.version
|
||||
// group = 'io.github.speiger'
|
||||
// licenses {
|
||||
// license {
|
||||
// name = 'The Apache License, Version 2.0'
|
||||
// url = 'http://www.apache.org/licenses/LICENSE-2.0.txt'
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// developers {
|
||||
// developer {
|
||||
// id = 'speiger'
|
||||
// name = 'Speiger'
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// scm {
|
||||
// connection = 'scm:git:git://github.com/Speiger/Primitive-Collections.git'
|
||||
// developerConnection = 'scm:git:ssh://github.com:Speiger/Primitive-Collections.git'
|
||||
// url = 'https://github.com/Speiger/Primitive-Collections'
|
||||
// }
|
||||
//
|
||||
// issueManagement {
|
||||
// system = 'github'
|
||||
// url = 'https://github.com/Speiger/Primitive-Collections/issues'
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//
|
|
@ -1,6 +1,4 @@
|
|||
org.gradle.jvmargs=-Xmx3G
|
||||
|
||||
maxMemory = 1024m
|
||||
testThreads = 4
|
||||
|
||||
RELEASE_VERSION = 0.9.0
|
||||
testThreads = 2
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,49 @@
|
|||
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;
|
||||
}
|
||||
|
||||
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,131 @@
|
|||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return functionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoaded() {
|
||||
Arrays.fill(state, LoadingState.LOADED);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return functionName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoaded() {
|
||||
for(int i = 0;i<state.length;i++) {
|
||||
Arrays.fill(state[i], LoadingState.LOADED);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,170 @@
|
|||
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;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return "Enabled";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoaded() {
|
||||
Arrays.fill(state, LoadingState.LOADED);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@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());
|
||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
||||
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||
if(owner.isBiModule()) {
|
||||
result = getObject(result, valueType.getClassPath(), false);
|
||||
state = state.replaceIfDefined(isEnabled(result, "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());
|
||||
JsonObject result = getObject(data, keyType.getClassPath(), false);
|
||||
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||
if(owner.isBiModule()) {
|
||||
result = getObject(result, valueType.getClassPath(), false);
|
||||
state = state.replaceIfDefined(isEnabled(result, "Enabled"));
|
||||
}
|
||||
result = getObject(result, owner.getModuleName(), false);
|
||||
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) {
|
||||
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,42 @@
|
|||
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) {
|
||||
if(keyType != myType || valueType != myType) return LoadingState.UNDEFINED;
|
||||
return owner.getState(keyType, valueType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean resolveDependencies() { return false; }
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return owner.getState(myType, myType) == LoadingState.LOADED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoaded() {
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
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();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLoaded() {
|
||||
}
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
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 resolveDependencies();
|
||||
public boolean isEnabled();
|
||||
public void setLoaded();
|
||||
public String getName();
|
||||
|
||||
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 replaceIfDefined(LoadingState state) {
|
||||
return state == UNDEFINED ? this : state;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public boolean getJsonResult() {
|
||||
return this == LOADED;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,9 +1,19 @@
|
|||
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
|
||||
{
|
||||
public static final BaseModule INSTANCE = new AsyncModule();
|
||||
public static final DependencyModule MODULE = CollectionModule.MODULE.addChild(new SingleTypeModule(INSTANCE));
|
||||
|
||||
|
||||
@Override
|
||||
public String getModuleName() { return "Async"; }
|
||||
|
@ -16,16 +26,16 @@ 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(!isModuleEnabled()) {
|
||||
if(MODULE.isEnabled()) {
|
||||
addBlockedFiles("AsyncBuilder", "Task");
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void loadFlags() {
|
||||
if(isModuleEnabled()) {
|
||||
if(MODULE.isEnabled()) {
|
||||
addKeyFlag("ASYNC_MODULE");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
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;
|
||||
|
||||
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;
|
||||
|
@ -56,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);
|
||||
}
|
||||
|
@ -205,4 +187,9 @@ public abstract class BaseModule
|
|||
entry.addMapper(mapper);
|
||||
return mapper;
|
||||
}
|
||||
|
||||
public static <T> T make(T input, Consumer<T> processor) {
|
||||
processor.accept(input);
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,52 +1,56 @@
|
|||
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
|
||||
{
|
||||
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
|
||||
public String getModuleName() { return "Collection"; }
|
||||
@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() {
|
||||
if(isModuleEnabled()) addKeyFlag("COLLECTION_MODULE");
|
||||
if(isModuleEnabled("Streams")) addKeyFlag("STREAM_FEATURE");
|
||||
if(isModuleEnabled("Splititerators")) addKeyFlag("SPLIT_ITERATOR_FEATURE");
|
||||
if(isModuleEnabled("IArray")) addKeyFlag("IARRAY_FEATURE");
|
||||
if(MODULE.isEnabled()) addKeyFlag("COLLECTION_MODULE");
|
||||
if(STREAMS.isEnabled()) addKeyFlag("STREAM_FEATURE");
|
||||
if(SPLIT_ITERATORS.isEnabled()) addKeyFlag("SPLIT_ITERATOR_FEATURE");
|
||||
if(IARRAY.isEnabled()) addKeyFlag("IARRAY_FEATURE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades() {
|
||||
if(!isModuleEnabled()) {
|
||||
if(!MODULE.isEnabled()) {
|
||||
addBlockedFiles("Iterable", "Iterables", "Iterator", "Iterators", "BidirectionalIterator", "ListIterator");
|
||||
addBlockedFiles("Arrays", "Collection", "AbstractCollection", "Collections", "Stack");
|
||||
}
|
||||
if(!isModuleEnabled("Splititerators")) addBlockedFiles("Splititerator", "Splititerators");
|
||||
if(!isModuleEnabled("IArray")) addBlockedFiles("IArray");
|
||||
if(!isModuleEnabled("Strategy")) addBlockedFiles("Strategy");
|
||||
if(!SPLIT_ITERATORS.isEnabled()) addBlockedFiles("Splititerator", "Splititerators");
|
||||
if(!IARRAY.isEnabled()) addBlockedFiles("IArray");
|
||||
if(!STRATEGY.isEnabled()) addBlockedFiles("Strategy");
|
||||
|
||||
if(keyType.isObject()) {
|
||||
if(keyType.isObject())
|
||||
{
|
||||
addBlockedFiles("Stack");
|
||||
addBlockedFiles("CollectionStreamTester");
|
||||
}
|
||||
if(keyType == ClassType.BOOLEAN) {
|
||||
if(keyType == ClassType.BOOLEAN)
|
||||
{
|
||||
addBlockedFiles("CollectionRemoveIfTester", "CollectionStreamTester");
|
||||
addBlockedFilter(T -> T.endsWith("Tester") && T.startsWith("Iterable"));
|
||||
}
|
||||
|
|
|
@ -1,12 +1,19 @@
|
|||
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")
|
||||
public class FunctionModule extends BaseModule
|
||||
{
|
||||
public static final BaseModule INSTANCE = new FunctionModule();
|
||||
public static final DependencyModule MODULE = new BiTypeModule(INSTANCE);
|
||||
|
||||
@Override
|
||||
public String getModuleName() { return "Function"; }
|
||||
|
@ -19,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()
|
||||
{
|
||||
|
|
|
@ -1,11 +1,18 @@
|
|||
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")
|
||||
public class JavaModule extends BaseModule
|
||||
{
|
||||
public static final BaseModule INSTANCE = new JavaModule();
|
||||
public static final DependencyBase MODULE = new SingleTypeModule(INSTANCE);
|
||||
|
||||
@Override
|
||||
public String getModuleName() { return "Base"; }
|
||||
|
@ -17,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()
|
||||
{
|
||||
|
|
|
@ -1,55 +1,58 @@
|
|||
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
|
||||
{
|
||||
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
|
||||
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() {
|
||||
if(isModuleEnabled()) addKeyFlag("LIST_MODULE");
|
||||
if(isModuleEnabled("Wrappers")) addKeyFlag("LISTS_FEATURE");
|
||||
boolean implementations = isModuleEnabled("Implementations");
|
||||
if(implementations && isModuleEnabled("ArrayList")) addKeyFlag("ARRAY_LIST_FEATURE");
|
||||
if(implementations && isModuleEnabled("LinkedList")) addKeyFlag("LINKED_LIST_FEATURE");
|
||||
if(implementations && isModuleEnabled("ImmutableList")) addKeyFlag("IMMUTABLE_LIST_FEATURE");
|
||||
if(implementations && isModuleEnabled("CopyOnWriteList")) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE");
|
||||
if(MODULE.isEnabled()) addKeyFlag("LIST_MODULE");
|
||||
if(WRAPPERS.isEnabled()) addKeyFlag("LISTS_FEATURE");
|
||||
if(ARRAY_LIST.isEnabled()) addKeyFlag("ARRAY_LIST_FEATURE");
|
||||
if(LINKED_LIST.isEnabled()) addKeyFlag("LINKED_LIST_FEATURE");
|
||||
if(IMMUTABLE_LIST.isEnabled()) addKeyFlag("IMMUTABLE_LIST_FEATURE");
|
||||
if(COPY_ON_WRITE_LIST.isEnabled()) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades()
|
||||
{
|
||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Lists");
|
||||
boolean implementations = !isModuleEnabled("Implementations");
|
||||
if(implementations || !isModuleEnabled("ArrayList")) addBlockedFiles("ArrayList");
|
||||
if(implementations || !isModuleEnabled("LinkedList")) addBlockedFiles("LinkedList");
|
||||
if(implementations || !isModuleEnabled("ImmutableList")) addBlockedFiles("ImmutableList");
|
||||
if(implementations || !isModuleEnabled("CopyOnWriteList")) addBlockedFiles("CopyOnWriteList");
|
||||
if(!isModuleEnabled()) addBlockedFiles("List", "AbstractList");
|
||||
if(!WRAPPERS.isEnabled()) addBlockedFiles("Lists");
|
||||
if(!ARRAY_LIST.isEnabled()) addBlockedFiles("ArrayList");
|
||||
if(!LINKED_LIST.isEnabled()) addBlockedFiles("LinkedList");
|
||||
if(!IMMUTABLE_LIST.isEnabled()) addBlockedFiles("ImmutableList");
|
||||
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()
|
||||
|
|
|
@ -1,15 +1,40 @@
|
|||
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.DependencyType;
|
||||
import speiger.src.builder.dependency.DependencyValue;
|
||||
import speiger.src.builder.dependency.IDependency;
|
||||
|
||||
@SuppressWarnings("javadoc")
|
||||
public class MapModule extends BaseModule
|
||||
{
|
||||
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("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");
|
||||
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
|
||||
public String getModuleName() { return "Map"; }
|
||||
|
@ -20,79 +45,48 @@ 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()
|
||||
{
|
||||
if(isModuleEnabled()) addFlag("MAP_MODULE");
|
||||
if(isModuleEnabled("Wrappers")) addFlag("MAPS_FEATURE");
|
||||
boolean implementations = isModuleEnabled("Implementations");
|
||||
boolean hashMap = implementations && isModuleEnabled("HashMap");
|
||||
boolean customHashMap = implementations && isModuleEnabled("CustomHashMap");
|
||||
boolean enumMap = implementations && isModuleEnabled("EnumMap");
|
||||
if(MODULE.isEnabled()) addFlag("MAP_MODULE");
|
||||
if(WRAPPERS.isEnabled()) addFlag("MAPS_FEATURE");
|
||||
if(ORDERED_MAP.isEnabled()) addFlag("ORDERED_MAP_FEATURE");
|
||||
if(ARRAY_MAP.isEnabled()) addFlag("ARRAY_MAP_FEATURE");
|
||||
if(LINKED_MAP.isEnabled()) addFlag("LINKED_MAP_FEATURE");
|
||||
if(LINKED_CUSTOM_MAP.isEnabled()) addFlag("LINKED_CUSTOM_MAP_FEATURE");
|
||||
if(LINKED_ENUM_MAP.isEnabled()) addFlag("LINKED_ENUM_MAP_FEATURE");
|
||||
|
||||
if(isModuleEnabled("OrderedMap")) {
|
||||
addFlag("ORDERED_MAP_FEATURE");
|
||||
if(isModuleEnabled("ArrayMap")) addFlag("ARRAY_MAP_FEATURE");
|
||||
if(hashMap && isModuleEnabled("LinkedHashMap")) addFlag("LINKED_MAP_FEATURE");
|
||||
if(customHashMap && isModuleEnabled("LinkedCustomHashMap")) addFlag("LINKED_CUSTOM_MAP_FEATURE");
|
||||
if(enumMap && isModuleEnabled("LinkedEnumMap")) addFlag("LINKED_ENUM_MAP_FEATURE");
|
||||
}
|
||||
if(isModuleEnabled("SortedMap")) {
|
||||
addFlag("SORTED_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");
|
||||
if(SORTED_MAP.isEnabled()) addFlag("SORTED_MAP_FEATURE");
|
||||
if(AVL_TREE_MAP.isEnabled()) addFlag("AVL_TREE_MAP_FEATURE");
|
||||
if(RB_TREE_MAP.isEnabled()) addFlag("RB_TREE_MAP_FEATURE");
|
||||
|
||||
if(CONCURRENT_MAP.isEnabled()) addFlag("CONCURRENT_MAP_FEATURE");
|
||||
if(IMMUTABLE_MAP.isEnabled()) addFlag("IMMUTABLE_MAP_FEATURE");
|
||||
if(HASH_MAP.isEnabled()) addFlag("MAP_FEATURE");
|
||||
if(CUSTOM_MAP.isEnabled()) addFlag("CUSTOM_MAP_FEATURE");
|
||||
if(ENUM_MAP.isEnabled()) addFlag("ENUM_MAP_FEATURE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades()
|
||||
{
|
||||
if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap");
|
||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Maps");
|
||||
boolean implementations = !isModuleEnabled("Implementations");
|
||||
if(implementations || !isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap");
|
||||
if(implementations || !isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
|
||||
|
||||
boolean ordered = !isModuleEnabled("OrderedMap");
|
||||
if(ordered) addBlockedFiles("OrderedMap");
|
||||
boolean hashMap = implementations || !isModuleEnabled("HashMap");
|
||||
if(hashMap) addBlockedFiles("OpenHashMap");
|
||||
if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap");
|
||||
|
||||
boolean customHashMap = implementations || !isModuleEnabled("CustomHashMap");
|
||||
if(customHashMap) addBlockedFiles("OpenCustomHashMap");
|
||||
if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap");
|
||||
|
||||
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(!MODULE.isEnabled()) addBlockedFiles("Map", "AbstractMap");
|
||||
if(!WRAPPERS.isEnabled()) addBlockedFiles("Maps");
|
||||
if(!IMMUTABLE_MAP.isEnabled()) addBlockedFiles("ImmutableOpenHashMap");
|
||||
if(!CONCURRENT_MAP.isEnabled()) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
|
||||
if(!ORDERED_MAP.isEnabled()) addBlockedFiles("OrderedMap");
|
||||
if(!HASH_MAP.isEnabled()) addBlockedFiles("OpenHashMap");
|
||||
if(!LINKED_MAP.isEnabled()) addBlockedFiles("LinkedOpenHashMap");
|
||||
if(CUSTOM_MAP.isEnabled()) addBlockedFiles("OpenCustomHashMap");
|
||||
if(!LINKED_CUSTOM_MAP.isEnabled()) addBlockedFiles("LinkedOpenCustomHashMap");
|
||||
if(!ENUM_MAP.isEnabled()) addBlockedFiles("EnumMap");
|
||||
if(!LINKED_ENUM_MAP.isEnabled()) addBlockedFiles("LinkedEnumMap");
|
||||
if(!ARRAY_MAP.isEnabled()) addBlockedFiles("ArrayMap");
|
||||
if(!SORTED_MAP.isEnabled()) addBlockedFiles("SortedMap", "NavigableMap");
|
||||
if(!AVL_TREE_MAP.isEnabled()) addBlockedFiles("AVLTreeMap");
|
||||
if(!RB_TREE_MAP.isEnabled()) addBlockedFiles("RBTreeMap");
|
||||
|
||||
if(keyType == ClassType.BOOLEAN)
|
||||
{
|
||||
|
|
|
@ -1,15 +1,22 @@
|
|||
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
|
||||
{
|
||||
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
|
||||
public String getModuleName() { return "Pair"; }
|
||||
@Override
|
||||
|
@ -21,20 +28,20 @@ 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() {
|
||||
if(isModuleEnabled()) addFlag("PAIR_MODULE");
|
||||
if(isModuleEnabled("Mutable")) addFlag("MUTABLE_PAIR");
|
||||
if(isModuleEnabled("Immutable")) addFlag("IMMUTABLE_PAIR");
|
||||
if(MODULE.isEnabled()) addFlag("PAIR_MODULE");
|
||||
if(MUTABLE.isEnabled()) addFlag("MUTABLE_PAIR");
|
||||
if(IMMUTABLE.isEnabled()) addFlag("IMMUTABLE_PAIR");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades() {
|
||||
if(!isModuleEnabled()) addBlockedFiles("Pair");
|
||||
if(!isModuleEnabled("Mutable")) addBlockedFiles("MutablePair");
|
||||
if(!isModuleEnabled("Immutable")) addBlockedFiles("ImmutablePair");
|
||||
if(!MODULE.isEnabled()) addBlockedFiles("Pair");
|
||||
if(!MUTABLE.isEnabled()) addBlockedFiles("MutablePair");
|
||||
if(!IMMUTABLE.isEnabled()) addBlockedFiles("ImmutablePair");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,15 +1,25 @@
|
|||
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
|
||||
{
|
||||
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
|
||||
public String getModuleName() { return "PriorityQueue"; }
|
||||
|
@ -18,36 +28,26 @@ 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() {
|
||||
if(isModuleEnabled()) addFlag("QUEUE_MODULE");
|
||||
if(isModuleEnabled("Wrappers")) addKeyFlag("QUEUES_FEATURE");
|
||||
boolean implementations = isModuleEnabled("Implementations");
|
||||
if(isModuleEnabled("Dequeue")) {
|
||||
addKeyFlag("DEQUEUE_FEATURE");
|
||||
if(implementations && isModuleEnabled("FiFoQueue")) addKeyFlag("FIFO_QUEUE_FEATURE");
|
||||
}
|
||||
if(implementations && isModuleEnabled("HeapQueue")) addKeyFlag("HEAP_QUEUE_FEATURE");
|
||||
if(implementations && isModuleEnabled("ArrayPrioQueue")) addKeyFlag("ARRAY_QUEUE_FEATURE");
|
||||
if(MODULE.isEnabled()) addFlag("QUEUE_MODULE");
|
||||
if(WRAPPERS.isEnabled()) addKeyFlag("QUEUES_FEATURE");
|
||||
if(DEQUEUE.isEnabled()) addKeyFlag("DEQUEUE_FEATURE");
|
||||
if(FIFO_QUEUE.isEnabled()) addKeyFlag("FIFO_QUEUE_FEATURE");
|
||||
if(HEAP_QUEUE.isEnabled()) addKeyFlag("HEAP_QUEUE_FEATURE");
|
||||
if(ARRAY_PRIO_QUEUE.isEnabled()) addKeyFlag("ARRAY_QUEUE_FEATURE");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades() {
|
||||
if(!isModuleEnabled()) addBlockedFiles("PriorityQueue", "AbstractPriorityQueue");
|
||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("PriorityQueues");
|
||||
boolean implementations = !isModuleEnabled("Implementations");
|
||||
boolean dequeue = !isModuleEnabled("Dequeue");
|
||||
if(dequeue) addBlockedFiles("PriorityDequeue");
|
||||
if(dequeue || implementations || !isModuleEnabled("FiFoQueue")) addBlockedFiles("ArrayFIFOQueue");
|
||||
if(implementations || !isModuleEnabled("HeapQueue")) addBlockedFiles("HeapPriorityQueue");
|
||||
if(implementations || !isModuleEnabled("ArrayPrioQueue")) addBlockedFiles("ArrayPriorityQueue");
|
||||
if(!MODULE.isEnabled()) addBlockedFiles("PriorityQueue", "AbstractPriorityQueue");
|
||||
if(!WRAPPERS.isEnabled()) addBlockedFiles("PriorityQueues");
|
||||
if(!DEQUEUE.isEnabled()) addBlockedFiles("PriorityDequeue");
|
||||
if(!FIFO_QUEUE.isEnabled()) addBlockedFiles("ArrayFIFOQueue");
|
||||
if(!HEAP_QUEUE.isEnabled()) addBlockedFiles("HeapPriorityQueue");
|
||||
if(!ARRAY_PRIO_QUEUE.isEnabled()) addBlockedFiles("ArrayPriorityQueue");
|
||||
|
||||
if(keyType == ClassType.BOOLEAN) {
|
||||
addBlockedFiles("QueueTests");
|
||||
|
|
|
@ -1,15 +1,31 @@
|
|||
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
|
||||
{
|
||||
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("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");
|
||||
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
|
||||
public String getModuleName() { return "Set"; }
|
||||
|
@ -19,68 +35,40 @@ 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()
|
||||
{
|
||||
if(isModuleEnabled()) addFlag("SET_MODULE");
|
||||
if(isModuleEnabled("Wrappers")) addFlag("SETS_FEATURE");
|
||||
boolean implementations = isModuleEnabled("Implementations");
|
||||
boolean hashSet = implementations && isModuleEnabled("HashSet");
|
||||
boolean customHashSet = implementations && isModuleEnabled("CustomHashSet");
|
||||
|
||||
if(isModuleEnabled("OrderedSet")) {
|
||||
addFlag("ORDERED_SET_FEATURE");
|
||||
if(implementations && isModuleEnabled("ArraySet")) addFlag("ARRAY_SET_FEATURE");
|
||||
if(hashSet && isModuleEnabled("LinkedHashSet")) addFlag("LINKED_SET_FEATURE");
|
||||
if(customHashSet && isModuleEnabled("LinkedCustomHashSet")) addFlag("LINKED_CUSTOM_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");
|
||||
if(MODULE.isEnabled()) addFlag("SET_MODULE");
|
||||
if(WRAPPERS.isEnabled()) addFlag("SETS_FEATURE");
|
||||
if(ORDERED_SET.isEnabled()) addFlag("ORDERED_SET_FEATURE");
|
||||
if(SORTED_SET.isEnabled()) addFlag("SORTED_SET_FEATURE");
|
||||
if(IMMUTABLE_SET.isEnabled()) addFlag("IMMUTABLE_SET_FEATURE");
|
||||
if(ARRAY_SET.isEnabled()) addFlag("ARRAY_SET_FEATURE");
|
||||
if(HASH_SET.isEnabled()) addFlag("HASH_SET_FEATURE");
|
||||
if(LINKED_SET.isEnabled()) addFlag("LINKED_SET_FEATURE");
|
||||
if(CUSTOM_SET.isEnabled()) addFlag("CUSTOM_HASH_SET_FEATURE");
|
||||
if(LINKED_CUSTOM_SET.isEnabled()) 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");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void loadBlockades()
|
||||
{
|
||||
if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet");
|
||||
if(!isModuleEnabled("Wrappers")) addBlockedFiles("Sets");
|
||||
boolean implementations = !isModuleEnabled("Implementations");
|
||||
if(implementations || !isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet");
|
||||
|
||||
boolean ordered = !isModuleEnabled("OrderedSet");
|
||||
if(ordered) addBlockedFiles("OrderedSet");
|
||||
boolean hashSet = implementations || !isModuleEnabled("HashSet");
|
||||
if(hashSet) addBlockedFiles("OpenHashSet");
|
||||
if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet");
|
||||
|
||||
boolean customHashSet = implementations || !isModuleEnabled("CustomHashSet");
|
||||
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(!MODULE.isEnabled()) addBlockedFiles("Set", "AbstractSet");
|
||||
if(!WRAPPERS.isEnabled()) addBlockedFiles("Sets");
|
||||
if(!IMMUTABLE_SET.isEnabled()) addBlockedFiles("ImmutableOpenHashSet");
|
||||
if(!ORDERED_SET.isEnabled()) addBlockedFiles("OrderedSet");
|
||||
if(!HASH_SET.isEnabled()) addBlockedFiles("OpenHashSet");
|
||||
if(!LINKED_SET.isEnabled()) addBlockedFiles("LinkedOpenHashSet");
|
||||
if(!CUSTOM_SET.isEnabled()) addBlockedFiles("OpenCustomHashSet");
|
||||
if(!LINKED_CUSTOM_SET.isEnabled()) addBlockedFiles("LinkedOpenCustomHashSet");
|
||||
if(!ARRAY_SET.isEnabled()) addBlockedFiles("ArraySet");
|
||||
if(!SORTED_SET.isEnabled()) addBlockedFiles("SortedSet", "NavigableSet");
|
||||
if(!AVL_TREE_SET.isEnabled()) addBlockedFiles("AVLTreeSet");
|
||||
if(!RB_TREE_SET.isEnabled()) addBlockedFiles("RBTreeSet");
|
||||
|
||||
if(keyType == ClassType.BOOLEAN)
|
||||
{
|
||||
|
|
|
@ -342,8 +342,6 @@ public class ITERABLES
|
|||
#argument MAPPER Predicate ToByteFunction ToShortFunction ToIntFunction ToLongFunction ToFloatFunction ToDoubleFunction
|
||||
#argument APPLY test applyAsByte applyAsShort applyAsInt applyAsLong applyAsFloat applyAsDouble
|
||||
#argument DATA_TYPE Boolean Byte Short Int Long Float Double
|
||||
#argument FILTER_TYPE BOOLEAN_COLLECTION_MODULE BYTE_COLLECTION_MODULE SHORT_COLLECTION_MODULE INT_COLLECTION_MODULE LONG_COLLECTION_MODULE FLOAT_COLLECTION_MODULE DOUBLE_COLLECTION_MODULE
|
||||
#if FILTER_TYPE
|
||||
private static class MAPPED_TYPEIterable<E> implements OUTPUT_ITERABLE, ISizeProvider
|
||||
{
|
||||
ITERABLE KEY_SPECIAL_GENERIC_TYPE<E> iterable;
|
||||
|
@ -371,7 +369,6 @@ public class ITERABLES
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#enditerate
|
||||
#endif
|
||||
private static class MappedIterable KSS_GENERIC_TYPE<E, T> implements ObjectIterable<T>, ISizeProvider
|
||||
|
|
|
@ -925,8 +925,6 @@ public class ITERATORS
|
|||
#argument MAPPER Predicate ToByteFunction ToShortFunction ToIntFunction ToLongFunction ToFloatFunction ToDoubleFunction
|
||||
#argument APPLY test applyAsByte applyAsShort applyAsInt applyAsLong applyAsFloat applyAsDouble
|
||||
#argument DATA_TYPE boolean byte short int long float double
|
||||
#argument FILTER_TYPE BOOLEAN_COLLECTION_MODULE BYTE_COLLECTION_MODULE SHORT_COLLECTION_MODULE INT_COLLECTION_MODULE LONG_COLLECTION_MODULE FLOAT_COLLECTION_MODULE DOUBLE_COLLECTION_MODULE
|
||||
#if FILTER_TYPE
|
||||
private static class MAPPED_TYPEIterator<E> implements OUTPUT_ITERATOR
|
||||
{
|
||||
ITERATOR<E> iterator;
|
||||
|
@ -953,7 +951,6 @@ public class ITERATORS
|
|||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
#enditerate
|
||||
#endif
|
||||
private static class FlatMappedIterator KSS_GENERIC_TYPE<E, T,[SPACE]V extends Iterable<T>> implements ObjectIterator<T>
|
||||
|
|
Loading…
Reference in New Issue