From 25a7cd060a6919c6085d2532b7fc62b24b072ba9 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 21 Nov 2022 06:39:22 +0100 Subject: [PATCH 01/20] The beginning of modulizing Primitive Collections. This will be a small rewrite of the "Builder". Why this is done? Basically this library is really big and having the Option to turn of modules that you don't need is really important. And right now enabling/disabling modules is really difficult since everything is merged together. So the first goal is to modularized where everything can be turned on or of as wished. --- .../speiger/src/builder/GlobalVariables.java | 67 ++++++++++++------- .../builder/PrimitiveCollectionsBuilder.java | 14 +++- 2 files changed, 55 insertions(+), 26 deletions(-) diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java index 8ed82aa7..963f4b99 100644 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ b/src/builder/java/speiger/src/builder/GlobalVariables.java @@ -2,6 +2,8 @@ package speiger.src.builder; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Collections; +import java.util.Comparator; import java.util.LinkedHashSet; import java.util.List; import java.util.Set; @@ -394,6 +396,7 @@ public class GlobalVariables addSimpleMapper("VALUE_TO_ARRAY", "to"+valueType.getNonFileType()+"Array"); addSimpleMapper("TO_ARRAY", "to"+type.getNonFileType()+"Array"); addSimpleMapper("[SPACE]", " "); + operators.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); return this; } @@ -419,6 +422,20 @@ public class GlobalVariables return process; } + public void testComparason(List keys, List values) { + List copy = new ArrayList<>(operators); + Collections.shuffle(copy); + copy.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); + operators.stream().map(IMapper::getSearchValue).forEach(keys::add); + copy.stream().map(IMapper::getSearchValue).forEach(values::add); + } + + private int sort(String key, String value) { + if(value.contains(key)) return 1; + else if(key.contains(value)) return -1; + return 0; + } + public ClassType getType() { return type; @@ -426,82 +443,82 @@ public class GlobalVariables private void addClassMapper(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"[VALUE_"+pattern+"]", "VALUE_"+pattern, valueType.getFileType()+replacement)); - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, type.getFileType()+replacement)); + operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+replacement)); + operators.add(new SimpleMapper(pattern, pattern, type.getFileType()+replacement)); } private void addBiClassMapper(String pattern, String replacement, String splitter) { - operators.add(new SimpleMapper(type.name()+"[KEY_"+pattern+"]", "KEY_"+pattern, type.getFileType()+splitter+type.getFileType()+replacement)); - operators.add(new SimpleMapper(type.name()+"[VALUE_"+pattern+"]", "VALUE_"+pattern, valueType.getFileType()+splitter+valueType.getFileType()+replacement)); - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, type.getFileType()+splitter+valueType.getFileType()+replacement)); + operators.add(new SimpleMapper("KEY_"+pattern, "KEY_"+pattern, type.getFileType()+splitter+type.getFileType()+replacement)); + operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+splitter+valueType.getFileType()+replacement)); + operators.add(new SimpleMapper(pattern, pattern, type.getFileType()+splitter+valueType.getFileType()+replacement)); } private void addAbstractMapper(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"[VALUE_"+pattern+"]", "VALUE_"+pattern, String.format(replacement, valueType.getFileType()))); - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, String.format(replacement, type.getFileType()))); + operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getFileType()))); + operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getFileType()))); } private void addAbstractBiMapper(String pattern, String replacement, String splitter) { - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, String.format(replacement, type.getFileType()+splitter+valueType.getFileType()))); + operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getFileType()+splitter+valueType.getFileType()))); } private void addFunctionMapper(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"[VALUE_"+pattern+"]", "VALUE_"+pattern, replacement+valueType.getNonFileType())); - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, replacement+type.getNonFileType())); + operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, replacement+valueType.getNonFileType())); + operators.add(new SimpleMapper(pattern, pattern, replacement+type.getNonFileType())); } private void addFunctionValueMapper(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, replacement+valueType.getNonFileType())); + operators.add(new SimpleMapper(pattern, pattern, replacement+valueType.getNonFileType())); } private void addFunctionMappers(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"[VALUE_"+pattern+"]", "VALUE_"+pattern, String.format(replacement, valueType.getNonFileType()))); - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, String.format(replacement, type.getNonFileType()))); + operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getNonFileType()))); + operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getNonFileType()))); } private void addFunctionValueMappers(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, String.format(replacement, valueType.getNonFileType()))); + operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, valueType.getNonFileType()))); } private void addSimpleMapper(String pattern, String replacement) { - operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, replacement)); + operators.add(new SimpleMapper(pattern, pattern, replacement)); } private void addAnnontion(String pattern, String value) { - if(type == ClassType.OBJECT) operators.add(new LineMapper(type.name()+"["+pattern+"]", pattern)); - else operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, value)); + if(type == ClassType.OBJECT) operators.add(new LineMapper(pattern, pattern)); + else operators.add(new SimpleMapper(pattern, pattern, value)); } private void addValueAnnontion(String pattern, String value) { - if(valueType == ClassType.OBJECT) operators.add(new LineMapper(valueType.name()+"["+pattern+"]", pattern)); - else operators.add(new SimpleMapper(valueType.name()+"["+pattern+"]", pattern, value)); + if(valueType == ClassType.OBJECT) operators.add(new LineMapper(pattern, pattern)); + else operators.add(new SimpleMapper(pattern, pattern, value)); } private void addComment(String pattern, String value) { - if(type == ClassType.OBJECT) operators.add(new InjectMapper(type.name()+"["+pattern+"]", pattern, value).removeBraces()); - else operators.add(new LineMapper(type.name()+"["+pattern+"]", pattern)); + if(type == ClassType.OBJECT) operators.add(new InjectMapper(pattern, pattern, value).removeBraces()); + else operators.add(new LineMapper(pattern, pattern)); } private void addValueComment(String pattern, String value) { - if(valueType == ClassType.OBJECT) operators.add(new InjectMapper(valueType.name()+"["+pattern+"]", pattern, value).removeBraces()); - else operators.add(new LineMapper(valueType.name()+"["+pattern+"]", pattern)); + if(valueType == ClassType.OBJECT) operators.add(new InjectMapper(pattern, pattern, value).removeBraces()); + else operators.add(new LineMapper(pattern, pattern)); } private InjectMapper addInjectMapper(String pattern, String replacement) { - InjectMapper mapper = new InjectMapper(type.name()+"["+pattern+"]", pattern, replacement); + InjectMapper mapper = new InjectMapper(pattern, pattern, replacement); operators.add(mapper); return mapper; } @@ -513,7 +530,7 @@ public class GlobalVariables private ArgumentMapper addArgumentMapper(String pattern, String replacement, String splitter) { - ArgumentMapper mapper = new ArgumentMapper(type.name()+"["+pattern+"]", pattern, replacement, splitter); + ArgumentMapper mapper = new ArgumentMapper(pattern, pattern, replacement, splitter); operators.add(mapper); return mapper; } diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 815e3a8a..396162ad 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -224,6 +224,18 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor } } + public void test() throws InterruptedException, IOException + { + init(); + List keys = new ArrayList<>(); + List values = new ArrayList<>(); + for(int i = 0,m=variables.size();i acceptor) { @@ -317,7 +329,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor boolean force = flags.contains("force"); boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); - +// new PrimitiveCollectionsBuilder(silent).test(); new PrimitiveCollectionsBuilder(silent).process(force); if(tests) { createTests(silent).process(force || forceTests); From b065ebe9ba78a383b0c1a78dea42436e23985c6f Mon Sep 17 00:00:00 2001 From: Speiger Date: Sun, 27 Nov 2022 13:16:21 +0100 Subject: [PATCH 02/20] Start of the Modularization -Added: Base code to modularize the project. -Added: Javas Base Module. --- .../src/builder/modules/BaseModule.java | 159 ++++++++++++++++ .../src/builder/modules/JavaModule.java | 178 ++++++++++++++++++ .../src/builder/modules/ModuleBuilder.java | 80 ++++++++ .../src/builder/modules/ModulePackage.java | 140 ++++++++++++++ .../src/builder/modules/RequiredType.java | 8 + 5 files changed, 565 insertions(+) create mode 100644 src/builder/java/speiger/src/builder/modules/BaseModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/JavaModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/ModuleBuilder.java create mode 100644 src/builder/java/speiger/src/builder/modules/ModulePackage.java create mode 100644 src/builder/java/speiger/src/builder/modules/RequiredType.java diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java new file mode 100644 index 00000000..01803ee2 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -0,0 +1,159 @@ +package speiger.src.builder.modules; + +import java.util.function.Predicate; + +import speiger.src.builder.ClassType; +import speiger.src.builder.mappers.ArgumentMapper; +import speiger.src.builder.mappers.InjectMapper; +import speiger.src.builder.mappers.LineMapper; +import speiger.src.builder.mappers.SimpleMapper; + +@SuppressWarnings("javadoc") +public abstract class BaseModule +{ + ModulePackage entry; + protected ClassType keyType; + protected ClassType valueType; + + public final void init(ModulePackage entry) + { + this.entry = entry; + keyType = entry.getKeyType(); + valueType = entry.getValueType(); + loadVariables(); + loadFlags(); + } + + public final void cleanup() { + entry = null; + keyType = null; + valueType = null; + } + + protected abstract void loadVariables(); + protected abstract void loadFlags(); + + protected void addFlag(String name) + { + entry.addFlag(name); + } + + protected void addBiRequirement(String fileName) { + entry.addRequirement(fileName, RequiredType.BI_CLASS); + entry.addSplitter(fileName, "%1$s2%2$s"); + } + + protected void addBiRequirement(String fileName, String splitter) { + entry.addRequirement(fileName, RequiredType.BI_CLASS); + entry.addSplitter(fileName, "%1$s"+splitter+"%2$s"); + } + + protected void addRequirement(String fileName, String splitter, RequiredType type) { + entry.addRequirement(fileName, type); + entry.addSplitter(fileName, splitter); + } + + protected void addBlockedFile(String name) + { + entry.addBlockedFile(name); + } + + protected void addBlockedFilter(Predicate filter) + { + entry.addBlockedFilter(filter); + } + + protected void addClassMapper(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+replacement)); + entry.addMapper(new SimpleMapper(pattern, pattern, keyType.getFileType()+replacement)); + } + + protected void addBiClassMapper(String pattern, String replacement, String splitter) + { + entry.addMapper(new SimpleMapper("KEY_"+pattern, "KEY_"+pattern, keyType.getFileType()+splitter+keyType.getFileType()+replacement)); + entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+splitter+valueType.getFileType()+replacement)); + entry.addMapper(new SimpleMapper(pattern, pattern, keyType.getFileType()+splitter+valueType.getFileType()+replacement)); + } + + protected void addAbstractMapper(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getFileType()))); + entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getFileType()))); + } + + protected void addAbstractBiMapper(String pattern, String replacement, String splitter) + { + entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getFileType()+splitter+valueType.getFileType()))); + } + + protected void addFunctionMapper(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, replacement+valueType.getNonFileType())); + entry.addMapper(new SimpleMapper(pattern, pattern, replacement+keyType.getNonFileType())); + } + + protected void addFunctionValueMapper(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper(pattern, pattern, replacement+valueType.getNonFileType())); + } + + protected void addFunctionMappers(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getNonFileType()))); + entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getNonFileType()))); + } + + protected void addFunctionValueMappers(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, valueType.getNonFileType()))); + } + + protected void addSimpleMapper(String pattern, String replacement) + { + entry.addMapper(new SimpleMapper(pattern, pattern, replacement)); + } + + protected void addAnnontion(String pattern, String value) + { + if(keyType == ClassType.OBJECT) entry.addMapper(new LineMapper(pattern, pattern)); + else entry.addMapper(new SimpleMapper(pattern, pattern, value)); + } + + protected void addValueAnnontion(String pattern, String value) + { + if(valueType == ClassType.OBJECT) entry.addMapper(new LineMapper(pattern, pattern)); + else entry.addMapper(new SimpleMapper(pattern, pattern, value)); + } + + protected void addComment(String pattern, String value) + { + if(keyType == ClassType.OBJECT) entry.addMapper(new InjectMapper(pattern, pattern, value).removeBraces()); + else entry.addMapper(new LineMapper(pattern, pattern)); + } + + protected void addValueComment(String pattern, String value) + { + if(valueType == ClassType.OBJECT) entry.addMapper(new InjectMapper(pattern, pattern, value).removeBraces()); + else entry.addMapper(new LineMapper(pattern, pattern)); + } + + protected InjectMapper addInjectMapper(String pattern, String replacement) + { + InjectMapper mapper = new InjectMapper(pattern, pattern, replacement); + entry.addMapper(mapper); + return mapper; + } + + protected ArgumentMapper addArgumentMapper(String pattern, String replacement) + { + return addArgumentMapper(pattern, replacement, ", "); + } + + protected ArgumentMapper addArgumentMapper(String pattern, String replacement, String splitter) + { + ArgumentMapper mapper = new ArgumentMapper(pattern, pattern, replacement, splitter); + entry.addMapper(mapper); + return mapper; + } +} diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java new file mode 100644 index 00000000..ad4e5487 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -0,0 +1,178 @@ +package speiger.src.builder.modules; + +import speiger.src.builder.ClassType; + +@SuppressWarnings("javadoc") +public class JavaModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadBaseVariables(); + createHelperVars(keyType, false, "KEY"); + createHelperVars(valueType, true, "VALUE"); + loadClasses(); + } + + @Override + protected void loadFlags() + { + addFlag("TYPE_"+keyType.getCapType()); + addFlag("VALUE_"+valueType.getCapType()); + if(keyType == valueType) addFlag("SAME_TYPE"); + if(keyType.hasFunction(valueType)) addFlag("JDK_FUNCTION"); + if(!keyType.needsCustomJDKType()) addFlag("JDK_TYPE"); + if(!keyType.isPrimitiveBlocking()) addFlag("PRIMITIVES"); + if(!valueType.isPrimitiveBlocking()) addFlag("VALUE_PRIMITIVES"); + if(valueType.needsCustomJDKType()) addFlag("JDK_VALUE"); + } + + private void loadFunctions() + { + + } + + private void loadClasses() + { + addSimpleMapper("JAVA_PREDICATE", keyType.isPrimitiveBlocking() ? "" : keyType.getCustomJDKType().getFileType()+"Predicate"); + addSimpleMapper("JAVA_CONSUMER", keyType.isPrimitiveBlocking() ? "" : "java.util.function."+keyType.getCustomJDKType().getFileType()+"Consumer"); + addSimpleMapper("JAVA_SUPPLIER", keyType.isPrimitiveBlocking() ? "" : "java.util.function."+keyType.getCustomJDKType().getFileType()+"Supplier"); + addSimpleMapper("JAVA_FUNCTION", keyType.getFunctionClass(valueType)); + addSimpleMapper("JAVA_BINARY_OPERATOR", keyType == ClassType.BOOLEAN ? "" : (keyType.isObject() ? "java.util.function.BinaryOperator" : "java.util.function."+keyType.getCustomJDKType().getFileType()+"BinaryOperator")); + addSimpleMapper("JAVA_UNARY_OPERATOR", keyType.isObject() ? "BinaryOperator" : keyType == ClassType.BOOLEAN ? "" : keyType.getCustomJDKType().getFileType()+"UnaryOperator"); + addSimpleMapper("JAVA_SPLIT_ITERATOR", keyType.isPrimitiveBlocking() ? "Spliterator" : "Of"+keyType.getCustomJDKType().getFileType()); + addSimpleMapper("JAVA_STREAM", keyType.isPrimitiveBlocking() ? "" : keyType.getCustomJDKType().getFileType()+"Stream"); + addSimpleMapper("JAVA_BUFFER", keyType.getFileType()+"Buffer"); + } + + private void loadBaseVariables() + { + addSimpleMapper("VALUE_PACKAGE", valueType.getPathType()); + addSimpleMapper("PACKAGE", keyType.getPathType()); + addSimpleMapper("CLASS_TYPE", keyType.getClassType()); + addSimpleMapper("CLASS_VALUE_TYPE", valueType.getClassValueType()); + addSimpleMapper("KEY_TYPE", keyType.getKeyType()); + addSimpleMapper("KEY_OBJECT_TYPE", keyType.isObject() ? "Object" : keyType.getKeyType()); + addSimpleMapper("KEY_STRING_TYPE", keyType.isObject() ? "String" : keyType.getKeyType()); + addSimpleMapper("KEY_SPECIAL_TYPE", keyType.isObject() ? "E" : keyType.getKeyType()); + addSimpleMapper("CLASS_OBJECT_TYPE", keyType.getClassType()); + addSimpleMapper("CLASS_OBJECT_VALUE_TYPE", valueType.getClassValueType()); + addSimpleMapper("CLASS_STRING_TYPE", keyType.isObject() ? "String" : keyType.getClassType()); + addSimpleMapper("CLASS_STRING_VALUE_TYPE", valueType.isObject() ? "String" : valueType.getClassValueType()); + addSimpleMapper("VALUE_TYPE", valueType.getValueType()); + addSimpleMapper("VALUE_OBJECT_TYPE", valueType.isObject() ? "Object" : valueType.getValueType()); + addSimpleMapper("VALUE_STRING_TYPE", valueType.isObject() ? "String" : valueType.getValueType()); + addSimpleMapper("VALUE_SPECIAL_TYPE", valueType.isObject() ? "E" : valueType.getKeyType()); + addSimpleMapper("KEY_JAVA_TYPE", keyType.getCustomJDKType().getKeyType()); + addSimpleMapper("VALUE_JAVA_TYPE", keyType.getCustomJDKType().getKeyType()); + + addSimpleMapper("EMPTY_KEY_VALUE", keyType.getEmptyValue()); + addSimpleMapper("EMPTY_VALUE", valueType.getEmptyValue()); + + addSimpleMapper("INVALID_KEY_VALUE", keyType.getInvalidValue()); + addSimpleMapper("INVALID_VALUE", valueType.getInvalidValue()); + + addSimpleMapper(" KEY_STRING_GENERIC_TYPE", keyType.isObject() ? "" : ""); + addSimpleMapper(" VALUE_STRING_GENERIC_TYPE", valueType.isObject() ? "" : ""); + addSimpleMapper(" KEY_VALUE_STRING_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); + + + addSimpleMapper(" KEY_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+">" : ""); + addSimpleMapper(" KEY_KEY_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+", "+keyType.getKeyType()+">" : ""); + addSimpleMapper(" KEY_CLASS_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getClassType()+">" : ""); + + + addSimpleMapper(" VALUE_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+">" : ""); + addSimpleMapper(" VALUE_VALUE_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+", "+valueType.getValueType()+">" : ""); + addSimpleMapper(" VALUE_CLASS_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getClassValueType()+">" : ""); + + addSimpleMapper(" KEY_VALUE_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "<"+keyType.getKeyType()+", "+valueType.getValueType()+">" : "<"+keyType.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+">" : "")); + addSimpleMapper(" KEY_VALUE_VALUE_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "<"+keyType.getKeyType()+", "+valueType.getValueType()+", "+valueType.getValueType()+">" : "<"+keyType.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+", "+valueType.getValueType()+">" : "")); + addInjectMapper(" KEY_VALUE_SPECIAL_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "<"+keyType.getKeyType()+", "+valueType.getValueType()+", %s>" : "<"+keyType.getKeyType()+", %s>") : (valueType.isObject() ? "<"+valueType.getValueType()+", %s>" : "<%s>")).setBraceType("<>").removeBraces(); + + addSimpleMapper(" NO_GENERIC_TYPE", keyType.isObject() ? "" : ""); + addSimpleMapper(" NO_KV_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "" : "") : valueType.isObject() ? "" : ""); + addSimpleMapper(" KEY_COMPAREABLE_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+" extends Comparable>" : ""); + + addSimpleMapper(" KEY_SUPER_GENERIC_TYPE", keyType.isObject() ? "" : ""); + addSimpleMapper(" VALUE_SUPER_GENERIC_TYPE", valueType.isObject() ? "" : ""); + addSimpleMapper(" KEY_VALUE_SUPER_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); + + addSimpleMapper(" KEY_UNKNOWN_GENERIC_TYPE", keyType.isObject() ? "" : ""); + addSimpleMapper(" VALUE_UNKNOWN_GENERIC_TYPE", valueType.isObject() ? "" : ""); + addSimpleMapper(" KEY_VALUE_UNKNOWN_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); + + addSimpleMapper(" KEY_ENUM_VALUE_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "<"+keyType.getKeyType()+" extends Enum<"+keyType.getKeyType()+">, "+valueType.getValueType()+">" : "<"+keyType.getKeyType()+" extends Enum<"+keyType.getKeyType()+">>") : (valueType.isObject() ? "<"+valueType.getValueType()+">" : "")); + addSimpleMapper(" KEY_VALUE_ENUM_GENERIC_TYPE", keyType.isObject() ? (valueType.isObject() ? "<"+keyType.getKeyType()+", "+valueType.getValueType()+" extends Enum<"+valueType.getValueType()+">>" : "<"+keyType.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+" extends Enum<"+valueType.getValueType()+">>" : "")); + + addInjectMapper(" KEY_SPECIAL_GENERIC_TYPE", keyType.isObject() ? "<%s>" : "").removeBraces().setBraceType("<>"); + addInjectMapper(" VALUE_SPECIAL_GENERIC_TYPE", valueType.isObject() ? "<%s>" : "").removeBraces().setBraceType("<>"); + addInjectMapper(" KSK_GENERIC_TYPE", keyType.isObject() ? "<%s, "+keyType.getKeyType()+">" : "<%s>").removeBraces().setBraceType("<>"); + addInjectMapper(" KKS_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+", %s>" : "<%s>").removeBraces().setBraceType("<>"); + addArgumentMapper(" KSS_GENERIC_TYPE", keyType.isObject() ? "<%1$s, %2$s>" : "<%2$s>").removeBraces().setBraceType("<>"); + addInjectMapper(" VSV_GENERIC_TYPE", valueType.isObject() ? "<%s, "+valueType.getValueType()+">" : "<%s>").removeBraces().setBraceType("<>"); + addInjectMapper(" VVS_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+", %s>" : "<%s>").removeBraces().setBraceType("<>"); + addArgumentMapper(" VSS_GENERIC_TYPE", valueType.isObject() ? "<%1$s, %2$s>" : "<%2$s>").removeBraces().setBraceType("<>"); + + addSimpleMapper(" GENERIC_KEY_BRACES", keyType.isObject() ? " <"+keyType.getKeyType()+">" : ""); + addSimpleMapper(" GENERIC_VALUE_BRACES", valueType.isObject() ? " <"+valueType.getValueType()+">" : ""); + addInjectMapper(" GENERIC_SPECIAL_KEY_BRACES", keyType.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>"); + addInjectMapper(" GENERIC_SPECIAL_VALUE_BRACES", valueType.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>"); + addSimpleMapper(" GENERIC_KEY_ENUM_VALUE_BRACES", keyType.isObject() ? (valueType.isObject() ? " <"+keyType.getKeyType()+" extends Enum<"+keyType.getKeyType()+">, "+valueType.getValueType()+">" : " <"+keyType.getKeyType()+" extends Enum<"+keyType.getKeyType()+">>") : (valueType.isObject() ? " <"+valueType.getValueType()+">" : "")); + + addInjectMapper(" GENERIC_KEY_SPECIAL_BRACES", keyType.isObject() ? " <"+keyType.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>"); + addInjectMapper(" GENERIC_VALUE_SPECIAL_BRACES", valueType.isObject() ? " <"+valueType.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>"); + + addSimpleMapper(" GENERIC_KEY_VALUE_BRACES", keyType.isObject() ? (valueType.isObject() ? " <"+keyType.getKeyType()+", "+valueType.getValueType()+">" : " <"+keyType.getKeyType()+">") : (valueType.isObject() ? " <"+valueType.getValueType()+">" : "")); + addSimpleMapper(" COMPAREABLE_KEY_BRACES", keyType.isObject() ? " <"+keyType.getKeyType()+" extends Comparable>" : ""); + addSimpleMapper("KV_BRACES", keyType.isObject() || valueType.isObject() ? "<>" : ""); + addSimpleMapper("VALUE_BRACES", valueType.isObject() ? "<>" : ""); + addSimpleMapper("BRACES", keyType.isObject() ? "<>" : ""); + if(keyType.needsCustomJDKType()) + { + addSimpleMapper("JAVA_TYPE", keyType.getCustomJDKType().getKeyType()); + addSimpleMapper("SANITY_CAST", "castTo"+keyType.getFileType()); + } + addSimpleMapper("JAVA_CLASS", keyType.getCustomJDKType().getClassType()); + if(valueType.needsCustomJDKType()) + { + addSimpleMapper("SANITY_CAST_VALUE", "castTo"+valueType.getFileType()); + } + addComment("@ArrayType", "@param <%s> the keyType of array that the operation should be applied"); + addComment("@Type", "@param <%s> the keyType of elements maintained by this Collection"); + addValueComment("@ValueArrayType", "@param <%s> the keyType of array that the operation should be applied"); + addValueComment("@ValueType", "@param <%s> the keyType of elements maintained by this Collection"); + addAnnontion("@PrimitiveOverride", "@Override"); + addSimpleMapper("@PrimitiveDoc", ""); + addAnnontion("@Primitive", "@Deprecated"); + addValueAnnontion("@ValuePrimitiveOverride", "@Override"); + addValueAnnontion("@ValuePrimitive", "@Deprecated"); + } + + private void createHelperVars(ClassType type, boolean value, String fix) + { + addArgumentMapper("EQUALS_"+fix+"_TYPE", "Objects.equals(%2$s, "+(type.isObject() ? "%1$s" : fix+"_TO_OBJ(%1$s)")+")").removeBraces(); + addInjectMapper(fix+"_EQUALS_NOT_NULL", type.getComparableValue()+" != "+(type.isPrimitiveBlocking() || type.needsCast() ? type.getEmptyValue() : "0")).removeBraces(); + addInjectMapper(fix+"_EQUALS_NULL", type.getComparableValue()+" == "+(type.isPrimitiveBlocking() || type.needsCast() ? type.getEmptyValue() : "0")).removeBraces(); + addArgumentMapper(fix+"_EQUALS_NOT", type.getEquals(true)).removeBraces(); + addArgumentMapper(fix+"_EQUALS", type.getEquals(false)).removeBraces(); + addSimpleMapper("FILE_"+fix+"_TYPE", type.getFileType()); + + addArgumentMapper("COMPAREABLE_TO_"+fix, type.isObject() ? "((Comparable<"+type.getKeyType(value)+">)%1$s).compareTo(("+type.getKeyType(value)+")%2$s)" : type.getClassType(value)+".compare(%1$s, %2$s)").removeBraces(); + addArgumentMapper("COMPARE_TO_"+fix, type.isObject() ? "%1$s.compareTo(%2$s)" : type.getClassType(value)+".compare(%1$s, %2$s)").removeBraces(); + + addInjectMapper(fix+"_TO_OBJ", type.isObject() ? "%s" : type.getClassType(value)+".valueOf(%s)").removeBraces(); + addInjectMapper("OBJ_TO_"+fix, type.isObject() ? "%s" : "%s."+type.getKeyType(value)+"Value()").removeBraces(); + addInjectMapper("CLASS_TO_"+fix, type.isObject() ? "("+type.getKeyType(value)+")%s" : "(("+type.getClassType(value)+")%s)."+type.getKeyType(value)+"Value()").removeBraces(); + + addInjectMapper(fix+"_TO_HASH", type.isObject() ? "Objects.hashCode(%s)" : type.getClassType(value)+".hashCode(%s)").removeBraces(); + addInjectMapper(fix+"_TO_STRING", type.isObject() ? "Objects.toString(%s)" : type.getClassType(value)+".toString(%s)").removeBraces(); + + addSimpleMapper("CAST_"+fix+"_ARRAY ", type.isObject() ? "("+fix+"_TYPE[])" : ""); + addSimpleMapper("EMPTY_"+fix+"_ARRAY", type.isObject() ? "("+fix+"_TYPE[])ARRAYS.EMPTY_ARRAY" : "ARRAYS.EMPTY_ARRAY"); + addInjectMapper("NEW_"+fix+"_ARRAY", type.isObject() ? "("+fix+"_TYPE[])new Object[%s]" : "new "+fix+"_TYPE[%s]").removeBraces(); + addInjectMapper("NEW_SPECIAL_"+fix+"_ARRAY", type.isObject() ? "(E[])new Object[%s]" : "new "+fix+"_TYPE[%s]").removeBraces(); + if(value) addInjectMapper("NEW_CLASS_VALUE_ARRAY", type.isObject() ? "(CLASS_VALUE_TYPE[])new Object[%s]" : "new CLASS_VALUE_TYPE[%s]").removeBraces(); + else addInjectMapper("NEW_CLASS_ARRAY", type.isObject() ? "(CLASS_TYPE[])new Object[%s]" : "new CLASS_TYPE[%s]").removeBraces(); + } +} diff --git a/src/builder/java/speiger/src/builder/modules/ModuleBuilder.java b/src/builder/java/speiger/src/builder/modules/ModuleBuilder.java new file mode 100644 index 00000000..3d46a107 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/ModuleBuilder.java @@ -0,0 +1,80 @@ +package speiger.src.builder.modules; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.function.Consumer; + +import speiger.src.builder.processor.TemplateProcess; +import speiger.src.builder.processor.TemplateProcessor; + +@SuppressWarnings("javadoc") +public class ModuleBuilder extends TemplateProcessor +{ + List simplePackages = new ArrayList<>(); + List biPackages = new ArrayList<>(); + List enumPackages = new ArrayList<>(); + Map requirements = new HashMap<>(); + + public ModuleBuilder(boolean silencedSuccess, Path sourceFolder, Path outputFolder, Path dataFolder) + { + super(silencedSuccess, sourceFolder, outputFolder, dataFolder); + } + + @Override + protected void init() + { + prepPackages(); + //Init Modules here + finishPackages(); + } + + public void addModule(BaseModule module) + { + biPackages.forEach(module::init); + module.cleanup(); + } + + private void finishPackages() + { + biPackages.forEach(ModulePackage::finish); + } + + private void prepPackages() + { + for(ModulePackage entry : ModulePackage.createPackages()) + { + entry.setRequirements(requirements::put); + biPackages.add(entry); + if(entry.isSame()) simplePackages.add(entry); + if(entry.isEnumValid()) enumPackages.add(entry); + } + } + + @Override + public void createProcesses(String fileName, Consumer process) + { + List packages = getPackagesByRequirement(requirements.get(fileName)); + for(int i = 0,m=packages.size();i getPackagesByRequirement(RequiredType type) { + if(type == null) return simplePackages; + if(type == RequiredType.BI_CLASS) return biPackages; + if(type == RequiredType.ENUM) return enumPackages; + return Collections.emptyList(); + } + + @Override + protected boolean isFileValid(Path fileName) { return true; } + @Override + protected boolean relativePackages() { return true; } + @Override + protected boolean debugUnusedMappers() { return false; } +} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/ModulePackage.java b/src/builder/java/speiger/src/builder/modules/ModulePackage.java new file mode 100644 index 00000000..da506156 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/ModulePackage.java @@ -0,0 +1,140 @@ +package speiger.src.builder.modules; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.Comparator; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Consumer; +import java.util.function.Predicate; +import java.util.function.UnaryOperator; + +import speiger.src.builder.ClassType; +import speiger.src.builder.mappers.IMapper; +import speiger.src.builder.processor.TemplateProcess; + +@SuppressWarnings("javadoc") +public class ModulePackage +{ + public static final ClassType[] TYPE = ClassType.values(); + final ClassType keyType; + final ClassType valueType; + Set blocked = new HashSet<>(); + Map nameRemapper = new HashMap<>(); + Map splitters = new HashMap<>(); + List> blockedFilters = new ArrayList<>(); + List mappers = new ArrayList<>(); + Set flags = new LinkedHashSet<>(); + BiConsumer requirements = (K, V) -> {}; + + public ModulePackage(ClassType keyType, ClassType valueType) { + this.keyType = keyType; + this.valueType = valueType; + } + + public void finish() { + mappers.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); + } + + public void setRequirements(BiConsumer requirements) { + this.requirements = requirements; + } + + public boolean isSame() { + return keyType == valueType; + } + + public boolean isEnumValid() { + return keyType == ClassType.OBJECT; + } + + public ClassType getKeyType() { + return keyType; + } + + public ClassType getValueType() { + return valueType; + } + + public void addFlag(String flag) { + flags.add(flag); + } + + public void addRequirement(String fileName, RequiredType type) { + requirements.accept(fileName, type); + } + + public void addMapper(IMapper mapper) { + mappers.add(mapper); + } + + public void addBlockedFilter(Predicate filter) { + blockedFilters.add(filter); + } + + public void addBlockedFile(String name) { + blocked.add(name); + } + + public void addSplitter(String fileName, String splitter) { + splitters.put(fileName, splitter); + } + + public void addRemapper(String fileName, String actualName) { + nameRemapper.put(fileName, actualName); + } + + public void process(String fileName, Consumer result) { + if(isBlocked(fileName)) return; + String splitter = String.format(splitters.getOrDefault(fileName, keyType.getFileType()), keyType.getFileType(), valueType.getFileType()); + String newName = String.format(nameRemapper.getOrDefault(fileName, "%s"+fileName), splitter); + TemplateProcess process = new TemplateProcess(newName); + process.setPathBuilder(new PathBuilder(keyType.getPathType())); + process.addFlags(flags); + process.addMappers(mappers); + result.accept(process); + } + + private boolean isBlocked(String fileName) { + if(blocked.contains(fileName)) return true; + for(int i = 0,m=blockedFilters.size();i createPackages() { + List list = new ArrayList<>(); + for(ClassType key : TYPE) { + for(ClassType value : TYPE) { + list.add(new ModulePackage(key, value)); + } + } + return list; + } + + private int sort(String key, String value) { + if(key.equals(value)) return 0; + if(value.contains(key)) return 1; + else if(key.contains(value)) return -1; + return 0; + } + + class PathBuilder implements UnaryOperator { + String before; + + public PathBuilder(String before) { + this.before = before; + } + + @Override + public Path apply(Path t) { + return t.subpath(0, 6).resolve(before).resolve(t.subpath(6, t.getNameCount())); + } + } +} diff --git a/src/builder/java/speiger/src/builder/modules/RequiredType.java b/src/builder/java/speiger/src/builder/modules/RequiredType.java new file mode 100644 index 00000000..bf4f9ef7 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/RequiredType.java @@ -0,0 +1,8 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public enum RequiredType +{ + BI_CLASS, + ENUM +} From 8e39acef4559307d3cc3f4313387487f358cd08b Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 29 Nov 2022 14:33:16 +0100 Subject: [PATCH 03/20] Finished adding the modules and implemented sorting algorythm. That this works is crazy... --- .../builder/{modules => }/ModuleBuilder.java | 44 ++++++- .../builder/{modules => }/ModulePackage.java | 12 +- .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../builder/{modules => }/RequiredType.java | 2 +- .../src/builder/modules/AsyncModule.java | 26 ++++ .../src/builder/modules/BaseModule.java | 68 +++++------ .../src/builder/modules/CollectionModule.java | 64 ++++++++++ .../src/builder/modules/FunctionModule.java | 72 +++++++++++ .../src/builder/modules/JavaModule.java | 13 +- .../src/builder/modules/ListModule.java | 62 ++++++++++ .../src/builder/modules/MapModule.java | 115 ++++++++++++++++++ .../src/builder/modules/PairModule.java | 35 ++++++ .../src/builder/modules/PrioQueueModule.java | 42 +++++++ .../src/builder/modules/SetModule.java | 71 +++++++++++ 14 files changed, 581 insertions(+), 47 deletions(-) rename src/builder/java/speiger/src/builder/{modules => }/ModuleBuilder.java (60%) rename src/builder/java/speiger/src/builder/{modules => }/ModulePackage.java (91%) rename src/builder/java/speiger/src/builder/{modules => }/RequiredType.java (67%) create mode 100644 src/builder/java/speiger/src/builder/modules/AsyncModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/CollectionModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/FunctionModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/ListModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/MapModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/PairModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/PrioQueueModule.java create mode 100644 src/builder/java/speiger/src/builder/modules/SetModule.java diff --git a/src/builder/java/speiger/src/builder/modules/ModuleBuilder.java b/src/builder/java/speiger/src/builder/ModuleBuilder.java similarity index 60% rename from src/builder/java/speiger/src/builder/modules/ModuleBuilder.java rename to src/builder/java/speiger/src/builder/ModuleBuilder.java index 3d46a107..37a72c57 100644 --- a/src/builder/java/speiger/src/builder/modules/ModuleBuilder.java +++ b/src/builder/java/speiger/src/builder/ModuleBuilder.java @@ -1,6 +1,8 @@ -package speiger.src.builder.modules; +package speiger.src.builder; +import java.io.IOException; import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -8,6 +10,16 @@ import java.util.List; import java.util.Map; import java.util.function.Consumer; +import speiger.src.builder.modules.AsyncModule; +import speiger.src.builder.modules.BaseModule; +import speiger.src.builder.modules.CollectionModule; +import speiger.src.builder.modules.FunctionModule; +import speiger.src.builder.modules.JavaModule; +import speiger.src.builder.modules.ListModule; +import speiger.src.builder.modules.MapModule; +import speiger.src.builder.modules.PairModule; +import speiger.src.builder.modules.PrioQueueModule; +import speiger.src.builder.modules.SetModule; import speiger.src.builder.processor.TemplateProcess; import speiger.src.builder.processor.TemplateProcessor; @@ -19,6 +31,27 @@ public class ModuleBuilder extends TemplateProcessor List enumPackages = new ArrayList<>(); Map requirements = new HashMap<>(); + public static void main(String...args) + { + try + { + new ModuleBuilder(true).process(true); + } + catch(IOException e) + { + e.printStackTrace(); + } + catch(InterruptedException e) + { + e.printStackTrace(); + } + } + + public ModuleBuilder(boolean silencedSuccess) + { + super(silencedSuccess, Paths.get("src/builder/resources/speiger/assets/collections/templates/"), Paths.get("src/main/java/speiger/src/collections/"), Paths.get("src/builder/resources/speiger/assets/collections/")); + } + public ModuleBuilder(boolean silencedSuccess, Path sourceFolder, Path outputFolder, Path dataFolder) { super(silencedSuccess, sourceFolder, outputFolder, dataFolder); @@ -29,6 +62,15 @@ public class ModuleBuilder extends TemplateProcessor { prepPackages(); //Init Modules here + addModule(new JavaModule()); + addModule(new FunctionModule()); + addModule(new CollectionModule()); + addModule(new PrioQueueModule()); + addModule(new ListModule()); + addModule(new SetModule()); + addModule(new MapModule()); + addModule(new PairModule()); + addModule(new AsyncModule()); finishPackages(); } diff --git a/src/builder/java/speiger/src/builder/modules/ModulePackage.java b/src/builder/java/speiger/src/builder/ModulePackage.java similarity index 91% rename from src/builder/java/speiger/src/builder/modules/ModulePackage.java rename to src/builder/java/speiger/src/builder/ModulePackage.java index da506156..b01f9565 100644 --- a/src/builder/java/speiger/src/builder/modules/ModulePackage.java +++ b/src/builder/java/speiger/src/builder/ModulePackage.java @@ -1,7 +1,8 @@ -package speiger.src.builder.modules; +package speiger.src.builder; import java.nio.file.Path; import java.util.ArrayList; +import java.util.Arrays; import java.util.Comparator; import java.util.HashMap; import java.util.HashSet; @@ -14,7 +15,6 @@ import java.util.function.Consumer; import java.util.function.Predicate; import java.util.function.UnaryOperator; -import speiger.src.builder.ClassType; import speiger.src.builder.mappers.IMapper; import speiger.src.builder.processor.TemplateProcess; @@ -38,6 +38,7 @@ public class ModulePackage } public void finish() { + mappers.sort(Comparator.comparing(IMapper::getSearchValue, Comparator.comparingInt(String::length).reversed())); mappers.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); } @@ -77,8 +78,8 @@ public class ModulePackage blockedFilters.add(filter); } - public void addBlockedFile(String name) { - blocked.add(name); + public void addBlockedFiles(String... names) { + blocked.addAll(Arrays.asList(names)); } public void addSplitter(String fileName, String splitter) { @@ -93,7 +94,7 @@ public class ModulePackage if(isBlocked(fileName)) return; String splitter = String.format(splitters.getOrDefault(fileName, keyType.getFileType()), keyType.getFileType(), valueType.getFileType()); String newName = String.format(nameRemapper.getOrDefault(fileName, "%s"+fileName), splitter); - TemplateProcess process = new TemplateProcess(newName); + TemplateProcess process = new TemplateProcess(newName+".java"); process.setPathBuilder(new PathBuilder(keyType.getPathType())); process.addFlags(flags); process.addMappers(mappers); @@ -119,7 +120,6 @@ public class ModulePackage } private int sort(String key, String value) { - if(key.equals(value)) return 0; if(value.contains(key)) return 1; else if(key.contains(value)) return -1; return 0; diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 396162ad..3e75b1cc 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -326,7 +326,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor { Set flags = new HashSet<>(Arrays.asList(args)); boolean silent = flags.contains("silent"); - boolean force = flags.contains("force"); + boolean force = !flags.contains("force"); boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); // new PrimitiveCollectionsBuilder(silent).test(); diff --git a/src/builder/java/speiger/src/builder/modules/RequiredType.java b/src/builder/java/speiger/src/builder/RequiredType.java similarity index 67% rename from src/builder/java/speiger/src/builder/modules/RequiredType.java rename to src/builder/java/speiger/src/builder/RequiredType.java index bf4f9ef7..0a11cbd1 100644 --- a/src/builder/java/speiger/src/builder/modules/RequiredType.java +++ b/src/builder/java/speiger/src/builder/RequiredType.java @@ -1,4 +1,4 @@ -package speiger.src.builder.modules; +package speiger.src.builder; @SuppressWarnings("javadoc") public enum RequiredType diff --git a/src/builder/java/speiger/src/builder/modules/AsyncModule.java b/src/builder/java/speiger/src/builder/modules/AsyncModule.java new file mode 100644 index 00000000..76a324bf --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/AsyncModule.java @@ -0,0 +1,26 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class AsyncModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadClasses(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadClasses() + { + //Abstract Classes + addAbstractMapper("BASE_TASK", "Base%sTask"); + + //Interfaces + addClassMapper("TASK", "Task"); + } +} diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 01803ee2..500127d9 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -3,6 +3,8 @@ package speiger.src.builder.modules; import java.util.function.Predicate; import speiger.src.builder.ClassType; +import speiger.src.builder.ModulePackage; +import speiger.src.builder.RequiredType; import speiger.src.builder.mappers.ArgumentMapper; import speiger.src.builder.mappers.InjectMapper; import speiger.src.builder.mappers.LineMapper; @@ -43,6 +45,12 @@ public abstract class BaseModule entry.addSplitter(fileName, "%1$s2%2$s"); } + protected void addEnumRequirement(String fileName) { + entry.addRequirement(fileName, RequiredType.ENUM); + entry.addSplitter(fileName, "%2$s"); + + } + protected void addBiRequirement(String fileName, String splitter) { entry.addRequirement(fileName, RequiredType.BI_CLASS); entry.addSplitter(fileName, "%1$s"+splitter+"%2$s"); @@ -53,105 +61,91 @@ public abstract class BaseModule entry.addSplitter(fileName, splitter); } - protected void addBlockedFile(String name) - { - entry.addBlockedFile(name); + protected void addRemapper(String fileName, String actualName) { + entry.addRemapper(fileName, actualName); } - protected void addBlockedFilter(Predicate filter) - { + protected void addBlockedFiles(String... name) { + entry.addBlockedFiles(name); + } + + protected void addBlockedFilter(Predicate filter) { entry.addBlockedFilter(filter); } - protected void addClassMapper(String pattern, String replacement) - { + protected void addClassMapper(String pattern, String replacement) { entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+replacement)); entry.addMapper(new SimpleMapper(pattern, pattern, keyType.getFileType()+replacement)); } - protected void addBiClassMapper(String pattern, String replacement, String splitter) - { + protected void addBiClassMapper(String pattern, String replacement, String splitter) { entry.addMapper(new SimpleMapper("KEY_"+pattern, "KEY_"+pattern, keyType.getFileType()+splitter+keyType.getFileType()+replacement)); entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+splitter+valueType.getFileType()+replacement)); entry.addMapper(new SimpleMapper(pattern, pattern, keyType.getFileType()+splitter+valueType.getFileType()+replacement)); } - protected void addAbstractMapper(String pattern, String replacement) - { + protected void addAbstractMapper(String pattern, String replacement) { entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getFileType()))); entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getFileType()))); } - protected void addAbstractBiMapper(String pattern, String replacement, String splitter) - { + protected void addAbstractBiMapper(String pattern, String replacement, String splitter) { entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getFileType()+splitter+valueType.getFileType()))); } - protected void addFunctionMapper(String pattern, String replacement) - { + protected void addFunctionMapper(String pattern, String replacement) { entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, replacement+valueType.getNonFileType())); entry.addMapper(new SimpleMapper(pattern, pattern, replacement+keyType.getNonFileType())); } - protected void addFunctionValueMapper(String pattern, String replacement) - { + protected void addFunctionValueMapper(String pattern, String replacement) { entry.addMapper(new SimpleMapper(pattern, pattern, replacement+valueType.getNonFileType())); } - protected void addFunctionMappers(String pattern, String replacement) - { + protected void addFunctionMappers(String pattern, String replacement) { entry.addMapper(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getNonFileType()))); entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, keyType.getNonFileType()))); } - protected void addFunctionValueMappers(String pattern, String replacement) - { + protected void addFunctionValueMappers(String pattern, String replacement) { entry.addMapper(new SimpleMapper(pattern, pattern, String.format(replacement, valueType.getNonFileType()))); } - protected void addSimpleMapper(String pattern, String replacement) - { + protected void addSimpleMapper(String pattern, String replacement) { entry.addMapper(new SimpleMapper(pattern, pattern, replacement)); } - protected void addAnnontion(String pattern, String value) - { + protected void addAnnontion(String pattern, String value) { if(keyType == ClassType.OBJECT) entry.addMapper(new LineMapper(pattern, pattern)); else entry.addMapper(new SimpleMapper(pattern, pattern, value)); } - protected void addValueAnnontion(String pattern, String value) - { + protected void addValueAnnontion(String pattern, String value) { if(valueType == ClassType.OBJECT) entry.addMapper(new LineMapper(pattern, pattern)); else entry.addMapper(new SimpleMapper(pattern, pattern, value)); } - protected void addComment(String pattern, String value) - { + protected void addComment(String pattern, String value) { if(keyType == ClassType.OBJECT) entry.addMapper(new InjectMapper(pattern, pattern, value).removeBraces()); else entry.addMapper(new LineMapper(pattern, pattern)); } - protected void addValueComment(String pattern, String value) - { + protected void addValueComment(String pattern, String value) { if(valueType == ClassType.OBJECT) entry.addMapper(new InjectMapper(pattern, pattern, value).removeBraces()); else entry.addMapper(new LineMapper(pattern, pattern)); } - protected InjectMapper addInjectMapper(String pattern, String replacement) - { + protected InjectMapper addInjectMapper(String pattern, String replacement) { InjectMapper mapper = new InjectMapper(pattern, pattern, replacement); entry.addMapper(mapper); return mapper; } - protected ArgumentMapper addArgumentMapper(String pattern, String replacement) - { + protected ArgumentMapper addArgumentMapper(String pattern, String replacement) { return addArgumentMapper(pattern, replacement, ", "); } - protected ArgumentMapper addArgumentMapper(String pattern, String replacement, String splitter) - { + protected ArgumentMapper addArgumentMapper(String pattern, String replacement, String splitter) { ArgumentMapper mapper = new ArgumentMapper(pattern, pattern, replacement, splitter); entry.addMapper(mapper); return mapper; diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java new file mode 100644 index 00000000..9a205aa0 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -0,0 +1,64 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class CollectionModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadClasses(); + loadFunctions(); + loadRemappers(); + loadBlockades(); + } + + @Override + protected void loadFlags() + { + } + + private void loadBlockades() + { + if(keyType.isObject()) addBlockedFiles("Stack"); + } + + private void loadRemappers() + { + addRemapper("IArray", "I%sArray"); + addRemapper("AbstractCollection", "Abstract%sCollection"); + } + + private void loadFunctions() + { + addFunctionMapper("NEXT", "next"); + addSimpleMapper("NEW_STREAM", keyType.isPrimitiveBlocking() ? "" : keyType.getCustomJDKType().getKeyType()+"Stream"); + addFunctionMapper("PREVIOUS", "previous"); + addFunctionMapper("REMOVE_KEY", "rem"); + addSimpleMapper("TO_ARRAY", "to"+keyType.getNonFileType()+"Array"); + addSimpleMapper("VALUE_TO_ARRAY", "to"+valueType.getNonFileType()+"Array"); + } + + private void loadClasses() + { + //Abstract Classes + addAbstractMapper("ABSTRACT_COLLECTION", "Abstract%sCollection"); + + //Helper Classes + addClassMapper("ARRAYS", "Arrays"); + addClassMapper("COLLECTIONS", "Collections"); + addClassMapper("ITERABLES", "Iterables"); + addClassMapper("SPLIT_ITERATORS", "Splititerators"); + addClassMapper("ITERATORS", "Iterators"); + + //Interfaces + addClassMapper("COLLECTION", "Collection"); + addClassMapper("ITERABLE", "Iterable"); + addClassMapper("SPLIT_ITERATOR", "Splititerator"); + addClassMapper("LIST_ITERATOR", "ListIterator"); + addClassMapper("BI_ITERATOR", "BidirectionalIterator"); + addClassMapper("ITERATOR", "Iterator"); + addClassMapper("STACK", "Stack"); + addClassMapper("STRATEGY", "Strategy"); + } + +} diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java new file mode 100644 index 00000000..81f40144 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -0,0 +1,72 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class FunctionModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadFunctions(); + loadClasses(); + loadRemappers(); + loadBlockades(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadBlockades() + { + if(keyType.isObject()) addBlockedFiles("Consumer", "Comparator"); + } + + private void loadRemappers() + { + addBiRequirement("BiConsumer", ""); + addBiRequirement("UnaryOperator", ""); + addBiRequirement("Function"); + addRemapper("BiConsumer", "%sConsumer"); + } + + private void loadFunctions() + { + addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); + addSimpleMapper("TEST_VALUE", keyType.isObject() ? "getBoolean" : "get"); + } + + private void loadClasses() + { + //Interfaces + addBiClassMapper("BI_CONSUMER", "Consumer", ""); + addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer"); + addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer"); + addClassMapper("TO_OBJECT_FUNCTION", "2ObjectFunction"); + addBiClassMapper("FUNCTION", "Function", "2"); + addClassMapper("PREDICATE", "2BooleanFunction"); + addClassMapper("SUPPLIER", "Supplier"); + addAbstractMapper("SINGLE_UNARY_OPERATOR", "%1$s%1$sUnaryOperator"); + addBiClassMapper("UNARY_OPERATOR", "UnaryOperator", ""); + if(keyType.isObject()) + { + if(!valueType.isObject()) addSimpleMapper("VALUE_CONSUMER", valueType.getFileType()+"Consumer"); + else addSimpleMapper("VALUE_CONSUMER", "Consumer"); + addSimpleMapper("CONSUMER", "Consumer"); + addSimpleMapper("IARRAY", "IObjectArray"); + } + else + { + if(valueType.isObject()) + { + addSimpleMapper("VALUE_CONSUMER", "Consumer"); + addSimpleMapper("CONSUMER", keyType.getFileType()+"Consumer"); + } + else addClassMapper("CONSUMER", "Consumer"); + addFunctionMappers("IARRAY", "I%sArray"); + } + addSimpleMapper("VALUE_COMPARATOR", valueType.isObject() ? "Comparator" : String.format("%sComparator", valueType.getNonFileType())); + addSimpleMapper("COMPARATOR", keyType.isObject() ? "Comparator" : String.format("%sComparator", keyType.getNonFileType())); + } +} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index ad4e5487..7ba5f1cb 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -8,10 +8,11 @@ public class JavaModule extends BaseModule @Override protected void loadVariables() { - loadBaseVariables(); createHelperVars(keyType, false, "KEY"); createHelperVars(valueType, true, "VALUE"); + loadBaseVariables(); loadClasses(); + loadFunctions(); } @Override @@ -29,7 +30,16 @@ public class JavaModule extends BaseModule private void loadFunctions() { + addSimpleMapper("APPLY_KEY_VALUE", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); + addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType()); + addSimpleMapper("APPLY_CAST", "applyAs"+keyType.getCustomJDKType().getNonFileType()); + addSimpleMapper("APPLY", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); + //Shared by Maps and Pairs so moved to java. + addFunctionMappers("ENTRY_KEY", "get%sKey"); + addFunctionValueMappers("ENTRY_VALUE", "get%sValue"); + addFunctionMappers("KEY_ENTRY", "set%sKey"); + addFunctionValueMappers("VALUE_ENTRY", "set%sValue"); } private void loadClasses() @@ -138,6 +148,7 @@ public class JavaModule extends BaseModule { addSimpleMapper("SANITY_CAST_VALUE", "castTo"+valueType.getFileType()); } + addSimpleMapper("[SPACE]", " "); addComment("@ArrayType", "@param <%s> the keyType of array that the operation should be applied"); addComment("@Type", "@param <%s> the keyType of elements maintained by this Collection"); addValueComment("@ValueArrayType", "@param <%s> the keyType of array that the operation should be applied"); diff --git a/src/builder/java/speiger/src/builder/modules/ListModule.java b/src/builder/java/speiger/src/builder/modules/ListModule.java new file mode 100644 index 00000000..58d82b0c --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/ListModule.java @@ -0,0 +1,62 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class ListModule extends BaseModule +{ + + @Override + protected void loadVariables() + { + loadClasses(); + loadFunctions(); + loadRemappers(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadRemappers() + { + addRemapper("AbstractList", "Abstract%sList"); + addRemapper("ImmutableList", "Immutable%sList"); + addRemapper("CopyOnWriteList", "CopyOnWrite%sArrayList"); + } + + private void loadFunctions() + { + addFunctionMapper("GET_KEY", "get"); + addFunctionMapper("REMOVE_LAST", "removeLast"); + addFunctionMapper("REMOVE_SWAP", "swapRemove"); + addFunctionMappers("REPLACE", keyType.isObject() ? "replaceObjects" : "replace%ss"); + addFunctionMappers("SORT", "sort%ss"); + } + + private void loadClasses() + { + //Implementation Classes + addClassMapper("ARRAY_LIST", "ArrayList"); + addAbstractMapper("COPY_ON_WRITE_LIST", "CopyOnWrite%sArrayList"); + addClassMapper("ASYNC_BUILDER", "AsyncBuilder"); + addClassMapper("LINKED_LIST", "LinkedList"); + addAbstractMapper("IMMUTABLE_LIST", "Immutable%sList"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_LIST", "Abstract%sList"); + + //SubClasses + addClassMapper("SUB_LIST", "SubList"); + addClassMapper("LIST_ITER", "ListIter"); + + //Helper Classes + addClassMapper("LISTS", "Lists"); + + + //Interfaces + addClassMapper("LIST", "List"); + + + } +} diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java new file mode 100644 index 00000000..a67ab9ef --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -0,0 +1,115 @@ +package speiger.src.builder.modules; + +import speiger.src.builder.ClassType; + +@SuppressWarnings("javadoc") +public class MapModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadFunctions(); + loadClasses(); + loadRemappers(); + loadBlockades(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadBlockades() + { + if(keyType == ClassType.BOOLEAN) + { + addBlockedFiles("SortedMap", "NavigableMap", "RBTreeMap", "AVLTreeMap"); + addBlockedFiles("OrderedMap", "ArrayMap", "LinkedOpenHashMap", "LinkedOpenCustomHashMap"); + addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); + addBlockedFiles("ImmutableOpenHashMap", "OpenHashMap", "OpenCustomHashMap"); + } + } + + private void loadRemappers() + { + addBiRequirement("Map"); + addBiRequirement("SortedMap"); + addBiRequirement("OrderedMap"); + addBiRequirement("NavigableMap"); + addBiRequirement("ConcurrentMap"); + addBiRequirement("AbstractMap"); + addEnumRequirement("EnumMap"); + addEnumRequirement("LinkedEnumMap"); + addBiRequirement("ConcurrentOpenHashMap"); + addBiRequirement("ImmutableOpenHashMap"); + addBiRequirement("OpenHashMap"); + addBiRequirement("LinkedOpenHashMap"); + addBiRequirement("OpenCustomHashMap"); + addBiRequirement("LinkedOpenCustomHashMap"); + addBiRequirement("ArrayMap"); + addBiRequirement("RBTreeMap"); + addBiRequirement("AVLTreeMap"); + addBiRequirement("Maps"); + + addRemapper("AbstractMap", "Abstract%sMap"); + addRemapper("EnumMap", "Enum2%sMap"); + addRemapper("LinkedEnumMap", "LinkedEnum2%sMap"); + addRemapper("ImmutableOpenHashMap", "Immutable%sOpenHashMap"); + } + + private void loadFunctions() + { + addFunctionValueMapper("BULK_MERGE", "mergeAll"); + addFunctionValueMappers("COMPUTE_IF_ABSENT", "compute%sIfAbsent"); + addFunctionValueMappers("COMPUTE_IF_PRESENT", "compute%sIfPresent"); + addFunctionValueMapper("COMPUTE", "compute"); + addFunctionMapper("DEQUEUE_LAST", "dequeueLast"); + addFunctionMapper("DEQUEUE", "dequeue"); + addSimpleMapper("ENTRY_SET", keyType.getFileType().toLowerCase()+"2"+valueType.getFileType()+"EntrySet"); + addFunctionMappers("FIRST_ENTRY_KEY", "first%sKey"); + addFunctionValueMappers("FIRST_ENTRY_VALUE", "first%sValue"); + if(keyType.isObject()) addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get"); + else addSimpleMapper("GET_VALUE", "get"); + addSimpleMapper("GET_JAVA", keyType.isObject() ? "get" : "getAs"+keyType.getCustomJDKType().getNonFileType()); + addFunctionMappers("LAST_ENTRY_KEY", "last%sKey"); + addFunctionValueMappers("LAST_ENTRY_VALUE", "last%sValue"); + addFunctionValueMapper("MERGE", "merge"); + addFunctionMappers("POLL_FIRST_ENTRY_KEY", "pollFirst%sKey"); + addFunctionMappers("POLL_LAST_ENTRY_KEY", "pollLast%sKey"); + if(keyType.isObject()) addFunctionMapper("REMOVE_VALUE", "rem"); + else addSimpleMapper("REMOVE_VALUE", "remove"); + addFunctionMapper("REMOVE", "remove"); + addFunctionValueMappers("REPLACE_VALUES", valueType.isObject() ? "replaceObjects" : "replace%ss"); + addFunctionValueMappers("SUPPLY_IF_ABSENT", "supply%sIfAbsent"); + } + + private void loadClasses() + { + //Implementation Classes + addAbstractBiMapper("IMMUTABLE_HASH_MAP", "Immutable%sOpenHashMap", "2"); + addBiClassMapper("LINKED_CUSTOM_HASH_MAP", "LinkedOpenCustomHashMap", "2"); + addBiClassMapper("LINKED_HASH_MAP", "LinkedOpenHashMap", "2"); + addBiClassMapper("CUSTOM_HASH_MAP", "OpenCustomHashMap", "2"); + addBiClassMapper("CONCURRENT_HASH_MAP", "ConcurrentOpenHashMap", "2"); + addBiClassMapper("AVL_TREE_MAP", "AVLTreeMap", "2"); + addBiClassMapper("RB_TREE_MAP", "RBTreeMap", "2"); + addFunctionValueMappers("LINKED_ENUM_MAP", valueType.isObject() ? "LinkedEnum2ObjectMap" : "LinkedEnum2%sMap"); + addFunctionValueMappers("ENUM_MAP", valueType.isObject() ? "Enum2ObjectMap" : "Enum2%sMap"); + addBiClassMapper("HASH_MAP", "OpenHashMap", "2"); + addBiClassMapper("ARRAY_MAP", "ArrayMap", "2"); + + //Abstract Classes + addAbstractBiMapper("ABSTRACT_MAP", "Abstract%sMap", "2"); + + //Helper Classes + addBiClassMapper("MAPS", "Maps", "2"); + + //Interfaces + addBiClassMapper("NAVIGABLE_MAP", "NavigableMap", "2"); + addBiClassMapper("ORDERED_MAP", "OrderedMap", "2"); + addBiClassMapper("SORTED_MAP", "SortedMap", "2"); + addBiClassMapper("CONCURRENT_MAP", "ConcurrentMap", "2"); + addBiClassMapper("MAP", "Map", "2"); + } +} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/PairModule.java b/src/builder/java/speiger/src/builder/modules/PairModule.java new file mode 100644 index 00000000..cc692bfe --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/PairModule.java @@ -0,0 +1,35 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class PairModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadClasses(); + loadRemappers(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadRemappers() + { + addBiRequirement("Pair", ""); + addBiRequirement("MutablePair", ""); + addBiRequirement("ImmutablePair", ""); + } + + private void loadClasses() + { + //Implementations + addBiClassMapper("IMMUTABLE_PAIR", "ImmutablePair", ""); + addBiClassMapper("MUTABLE_PAIR", "MutablePair", ""); + + //Interfaces + addBiClassMapper("PAIR", "Pair", ""); + } +} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java new file mode 100644 index 00000000..997fb476 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -0,0 +1,42 @@ +package speiger.src.builder.modules; + +@SuppressWarnings("javadoc") +public class PrioQueueModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadClasses(); + loadReampper(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadReampper() + { + addRemapper("AbstractPriorityQueue", "Abstract%sPriorityQueue"); + } + + private void loadClasses() + { + //Implementation Classes + addClassMapper("ARRAY_FIFO_QUEUE", "ArrayFIFOQueue"); + addClassMapper("ARRAY_PRIORITY_QUEUE", "ArrayPriorityQueue"); + addClassMapper("HEAP_PRIORITY_QUEUE", "HeapPriorityQueue"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_PRIORITY_QUEUE", "Abstract%sPriorityQueue"); + + //Helper Classes + addClassMapper("PRIORITY_QUEUES", "PriorityQueues"); + + //Interfaces + addClassMapper("PRIORITY_QUEUE", "PriorityQueue"); + addClassMapper("PRIORITY_DEQUEUE", "PriorityDequeue"); + + } +} diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java new file mode 100644 index 00000000..696ed949 --- /dev/null +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -0,0 +1,71 @@ +package speiger.src.builder.modules; + +import speiger.src.builder.ClassType; + +@SuppressWarnings("javadoc") +public class SetModule extends BaseModule +{ + @Override + protected void loadVariables() + { + loadClasses(); + loadFunctions(); + loadReamppers(); + loadBlockades(); + } + + @Override + protected void loadFlags() + { + + } + + private void loadBlockades() + { + if(keyType == ClassType.BOOLEAN) + { + addBlockedFiles("SortedSet", "NavigableSet", "AVLTreeSet", "RBTreeSet"); + addBlockedFiles("OrderedSet", "ArraySet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet"); + addBlockedFiles("OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); + } + } + + private void loadReamppers() + { + addRemapper("AbstractSet", "Abstract%sSet"); + addRemapper("ImmutableOpenHashSet", "Immutable%sOpenHashSet"); + } + + private void loadFunctions() + { + addFunctionMapper("POLL_FIRST_KEY", "pollFirst"); + addFunctionMapper("POLL_LAST_KEY", "pollLast"); + addFunctionMapper("FIRST_KEY", "first"); + addFunctionMapper("LAST_KEY", "last"); + } + + private void loadClasses() + { + //Implementation Classes + addClassMapper("LINKED_CUSTOM_HASH_SET", "LinkedOpenCustomHashSet"); + addClassMapper("LINKED_HASH_SET", "LinkedOpenHashSet"); + addAbstractMapper("IMMUTABLE_HASH_SET", "Immutable%sOpenHashSet"); + addClassMapper("CUSTOM_HASH_SET", "OpenCustomHashSet"); + addClassMapper("HASH_SET", "OpenHashSet"); + addClassMapper("RB_TREE_SET", "RBTreeSet"); + addClassMapper("AVL_TREE_SET", "AVLTreeSet"); + addClassMapper("ARRAY_SET", "ArraySet"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_SET", "Abstract%sSet"); + + //Helper Classes + addClassMapper("SETS", "Sets"); + + //Interfaces + addClassMapper("NAVIGABLE_SET", "NavigableSet"); + addClassMapper("SORTED_SET", "SortedSet"); + addClassMapper("ORDERED_SET", "OrderedSet"); + addClassMapper("SET", "Set"); + } +} From 6722f399db14a30fb276a87bf717312cd8d52839 Mon Sep 17 00:00:00 2001 From: Speiger Date: Fri, 2 Dec 2022 22:36:34 +0100 Subject: [PATCH 04/20] Implemented Module Configuration --- ModulSettings.json | 1082 +++++++++++++++++ build.gradle | 1 + .../java/speiger/src/builder/ClassType.java | 5 + .../speiger/src/builder/GlobalVariables.java | 553 --------- .../speiger/src/builder/ModuleBuilder.java | 122 -- .../speiger/src/builder/ModulePackage.java | 4 +- .../builder/PrimitiveCollectionsBuilder.java | 268 ++-- .../speiger/src/builder/SettingsManager.java | 105 ++ .../src/builder/modules/AsyncModule.java | 22 +- .../src/builder/modules/BaseModule.java | 33 +- .../src/builder/modules/CollectionModule.java | 65 +- .../src/builder/modules/FunctionModule.java | 29 +- .../src/builder/modules/JavaModule.java | 20 +- .../src/builder/modules/ListModule.java | 59 +- .../src/builder/modules/MapModule.java | 119 +- .../src/builder/modules/PairModule.java | 30 +- .../src/builder/modules/PrioQueueModule.java | 50 +- .../src/builder/modules/SetModule.java | 64 +- 18 files changed, 1659 insertions(+), 972 deletions(-) create mode 100644 ModulSettings.json delete mode 100644 src/builder/java/speiger/src/builder/GlobalVariables.java delete mode 100644 src/builder/java/speiger/src/builder/ModuleBuilder.java create mode 100644 src/builder/java/speiger/src/builder/SettingsManager.java diff --git a/ModulSettings.json b/ModulSettings.json new file mode 100644 index 00000000..9534e91c --- /dev/null +++ b/ModulSettings.json @@ -0,0 +1,1082 @@ +{ + "Async": true, + "Base": true, + "Collection": true, + "Function": true, + "List": true, + "Map": true, + "Pair": true, + "PriorityQueue": true, + "Set": true, + "Boolean": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Byte": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Short": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Character": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Integer": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Long": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Float": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Double": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + }, + "Object": { + "Base": { + "enabled": true + }, + "Boolean": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "Function": { + "enabled": true + }, + "Map": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Collection": { + "enabled": true + }, + "PriorityQueue": { + "enabled": true + }, + "List": { + "enabled": true + }, + "Set": { + "enabled": true + }, + "Async": { + "enabled": true + } + } +} \ No newline at end of file diff --git a/build.gradle b/build.gradle index c848ad5b..bbddc89a 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,7 @@ configurations { } dependencies { + builderImplementation 'com.google.code.gson:gson:2.10' builderImplementation 'de.speiger:Simple-Code-Generator:1.1.4' testImplementation 'junit:junit:4.12' testImplementation 'com.google.guava:guava-testlib:31.0.1-jre' diff --git a/src/builder/java/speiger/src/builder/ClassType.java b/src/builder/java/speiger/src/builder/ClassType.java index f799e726..139d1306 100644 --- a/src/builder/java/speiger/src/builder/ClassType.java +++ b/src/builder/java/speiger/src/builder/ClassType.java @@ -52,6 +52,11 @@ public enum ClassType return classType; } + public String getClassPath() + { + return this == OBJECT ? "Object" : classType; + } + public String getClassType(boolean value) { return value && this == OBJECT ? "V" : classType; diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java deleted file mode 100644 index 963f4b99..00000000 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ /dev/null @@ -1,553 +0,0 @@ -package speiger.src.builder; - -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; -import java.util.function.UnaryOperator; - -import speiger.src.builder.mappers.ArgumentMapper; -import speiger.src.builder.mappers.IMapper; -import speiger.src.builder.mappers.InjectMapper; -import speiger.src.builder.mappers.LineMapper; -import speiger.src.builder.mappers.SimpleMapper; -import speiger.src.builder.processor.TemplateProcess; - -@SuppressWarnings("javadoc") -public class GlobalVariables -{ - List operators = new ArrayList<>(); - Set flags = new LinkedHashSet<>(); - ClassType type; - ClassType valueType; - - public GlobalVariables(ClassType type, ClassType subType) - { - this.type = type; - valueType = subType; - } - - public GlobalVariables createVariables() - { - addSimpleMapper("VALUE_PACKAGE", valueType.getPathType()); - addSimpleMapper("PACKAGE", type.getPathType()); - addSimpleMapper("CLASS_TYPE", type.getClassType()); - addSimpleMapper("CLASS_VALUE_TYPE", valueType.getClassValueType()); - addSimpleMapper("KEY_TYPE", type.getKeyType()); - addSimpleMapper("KEY_OBJECT_TYPE", type.isObject() ? "Object" : type.getKeyType()); - addSimpleMapper("KEY_STRING_TYPE", type.isObject() ? "String" : type.getKeyType()); - addSimpleMapper("KEY_SPECIAL_TYPE", type.isObject() ? "E" : type.getKeyType()); - addSimpleMapper("CLASS_OBJECT_TYPE", type.getClassType()); - addSimpleMapper("CLASS_OBJECT_VALUE_TYPE", valueType.getClassValueType()); - addSimpleMapper("CLASS_STRING_TYPE", type.isObject() ? "String" : type.getClassType()); - addSimpleMapper("CLASS_STRING_VALUE_TYPE", valueType.isObject() ? "String" : valueType.getClassValueType()); - addSimpleMapper("VALUE_TYPE", valueType.getValueType()); - addSimpleMapper("VALUE_OBJECT_TYPE", valueType.isObject() ? "Object" : valueType.getValueType()); - addSimpleMapper("VALUE_STRING_TYPE", valueType.isObject() ? "String" : valueType.getValueType()); - addSimpleMapper("VALUE_SPECIAL_TYPE", valueType.isObject() ? "E" : valueType.getKeyType()); - addSimpleMapper("KEY_JAVA_TYPE", type.getCustomJDKType().getKeyType()); - addSimpleMapper("VALUE_JAVA_TYPE", type.getCustomJDKType().getKeyType()); - - addSimpleMapper("EMPTY_KEY_VALUE", type.getEmptyValue()); - addSimpleMapper("EMPTY_VALUE", valueType.getEmptyValue()); - - addSimpleMapper("INVALID_KEY_VALUE", type.getInvalidValue()); - addSimpleMapper("INVALID_VALUE", valueType.getInvalidValue()); - - addSimpleMapper(" KEY_STRING_GENERIC_TYPE", type.isObject() ? "" : ""); - addSimpleMapper(" VALUE_STRING_GENERIC_TYPE", valueType.isObject() ? "" : ""); - addSimpleMapper(" KEY_VALUE_STRING_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); - - - addSimpleMapper(" KEY_GENERIC_TYPE", type.isObject() ? "<"+type.getKeyType()+">" : ""); - addSimpleMapper(" KEY_KEY_GENERIC_TYPE", type.isObject() ? "<"+type.getKeyType()+", "+type.getKeyType()+">" : ""); - addSimpleMapper(" KEY_CLASS_GENERIC_TYPE", type.isObject() ? "<"+type.getClassType()+">" : ""); - - - addSimpleMapper(" VALUE_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+">" : ""); - addSimpleMapper(" VALUE_VALUE_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+", "+valueType.getValueType()+">" : ""); - addSimpleMapper(" VALUE_CLASS_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getClassValueType()+">" : ""); - - addSimpleMapper(" KEY_VALUE_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "<"+type.getKeyType()+", "+valueType.getValueType()+">" : "<"+type.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+">" : "")); - addSimpleMapper(" KEY_VALUE_VALUE_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "<"+type.getKeyType()+", "+valueType.getValueType()+", "+valueType.getValueType()+">" : "<"+type.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+", "+valueType.getValueType()+">" : "")); - addInjectMapper(" KEY_VALUE_SPECIAL_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "<"+type.getKeyType()+", "+valueType.getValueType()+", %s>" : "<"+type.getKeyType()+", %s>") : (valueType.isObject() ? "<"+valueType.getValueType()+", %s>" : "<%s>")).setBraceType("<>").removeBraces(); - - addSimpleMapper(" NO_GENERIC_TYPE", type.isObject() ? "" : ""); - addSimpleMapper(" NO_KV_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "" : "") : valueType.isObject() ? "" : ""); - addSimpleMapper(" KEY_COMPAREABLE_TYPE", type.isObject() ? "<"+type.getKeyType()+" extends Comparable>" : ""); - - addSimpleMapper(" KEY_SUPER_GENERIC_TYPE", type.isObject() ? "" : ""); - addSimpleMapper(" VALUE_SUPER_GENERIC_TYPE", valueType.isObject() ? "" : ""); - addSimpleMapper(" KEY_VALUE_SUPER_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); - - addSimpleMapper(" KEY_UNKNOWN_GENERIC_TYPE", type.isObject() ? "" : ""); - addSimpleMapper(" VALUE_UNKNOWN_GENERIC_TYPE", valueType.isObject() ? "" : ""); - addSimpleMapper(" KEY_VALUE_UNKNOWN_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "" : "") : (valueType.isObject() ? "" : "")); - - addSimpleMapper(" KEY_ENUM_VALUE_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "<"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">, "+valueType.getValueType()+">" : "<"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">>") : (valueType.isObject() ? "<"+valueType.getValueType()+">" : "")); - addSimpleMapper(" KEY_VALUE_ENUM_GENERIC_TYPE", type.isObject() ? (valueType.isObject() ? "<"+type.getKeyType()+", "+valueType.getValueType()+" extends Enum<"+valueType.getValueType()+">>" : "<"+type.getKeyType()+">") : (valueType.isObject() ? "<"+valueType.getValueType()+" extends Enum<"+valueType.getValueType()+">>" : "")); - - addInjectMapper(" KEY_SPECIAL_GENERIC_TYPE", type.isObject() ? "<%s>" : "").removeBraces().setBraceType("<>"); - addInjectMapper(" VALUE_SPECIAL_GENERIC_TYPE", valueType.isObject() ? "<%s>" : "").removeBraces().setBraceType("<>"); - addInjectMapper(" KSK_GENERIC_TYPE", type.isObject() ? "<%s, "+type.getKeyType()+">" : "<%s>").removeBraces().setBraceType("<>"); - addInjectMapper(" KKS_GENERIC_TYPE", type.isObject() ? "<"+type.getKeyType()+", %s>" : "<%s>").removeBraces().setBraceType("<>"); - addArgumentMapper(" KSS_GENERIC_TYPE", type.isObject() ? "<%1$s, %2$s>" : "<%2$s>").removeBraces().setBraceType("<>"); - addInjectMapper(" VSV_GENERIC_TYPE", valueType.isObject() ? "<%s, "+valueType.getValueType()+">" : "<%s>").removeBraces().setBraceType("<>"); - addInjectMapper(" VVS_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+", %s>" : "<%s>").removeBraces().setBraceType("<>"); - addArgumentMapper(" VSS_GENERIC_TYPE", valueType.isObject() ? "<%1$s, %2$s>" : "<%2$s>").removeBraces().setBraceType("<>"); - - addSimpleMapper(" GENERIC_KEY_BRACES", type.isObject() ? " <"+type.getKeyType()+">" : ""); - addSimpleMapper(" GENERIC_VALUE_BRACES", valueType.isObject() ? " <"+valueType.getValueType()+">" : ""); - addInjectMapper(" GENERIC_SPECIAL_KEY_BRACES", type.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>"); - addInjectMapper(" GENERIC_SPECIAL_VALUE_BRACES", valueType.isObject() ? " <%s>" : "").removeBraces().setBraceType("<>"); - addSimpleMapper(" GENERIC_KEY_ENUM_VALUE_BRACES", type.isObject() ? (valueType.isObject() ? " <"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">, "+valueType.getValueType()+">" : " <"+type.getKeyType()+" extends Enum<"+type.getKeyType()+">>") : (valueType.isObject() ? " <"+valueType.getValueType()+">" : "")); - - addInjectMapper(" GENERIC_KEY_SPECIAL_BRACES", type.isObject() ? " <"+type.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>"); - addInjectMapper(" GENERIC_VALUE_SPECIAL_BRACES", valueType.isObject() ? " <"+valueType.getKeyType()+", %s>" : " <%s>").removeBraces().setBraceType("<>"); - - addSimpleMapper(" GENERIC_KEY_VALUE_BRACES", type.isObject() ? (valueType.isObject() ? " <"+type.getKeyType()+", "+valueType.getValueType()+">" : " <"+type.getKeyType()+">") : (valueType.isObject() ? " <"+valueType.getValueType()+">" : "")); - addSimpleMapper(" COMPAREABLE_KEY_BRACES", type.isObject() ? " <"+type.getKeyType()+" extends Comparable>" : ""); - addSimpleMapper("KV_BRACES", type.isObject() || valueType.isObject() ? "<>" : ""); - addSimpleMapper("VALUE_BRACES", valueType.isObject() ? "<>" : ""); - addSimpleMapper("BRACES", type.isObject() ? "<>" : ""); - if(type.needsCustomJDKType()) - { - addSimpleMapper("JAVA_TYPE", type.getCustomJDKType().getKeyType()); - addSimpleMapper("SANITY_CAST", "castTo"+type.getFileType()); - } - addSimpleMapper("JAVA_CLASS", type.getCustomJDKType().getClassType()); - if(valueType.needsCustomJDKType()) - { - addSimpleMapper("SANITY_CAST_VALUE", "castTo"+valueType.getFileType()); - } - addComment("@ArrayType", "@param <%s> the type of array that the operation should be applied"); - addComment("@Type", "@param <%s> the type of elements maintained by this Collection"); - addValueComment("@ValueArrayType", "@param <%s> the type of array that the operation should be applied"); - addValueComment("@ValueType", "@param <%s> the type of elements maintained by this Collection"); - addAnnontion("@PrimitiveOverride", "@Override"); - addSimpleMapper("@PrimitiveDoc", ""); - addAnnontion("@Primitive", "@Deprecated"); - addValueAnnontion("@ValuePrimitiveOverride", "@Override"); - addValueAnnontion("@ValuePrimitive", "@Deprecated"); - return this; - } - - public GlobalVariables createHelperVariables() - { - createHelperVars(type, false, "KEY"); - createHelperVars(valueType, true, "VALUE"); - return this; - } - - private void createHelperVars(ClassType type, boolean value, String fix) - { - addArgumentMapper("EQUALS_"+fix+"_TYPE", "Objects.equals(%2$s, "+(type.isObject() ? "%1$s" : fix+"_TO_OBJ(%1$s)")+")").removeBraces(); - addInjectMapper(fix+"_EQUALS_NOT_NULL", type.getComparableValue()+" != "+(type.isPrimitiveBlocking() || type.needsCast() ? type.getEmptyValue() : "0")).removeBraces(); - addInjectMapper(fix+"_EQUALS_NULL", type.getComparableValue()+" == "+(type.isPrimitiveBlocking() || type.needsCast() ? type.getEmptyValue() : "0")).removeBraces(); - addArgumentMapper(fix+"_EQUALS_NOT", type.getEquals(true)).removeBraces(); - addArgumentMapper(fix+"_EQUALS", type.getEquals(false)).removeBraces(); - addSimpleMapper("FILE_"+fix+"_TYPE", type.getFileType()); - - addArgumentMapper("COMPAREABLE_TO_"+fix, type.isObject() ? "((Comparable<"+type.getKeyType(value)+">)%1$s).compareTo(("+type.getKeyType(value)+")%2$s)" : type.getClassType(value)+".compare(%1$s, %2$s)").removeBraces(); - addArgumentMapper("COMPARE_TO_"+fix, type.isObject() ? "%1$s.compareTo(%2$s)" : type.getClassType(value)+".compare(%1$s, %2$s)").removeBraces(); - - addInjectMapper(fix+"_TO_OBJ", type.isObject() ? "%s" : type.getClassType(value)+".valueOf(%s)").removeBraces(); - addInjectMapper("OBJ_TO_"+fix, type.isObject() ? "%s" : "%s."+type.getKeyType(value)+"Value()").removeBraces(); - addInjectMapper("CLASS_TO_"+fix, type.isObject() ? "("+type.getKeyType(value)+")%s" : "(("+type.getClassType(value)+")%s)."+type.getKeyType(value)+"Value()").removeBraces(); - - addInjectMapper(fix+"_TO_HASH", type.isObject() ? "Objects.hashCode(%s)" : type.getClassType(value)+".hashCode(%s)").removeBraces(); - addInjectMapper(fix+"_TO_STRING", type.isObject() ? "Objects.toString(%s)" : type.getClassType(value)+".toString(%s)").removeBraces(); - - addSimpleMapper("CAST_"+fix+"_ARRAY ", type.isObject() ? "("+fix+"_TYPE[])" : ""); - addSimpleMapper("EMPTY_"+fix+"_ARRAY", type.isObject() ? "("+fix+"_TYPE[])ARRAYS.EMPTY_ARRAY" : "ARRAYS.EMPTY_ARRAY"); - addInjectMapper("NEW_"+fix+"_ARRAY", type.isObject() ? "("+fix+"_TYPE[])new Object[%s]" : "new "+fix+"_TYPE[%s]").removeBraces(); - addInjectMapper("NEW_SPECIAL_"+fix+"_ARRAY", type.isObject() ? "(E[])new Object[%s]" : "new "+fix+"_TYPE[%s]").removeBraces(); - if(value) addInjectMapper("NEW_CLASS_VALUE_ARRAY", type.isObject() ? "(CLASS_VALUE_TYPE[])new Object[%s]" : "new CLASS_VALUE_TYPE[%s]").removeBraces(); - else addInjectMapper("NEW_CLASS_ARRAY", type.isObject() ? "(CLASS_TYPE[])new Object[%s]" : "new CLASS_TYPE[%s]").removeBraces(); - } - - public GlobalVariables createPreFunctions() - { - addSimpleMapper("ENTRY_SET", type.getFileType().toLowerCase()+"2"+valueType.getFileType()+"EntrySet"); - return this; - } - - public GlobalVariables createClassTypes() - { - addSimpleMapper("JAVA_PREDICATE", type.isPrimitiveBlocking() ? "" : type.getCustomJDKType().getFileType()+"Predicate"); - addSimpleMapper("JAVA_CONSUMER", type.isPrimitiveBlocking() ? "" : "java.util.function."+type.getCustomJDKType().getFileType()+"Consumer"); - addSimpleMapper("JAVA_SUPPLIER", type.isPrimitiveBlocking() ? "" : "java.util.function."+type.getCustomJDKType().getFileType()+"Supplier"); - addSimpleMapper("JAVA_FUNCTION", type.getFunctionClass(valueType)); - addSimpleMapper("JAVA_BINARY_OPERATOR", type == ClassType.BOOLEAN ? "" : (type.isObject() ? "java.util.function.BinaryOperator" : "java.util.function."+type.getCustomJDKType().getFileType()+"BinaryOperator")); - addSimpleMapper("JAVA_UNARY_OPERATOR", type.isObject() ? "BinaryOperator" : type == ClassType.BOOLEAN ? "" : type.getCustomJDKType().getFileType()+"UnaryOperator"); - addSimpleMapper("JAVA_SPLIT_ITERATOR", type.isPrimitiveBlocking() ? "Spliterator" : "Of"+type.getCustomJDKType().getFileType()); - addSimpleMapper("JAVA_STREAM", type.isPrimitiveBlocking() ? "" : type.getCustomJDKType().getFileType()+"Stream"); - addSimpleMapper("JAVA_BUFFER", type.getFileType()+"Buffer"); - - //Final Classes - addClassMapper("ARRAY_LIST", "ArrayList"); - addAbstractMapper("COPY_ON_WRITE_LIST", "CopyOnWrite%sArrayList"); - addClassMapper("ASYNC_BUILDER", "AsyncBuilder"); - addClassMapper("LINKED_LIST", "LinkedList"); - addAbstractMapper("IMMUTABLE_LIST", "Immutable%sList"); - addClassMapper("ARRAY_FIFO_QUEUE", "ArrayFIFOQueue"); - addClassMapper("ARRAY_PRIORITY_QUEUE", "ArrayPriorityQueue"); - addClassMapper("HEAP_PRIORITY_QUEUE", "HeapPriorityQueue"); - addClassMapper("LINKED_CUSTOM_HASH_SET", "LinkedOpenCustomHashSet"); - addClassMapper("LINKED_HASH_SET", "LinkedOpenHashSet"); - addAbstractMapper("IMMUTABLE_HASH_SET", "Immutable%sOpenHashSet"); - addClassMapper("CUSTOM_HASH_SET", "OpenCustomHashSet"); - addClassMapper("HASH_SET", "OpenHashSet"); - addAbstractBiMapper("IMMUTABLE_HASH_MAP", "Immutable%sOpenHashMap", "2"); - addBiClassMapper("LINKED_CUSTOM_HASH_MAP", "LinkedOpenCustomHashMap", "2"); - addBiClassMapper("LINKED_HASH_MAP", "LinkedOpenHashMap", "2"); - addBiClassMapper("CUSTOM_HASH_MAP", "OpenCustomHashMap", "2"); - addBiClassMapper("CONCURRENT_HASH_MAP", "ConcurrentOpenHashMap", "2"); - addBiClassMapper("AVL_TREE_MAP", "AVLTreeMap", "2"); - addBiClassMapper("RB_TREE_MAP", "RBTreeMap", "2"); - addFunctionValueMappers("LINKED_ENUM_MAP", valueType.isObject() ? "LinkedEnum2ObjectMap" : "LinkedEnum2%sMap"); - addFunctionValueMappers("ENUM_MAP", valueType.isObject() ? "Enum2ObjectMap" : "Enum2%sMap"); - addBiClassMapper("HASH_MAP", "OpenHashMap", "2"); - addBiClassMapper("ARRAY_MAP", "ArrayMap", "2"); - addBiClassMapper("IMMUTABLE_PAIR", "ImmutablePair", ""); - addBiClassMapper("MUTABLE_PAIR", "MutablePair", ""); - addClassMapper("RB_TREE_SET", "RBTreeSet"); - addClassMapper("AVL_TREE_SET", "AVLTreeSet"); - addClassMapper("ARRAY_SET", "ArraySet"); - addAbstractBiMapper("SIMPLE_TEST_MAP", "Test%sMap", "2"); - - //Final UnitTest Classes - addAbstractMapper("MINIMAL_COLLECTION", "Minimal%sCollection"); - addAbstractMapper("MINIMAL_SET", "Minimal%sSet"); - addAbstractMapper("ABSTRACT_CONTAINER_TESTER", "Abstract%sContainerTester"); - addAbstractMapper("ABSTRACT_COLLECTION_TESTER", "Abstract%sCollectionTester"); - addAbstractMapper("ABSTRACT_QUEUE_TESTER", "Abstract%sQueueTester"); - addAbstractMapper("ABSTRACT_LIST_INDEX_OF_TESTER", "Abstract%sListIndexOfTester"); - addAbstractMapper("ABSTRACT_LIST_TESTER", "Abstract%sListTester"); - addAbstractMapper("ABSTRACT_SET_TESTER", "Abstract%sSetTester"); - addAbstractMapper("ABSTRACT_ITERATOR_TESTER", "Abstract%sIteratorTester"); - addAbstractBiMapper("ABSTRACT_MAP_TESTER", "Abstract%sMapTester", "2"); - addClassMapper("LIST_ITERATOR_TESTER", "ListIteratorTester"); - addClassMapper("BIDIRECTIONAL_ITERATOR_TESTER", "BidirectionalteratorTester"); - addClassMapper("ITERATOR_TESTER", "IteratorTester"); - addClassMapper("COLLECTION_TEST_BUILDER", "CollectionTestSuiteBuilder"); - addClassMapper("DEQUEUE_TEST_BUILDER", "DequeueTestSuiteBuilder"); - addClassMapper("QUEUE_TEST_BUILDER", "QueueTestSuiteBuilder"); - addClassMapper("LIST_TEST_BUILDER", "ListTestSuiteBuilder"); - addClassMapper("ORDERED_SET_TEST_BUILDER", "OrderedSetTestSuiteBuilder"); - addClassMapper("SORTED_SET_TEST_BUILDER", "SortedSetTestSuiteBuilder"); - addClassMapper("NAVIGABLE_SET_TEST_BUILDER", "NavigableSetTestSuiteBuilder"); - addClassMapper("SET_TEST_BUILDER", "SetTestSuiteBuilder"); - addAbstractBiMapper("NAVIGABLE_MAP_TEST_BUILDER", "%sNavigableMapTestSuiteBuilder", "2"); - addAbstractBiMapper("SORTED_MAP_TEST_BUILDER", "%sSortedMapTestSuiteBuilder", "2"); - addAbstractBiMapper("ORDERED_MAP_TEST_BUILDER", "%sOrderedMapTestSuiteBuilder", "2"); - addAbstractBiMapper("MAP_TEST_BUILDER", "%sMapTestSuiteBuilder", "2"); - addAbstractBiMapper("MAP_CONSTRUCTOR_TESTS", "%sMapConstructorTests", "2"); - addClassMapper("COLLECTION_CONSTRUCTOR_TESTS", "CollectionConstructorTests"); - addClassMapper("SUB_SORTED_SET_CLASS_GENERATOR", "SortedSetSubsetTestSetGenerator"); - addClassMapper("SUB_NAVIGABLE_SET_CLASS_GENERATOR", "NavigableSetSubsetTestSetGenerator"); - addClassMapper("LIST_TESTS", "ListTests"); - addClassMapper("SET_TESTS", "SetTests"); - addClassMapper("QUEUE_TESTS", "QueueTests"); - addBiClassMapper("MAP_TESTS", "MapTests", "2"); - - //Abstract Classes - addAbstractMapper("ABSTRACT_COLLECTION", "Abstract%sCollection"); - addAbstractMapper("ABSTRACT_PRIORITY_QUEUE", "Abstract%sPriorityQueue"); - addAbstractMapper("ABSTRACT_SET", "Abstract%sSet"); - addAbstractMapper("ABSTRACT_LIST", "Abstract%sList"); - addAbstractBiMapper("ABSTRACT_MAP", "Abstract%sMap", "2"); - addClassMapper("SUB_LIST", "SubList"); - addAbstractMapper("BASE_TASK", "Base%sTask"); - - //Helper Classes - addClassMapper("LISTS", "Lists"); - addClassMapper("SETS", "Sets"); - addClassMapper("COLLECTIONS", "Collections"); - addClassMapper("ARRAYS", "Arrays"); - addClassMapper("PRIORITY_QUEUES", "PriorityQueues"); - addClassMapper("SPLIT_ITERATORS", "Splititerators"); - addClassMapper("ITERATORS", "Iterators"); - addClassMapper("ITERABLES", "Iterables"); - addBiClassMapper("MAPS", "Maps", "2"); - addClassMapper("SAMPLE_ELEMENTS", "Samples"); - - //UnitTest Helper Classes - addClassMapper("HELPERS", "Helpers"); - addAbstractMapper("TEST_COLLECTION_GENERATOR", "Test%sCollectionGenerator"); - addAbstractMapper("TEST_QUEUE_GENERATOR", "Test%sQueueGenerator"); - addAbstractMapper("TEST_LIST_GENERATOR", "Test%sListGenerator"); - addAbstractMapper("TEST_NAVIGABLE_SET_GENERATOR", "Test%sNavigableSetGenerator"); - addAbstractMapper("TEST_SORTED_SET_GENERATOR", "Test%sSortedSetGenerator"); - addAbstractMapper("TEST_ORDERED_SET_GENERATOR", "Test%sOrderedSetGenerator"); - addAbstractMapper("TEST_SET_GENERATOR", "Test%sSetGenerator"); - addAbstractMapper("SIMPLE_TEST_GENERATOR", "Simple%sTestGenerator"); - addAbstractMapper("SIMPLE_QUEUE_TEST_GENERATOR", "Simple%sQueueTestGenerator"); - addAbstractBiMapper("SIMPLE_MAP_TEST_GENERATOR", "Simple%sMapTestGenerator", "2"); - addAbstractBiMapper("DERIVED_MAP_GENERATORS", "Derived%sMapGenerators", "2"); - addAbstractBiMapper("TEST_ORDERED_MAP_GENERATOR", "Test%sOrderedMapGenerator", "2"); - addAbstractBiMapper("TEST_SORTED_MAP_GENERATOR", "Test%sSortedMapGenerator", "2"); - addAbstractBiMapper("TEST_MAP_GENERATOR", "Test%sMapGenerator", "2"); - - //Interfaces - addClassMapper("LIST_ITERATOR", "ListIterator"); - addClassMapper("BI_ITERATOR", "BidirectionalIterator"); - addBiClassMapper("BI_CONSUMER", "Consumer", ""); - addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer"); - addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer"); - addClassMapper("SPLIT_ITERATOR", "Splititerator"); - addClassMapper("ITERATOR", "Iterator"); - addClassMapper("ITERABLE", "Iterable"); - addClassMapper("COLLECTION", "Collection"); - addClassMapper("TO_OBJECT_FUNCTION", "2ObjectFunction"); - addBiClassMapper("FUNCTION", "Function", "2"); - addClassMapper("LIST_ITER", "ListIter"); - addClassMapper("LIST", "List"); - addBiClassMapper("NAVIGABLE_MAP", "NavigableMap", "2"); - addBiClassMapper("ORDERED_MAP", "OrderedMap", "2"); - addBiClassMapper("SORTED_MAP", "SortedMap", "2"); - addBiClassMapper("CONCURRENT_MAP", "ConcurrentMap", "2"); - addBiClassMapper("MAP", "Map", "2"); - addClassMapper("NAVIGABLE_SET", "NavigableSet"); - addBiClassMapper("PAIR", "Pair", ""); - addClassMapper("PRIORITY_QUEUE", "PriorityQueue"); - addClassMapper("PRIORITY_DEQUEUE", "PriorityDequeue"); - addClassMapper("PREDICATE", "2BooleanFunction"); - addClassMapper("SORTED_SET", "SortedSet"); - addClassMapper("ORDERED_SET", "OrderedSet"); - addClassMapper("SET", "Set"); - addClassMapper("STRATEGY", "Strategy"); - addClassMapper("STACK", "Stack"); - addClassMapper("SUPPLIER", "Supplier"); - addAbstractMapper("SINGLE_UNARY_OPERATOR", "%1$s%1$sUnaryOperator"); - addClassMapper("TASK", "Task"); - addBiClassMapper("UNARY_OPERATOR", "UnaryOperator", ""); - if(type.isObject()) - { - if(!valueType.isObject()) addSimpleMapper("VALUE_CONSUMER", valueType.getFileType()+"Consumer"); - else addSimpleMapper("VALUE_CONSUMER", "Consumer"); - addSimpleMapper("CONSUMER", "Consumer"); - addSimpleMapper("IARRAY", "IObjectArray"); - } - else - { - if(valueType.isObject()) - { - addSimpleMapper("VALUE_CONSUMER", "Consumer"); - addSimpleMapper("CONSUMER", type.getFileType()+"Consumer"); - } - else addClassMapper("CONSUMER", "Consumer"); - addFunctionMappers("IARRAY", "I%sArray"); - } - addSimpleMapper("VALUE_COMPARATOR", valueType.isObject() ? "Comparator" : String.format("%sComparator", valueType.getNonFileType())); - addSimpleMapper("COMPARATOR", type.isObject() ? "Comparator" : String.format("%sComparator", type.getNonFileType())); - return this; - } - - public GlobalVariables createFunctions() - { - addSimpleMapper("APPLY_KEY_VALUE", type.isObject() ? "apply" : "applyAs"+type.getNonFileType()); - addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType()); - addSimpleMapper("APPLY_CAST", "applyAs"+type.getCustomJDKType().getNonFileType()); - addSimpleMapper("APPLY", type.isObject() ? "apply" : "applyAs"+type.getNonFileType()); - addFunctionValueMapper("BULK_MERGE", "mergeAll"); - addFunctionValueMappers("COMPUTE_IF_ABSENT", "compute%sIfAbsent"); - addFunctionValueMappers("COMPUTE_IF_PRESENT", "compute%sIfPresent"); - addFunctionValueMapper("COMPUTE", "compute"); - addFunctionMapper("DEQUEUE_LAST", "dequeueLast"); - addFunctionMapper("DEQUEUE", "dequeue"); - addFunctionMappers("POLL_FIRST_ENTRY_KEY", "pollFirst%sKey"); - addFunctionMappers("POLL_LAST_ENTRY_KEY", "pollLast%sKey"); - addFunctionMapper("POLL_FIRST_KEY", "pollFirst"); - addFunctionMapper("POLL_LAST_KEY", "pollLast"); - addFunctionMappers("FIRST_ENTRY_KEY", "first%sKey"); - addFunctionValueMappers("FIRST_ENTRY_VALUE", "first%sValue"); - addFunctionMapper("FIRST_KEY", "first"); - addFunctionMappers("LAST_ENTRY_KEY", "last%sKey"); - addFunctionValueMappers("LAST_ENTRY_VALUE", "last%sValue"); - addFunctionMappers("ENTRY_KEY", "get%sKey"); - addFunctionValueMappers("ENTRY_VALUE", "get%sValue"); - addFunctionMappers("KEY_ENTRY", "set%sKey"); - addFunctionValueMappers("VALUE_ENTRY", "set%sValue"); - addFunctionMapper("GET_KEY", "get"); - if(type.isObject()) addFunctionValueMapper("GET_VALUE", valueType.isObject() ? "getObject" : "get"); - else addSimpleMapper("GET_VALUE", "get"); - addSimpleMapper("GET_JAVA", type.isObject() ? "get" : "getAs"+type.getCustomJDKType().getNonFileType()); - addFunctionMapper("LAST_KEY", "last"); - addFunctionValueMapper("MERGE", "merge"); - addFunctionMapper("NEXT", "next"); - addFunctionMapper("PREVIOUS", "previous"); - addFunctionMapper("REMOVE_SWAP", "swapRemove"); - if(type.isObject()) addFunctionMapper("REMOVE_VALUE", "rem"); - else addSimpleMapper("REMOVE_VALUE", "remove"); - addFunctionMapper("REMOVE_KEY", "rem"); - addFunctionMapper("REMOVE_LAST", "removeLast"); - addFunctionMapper("REMOVE", "remove"); - addFunctionValueMappers("REPLACE_VALUES", valueType.isObject() ? "replaceObjects" : "replace%ss"); - addFunctionMappers("REPLACE", type.isObject() ? "replaceObjects" : "replace%ss"); - addFunctionMappers("SORT", "sort%ss"); - addFunctionValueMappers("SUPPLY_IF_ABSENT", "supply%sIfAbsent"); - addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); - addSimpleMapper("TEST_VALUE", type.isObject() ? "getBoolean" : "get"); - addSimpleMapper("NEW_STREAM", type.isPrimitiveBlocking() ? "" : type.getCustomJDKType().getKeyType()+"Stream"); - addSimpleMapper("VALUE_TO_ARRAY", "to"+valueType.getNonFileType()+"Array"); - addSimpleMapper("TO_ARRAY", "to"+type.getNonFileType()+"Array"); - addSimpleMapper("[SPACE]", " "); - operators.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); - return this; - } - - public GlobalVariables createFlags() - { - flags.add("TYPE_"+type.getCapType()); - flags.add("VALUE_"+valueType.getCapType()); - if(type == valueType) flags.add("SAME_TYPE"); - if(type.hasFunction(valueType)) flags.add("JDK_FUNCTION"); - if(!type.needsCustomJDKType()) flags.add("JDK_TYPE"); - if(!type.isPrimitiveBlocking()) flags.add("PRIMITIVES"); - if(!valueType.isPrimitiveBlocking()) flags.add("VALUE_PRIMITIVES"); - if(valueType.needsCustomJDKType()) flags.add("JDK_VALUE"); - return this; - } - - public TemplateProcess create(String fileName, String splitter, boolean valueOnly) - { - TemplateProcess process = new TemplateProcess(String.format(fileName+".java", (splitter != null ? type.getFileType()+splitter+valueType.getFileType() : (valueOnly ? valueType : type).getFileType()))); - process.setPathBuilder(new PathBuilder(type.getPathType())); - process.addFlags(flags); - process.addMappers(operators); - return process; - } - - public void testComparason(List keys, List values) { - List copy = new ArrayList<>(operators); - Collections.shuffle(copy); - copy.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); - operators.stream().map(IMapper::getSearchValue).forEach(keys::add); - copy.stream().map(IMapper::getSearchValue).forEach(values::add); - } - - private int sort(String key, String value) { - if(value.contains(key)) return 1; - else if(key.contains(value)) return -1; - return 0; - } - - public ClassType getType() - { - return type; - } - - private void addClassMapper(String pattern, String replacement) - { - operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+replacement)); - operators.add(new SimpleMapper(pattern, pattern, type.getFileType()+replacement)); - } - - private void addBiClassMapper(String pattern, String replacement, String splitter) - { - operators.add(new SimpleMapper("KEY_"+pattern, "KEY_"+pattern, type.getFileType()+splitter+type.getFileType()+replacement)); - operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, valueType.getFileType()+splitter+valueType.getFileType()+replacement)); - operators.add(new SimpleMapper(pattern, pattern, type.getFileType()+splitter+valueType.getFileType()+replacement)); - } - - private void addAbstractMapper(String pattern, String replacement) - { - operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getFileType()))); - operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getFileType()))); - } - - private void addAbstractBiMapper(String pattern, String replacement, String splitter) - { - operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getFileType()+splitter+valueType.getFileType()))); - } - - private void addFunctionMapper(String pattern, String replacement) - { - operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, replacement+valueType.getNonFileType())); - operators.add(new SimpleMapper(pattern, pattern, replacement+type.getNonFileType())); - } - - private void addFunctionValueMapper(String pattern, String replacement) - { - operators.add(new SimpleMapper(pattern, pattern, replacement+valueType.getNonFileType())); - } - - private void addFunctionMappers(String pattern, String replacement) - { - operators.add(new SimpleMapper("VALUE_"+pattern, "VALUE_"+pattern, String.format(replacement, valueType.getNonFileType()))); - operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, type.getNonFileType()))); - } - - private void addFunctionValueMappers(String pattern, String replacement) - { - operators.add(new SimpleMapper(pattern, pattern, String.format(replacement, valueType.getNonFileType()))); - } - - private void addSimpleMapper(String pattern, String replacement) - { - operators.add(new SimpleMapper(pattern, pattern, replacement)); - } - - private void addAnnontion(String pattern, String value) - { - if(type == ClassType.OBJECT) operators.add(new LineMapper(pattern, pattern)); - else operators.add(new SimpleMapper(pattern, pattern, value)); - } - - private void addValueAnnontion(String pattern, String value) - { - if(valueType == ClassType.OBJECT) operators.add(new LineMapper(pattern, pattern)); - else operators.add(new SimpleMapper(pattern, pattern, value)); - } - - private void addComment(String pattern, String value) - { - if(type == ClassType.OBJECT) operators.add(new InjectMapper(pattern, pattern, value).removeBraces()); - else operators.add(new LineMapper(pattern, pattern)); - } - - private void addValueComment(String pattern, String value) - { - if(valueType == ClassType.OBJECT) operators.add(new InjectMapper(pattern, pattern, value).removeBraces()); - else operators.add(new LineMapper(pattern, pattern)); - } - - private InjectMapper addInjectMapper(String pattern, String replacement) - { - InjectMapper mapper = new InjectMapper(pattern, pattern, replacement); - operators.add(mapper); - return mapper; - } - - private ArgumentMapper addArgumentMapper(String pattern, String replacement) - { - return addArgumentMapper(pattern, replacement, ", "); - } - - private ArgumentMapper addArgumentMapper(String pattern, String replacement, String splitter) - { - ArgumentMapper mapper = new ArgumentMapper(pattern, pattern, replacement, splitter); - operators.add(mapper); - return mapper; - } - - class PathBuilder implements UnaryOperator - { - String before; - - public PathBuilder(String before) - { - this.before = before; - } - - @Override - public Path apply(Path t) - { - return t.subpath(0, 6).resolve(before).resolve(t.subpath(6, t.getNameCount())); - } - } -} diff --git a/src/builder/java/speiger/src/builder/ModuleBuilder.java b/src/builder/java/speiger/src/builder/ModuleBuilder.java deleted file mode 100644 index 37a72c57..00000000 --- a/src/builder/java/speiger/src/builder/ModuleBuilder.java +++ /dev/null @@ -1,122 +0,0 @@ -package speiger.src.builder; - -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.function.Consumer; - -import speiger.src.builder.modules.AsyncModule; -import speiger.src.builder.modules.BaseModule; -import speiger.src.builder.modules.CollectionModule; -import speiger.src.builder.modules.FunctionModule; -import speiger.src.builder.modules.JavaModule; -import speiger.src.builder.modules.ListModule; -import speiger.src.builder.modules.MapModule; -import speiger.src.builder.modules.PairModule; -import speiger.src.builder.modules.PrioQueueModule; -import speiger.src.builder.modules.SetModule; -import speiger.src.builder.processor.TemplateProcess; -import speiger.src.builder.processor.TemplateProcessor; - -@SuppressWarnings("javadoc") -public class ModuleBuilder extends TemplateProcessor -{ - List simplePackages = new ArrayList<>(); - List biPackages = new ArrayList<>(); - List enumPackages = new ArrayList<>(); - Map requirements = new HashMap<>(); - - public static void main(String...args) - { - try - { - new ModuleBuilder(true).process(true); - } - catch(IOException e) - { - e.printStackTrace(); - } - catch(InterruptedException e) - { - e.printStackTrace(); - } - } - - public ModuleBuilder(boolean silencedSuccess) - { - super(silencedSuccess, Paths.get("src/builder/resources/speiger/assets/collections/templates/"), Paths.get("src/main/java/speiger/src/collections/"), Paths.get("src/builder/resources/speiger/assets/collections/")); - } - - public ModuleBuilder(boolean silencedSuccess, Path sourceFolder, Path outputFolder, Path dataFolder) - { - super(silencedSuccess, sourceFolder, outputFolder, dataFolder); - } - - @Override - protected void init() - { - prepPackages(); - //Init Modules here - addModule(new JavaModule()); - addModule(new FunctionModule()); - addModule(new CollectionModule()); - addModule(new PrioQueueModule()); - addModule(new ListModule()); - addModule(new SetModule()); - addModule(new MapModule()); - addModule(new PairModule()); - addModule(new AsyncModule()); - finishPackages(); - } - - public void addModule(BaseModule module) - { - biPackages.forEach(module::init); - module.cleanup(); - } - - private void finishPackages() - { - biPackages.forEach(ModulePackage::finish); - } - - private void prepPackages() - { - for(ModulePackage entry : ModulePackage.createPackages()) - { - entry.setRequirements(requirements::put); - biPackages.add(entry); - if(entry.isSame()) simplePackages.add(entry); - if(entry.isEnumValid()) enumPackages.add(entry); - } - } - - @Override - public void createProcesses(String fileName, Consumer process) - { - List packages = getPackagesByRequirement(requirements.get(fileName)); - for(int i = 0,m=packages.size();i getPackagesByRequirement(RequiredType type) { - if(type == null) return simplePackages; - if(type == RequiredType.BI_CLASS) return biPackages; - if(type == RequiredType.ENUM) return enumPackages; - return Collections.emptyList(); - } - - @Override - protected boolean isFileValid(Path fileName) { return true; } - @Override - protected boolean relativePackages() { return true; } - @Override - protected boolean debugUnusedMappers() { return false; } -} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/ModulePackage.java b/src/builder/java/speiger/src/builder/ModulePackage.java index b01f9565..e7c4b5bb 100644 --- a/src/builder/java/speiger/src/builder/ModulePackage.java +++ b/src/builder/java/speiger/src/builder/ModulePackage.java @@ -21,6 +21,7 @@ import speiger.src.builder.processor.TemplateProcess; @SuppressWarnings("javadoc") public class ModulePackage { + private static final BiConsumer VOID = (K, V) -> {}; public static final ClassType[] TYPE = ClassType.values(); final ClassType keyType; final ClassType valueType; @@ -30,7 +31,7 @@ public class ModulePackage List> blockedFilters = new ArrayList<>(); List mappers = new ArrayList<>(); Set flags = new LinkedHashSet<>(); - BiConsumer requirements = (K, V) -> {}; + BiConsumer requirements = VOID; public ModulePackage(ClassType keyType, ClassType valueType) { this.keyType = keyType; @@ -38,6 +39,7 @@ public class ModulePackage } public void finish() { + requirements = VOID; mappers.sort(Comparator.comparing(IMapper::getSearchValue, Comparator.comparingInt(String::length).reversed())); mappers.sort(Comparator.comparing(IMapper::getSearchValue, this::sort)); } diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 3e75b1cc..dc99a0ce 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -7,8 +7,7 @@ import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; -import java.util.EnumMap; -import java.util.EnumSet; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.List; @@ -16,25 +15,34 @@ import java.util.Map; import java.util.Set; import java.util.StringJoiner; import java.util.function.Consumer; -import java.util.function.Predicate; import java.util.stream.Stream; +import speiger.src.builder.modules.AsyncModule; +import speiger.src.builder.modules.BaseModule; +import speiger.src.builder.modules.CollectionModule; +import speiger.src.builder.modules.FunctionModule; +import speiger.src.builder.modules.JavaModule; +import speiger.src.builder.modules.ListModule; +import speiger.src.builder.modules.MapModule; +import speiger.src.builder.modules.PairModule; +import speiger.src.builder.modules.PrioQueueModule; +import speiger.src.builder.modules.SetModule; import speiger.src.builder.processor.TemplateProcess; import speiger.src.builder.processor.TemplateProcessor; @SuppressWarnings("javadoc") public class PrimitiveCollectionsBuilder extends TemplateProcessor { - Map> blocked = new HashMap<>(); - EnumMap>> blockedPredicate = new EnumMap<>(ClassType.class); - Map nameRemapper = new HashMap<>(); - Map biRequired = new HashMap<>(); - Set enumRequired = new HashSet<>(); - public static final ClassType[] TYPE = ClassType.values(); - List variables = new ArrayList<>(); - List biVariables = new ArrayList<>(); - List enumVariables = new ArrayList<>(); - boolean special = false; + private static final int SPECIAL = 0x1; //Detects if the Builder is generating tests + private static final int LOAD = 0x2; //If Configs should be loaded + private static final int ANTI_SAVE = SPECIAL | LOAD; //If save should be disabled since load/save shouldn't happen at the same time. + private static final int SAVE = 0x4; //if the configuration should be created + List simplePackages = new ArrayList<>(); + List biPackages = new ArrayList<>(); + List enumPackages = new ArrayList<>(); + Map requirements = new HashMap<>(); + SettingsManager manager = new SettingsManager(); + int flags; public PrimitiveCollectionsBuilder() { @@ -56,17 +64,26 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor super(silencedSuccess, sourceFolder, outputFolder, dataFolder); } - private PrimitiveCollectionsBuilder setSpecial() { - special = true; + private PrimitiveCollectionsBuilder setFlags(int flags) { + this.flags = flags; + if((flags & ANTI_SAVE) != 0) { + this.flags &= ~SAVE; + } return this; } - private static PrimitiveCollectionsBuilder createTests(boolean silent) { - return new PrimitiveCollectionsBuilder(silent, Paths.get("src/builder/resources/speiger/assets/tests/templates/"), Paths.get("src/test/java/speiger/src/tests/"), Paths.get("src/builder/resources/speiger/assets/tests/")).setSpecial(); + private static PrimitiveCollectionsBuilder createTests(boolean silent, int flags) { + return new PrimitiveCollectionsBuilder(silent, + Paths.get("src/builder/resources/speiger/assets/tests/templates/"), + Paths.get("src/test/java/speiger/src/tests/"), + Paths.get("src/builder/resources/speiger/assets/tests/")).setFlags(flags | SPECIAL); } - private static PrimitiveCollectionsBuilder createTesters(boolean silent) { - return new PrimitiveCollectionsBuilder(silent, Paths.get("src/builder/resources/speiger/assets/testers/templates/"), Paths.get("src/test/java/speiger/src/testers/"), Paths.get("src/builder/resources/speiger/assets/testers/")).setSpecial(); + private static PrimitiveCollectionsBuilder createTesters(boolean silent, int flags) { + return new PrimitiveCollectionsBuilder(silent, + Paths.get("src/builder/resources/speiger/assets/testers/templates/"), + Paths.get("src/test/java/speiger/src/testers/"), + Paths.get("src/builder/resources/speiger/assets/testers/")).setFlags(flags | SPECIAL); } @Override @@ -90,7 +107,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor @Override protected void afterFinish() { - if(!special && getVersion() > 8) + if((flags & SPECIAL) == 0 && getVersion() > 8) { Path basePath = Paths.get("src/main/java"); try(BufferedWriter writer = Files.newBufferedWriter(basePath.resolve("module-info.java"))) @@ -105,170 +122,62 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor } @Override - protected void init() + protected void init() { - variables.clear(); - for(ClassType clzType : TYPE) + prepPackages(); + //Init Modules here + addModule(new JavaModule()); + addModule(new FunctionModule()); + addModule(new CollectionModule()); + addModule(new PrioQueueModule()); + addModule(new ListModule()); + addModule(new SetModule()); + addModule(new MapModule()); + addModule(new PairModule()); + addModule(new AsyncModule()); + finishPackages(); + } + + public void addModule(BaseModule module) + { + module.setManager(manager); + biPackages.forEach(module::init); + module.cleanup(); + } + + private void finishPackages() + { + biPackages.forEach(ModulePackage::finish); + if((flags & SAVE) != 0) manager.save(); + } + + private void prepPackages() + { + if((flags & LOAD) != 0) manager.load(); + for(ModulePackage entry : ModulePackage.createPackages()) { - for(ClassType subType : TYPE) - { - create(clzType, subType); - } - } - enumRequired.add("EnumMap"); - enumRequired.add("LinkedEnumMap"); - biRequired.put("BiConsumer", ""); - biRequired.put("UnaryOperator", ""); - biRequired.put("Pair", ""); - biRequired.put("MutablePair", ""); - biRequired.put("ImmutablePair", ""); - addBiClass("Function", "Maps", "Map", "SortedMap", "OrderedMap", "NavigableMap", "ConcurrentMap", "AbstractMap", "ConcurrentOpenHashMap", "ImmutableOpenHashMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap"); - nameRemapper.put("BiConsumer", "%sConsumer"); - nameRemapper.put("IArray", "I%sArray"); - nameRemapper.put("AbstractMap", "Abstract%sMap"); - nameRemapper.put("AbstractCollection", "Abstract%sCollection"); - nameRemapper.put("AbstractPriorityQueue", "Abstract%sPriorityQueue"); - nameRemapper.put("AbstractSet", "Abstract%sSet"); - nameRemapper.put("AbstractList", "Abstract%sList"); - nameRemapper.put("EnumMap", "Enum2%sMap"); - nameRemapper.put("LinkedEnumMap", "LinkedEnum2%sMap"); - nameRemapper.put("ImmutableList", "Immutable%sList"); - nameRemapper.put("CopyOnWriteList", "CopyOnWrite%sArrayList"); - nameRemapper.put("ImmutableOpenHashSet", "Immutable%sOpenHashSet"); - nameRemapper.put("ImmutableOpenHashMap", "Immutable%sOpenHashMap"); - - - addBlockage(ClassType.OBJECT, "Consumer", "Comparator", "Stack"); - addBlockage(ClassType.BOOLEAN, "ArraySet", "AVLTreeSet", "RBTreeSet", "SortedSet", "OrderedSet", "NavigableSet", "OpenHashSet", "OpenCustomHashSet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet"); - addBlockage(ClassType.BOOLEAN, "ConcurrentOpenHashMap", "ImmutableOpenHashMap", "ImmutableOpenHashSet", "SortedMap", "OrderedMap", "NavigableMap", "ConcurrentMap", "OpenHashMap", "LinkedOpenHashMap", "OpenCustomHashMap", "LinkedOpenCustomHashMap", "ArrayMap", "RBTreeMap", "AVLTreeMap"); - - //UnitTesters - nameRemapper.put("AbstractIteratorTester", "Abstract%sIteratorTester"); - nameRemapper.put("MinimalCollection", "Minimal%sCollection"); - nameRemapper.put("MinimalSet", "Minimal%sSet"); - nameRemapper.put("TestCollectionGenerator", "Test%sCollectionGenerator"); - nameRemapper.put("TestQueueGenerator", "Test%sQueueGenerator"); - nameRemapper.put("TestListGenerator", "Test%sListGenerator"); - nameRemapper.put("TestNavigableSetGenerator", "Test%sNavigableSetGenerator"); - nameRemapper.put("TestSortedSetGenerator", "Test%sSortedSetGenerator"); - nameRemapper.put("TestOrderedSetGenerator", "Test%sOrderedSetGenerator"); - nameRemapper.put("TestSetGenerator", "Test%sSetGenerator"); - nameRemapper.put("AbstractContainerTester", "Abstract%sContainerTester"); - nameRemapper.put("AbstractCollectionTester", "Abstract%sCollectionTester"); - nameRemapper.put("AbstractQueueTester", "Abstract%sQueueTester"); - nameRemapper.put("AbstractListTester", "Abstract%sListTester"); - nameRemapper.put("AbstractListIndexOfTester", "Abstract%sListIndexOfTester"); - nameRemapper.put("AbstractSetTester", "Abstract%sSetTester"); - nameRemapper.put("SimpleTestGenerator", "Simple%sTestGenerator"); - nameRemapper.put("SimpleQueueTestGenerator", "Simple%sQueueTestGenerator"); - nameRemapper.put("TestMapGenerator", "Test%sMapGenerator"); - nameRemapper.put("TestSortedMapGenerator", "Test%sSortedMapGenerator"); - nameRemapper.put("TestOrderedMapGenerator", "Test%sOrderedMapGenerator"); - nameRemapper.put("SimpleMapTestGenerator", "Simple%sMapTestGenerator"); - nameRemapper.put("DerivedMapGenerators", "Derived%sMapGenerators"); - nameRemapper.put("AbstractMapTester", "Abstract%sMapTester"); - nameRemapper.put("TestMap", "Test%sMap"); - biRequired.put("PairTester", ""); - - addBiClass("TestMapGenerator", "TestSortedMapGenerator", "TestOrderedMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester", "MapTestSuiteBuilder", "SortedMapTestSuiteBuilder", "NavigableMapTestSuiteBuilder", "OrderedMapTestSuiteBuilder", "MapTests", "MapConstructorTests", "TestMap"); - addBiClass("MapAddToTester", "MapSubFromTester", "MapClearTester", "MapComputeIfAbsentTester", "MapComputeIfPresentTester", "MapComputeTester", "MapCopyTester", "MapContainsTester", "MapContainsKeyTester", "MapContainsValueTester", "MapCreatorTester", "MapEntrySetTester", - "MapEqualsTester", "MapForEachTester", "MapGetOrDefaultTester", "MapGetTester", "MapHashCodeTester", "MapIsEmptyTester", "MapMergeTester", "MapMergeBulkTester", "MapPutAllArrayTester", "MapPutAllTester", "MapPutIfAbsentTester", "MapPutTester", - "MapRemoveEntryTester", "MapRemoveOrDefaultTester", "MapRemoveTester", "MapReplaceAllTester", "MapReplaceEntryTester", "MapReplaceTester", "MapSizeTester", "MapSupplyIfAbsentTester", "MapToStringTester", - "NavigableMapNavigationTester", "SortedMapNavigationTester", "OrderedMapNavigationTester", "OrderedMapMoveTester", "MapConstructorTester"); - - addBlockage(ClassType.OBJECT, "CollectionStreamTester", "ListFillBufferTester"); - addBlockage(ClassType.BOOLEAN, "TestOrderedSetGenerator", "TestSortedSetGenerator", "TestNavigableSetGenerator", "CollectionRemoveIfTester", "CollectionStreamTester", "ListFillBufferTester", "ListReplaceAllTester", "NavigableSetNavigationTester", "SetTests", "MapConstructorTests", "TestMap", "QueueTests"); - addBlockage(ClassType.BOOLEAN, "OrderedSetMoveTester", "OrderedSetNavigationTester", "SortedSetNaviationTester", "SetTestSuiteBuilder", "OrderedSetTestSuiteBuilder", "SortedSetTestSuiteBuilder", "NavigableSetTestSuiteBuilder", "SortedSetSubsetTestSetGenerator", "OrderedMapNavigationTester", "OrderedMapTestSuiteBuilder", "OrderedSetIterationTester", "SortedSetIterationTester"); - addBlockage(ClassType.BOOLEAN, "TestMapGenerator", "TestSortedMapGenerator", "TestOrderedMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester", "MapTestSuiteBuilder", "SortedMapTestSuiteBuilder", "NavigableMapTestSuiteBuilder", "MapTests"); - addBlockage(ClassType.BOOLEAN, T -> T.endsWith("Tester") && (T.startsWith("Iterable") ||T.startsWith("Map") || T.startsWith("OrderedMap") || T.startsWith("SortedMap") || T.startsWith("NavigableMap"))); - } - - protected void create(ClassType mainType, ClassType subType) - { - GlobalVariables type = new GlobalVariables(mainType, subType); - type.createFlags(); - type.createHelperVariables(); - type.createVariables(); - type.createPreFunctions(); - type.createClassTypes(); - type.createFunctions(); - if(mainType == subType) variables.add(type); - biVariables.add(type); - if(mainType.isObject()) enumVariables.add(type); - } - - protected void addBiClass(String...classNames) - { - for(String s : classNames) - { - biRequired.put(s, "2"); - } - } - - protected void addBlockage(ClassType type, Predicate filter) - { - blockedPredicate.computeIfAbsent(type, T -> new ArrayList<>()).add(filter); - } - - protected void addBlockage(ClassType type, String...args) - { - for(String s : args) - { - EnumSet set = blocked.get(s); - if(set == null) - { - set = EnumSet.noneOf(ClassType.class); - blocked.put(s, set); - } - set.add(type); - } - } - - public void test() throws InterruptedException, IOException - { - init(); - List keys = new ArrayList<>(); - List values = new ArrayList<>(); - for(int i = 0,m=variables.size();i acceptor) + public void createProcesses(String fileName, Consumer process) { - String splitter = biRequired.get(name); - boolean valueRequired = enumRequired.contains(name); - List vars = getVariablesByClass(name, splitter != null); - for(int i = 0,m=vars.size();i packages = getPackagesByRequirement(requirements.get(fileName)); + for(int i = 0,m=packages.size();i types = blocked.get(fileName); - if(types != null && types.contains(type)) return false; - List> list = blockedPredicate.get(type); - if(list != null) { - for(int i = 0,m=list.size();i getVariablesByClass(String name, boolean bi) { - if(enumRequired.contains(name)) return enumVariables; - if(bi) return biVariables; - return variables; + protected List getPackagesByRequirement(RequiredType type) { + if(type == null) return simplePackages; + if(type == RequiredType.BI_CLASS) return biPackages; + if(type == RequiredType.ENUM) return enumPackages; + return Collections.emptyList(); } private String getModuleInfo(Path basePath) { @@ -326,14 +235,17 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor { Set flags = new HashSet<>(Arrays.asList(args)); boolean silent = flags.contains("silent"); - boolean force = !flags.contains("force"); + boolean force = flags.contains("force"); boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); + boolean load = flags.contains("load"); + boolean save = !flags.contains("save"); + int flag = (load ? LOAD : 0) | (save ? SAVE : 0); // new PrimitiveCollectionsBuilder(silent).test(); - new PrimitiveCollectionsBuilder(silent).process(force); + new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); if(tests) { - createTests(silent).process(force || forceTests); - createTesters(silent).process(force || forceTests); + createTests(silent, flag).process(force || forceTests); + createTesters(silent, flag).process(force || forceTests); } } catch(InterruptedException | IOException e) diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java new file mode 100644 index 00000000..438ac210 --- /dev/null +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -0,0 +1,105 @@ +package speiger.src.builder; + +import java.io.BufferedReader; +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.Set; +import java.util.TreeSet; + +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; +import com.google.gson.internal.Streams; +import com.google.gson.stream.JsonWriter; + +import speiger.src.builder.modules.BaseModule; + +@SuppressWarnings("javadoc") +public class SettingsManager +{ + boolean loaded; + JsonObject data = new JsonObject(); + Set moduleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + + 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()); + if(base.isBiModule()) result = getObject(result, valueType.getClassPath()); + result = getObject(result, base.getModuleName()); + return result.size() <= 0 || (isEnabled(result, "enabled") && isEnabled(result, entry)); + } + + public void addModule(BaseModule module) { + if(loaded) return; + String moduleName = module.getModuleName(); + moduleNames.add(moduleName); + data.addProperty(moduleName, true); + if(module.isBiModule()) { + for(ClassType keyType : ModulePackage.TYPE) { + for(ClassType valueType : ModulePackage.TYPE) { + JsonObject obj = new JsonObject(); + obj.addProperty("enabled", true); + for(String key : module.getModuleKeys(keyType, valueType)) { + obj.addProperty(key, true); + } + addModule(keyType, valueType, true, moduleName, obj); + } + } + return; + } + for(ClassType keyType : ModulePackage.TYPE) { + JsonObject obj = new JsonObject(); + obj.addProperty("enabled", true); + for(String key : module.getModuleKeys(keyType, keyType)) { + obj.addProperty(key, true); + } + addModule(keyType, keyType, false, moduleName, obj); + } + } + + public void load() { + try(BufferedReader reader = Files.newBufferedReader(Paths.get("ModulSettings.json"))) { + data = JsonParser.parseReader(reader).getAsJsonObject(); + loaded = true; + } + catch(Exception e) { e.printStackTrace(); } + } + + public void save() { + data.asMap().keySet().removeAll(moduleNames); + JsonObject result = new JsonObject(); + for(String s : moduleNames) { + result.addProperty(s, true); + } + result.asMap().putAll(data.asMap()); + + try(JsonWriter writer = new JsonWriter(Files.newBufferedWriter(Paths.get("ModulSettings.json")))) { + writer.setIndent("\t"); + Streams.write(result, writer); + } + catch(Exception e) { e.printStackTrace(); } + } + + private void addModule(ClassType keyType, ClassType valueType, boolean bi, String moduleName, JsonObject obj) { + JsonObject result = getObject(data, keyType.getClassPath()); + if(bi) { + result = getObject(result, valueType.getClassPath()); + } + result.add(moduleName, obj); + } + + private JsonObject getObject(JsonObject data, String name) { + JsonObject obj = data.getAsJsonObject(name); + if(obj == null) { + obj = new JsonObject(); + data.add(name, obj); + } + return obj; + } + + private boolean isEnabled(JsonObject obj, String key) { + if(obj.has(key)) return obj.getAsJsonPrimitive(key).getAsBoolean(); + return true; + } +} diff --git a/src/builder/java/speiger/src/builder/modules/AsyncModule.java b/src/builder/java/speiger/src/builder/modules/AsyncModule.java index 76a324bf..48bb432f 100644 --- a/src/builder/java/speiger/src/builder/modules/AsyncModule.java +++ b/src/builder/java/speiger/src/builder/modules/AsyncModule.java @@ -4,18 +4,20 @@ package speiger.src.builder.modules; public class AsyncModule extends BaseModule { @Override - protected void loadVariables() - { - loadClasses(); - } + public String getModuleName() { return "Async"; } + @Override + protected void loadVariables() {} + @Override + protected void loadRemappers() {} + @Override + protected void loadTestClasses() {} + @Override + protected void loadFunctions() {} + @Override + protected void loadFlags() {} @Override - protected void loadFlags() - { - - } - - private void loadClasses() + protected void loadClasses() { //Abstract Classes addAbstractMapper("BASE_TASK", "Base%sTask"); diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 500127d9..9f55b060 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -1,10 +1,13 @@ package speiger.src.builder.modules; +import java.util.Collections; +import java.util.Set; 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.mappers.ArgumentMapper; import speiger.src.builder.mappers.InjectMapper; import speiger.src.builder.mappers.LineMapper; @@ -13,16 +16,25 @@ import speiger.src.builder.mappers.SimpleMapper; @SuppressWarnings("javadoc") public abstract class BaseModule { + SettingsManager manager; ModulePackage entry; protected ClassType keyType; protected ClassType valueType; - public final void init(ModulePackage entry) - { + public final void setManager(SettingsManager manager) { + this.manager = manager; + manager.addModule(this); + } + + public final void init(ModulePackage entry) { this.entry = entry; keyType = entry.getKeyType(); valueType = entry.getValueType(); loadVariables(); + loadClasses(); + loadTestClasses(); + loadFunctions(); + loadRemappers(); loadFlags(); } @@ -30,13 +42,26 @@ public abstract class BaseModule entry = null; keyType = null; valueType = null; + manager = null; } protected abstract void loadVariables(); + protected abstract void loadClasses(); + protected abstract void loadTestClasses(); + protected abstract void loadFunctions(); + protected abstract void loadRemappers(); protected abstract void loadFlags(); - protected void addFlag(String name) - { + public abstract String getModuleName(); + public boolean isBiModule() { return false; } + public Set getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); } + + protected boolean isModuleEnabled(String name) { + if(manager == null) return true; + return manager.isModuleEnabled(this, keyType, valueType, name); + } + + protected void addFlag(String name) { entry.addFlag(name); } diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java index 9a205aa0..a293840d 100644 --- a/src/builder/java/speiger/src/builder/modules/CollectionModule.java +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -1,34 +1,47 @@ package speiger.src.builder.modules; +import speiger.src.builder.ClassType; + @SuppressWarnings("javadoc") public class CollectionModule extends BaseModule { @Override - protected void loadVariables() - { - loadClasses(); - loadFunctions(); - loadRemappers(); - loadBlockades(); - } - + public String getModuleName() { return "Collection"; } @Override - protected void loadFlags() - { - } + protected void loadVariables() { loadBlockades(); } + @Override + protected void loadFlags() {} private void loadBlockades() { - if(keyType.isObject()) addBlockedFiles("Stack"); + if(keyType.isObject()) { + addBlockedFiles("Stack"); + addBlockedFiles("CollectionStreamTester"); + } + if(keyType == ClassType.BOOLEAN) { + addBlockedFiles("CollectionRemoveIfTester", "CollectionStreamTester"); + addBlockedFilter(T -> T.endsWith("Tester") && T.startsWith("Iterable")); + } } - private void loadRemappers() + @Override + protected void loadRemappers() { + //Main Classes addRemapper("IArray", "I%sArray"); addRemapper("AbstractCollection", "Abstract%sCollection"); + + //Test Classes + addRemapper("AbstractIteratorTester", "Abstract%sIteratorTester"); + addRemapper("MinimalCollection", "Minimal%sCollection"); + addRemapper("TestCollectionGenerator", "Test%sCollectionGenerator"); + addRemapper("AbstractContainerTester", "Abstract%sContainerTester"); + addRemapper("AbstractCollectionTester", "Abstract%sCollectionTester"); + addRemapper("SimpleTestGenerator", "Simple%sTestGenerator"); } - private void loadFunctions() + @Override + protected void loadFunctions() { addFunctionMapper("NEXT", "next"); addSimpleMapper("NEW_STREAM", keyType.isPrimitiveBlocking() ? "" : keyType.getCustomJDKType().getKeyType()+"Stream"); @@ -38,7 +51,8 @@ public class CollectionModule extends BaseModule addSimpleMapper("VALUE_TO_ARRAY", "to"+valueType.getNonFileType()+"Array"); } - private void loadClasses() + @Override + protected void loadClasses() { //Abstract Classes addAbstractMapper("ABSTRACT_COLLECTION", "Abstract%sCollection"); @@ -61,4 +75,25 @@ public class CollectionModule extends BaseModule addClassMapper("STRATEGY", "Strategy"); } + @Override + protected void loadTestClasses() + { + //Implementation Classes + addAbstractMapper("MINIMAL_COLLECTION", "Minimal%sCollection"); + addClassMapper("BIDIRECTIONAL_ITERATOR_TESTER", "BidirectionalteratorTester"); + addClassMapper("LIST_ITERATOR_TESTER", "ListIteratorTester"); + addClassMapper("ITERATOR_TESTER", "IteratorTester"); + addClassMapper("COLLECTION_TEST_BUILDER", "CollectionTestSuiteBuilder"); + addClassMapper("COLLECTION_CONSTRUCTOR_TESTS", "CollectionConstructorTests"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_COLLECTION_TESTER", "Abstract%sCollectionTester"); + addAbstractMapper("ABSTRACT_CONTAINER_TESTER", "Abstract%sContainerTester"); + addAbstractMapper("ABSTRACT_ITERATOR_TESTER", "Abstract%sIteratorTester"); + + //Helper Classes + addAbstractMapper("TEST_COLLECTION_GENERATOR", "Test%sCollectionGenerator"); + addAbstractMapper("SIMPLE_TEST_GENERATOR", "Simple%sTestGenerator"); + + } } diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index 81f40144..f6fff714 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -4,26 +4,23 @@ package speiger.src.builder.modules; public class FunctionModule extends BaseModule { @Override - protected void loadVariables() - { - loadFunctions(); - loadClasses(); - loadRemappers(); - loadBlockades(); - } - + public String getModuleName() { return "Function"; } @Override - protected void loadFlags() - { - - } + public boolean isBiModule() { return true; } + @Override + protected void loadVariables() { loadBlockades(); } + @Override + protected void loadFlags() {} + @Override + protected void loadTestClasses() {} private void loadBlockades() { if(keyType.isObject()) addBlockedFiles("Consumer", "Comparator"); } - private void loadRemappers() + @Override + protected void loadRemappers() { addBiRequirement("BiConsumer", ""); addBiRequirement("UnaryOperator", ""); @@ -31,13 +28,15 @@ public class FunctionModule extends BaseModule addRemapper("BiConsumer", "%sConsumer"); } - private void loadFunctions() + @Override + protected void loadFunctions() { addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); addSimpleMapper("TEST_VALUE", keyType.isObject() ? "getBoolean" : "get"); } - private void loadClasses() + @Override + protected void loadClasses() { //Interfaces addBiClassMapper("BI_CONSUMER", "Consumer", ""); diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index 7ba5f1cb..08344bfb 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -5,14 +5,14 @@ import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") public class JavaModule extends BaseModule { + @Override + public String getModuleName() { return "Base"; } @Override protected void loadVariables() { createHelperVars(keyType, false, "KEY"); createHelperVars(valueType, true, "VALUE"); loadBaseVariables(); - loadClasses(); - loadFunctions(); } @Override @@ -28,7 +28,11 @@ public class JavaModule extends BaseModule if(valueType.needsCustomJDKType()) addFlag("JDK_VALUE"); } - private void loadFunctions() + @Override + protected void loadRemappers() {} + + @Override + protected void loadFunctions() { addSimpleMapper("APPLY_KEY_VALUE", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType()); @@ -42,7 +46,8 @@ public class JavaModule extends BaseModule addFunctionValueMappers("VALUE_ENTRY", "set%sValue"); } - private void loadClasses() + @Override + protected void loadClasses() { addSimpleMapper("JAVA_PREDICATE", keyType.isPrimitiveBlocking() ? "" : keyType.getCustomJDKType().getFileType()+"Predicate"); addSimpleMapper("JAVA_CONSUMER", keyType.isPrimitiveBlocking() ? "" : "java.util.function."+keyType.getCustomJDKType().getFileType()+"Consumer"); @@ -55,6 +60,13 @@ public class JavaModule extends BaseModule addSimpleMapper("JAVA_BUFFER", keyType.getFileType()+"Buffer"); } + @Override + protected void loadTestClasses() + { + addClassMapper("HELPERS", "Helpers"); + addClassMapper("SAMPLE_ELEMENTS", "Samples"); + } + private void loadBaseVariables() { addSimpleMapper("VALUE_PACKAGE", valueType.getPathType()); diff --git a/src/builder/java/speiger/src/builder/modules/ListModule.java b/src/builder/java/speiger/src/builder/modules/ListModule.java index 58d82b0c..c83c3d3b 100644 --- a/src/builder/java/speiger/src/builder/modules/ListModule.java +++ b/src/builder/java/speiger/src/builder/modules/ListModule.java @@ -1,31 +1,43 @@ package speiger.src.builder.modules; +import speiger.src.builder.ClassType; + @SuppressWarnings("javadoc") public class ListModule extends BaseModule { - @Override - protected void loadVariables() + public String getModuleName() { return "List"; } + @Override + protected void loadVariables() { loadBlockedFiles(); } + @Override + protected void loadFlags() {} + + private void loadBlockedFiles() { - loadClasses(); - loadFunctions(); - loadRemappers(); + if(keyType.isObject()) { + addBlockedFiles("ListFillBufferTester"); + } + if(keyType == ClassType.BOOLEAN) { + addBlockedFiles("ListFillBufferTester", "ListReplaceAllTester"); + } } @Override - protected void loadFlags() - { - - } - - private void loadRemappers() + protected void loadRemappers() { + //Main Classes addRemapper("AbstractList", "Abstract%sList"); addRemapper("ImmutableList", "Immutable%sList"); addRemapper("CopyOnWriteList", "CopyOnWrite%sArrayList"); + + //Test Classes + addRemapper("AbstractListTester", "Abstract%sListTester"); + addRemapper("AbstractListIndexOfTester", "Abstract%sListIndexOfTester"); + addRemapper("TestListGenerator", "Test%sListGenerator"); } - private void loadFunctions() + @Override + protected void loadFunctions() { addFunctionMapper("GET_KEY", "get"); addFunctionMapper("REMOVE_LAST", "removeLast"); @@ -34,7 +46,8 @@ public class ListModule extends BaseModule addFunctionMappers("SORT", "sort%ss"); } - private void loadClasses() + @Override + protected void loadClasses() { //Implementation Classes addClassMapper("ARRAY_LIST", "ArrayList"); @@ -53,10 +66,22 @@ public class ListModule extends BaseModule //Helper Classes addClassMapper("LISTS", "Lists"); - //Interfaces addClassMapper("LIST", "List"); - - } -} + + @Override + protected void loadTestClasses() + { + //Implementation Classes + addClassMapper("LIST_TEST_BUILDER", "ListTestSuiteBuilder"); + addClassMapper("LIST_TESTS", "ListTests"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_LIST_INDEX_OF_TESTER", "Abstract%sListIndexOfTester"); + addAbstractMapper("ABSTRACT_LIST_TESTER", "Abstract%sListTester"); + + //Helper classes + addAbstractMapper("TEST_LIST_GENERATOR", "Test%sListGenerator"); + } +} \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index a67ab9ef..fc8723f3 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -6,33 +6,36 @@ import speiger.src.builder.ClassType; public class MapModule extends BaseModule { @Override - protected void loadVariables() - { - loadFunctions(); - loadClasses(); - loadRemappers(); - loadBlockades(); - } - + public String getModuleName() { return "Map"; } @Override - protected void loadFlags() - { - - } + public boolean isBiModule() { return true; } + @Override + protected void loadVariables() { loadBlockades(); } + @Override + protected void loadFlags() {} private void loadBlockades() { if(keyType == ClassType.BOOLEAN) { + //Main Classes addBlockedFiles("SortedMap", "NavigableMap", "RBTreeMap", "AVLTreeMap"); addBlockedFiles("OrderedMap", "ArrayMap", "LinkedOpenHashMap", "LinkedOpenCustomHashMap"); addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); addBlockedFiles("ImmutableOpenHashMap", "OpenHashMap", "OpenCustomHashMap"); + + //Test Classes + addBlockedFiles("TestMap", "MapTests", "MapTestSuiteBuilder", "MapConstructorTests", "TestMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester"); + addBlockedFiles("TestSortedMapGenerator", "NavigableMapTestSuiteBuilder", "SortedMapTestSuiteBuilder"); + addBlockedFiles("TestOrderedMapGenerator"); + addBlockedFilter(T -> T.endsWith("Tester") && (T.startsWith("Map") || T.startsWith("OrderedMap") || T.startsWith("SortedMap") || T.startsWith("NavigableMap"))); } } - private void loadRemappers() + @Override + protected void loadRemappers() { + //Main Classes addBiRequirement("Map"); addBiRequirement("SortedMap"); addBiRequirement("OrderedMap"); @@ -56,9 +59,71 @@ public class MapModule extends BaseModule addRemapper("EnumMap", "Enum2%sMap"); addRemapper("LinkedEnumMap", "LinkedEnum2%sMap"); addRemapper("ImmutableOpenHashMap", "Immutable%sOpenHashMap"); + + //Test Classes + addBiRequirement("TestMapGenerator"); + addBiRequirement("TestSortedMapGenerator"); + addBiRequirement("TestOrderedMapGenerator"); + addBiRequirement("SimpleMapTestGenerator"); + addBiRequirement("DerivedMapGenerators"); + addBiRequirement("AbstractMapTester"); + addBiRequirement("MapTestSuiteBuilder"); + addBiRequirement("SortedMapTestSuiteBuilder"); + addBiRequirement("NavigableMapTestSuiteBuilder"); + addBiRequirement("OrderedMapTestSuiteBuilder"); + addBiRequirement("MapTests"); + addBiRequirement("MapConstructorTests"); + addBiRequirement("TestMap"); + addBiRequirement("MapAddToTester"); + addBiRequirement("MapSubFromTester"); + addBiRequirement("MapClearTester"); + addBiRequirement("MapComputeIfAbsentTester"); + addBiRequirement("MapComputeIfPresentTester"); + addBiRequirement("MapComputeTester"); + addBiRequirement("MapCopyTester"); + addBiRequirement("MapContainsTester"); + addBiRequirement("MapContainsKeyTester"); + addBiRequirement("MapContainsValueTester"); + addBiRequirement("MapCreatorTester"); + addBiRequirement("MapEntrySetTester"); + addBiRequirement("MapEqualsTester"); + addBiRequirement("MapForEachTester"); + addBiRequirement("MapGetOrDefaultTester"); + addBiRequirement("MapGetTester"); + addBiRequirement("MapHashCodeTester"); + addBiRequirement("MapIsEmptyTester"); + addBiRequirement("MapMergeTester"); + addBiRequirement("MapMergeBulkTester"); + addBiRequirement("MapPutAllArrayTester"); + addBiRequirement("MapPutAllTester"); + addBiRequirement("MapPutIfAbsentTester"); + addBiRequirement("MapPutTester"); + addBiRequirement("MapRemoveEntryTester"); + addBiRequirement("MapRemoveOrDefaultTester"); + addBiRequirement("MapRemoveTester"); + addBiRequirement("MapReplaceAllTester"); + addBiRequirement("MapReplaceEntryTester"); + addBiRequirement("MapReplaceTester"); + addBiRequirement("MapSizeTester"); + addBiRequirement("MapSupplyIfAbsentTester"); + addBiRequirement("MapToStringTester"); + addBiRequirement("NavigableMapNavigationTester"); + addBiRequirement("SortedMapNavigationTester"); + addBiRequirement("OrderedMapNavigationTester"); + addBiRequirement("OrderedMapMoveTester"); + addBiRequirement("MapConstructorTester"); + + addRemapper("TestMapGenerator", "Test%sMapGenerator"); + addRemapper("TestSortedMapGenerator", "Test%sSortedMapGenerator"); + addRemapper("TestOrderedMapGenerator", "Test%sOrderedMapGenerator"); + addRemapper("SimpleMapTestGenerator", "Simple%sMapTestGenerator"); + addRemapper("DerivedMapGenerators", "Derived%sMapGenerators"); + addRemapper("AbstractMapTester", "Abstract%sMapTester"); + addRemapper("TestMap", "Test%sMap"); } - private void loadFunctions() + @Override + protected void loadFunctions() { addFunctionValueMapper("BULK_MERGE", "mergeAll"); addFunctionValueMappers("COMPUTE_IF_ABSENT", "compute%sIfAbsent"); @@ -84,7 +149,8 @@ public class MapModule extends BaseModule addFunctionValueMappers("SUPPLY_IF_ABSENT", "supply%sIfAbsent"); } - private void loadClasses() + @Override + protected void loadClasses() { //Implementation Classes addAbstractBiMapper("IMMUTABLE_HASH_MAP", "Immutable%sOpenHashMap", "2"); @@ -112,4 +178,27 @@ public class MapModule extends BaseModule addBiClassMapper("CONCURRENT_MAP", "ConcurrentMap", "2"); addBiClassMapper("MAP", "Map", "2"); } + + @Override + protected void loadTestClasses() + { + //Implementation Classes + addAbstractBiMapper("SIMPLE_TEST_MAP", "Test%sMap", "2"); + addBiClassMapper("MAP_TESTS", "MapTests", "2"); + addAbstractBiMapper("NAVIGABLE_MAP_TEST_BUILDER", "%sNavigableMapTestSuiteBuilder", "2"); + addAbstractBiMapper("SORTED_MAP_TEST_BUILDER", "%sSortedMapTestSuiteBuilder", "2"); + addAbstractBiMapper("ORDERED_MAP_TEST_BUILDER", "%sOrderedMapTestSuiteBuilder", "2"); + addAbstractBiMapper("MAP_TEST_BUILDER", "%sMapTestSuiteBuilder", "2"); + + //Abstract Classes + addAbstractBiMapper("ABSTRACT_MAP_TESTER", "Abstract%sMapTester", "2"); + + //Helper Classes + addAbstractBiMapper("MAP_CONSTRUCTOR_TESTS", "%sMapConstructorTests", "2"); + addAbstractBiMapper("SIMPLE_MAP_TEST_GENERATOR", "Simple%sMapTestGenerator", "2"); + addAbstractBiMapper("DERIVED_MAP_GENERATORS", "Derived%sMapGenerators", "2"); + addAbstractBiMapper("TEST_ORDERED_MAP_GENERATOR", "Test%sOrderedMapGenerator", "2"); + addAbstractBiMapper("TEST_SORTED_MAP_GENERATOR", "Test%sSortedMapGenerator", "2"); + addAbstractBiMapper("TEST_MAP_GENERATOR", "Test%sMapGenerator", "2"); + } } \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/modules/PairModule.java b/src/builder/java/speiger/src/builder/modules/PairModule.java index cc692bfe..95e85b2c 100644 --- a/src/builder/java/speiger/src/builder/modules/PairModule.java +++ b/src/builder/java/speiger/src/builder/modules/PairModule.java @@ -4,26 +4,32 @@ package speiger.src.builder.modules; public class PairModule extends BaseModule { @Override - protected void loadVariables() - { - loadClasses(); - loadRemappers(); - } + public String getModuleName() { return "Pair"; } + @Override + public boolean isBiModule() { return true; } + @Override + protected void loadVariables() {} + @Override + protected void loadFlags() {} + @Override + protected void loadFunctions() {} + @Override + protected void loadTestClasses() {} @Override - protected void loadFlags() - { - - } - - private void loadRemappers() + protected void loadRemappers() { + //Main Classes addBiRequirement("Pair", ""); addBiRequirement("MutablePair", ""); addBiRequirement("ImmutablePair", ""); + + //Test Classes + addBiRequirement("PairTester", ""); } - private void loadClasses() + @Override + protected void loadClasses() { //Implementations addBiClassMapper("IMMUTABLE_PAIR", "ImmutablePair", ""); diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java index 997fb476..81ba212c 100644 --- a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -1,27 +1,40 @@ package speiger.src.builder.modules; +import speiger.src.builder.ClassType; + @SuppressWarnings("javadoc") public class PrioQueueModule extends BaseModule { @Override - protected void loadVariables() + public String getModuleName() { return "PriorityQueue"; } + @Override + protected void loadVariables() { loadBlockades(); } + @Override + protected void loadFlags() {} + @Override + protected void loadFunctions() {} + + private void loadBlockades() { - loadClasses(); - loadReampper(); + if(keyType == ClassType.BOOLEAN) { + addBlockedFiles("QueueTests"); + } } @Override - protected void loadFlags() + protected void loadRemappers() { + //Main Classes + addRemapper("AbstractPriorityQueue", "Abstract%sPriorityQueue"); + //Test Classes + addRemapper("TestQueueGenerator", "Test%sQueueGenerator"); + addRemapper("AbstractQueueTester", "Abstract%sQueueTester"); + addRemapper("SimpleQueueTestGenerator", "Simple%sQueueTestGenerator"); } - private void loadReampper() - { - addRemapper("AbstractPriorityQueue", "Abstract%sPriorityQueue"); - } - - private void loadClasses() + @Override + protected void loadClasses() { //Implementation Classes addClassMapper("ARRAY_FIFO_QUEUE", "ArrayFIFOQueue"); @@ -36,7 +49,22 @@ public class PrioQueueModule extends BaseModule //Interfaces addClassMapper("PRIORITY_QUEUE", "PriorityQueue"); - addClassMapper("PRIORITY_DEQUEUE", "PriorityDequeue"); + addClassMapper("PRIORITY_DEQUEUE", "PriorityDequeue"); + } + + @Override + protected void loadTestClasses() + { + //Implementation Classes + addClassMapper("DEQUEUE_TEST_BUILDER", "DequeueTestSuiteBuilder"); + addClassMapper("QUEUE_TEST_BUILDER", "QueueTestSuiteBuilder"); + addClassMapper("QUEUE_TESTS", "QueueTests"); + //Abstract Classes + addAbstractMapper("ABSTRACT_QUEUE_TESTER", "Abstract%sQueueTester"); + + //Helper Classes + addAbstractMapper("SIMPLE_QUEUE_TEST_GENERATOR", "Simple%sQueueTestGenerator"); + addAbstractMapper("TEST_QUEUE_GENERATOR", "Test%sQueueGenerator"); } } diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 696ed949..1f3d2d31 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -6,37 +6,47 @@ import speiger.src.builder.ClassType; public class SetModule extends BaseModule { @Override - protected void loadVariables() - { - loadClasses(); - loadFunctions(); - loadReamppers(); - loadBlockades(); - } - + public String getModuleName() { return "Set"; } @Override - protected void loadFlags() - { - - } + protected void loadVariables() { loadBlockades(); } + @Override + protected void loadFlags() {} private void loadBlockades() { if(keyType == ClassType.BOOLEAN) { + //Main Classes addBlockedFiles("SortedSet", "NavigableSet", "AVLTreeSet", "RBTreeSet"); addBlockedFiles("OrderedSet", "ArraySet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet"); addBlockedFiles("OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); + + //Test Classes + addBlockedFiles("SetTests", "SetTestSuiteBuilder"); + addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedMapNavigationTester", "OrderedMapTestSuiteBuilder", "OrderedSetIterationTester"); + addBlockedFiles("SortedSetTestSuiteBuilder", "TestSortedSetGenerator", "SortedSetNaviationTester", "SortedSetSubsetTestSetGenerator", "SortedSetIterationTester", "SortedSetNaviationTester"); + addBlockedFiles("NavigableSetTestSuiteBuilder", "TestNavigableSetGenerator", "NavigableSetNavigationTester"); } } - private void loadReamppers() + @Override + protected void loadRemappers() { + //Main Classes addRemapper("AbstractSet", "Abstract%sSet"); addRemapper("ImmutableOpenHashSet", "Immutable%sOpenHashSet"); + + //Test Classes + addRemapper("MinimalSet", "Minimal%sSet"); + addRemapper("TestNavigableSetGenerator", "Test%sNavigableSetGenerator"); + addRemapper("TestSortedSetGenerator", "Test%sSortedSetGenerator"); + addRemapper("TestOrderedSetGenerator", "Test%sOrderedSetGenerator"); + addRemapper("TestSetGenerator", "Test%sSetGenerator"); + addRemapper("AbstractSetTester", "Abstract%sSetTester"); } - private void loadFunctions() + @Override + protected void loadFunctions() { addFunctionMapper("POLL_FIRST_KEY", "pollFirst"); addFunctionMapper("POLL_LAST_KEY", "pollLast"); @@ -44,7 +54,31 @@ public class SetModule extends BaseModule addFunctionMapper("LAST_KEY", "last"); } - private void loadClasses() + @Override + protected void loadTestClasses() + { + //Implementation Classes + addAbstractMapper("MINIMAL_SET", "Minimal%sSet"); + addClassMapper("ORDERED_SET_TEST_BUILDER", "OrderedSetTestSuiteBuilder"); + addClassMapper("SORTED_SET_TEST_BUILDER", "SortedSetTestSuiteBuilder"); + addClassMapper("NAVIGABLE_SET_TEST_BUILDER", "NavigableSetTestSuiteBuilder"); + addClassMapper("SET_TEST_BUILDER", "SetTestSuiteBuilder"); + addClassMapper("SET_TESTS", "SetTests"); + + //Abstract Classes + addAbstractMapper("ABSTRACT_SET_TESTER", "Abstract%sSetTester"); + + //Helper Classes + addClassMapper("SUB_SORTED_SET_CLASS_GENERATOR", "SortedSetSubsetTestSetGenerator"); + addClassMapper("SUB_NAVIGABLE_SET_CLASS_GENERATOR", "NavigableSetSubsetTestSetGenerator"); + addAbstractMapper("TEST_NAVIGABLE_SET_GENERATOR", "Test%sNavigableSetGenerator"); + addAbstractMapper("TEST_SORTED_SET_GENERATOR", "Test%sSortedSetGenerator"); + addAbstractMapper("TEST_ORDERED_SET_GENERATOR", "Test%sOrderedSetGenerator"); + addAbstractMapper("TEST_SET_GENERATOR", "Test%sSetGenerator"); + } + + @Override + protected void loadClasses() { //Implementation Classes addClassMapper("LINKED_CUSTOM_HASH_SET", "LinkedOpenCustomHashSet"); From b29874189cb632fc9a34761a1366c4ff02553b4f Mon Sep 17 00:00:00 2001 From: Speiger Date: Sun, 4 Dec 2022 07:56:04 +0100 Subject: [PATCH 05/20] Finishing Framework and making Async Module Optional. --- ModulSettings.json | 180 ++++++++---------- .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../speiger/src/builder/SettingsManager.java | 31 ++- .../src/builder/modules/AsyncModule.java | 15 +- .../src/builder/modules/BaseModule.java | 14 +- .../src/builder/modules/CollectionModule.java | 5 +- .../src/builder/modules/FunctionModule.java | 5 +- .../src/builder/modules/JavaModule.java | 4 +- .../src/builder/modules/ListModule.java | 10 +- .../src/builder/modules/MapModule.java | 5 +- .../src/builder/modules/PairModule.java | 2 + .../src/builder/modules/PrioQueueModule.java | 5 +- .../src/builder/modules/SetModule.java | 5 +- .../templates/collections/Iterable.template | 4 + .../templates/utils/AsyncBuilder.template | 28 ++- 15 files changed, 188 insertions(+), 127 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 9534e91c..1a48122c 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -9,108 +9,10 @@ "PriorityQueue": true, "Set": true, "Boolean": { + "enabled": true, "Base": { "enabled": true }, - "Boolean": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Byte": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Short": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Character": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Integer": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Long": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Float": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Double": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, - "Object": { - "Function": { - "enabled": true - }, - "Map": { - "enabled": true - }, - "Pair": { - "enabled": true - } - }, "Collection": { "enabled": true }, @@ -128,10 +30,12 @@ } }, "Byte": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -143,6 +47,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -154,6 +59,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -165,6 +71,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -176,6 +83,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -187,6 +95,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -198,6 +107,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -209,6 +119,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -220,6 +131,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -247,10 +159,12 @@ } }, "Short": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -262,6 +176,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -273,6 +188,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -284,6 +200,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -295,6 +212,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -306,6 +224,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -317,6 +236,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -328,6 +248,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -339,6 +260,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -366,10 +288,12 @@ } }, "Character": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -381,6 +305,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -392,6 +317,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -403,6 +329,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -414,6 +341,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -425,6 +353,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -436,6 +365,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -447,6 +377,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -458,6 +389,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -485,10 +417,12 @@ } }, "Integer": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -500,6 +434,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -511,6 +446,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -522,6 +458,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -533,6 +470,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -544,6 +482,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -555,6 +494,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -566,6 +506,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -577,6 +518,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -604,10 +546,12 @@ } }, "Long": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -619,6 +563,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -630,6 +575,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -641,6 +587,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -652,6 +599,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -663,6 +611,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -674,6 +623,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -685,6 +635,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -696,6 +647,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -723,10 +675,12 @@ } }, "Float": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -738,6 +692,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -749,6 +704,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -760,6 +716,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -771,6 +728,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -782,6 +740,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -793,6 +752,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -804,6 +764,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -815,6 +776,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -842,10 +804,12 @@ } }, "Double": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -857,6 +821,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -868,6 +833,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -879,6 +845,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -890,6 +857,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -901,6 +869,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -912,6 +881,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -923,6 +893,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -934,6 +905,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, @@ -961,10 +933,12 @@ } }, "Object": { + "enabled": true, "Base": { "enabled": true }, "Boolean": { + "enabled": true, "Function": { "enabled": true }, @@ -976,6 +950,7 @@ } }, "Byte": { + "enabled": true, "Function": { "enabled": true }, @@ -987,6 +962,7 @@ } }, "Short": { + "enabled": true, "Function": { "enabled": true }, @@ -998,6 +974,7 @@ } }, "Character": { + "enabled": true, "Function": { "enabled": true }, @@ -1009,6 +986,7 @@ } }, "Integer": { + "enabled": true, "Function": { "enabled": true }, @@ -1020,6 +998,7 @@ } }, "Long": { + "enabled": true, "Function": { "enabled": true }, @@ -1031,6 +1010,7 @@ } }, "Float": { + "enabled": true, "Function": { "enabled": true }, @@ -1042,6 +1022,7 @@ } }, "Double": { + "enabled": true, "Function": { "enabled": true }, @@ -1053,6 +1034,7 @@ } }, "Object": { + "enabled": true, "Function": { "enabled": true }, diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index dc99a0ce..ddb7a073 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -239,7 +239,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); boolean load = flags.contains("load"); - boolean save = !flags.contains("save"); + boolean save = flags.contains("save"); int flag = (load ? LOAD : 0) | (save ? SAVE : 0); // new PrimitiveCollectionsBuilder(silent).test(); new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index 438ac210..d97e63d8 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -20,13 +20,30 @@ public class SettingsManager JsonObject data = new JsonObject(); Set moduleNames = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + 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; + } + result = getObject(result, base.getModuleName(), false); + return result.size() <= 0 || isEnabled(result, "enabled"); + } + 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()); - if(base.isBiModule()) result = getObject(result, valueType.getClassPath()); - result = getObject(result, base.getModuleName()); + 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)); } @@ -37,6 +54,7 @@ public class SettingsManager data.addProperty(moduleName, true); if(module.isBiModule()) { for(ClassType keyType : ModulePackage.TYPE) { + if(keyType == ClassType.BOOLEAN) continue; for(ClassType valueType : ModulePackage.TYPE) { JsonObject obj = new JsonObject(); obj.addProperty("enabled", true); @@ -82,18 +100,19 @@ public class SettingsManager } private void addModule(ClassType keyType, ClassType valueType, boolean bi, String moduleName, JsonObject obj) { - JsonObject result = getObject(data, keyType.getClassPath()); + JsonObject result = getObject(data, keyType.getClassPath(), true); if(bi) { - result = getObject(result, valueType.getClassPath()); + result = getObject(result, valueType.getClassPath(), true); } result.add(moduleName, obj); } - private JsonObject getObject(JsonObject data, String name) { + 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; } diff --git a/src/builder/java/speiger/src/builder/modules/AsyncModule.java b/src/builder/java/speiger/src/builder/modules/AsyncModule.java index 48bb432f..a5f41d8a 100644 --- a/src/builder/java/speiger/src/builder/modules/AsyncModule.java +++ b/src/builder/java/speiger/src/builder/modules/AsyncModule.java @@ -14,11 +14,24 @@ public class AsyncModule extends BaseModule @Override protected void loadFunctions() {} @Override - protected void loadFlags() {} + protected void loadBlockades() { + if(!isModuleEnabled()) { + addBlockedFiles("AsyncBuilder"); + } + } + @Override + protected void loadFlags() { + if(isModuleEnabled()) { + addKeyFlag("ASYNC_MODULE"); + } + } @Override protected void loadClasses() { + //Implementation Classes + addClassMapper("ASYNC_BUILDER", "AsyncBuilder"); + //Abstract Classes addAbstractMapper("BASE_TASK", "Base%sTask"); diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 9f55b060..8523dfa1 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -35,6 +35,7 @@ public abstract class BaseModule loadTestClasses(); loadFunctions(); loadRemappers(); + loadBlockades(); loadFlags(); } @@ -50,21 +51,30 @@ public abstract class BaseModule protected abstract void loadTestClasses(); protected abstract void loadFunctions(); protected abstract void loadRemappers(); + protected abstract void loadBlockades(); protected abstract void loadFlags(); public abstract String getModuleName(); public boolean isBiModule() { return false; } public Set getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); } + protected boolean isModuleEnabled() { + return manager == null || manager.isModuleEnabled(this, keyType, valueType); + } + protected boolean isModuleEnabled(String name) { - if(manager == null) return true; - return manager.isModuleEnabled(this, keyType, valueType, name); + return manager == null || manager.isModuleEnabled(this, keyType, valueType, name); } protected void addFlag(String name) { entry.addFlag(name); } + protected void addKeyFlag(String name) { + entry.addFlag(name); + entry.addFlag(keyType.getCapType()+"_"+name); + } + protected void addBiRequirement(String fileName) { entry.addRequirement(fileName, RequiredType.BI_CLASS); entry.addSplitter(fileName, "%1$s2%2$s"); diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java index a293840d..03cf9408 100644 --- a/src/builder/java/speiger/src/builder/modules/CollectionModule.java +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -8,11 +8,12 @@ public class CollectionModule extends BaseModule @Override public String getModuleName() { return "Collection"; } @Override - protected void loadVariables() { loadBlockades(); } + protected void loadVariables() {} @Override protected void loadFlags() {} - private void loadBlockades() + @Override + protected void loadBlockades() { if(keyType.isObject()) { addBlockedFiles("Stack"); diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index f6fff714..45562e36 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -8,13 +8,14 @@ public class FunctionModule extends BaseModule @Override public boolean isBiModule() { return true; } @Override - protected void loadVariables() { loadBlockades(); } + protected void loadVariables() {} @Override protected void loadFlags() {} @Override protected void loadTestClasses() {} - private void loadBlockades() + @Override + protected void loadBlockades() { if(keyType.isObject()) addBlockedFiles("Consumer", "Comparator"); } diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index 08344bfb..1ec496e1 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -30,7 +30,9 @@ public class JavaModule extends BaseModule @Override protected void loadRemappers() {} - + @Override + protected void loadBlockades() {} + @Override protected void loadFunctions() { diff --git a/src/builder/java/speiger/src/builder/modules/ListModule.java b/src/builder/java/speiger/src/builder/modules/ListModule.java index c83c3d3b..b1e50cd7 100644 --- a/src/builder/java/speiger/src/builder/modules/ListModule.java +++ b/src/builder/java/speiger/src/builder/modules/ListModule.java @@ -8,11 +8,14 @@ public class ListModule extends BaseModule @Override public String getModuleName() { return "List"; } @Override - protected void loadVariables() { loadBlockedFiles(); } + protected void loadVariables() {} @Override - protected void loadFlags() {} + protected void loadFlags() { + + } - private void loadBlockedFiles() + @Override + protected void loadBlockades() { if(keyType.isObject()) { addBlockedFiles("ListFillBufferTester"); @@ -52,7 +55,6 @@ public class ListModule extends BaseModule //Implementation Classes addClassMapper("ARRAY_LIST", "ArrayList"); addAbstractMapper("COPY_ON_WRITE_LIST", "CopyOnWrite%sArrayList"); - addClassMapper("ASYNC_BUILDER", "AsyncBuilder"); addClassMapper("LINKED_LIST", "LinkedList"); addAbstractMapper("IMMUTABLE_LIST", "Immutable%sList"); diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index fc8723f3..b0d11da7 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -10,11 +10,12 @@ public class MapModule extends BaseModule @Override public boolean isBiModule() { return true; } @Override - protected void loadVariables() { loadBlockades(); } + protected void loadVariables() {} @Override protected void loadFlags() {} - private void loadBlockades() + @Override + protected void loadBlockades() { if(keyType == ClassType.BOOLEAN) { diff --git a/src/builder/java/speiger/src/builder/modules/PairModule.java b/src/builder/java/speiger/src/builder/modules/PairModule.java index 95e85b2c..6af75532 100644 --- a/src/builder/java/speiger/src/builder/modules/PairModule.java +++ b/src/builder/java/speiger/src/builder/modules/PairModule.java @@ -10,6 +10,8 @@ public class PairModule extends BaseModule @Override protected void loadVariables() {} @Override + protected void loadBlockades() {} + @Override protected void loadFlags() {} @Override protected void loadFunctions() {} diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java index 81ba212c..0b2d1322 100644 --- a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -8,13 +8,14 @@ public class PrioQueueModule extends BaseModule @Override public String getModuleName() { return "PriorityQueue"; } @Override - protected void loadVariables() { loadBlockades(); } + protected void loadVariables() {} @Override protected void loadFlags() {} @Override protected void loadFunctions() {} - private void loadBlockades() + @Override + protected void loadBlockades() { if(keyType == ClassType.BOOLEAN) { addBlockedFiles("QueueTests"); diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 1f3d2d31..5ef11bc3 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -8,11 +8,12 @@ public class SetModule extends BaseModule @Override public String getModuleName() { return "Set"; } @Override - protected void loadVariables() { loadBlockades(); } + protected void loadVariables() {} @Override protected void loadFlags() {} - private void loadBlockades() + @Override + protected void loadBlockades() { if(keyType == ClassType.BOOLEAN) { diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index 38ac2290..213b4a9a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -23,7 +23,9 @@ import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #endif +#if ASYNC_MODULE import speiger.src.collections.PACKAGE.utils.ASYNC_BUILDER; +#endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; import speiger.src.collections.PACKAGE.utils.ITERABLES; import speiger.src.collections.PACKAGE.utils.ITERATORS; @@ -93,6 +95,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable @Override default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createUnknownSplititerator(iterator(), 0); } +#if ASYNC_MODULE /** * Creates a Async Builder for moving work of the thread. * It is not designed to split the work to multithreaded work, so using this keep it singlethreaded, but it allows to be moved to another thread. @@ -103,6 +106,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable return new ASYNC_BUILDERBRACES(this); } +#endif /** * A Helper function to reduce the usage of Streams and allows to convert a Iterable to something else. * @param mapper the mapping function diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index 2de567ec..129637b9 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -17,27 +17,33 @@ import java.util.Comparator; #endif import speiger.src.collections.PACKAGE.collections.ITERABLE; +#if OBJECT_ASYNC_MODULE import speiger.src.collections.PACKAGE.collections.COLLECTION; +#endif import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.TASK; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#if OBJECT_ASYNC_MODULE import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; +#if OBJECT_ASYNC_MODULE import speiger.src.collections.PACKAGE.lists.LIST; #if !TYPE_BOOLEAN import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #endif -#if !TYPE_BOOLEAN +#endif +#if !TYPE_BOOLEAN && BOOLEAN_ASYNC_MODULE import speiger.src.collections.booleans.utils.BooleanAsyncBuilder; import speiger.src.collections.booleans.utils.BooleanAsyncBuilder.BaseBooleanTask; #endif -#if !TYPE_OBJECT +#if !TYPE_OBJECT && OBJECT_ASYNC_MODULE import speiger.src.collections.objects.utils.ObjectAsyncBuilder; import speiger.src.collections.objects.utils.ObjectAsyncBuilder.BaseObjectTask; #endif -#if !TYPE_INT +#if !TYPE_INT && INT_ASYNC_MODULE import speiger.src.collections.ints.utils.IntAsyncBuilder; import speiger.src.collections.ints.utils.IntAsyncBuilder.BaseIntTask; #endif @@ -123,6 +129,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ASYNC_BUILDERBRACES(ARRAY_LIST.wrap(values)); } +#if OBJECT_ASYNC_MODULE /** * Maps the elements to something else * @param mapper the mapping function @@ -154,6 +161,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ObjectAsyncBuilder<>(ITERABLES.arrayFlatMap(iterable, mapper)); } +#endif /** * Filters out the unwanted elements out of the Iterable * @param filter the elements that should be kept @@ -214,6 +222,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return this; } +#if OBJECT_ASYNC_MODULE /** * Iterates over the Iterable with a desired action * @param action that should be applied @@ -223,6 +232,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ObjectAsyncBuilder<>(new ForEachTask<>(iterable.iterator(), action)); } +#endif /** * Reduces the elements inside of the Iterable down to one element * @param operator that reduces the elements. @@ -257,6 +267,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } #endif +#if OBJECT_ASYNC_MODULE /** * Pours all elements into a List that can be later * @return a new Builder with the pour function applied @@ -285,6 +296,8 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ObjectAsyncBuilder<>(new CollectTask<>(iterable.iterator(), collection)); } +#endif +#if BOOLEAN_ASYNC_MODULE /** * Searches through the elements of the Iterable to find if the desired element is present. * @param filter that decides the desired elements @@ -312,6 +325,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new BooleanAsyncBuilder(new MatchTaskBRACES(iterable.iterator(), filter, 2)); } +#endif /** * Searches through the elements of the Iterable to find if the desired element. * If not present it will return the default value of the type @@ -323,6 +337,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return this; } +#if INT_ASYNC_MODULE /** * Counts all desired elements inside the Iterable * @param filter that decides the desired elements @@ -332,6 +347,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new IntAsyncBuilder(new CountTaskBRACES(iterable.iterator(), filter)); } +#endif /** * Optional way to add a custom executor that runs this offthread task. * Can only be set after the action was decided on. @@ -512,6 +528,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } } +#if BOOLEAN_ASYNC_MODULE private static class MatchTask KEY_GENERIC_TYPE extends BaseBooleanTask { ITERATOR KEY_GENERIC_TYPE iter; @@ -580,6 +597,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } } +#endif private static class FindFirstTask KEY_GENERIC_TYPE extends BASE_TASK KEY_GENERIC_TYPE { ITERATOR KEY_GENERIC_TYPE iter; @@ -614,6 +632,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } } +#if INT_ASYNC_MODULE private static class CountTask KEY_GENERIC_TYPE extends BaseIntTask { ITERATOR KEY_GENERIC_TYPE iter; @@ -648,6 +667,8 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } } +#endif +#if OBJECT_ASYNC_MODULE private static class CollectTask KSS_GENERIC_TYPE> extends BaseObjectTask { ITERATOR KEY_SPECIAL_GENERIC_TYPE iter; @@ -704,6 +725,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } } +#endif /** * Base Task of the Actions that can be performed. * Allows to simplify the actions that get executed. From f53d61a5bca169924af52f45d898b63776d83392 Mon Sep 17 00:00:00 2001 From: Speiger Date: Sun, 4 Dec 2022 08:00:31 +0100 Subject: [PATCH 06/20] Fixed bug in the module generator config. --- ModulSettings.json | 81 +++++++++++++++++++ .../speiger/src/builder/SettingsManager.java | 3 +- .../src/builder/modules/BaseModule.java | 1 + .../src/builder/modules/MapModule.java | 2 + 4 files changed, 86 insertions(+), 1 deletion(-) diff --git a/ModulSettings.json b/ModulSettings.json index 1a48122c..0fc6dbba 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -13,6 +13,87 @@ "Base": { "enabled": true }, + "Boolean": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Byte": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Short": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Character": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Integer": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Long": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Float": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Double": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, + "Object": { + "enabled": true, + "Function": { + "enabled": true + }, + "Pair": { + "enabled": true + } + }, "Collection": { "enabled": true }, diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index d97e63d8..df08e47b 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -54,8 +54,8 @@ public class SettingsManager data.addProperty(moduleName, true); if(module.isBiModule()) { for(ClassType keyType : ModulePackage.TYPE) { - if(keyType == ClassType.BOOLEAN) continue; 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)) { @@ -67,6 +67,7 @@ public class SettingsManager return; } 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)) { diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 8523dfa1..8aadcab1 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -57,6 +57,7 @@ public abstract class BaseModule public abstract String getModuleName(); public boolean isBiModule() { return false; } public Set getModuleKeys(ClassType keyType, ClassType valueType) { return Collections.emptySet(); } + public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; } protected boolean isModuleEnabled() { return manager == null || manager.isModuleEnabled(this, keyType, valueType); diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index b0d11da7..e57124fb 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -13,6 +13,8 @@ public class MapModule extends BaseModule protected void loadVariables() {} @Override protected void loadFlags() {} + @Override + public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } @Override protected void loadBlockades() From cc87cae145a8ab6b64de5a04c65d3cb5d7c42f33 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 5 Dec 2022 00:00:05 +0100 Subject: [PATCH 07/20] Implemented Lists can now be Disabled Each List implementation can be now turned off. Or all Lists can be turned off. ListIterator can't be turned of since it is a IndexBasedIterator and not a List and a few implementation use them. --- Changelog.md | 2 + ModulSettings.json | 65 +++++- .../builder/PrimitiveCollectionsBuilder.java | 1 - .../src/builder/modules/ListModule.java | 32 ++- .../templates/collections/Iterable.template | 19 +- .../templates/lists/CopyOnWriteList.template | 4 +- .../collections/templates/lists/List.template | 4 + .../customHash/OpenCustomHashMap.template | 26 ++- .../maps/impl/hash/OpenHashMap.template | 26 ++- .../templates/sets/OpenCustomHashSet.template | 26 ++- .../templates/sets/OpenHashSet.template | 26 ++- .../templates/utils/Arrays.template | 34 ++- .../templates/utils/AsyncBuilder.template | 15 +- .../templates/utils/Collections.template | 203 ++++++++++++++++++ .../templates/utils/IArray.template | 2 + .../templates/utils/Iterables.template | 31 ++- .../templates/utils/Iterators.template | 67 +++--- 17 files changed, 466 insertions(+), 117 deletions(-) diff --git a/Changelog.md b/Changelog.md index 9725396c..8e0630ed 100644 --- a/Changelog.md +++ b/Changelog.md @@ -5,6 +5,8 @@ - Added: ISizeProvider into most Iterable implementations (Distinct/Filter/FlatMap/ArrayFlatMap don't support it, for obvious reasons) - Added: ToArray function into Iterable which uses ISizeProvider to reduce overhead of duplicating arrays. - Fixed: putIfAbsent now replaces defaultValues +- Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations. +- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant. ### Version 0.7.0 - Added: Over 11 Million Unit Tests to this library to ensure quality. diff --git a/ModulSettings.json b/ModulSettings.json index 0fc6dbba..ebc5a6a3 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -3,7 +3,7 @@ "Base": true, "Collection": true, "Function": true, - "List": true, + "List": false, "Map": true, "Pair": true, "PriorityQueue": true, @@ -101,7 +101,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -230,7 +235,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -359,7 +369,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -488,7 +503,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -617,7 +637,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -746,7 +771,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -875,7 +905,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -1004,7 +1039,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true @@ -1133,7 +1173,12 @@ "enabled": true }, "List": { - "enabled": true + "enabled": true, + "Lists": true, + "ImmutableList": true, + "CopyOnWriteList": true, + "ArrayList": true, + "LinkedList": true }, "Set": { "enabled": true diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index ddb7a073..04a7dba2 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -241,7 +241,6 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor boolean load = flags.contains("load"); boolean save = flags.contains("save"); int flag = (load ? LOAD : 0) | (save ? SAVE : 0); -// new PrimitiveCollectionsBuilder(silent).test(); new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); if(tests) { createTests(silent, flag).process(force || forceTests); diff --git a/src/builder/java/speiger/src/builder/modules/ListModule.java b/src/builder/java/speiger/src/builder/modules/ListModule.java index b1e50cd7..2fb2b105 100644 --- a/src/builder/java/speiger/src/builder/modules/ListModule.java +++ b/src/builder/java/speiger/src/builder/modules/ListModule.java @@ -1,5 +1,9 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") @@ -11,18 +15,32 @@ public class ListModule extends BaseModule protected void loadVariables() {} @Override protected void loadFlags() { - + if(isModuleEnabled()) addKeyFlag("LIST_MODULE"); + if(isModuleEnabled("Lists")) addKeyFlag("LISTS_FEATURE"); + if(isModuleEnabled("ArrayList")) addKeyFlag("ARRAY_LIST_FEATURE"); + if(isModuleEnabled("LinkedList")) addKeyFlag("LINKED_LIST_FEATURE"); + if(isModuleEnabled("ImmutableList")) addKeyFlag("IMMUTABLE_LIST_FEATURE"); + if(isModuleEnabled("CopyOnWriteList")) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE"); } @Override protected void loadBlockades() { - if(keyType.isObject()) { - addBlockedFiles("ListFillBufferTester"); - } - if(keyType == ClassType.BOOLEAN) { - addBlockedFiles("ListFillBufferTester", "ListReplaceAllTester"); - } + if(!isModuleEnabled("Lists")) addBlockedFiles("Lists"); + if(!isModuleEnabled("ArrayList")) addBlockedFiles("ArrayList"); + if(!isModuleEnabled("LinkedList")) addBlockedFiles("LinkedList"); + if(!isModuleEnabled("ImmutableList")) addBlockedFiles("ImmutableList"); + if(!isModuleEnabled("CopyOnWriteList")) addBlockedFiles("CopyOnWriteList"); + if(!isModuleEnabled()) addBlockedFiles("List", "AbstractList"); + + if(keyType.isObject()) addBlockedFiles("ListFillBufferTester"); + if(keyType == ClassType.BOOLEAN) addBlockedFiles("ListFillBufferTester", "ListReplaceAllTester"); + } + + @Override + public Set getModuleKeys(ClassType keyType, ClassType valueType) + { + return new HashSet<>(Arrays.asList("Lists", "ArrayList", "LinkedList", "ImmutableList", "CopyOnWriteList")); } @Override diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index 213b4a9a..afb91941 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -17,12 +17,19 @@ import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LIST; +#if ARRAY_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; +#else +import speiger.src.collections.PACKAGE.lists.LINKED_LIST; +#endif +#endif #if !TYPE_BOOLEAN import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #endif +import speiger.src.collections.PACKAGE.utils.ARRAYS; #if ASYNC_MODULE import speiger.src.collections.PACKAGE.utils.ASYNC_BUILDER; #endif @@ -206,14 +213,20 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable return collection; } +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE /** * A Helper function that reduces the usage of streams and allows to collect all elements as a ArrayList * @return a new ArrayList of all elements */ default LIST KEY_GENERIC_TYPE pourAsList() { - return pour(new ARRAY_LISTBRACES()); +#if ARRAY_LIST_FEATURE + return pour(new ARRAY_LISTBRACES()); +#else + return pour(new LINKED_LISTBRACES()); +#endif } +#endif #if !TYPE_BOOLEAN /** * A Helper function that reduces the usage of streams and allows to collect all elements as a LinkedHashSet @@ -241,7 +254,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable return array; } } - return ITERATORS.pour(iterator()).TO_ARRAY(action); + return ARRAYS.pour(iterator(), action); } #else /** @@ -258,7 +271,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable return array; } } - return ITERATORS.pour(iterator()).TO_ARRAY(); + return ARRAYS.pour(iterator()); } #endif diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template b/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template index 806223f3..0e49659f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template @@ -148,8 +148,8 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER * @Type(T) * @return a typed List */ - public static GENERIC_KEY_BRACES ARRAY_LIST KEY_GENERIC_TYPE of(Class c) { - ARRAY_LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); + public static GENERIC_KEY_BRACES COPY_ON_WRITE_LIST KEY_GENERIC_TYPE of(Class c) { + COPY_ON_WRITE_LIST KEY_GENERIC_TYPE list = new COPY_ON_WRITE_LISTBRACES(); list.data = (KEY_TYPE[])ObjectArrays.newArray(c, 0); return list; } diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/List.template b/src/builder/resources/speiger/assets/collections/templates/lists/List.template index 5c0a2c4c..6488ca27 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/List.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/List.template @@ -20,7 +20,9 @@ import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.utils.ARRAYS; +#if LIST_FEATURE import speiger.src.collections.PACKAGE.utils.LISTS; +#endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; #if TYPE_BYTE || TYPE_SHORT || TYPE_CHAR || TYPE_FLOAT import speiger.src.collections.utils.SanityChecks; @@ -379,6 +381,7 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List @Override public LIST KEY_GENERIC_TYPE subList(int from, int to); +#if LISTS_FEATURE /** * Creates a Wrapped List that is Synchronized * @return a new List that is synchronized @@ -401,6 +404,7 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List */ public default LIST KEY_GENERIC_TYPE unmodifiable() { return LISTS.unmodifiable(this); } +#endif /** * A function to ensure the elements are within the requested size. * If smaller then the stored elements they get removed as needed. diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template index 1d67e8b5..8f4c4b61 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template @@ -22,8 +22,6 @@ import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #if !TYPE_OBJECT && !VALUE_BOOLEAN import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; -import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.utils.maps.MAPS; @@ -1420,7 +1418,8 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL int lastReturned = -1; int nextIndex = Integer.MIN_VALUE; boolean returnNull = containsNull; - LIST KEY_GENERIC_TYPE wrapped = null; + KEY_TYPE[] wrapped = null; + int wrappedIndex = 0; public boolean hasNext() { if(nextIndex == Integer.MIN_VALUE) { @@ -1432,7 +1431,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL { while(true) { if(--pos < 0) { - if(wrapped == null || wrapped.size() <= -pos - 1) break; + if(wrapped == null || wrappedIndex <= -pos - 1) break; nextIndex = -pos - 1; break; } @@ -1451,7 +1450,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL returnedPos = pos; if(nextIndex < 0){ lastReturned = Integer.MAX_VALUE; - int value = findIndex(wrapped.GET_KEY(nextIndex)); + int value = findIndex(wrapped[nextIndex]); if(value < 0) throw new IllegalStateException("Entry ["+nextIndex+"] was removed during Iteration"); nextIndex = Integer.MIN_VALUE; return value; @@ -1470,7 +1469,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } else if(returnedPos >= 0) shiftKeys(returnedPos); else { - CUSTOM_HASH_MAP.this.remove(wrapped.GET_KEY(-returnedPos - 1)); + CUSTOM_HASH_MAP.this.remove(wrapped[-returnedPos - 1]); lastReturned = -1; return; } @@ -1493,13 +1492,20 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; startPos = ++startPos & mask; } - if(startPos < last) { - if(wrapped == null) wrapped = new ARRAY_LISTBRACES(2); - wrapped.add(keys[startPos]); - } + if(startPos < last) addWrapper(keys[startPos]); keys[last] = current; values[last] = values[startPos]; } } + + private void addWrapper(KEY_TYPE value) { + if(wrapped == null) wrapped = NEW_KEY_ARRAY(2); + else if(wrappedIndex >= wrapped.length) { + KEY_TYPE[] newArray = NEW_KEY_ARRAY(wrapped.length * 2); + System.arraycopy(wrapped, 0, newArray, 0, wrapped.length); + wrapped = newArray; + } + wrapped[wrappedIndex++] = value; + } } } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template index ce267135..24e30d14 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template @@ -22,8 +22,6 @@ import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #if !TYPE_OBJECT && !VALUE_BOOLEAN import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; -import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.utils.maps.MAPS; @@ -1376,7 +1374,8 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE int lastReturned = -1; int nextIndex = Integer.MIN_VALUE; boolean returnNull = containsNull; - LIST KEY_GENERIC_TYPE wrapped = null; + KEY_TYPE[] wrapped = null; + int wrappedIndex = 0; public boolean hasNext() { if(nextIndex == Integer.MIN_VALUE) { @@ -1388,7 +1387,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE { while(true) { if(--pos < 0) { - if(wrapped == null || wrapped.size() <= -pos - 1) break; + if(wrapped == null || wrappedIndex <= -pos - 1) break; nextIndex = -pos - 1; break; } @@ -1407,7 +1406,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE returnedPos = pos; if(nextIndex < 0){ lastReturned = Integer.MAX_VALUE; - int value = findIndex(wrapped.GET_KEY(nextIndex)); + int value = findIndex(wrapped[nextIndex]); if(value < 0) throw new IllegalStateException("Entry ["+nextIndex+"] was removed during Iteration"); nextIndex = Integer.MIN_VALUE; return value; @@ -1426,7 +1425,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } else if(returnedPos >= 0) shiftKeys(returnedPos); else { - HASH_MAP.this.remove(wrapped.GET_KEY(-returnedPos - 1)); + HASH_MAP.this.remove(wrapped[-returnedPos - 1]); lastReturned = -1; return; } @@ -1449,13 +1448,20 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; startPos = ++startPos & mask; } - if(startPos < last) { - if(wrapped == null) wrapped = new ARRAY_LISTBRACES(2); - wrapped.add(keys[startPos]); - } + if(startPos < last) addWrapper(keys[startPos]); keys[last] = current; values[last] = values[startPos]; } } + + private void addWrapper(KEY_TYPE value) { + if(wrapped == null) wrapped = NEW_KEY_ARRAY(2); + else if(wrappedIndex >= wrapped.length) { + KEY_TYPE[] newArray = NEW_KEY_ARRAY(wrapped.length * 2); + System.arraycopy(wrapped, 0, newArray, 0, wrapped.length); + wrapped = newArray; + } + wrapped[wrappedIndex++] = value; + } } } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template index b1e7a9d9..c9ddeb46 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template @@ -13,8 +13,6 @@ import java.util.function.BiFunction; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; -import speiger.src.collections.PACKAGE.lists.LIST; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; @@ -630,7 +628,8 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T int lastReturned = -1; int nextIndex = Integer.MIN_VALUE; boolean returnNull = containsNull; - LIST KEY_GENERIC_TYPE wrapped = null; + KEY_TYPE[] wrapped = null; + int wrappedIndex = 0; @Override public boolean hasNext() { @@ -642,7 +641,7 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T else { while(true) { if(--pos < 0) { - if(wrapped == null || wrapped.size() <= -pos - 1) break; + if(wrapped == null || wrappedIndex <= -pos - 1) break; nextIndex = -pos - 1; break; } @@ -662,7 +661,7 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T returnedPos = pos; if(nextIndex < 0){ lastReturned = Integer.MAX_VALUE; - KEY_TYPE value = wrapped.GET_KEY(nextIndex); + KEY_TYPE value = wrapped[nextIndex]; nextIndex = Integer.MIN_VALUE; return value; } @@ -680,7 +679,7 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T } else if(returnedPos >= 0) shiftKeys(returnedPos); else { - CUSTOM_HASH_SET.this.remove(wrapped.GET_KEY(-returnedPos - 1)); + CUSTOM_HASH_SET.this.remove(wrapped[-returnedPos - 1]); lastReturned = -1; return; } @@ -702,12 +701,19 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; startPos = ++startPos & mask; } - if(startPos < last) { - if(wrapped == null) wrapped = new ARRAY_LISTBRACES(2); - wrapped.add(keys[startPos]); - } + if(startPos < last) addWrapper(keys[startPos]); keys[last] = current; } } + + private void addWrapper(KEY_TYPE value) { + if(wrapped == null) wrapped = NEW_KEY_ARRAY(2); + else if(wrappedIndex >= wrapped.length) { + KEY_TYPE[] newArray = NEW_KEY_ARRAY(wrapped.length * 2); + System.arraycopy(wrapped, 0, newArray, 0, wrapped.length); + wrapped = newArray; + } + wrapped[wrappedIndex++] = value; + } } } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template index 5cac2a92..b5646b03 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template @@ -13,8 +13,6 @@ import java.util.function.BiFunction; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; -import speiger.src.collections.PACKAGE.lists.LIST; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; @@ -597,7 +595,8 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp int lastReturned = -1; int nextIndex = Integer.MIN_VALUE; boolean returnNull = containsNull; - LIST KEY_GENERIC_TYPE wrapped = null; + KEY_TYPE[] wrapped = null; + int wrappedIndex = 0; @Override public boolean hasNext() { @@ -610,7 +609,7 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp { while(true) { if(--pos < 0) { - if(wrapped == null || wrapped.size() <= -pos - 1) break; + if(wrapped == null || wrappedIndex <= -pos - 1) break; nextIndex = -pos - 1; break; } @@ -630,7 +629,7 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp returnedPos = pos; if(nextIndex < 0){ lastReturned = Integer.MAX_VALUE; - KEY_TYPE value = wrapped.GET_KEY(nextIndex); + KEY_TYPE value = wrapped[nextIndex]; nextIndex = Integer.MIN_VALUE; return value; } @@ -648,7 +647,7 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp } else if(returnedPos >= 0) shiftKeys(returnedPos); else { - HASH_SET.this.remove(wrapped.GET_KEY(-returnedPos - 1)); + HASH_SET.this.remove(wrapped[-returnedPos - 1]); lastReturned = -1; return; } @@ -670,12 +669,19 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; startPos = ++startPos & mask; } - if(startPos < last) { - if(wrapped == null) wrapped = new ARRAY_LISTBRACES(2); - wrapped.add(keys[startPos]); - } + if(startPos < last) addWrapper(keys[startPos]); keys[last] = current; } } + + private void addWrapper(KEY_TYPE value) { + if(wrapped == null) wrapped = NEW_KEY_ARRAY(2); + else if(wrappedIndex >= wrapped.length) { + KEY_TYPE[] newArray = NEW_KEY_ARRAY(wrapped.length * 2); + System.arraycopy(wrapped, 0, newArray, 0, wrapped.length); + wrapped = newArray; + } + wrapped[wrappedIndex++] = value; + } } } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template index 44937fb2..68065f4e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template @@ -9,10 +9,11 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; #else import java.util.Comparator; +import speiger.src.collections.ints.functions.function.Int2ObjectFunction; #endif import speiger.src.collections.PACKAGE.collections.ITERATOR; -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.utils.ITERATORS; +import speiger.src.collections.PACKAGE.utils.COLLECTIONS; import speiger.src.collections.utils.SanityChecks; /** @@ -132,10 +133,39 @@ public class ARRAYS * @return array with all requested elements of the iterator */ public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max) { - ARRAY_LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); + COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE list = COLLECTIONS.wrapper(); ITERATORS.pour(iter, list, max); return list.TO_ARRAY(NEW_KEY_ARRAY(list.size())); } + +#if TYPE_OBJECT + /** + * A Helper function that pours all elements of a iterator into a Array + * @param iter the elements that should be gathered. + * @ArrayType(T) + * @param action that is creating the Array to be poured into + * @return array with all elements of the iterator + */ + public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, Int2ObjectFunction action) { + return pour(iter, Integer.MAX_VALUE, action); + } + + /** + * A Helper function that pours all elements of a iterator into a Array + * @param iter the elements that should be gathered. + * @param max how many elements should be added + * @param action that is creating the Array to be poured into + * @ArrayType(T) + * @return array with all requested elements of the iterator + */ + public static GENERIC_KEY_BRACES KEY_TYPE[] pour(ITERATOR KEY_GENERIC_TYPE iter, int max, Int2ObjectFunction action) { + COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE list = COLLECTIONS.wrapper(); + ITERATORS.pour(iter, list, max); + return list.TO_ARRAY(action.apply(list.size())); + } + +#endif + /** * Method to validate if the current value is the lowest value in the heap * @param data the current heap. diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index 129637b9..e2d8c211 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -27,9 +27,12 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; #endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #if OBJECT_ASYNC_MODULE -import speiger.src.collections.PACKAGE.lists.LIST; +#if ARRAY_LIST_FEATURE +import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; +#else if LINKED_LIST_FEATURE +import speiger.src.collections.PACKAGE.lists.LINKED_LIST; +#endif #if !TYPE_BOOLEAN import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; @@ -119,6 +122,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ASYNC_BUILDERBRACES(ITERABLES.wrap(iterable)); } +#if ARRAY_LIST_FEATURE /** * Helper function that automatically wraps a array into a AsyncBuilder since it forces this collections Iterable. * @param values that should be wrapped @@ -129,6 +133,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE return new ASYNC_BUILDERBRACES(ARRAY_LIST.wrap(values)); } +#endif #if OBJECT_ASYNC_MODULE /** * Maps the elements to something else @@ -268,14 +273,20 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE #endif #if OBJECT_ASYNC_MODULE +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE /** * Pours all elements into a List that can be later * @return a new Builder with the pour function applied */ public ObjectAsyncBuilder pourAsList() { +#if ARRAY_LIST_FEATURE return pour(new ARRAY_LISTBRACES()); +#else + return pour(new LINKED_LISTBRACES()); +#endif } +#endif #if !TYPE_BOOLEAN /** * Pours all elements into a Set that can be later diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template index d9222893..58136b18 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -1,7 +1,10 @@ package speiger.src.collections.PACKAGE.utils; +import java.util.Arrays; import java.util.Collection; +import java.util.Objects; #if TYPE_OBJECT +import java.util.Comparator; import java.util.function.BiFunction; #endif import java.util.function.Predicate; @@ -13,6 +16,9 @@ import java.util.function.Consumer; import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; +#if !TYPE_OBJECT +import speiger.src.collections.PACKAGE.functions.COMPARATOR; +#endif import speiger.src.collections.objects.utils.ObjectArrays; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; @@ -21,6 +27,9 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +import speiger.src.collections.utils.ITrimmable; +import speiger.src.collections.utils.SanityChecks; + /** * A Helper class for Collections */ @@ -75,6 +84,200 @@ public class COLLECTIONS return c instanceof SynchronizedCollection ? c : new SynchronizedCollectionBRACES(c, mutex); } + protected static GENERIC_KEY_BRACES CollectionWrapper KEY_GENERIC_TYPE wrapper() { + return new CollectionWrapperBRACES(); + } + + protected static GENERIC_KEY_BRACES CollectionWrapper KEY_GENERIC_TYPE wrapper(int size) { + return new CollectionWrapperBRACES(size); + } + + protected static class CollectionWrapper KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE implements ITrimmable { + KEY_TYPE[] elements; + int size = 0; + + public CollectionWrapper() { + this(10); + } + + public CollectionWrapper(int size) { + if(size < 0) throw new IllegalStateException("Size has to be 0 or greater"); + elements = NEW_KEY_ARRAY(size); + } + + @Override + public boolean add(KEY_TYPE o) { + if(size >= elements.length) elements = Arrays.copyOf(elements, (int)Math.min((long)elements.length + (elements.length >> 1), SanityChecks.MAX_ARRAY_SIZE)); + elements[size++] = o; + return true; + } + + public KEY_TYPE GET_KEY(int index) { + if(index < 0 || index >= size) throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + return elements[index]; + } + +#if TYPE_OBJECT + @Override + public boolean remove(Object e) { + for(int i = 0;i= size) throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); + size--; + if(index != size) System.arraycopy(elements, index+1, elements, index, size - index); + } + + @Override + public ITERATOR KEY_GENERIC_TYPE iterator() { + return new ITERATOR KEY_GENERIC_TYPE() { + int index = 0; + int lastReturned = -1; + + @Override + public boolean hasNext() { + return index < size; + } + + @Override + public KEY_TYPE NEXT() { + int i = index++; + return elements[(lastReturned = i)]; + } + + @Override + public void remove() { + if(lastReturned == -1) throw new IllegalStateException(); + removeIndex(lastReturned); + index = lastReturned; + lastReturned = -1; + } + }; + } + + @Override + public int size() { + return size; + } + + @Override + public void clear() { +#if TYPE_OBJECT + for(int i = 0;i c) { + if(c != null) ARRAYS.stableSort(elements, size, c); + else ARRAYS.stableSort(elements, size); + } + + public void unstableSort(Comparator c) { + if(c != null) ARRAYS.unstableSort(elements, size, c); + else ARRAYS.unstableSort(elements, size); + } + +#else + public void sort(COMPARATOR c) { + if(c != null) ARRAYS.stableSort(elements, size, c); + else ARRAYS.stableSort(elements, size); + } + + public void unstableSort(COMPARATOR c) { + if(c != null) ARRAYS.unstableSort(elements, size, c); + else ARRAYS.unstableSort(elements, size); + } + +#endif + @Override + public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) { + Objects.requireNonNull(action); + for(int i = 0;i void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { + Objects.requireNonNull(action); + for(int i = 0;i size() || size() == elements.length) return false; + int value = Math.max(size, size()); + elements = value == 0 ? EMPTY_KEY_ARRAY : Arrays.copyOf(elements, value); + return true; + } + + @Override + public void clearAndTrim(int size) { + if(elements.length <= size) { + clear(); + return; + } + elements = size == 0 ? EMPTY_KEY_ARRAY : NEW_KEY_ARRAY(size); + this.size = size; + } + + @Override + @Primitive + public Object[] toArray() { + Object[] obj = new Object[size]; + for(int i = 0;i E[] toArray(E[] a) { + if(a == null) a = (E[])new Object[size]; + else if(a.length < size) a = (E[])ObjectArrays.newArray(a.getClass().getComponentType(), size); + #if TYPE_OBJECT + System.arraycopy(elements, 0, a, 0, size); + #else + for(int i = 0;i size) a[size] = null; + return a; + } + +#if !TYPE_OBJECT + @Override + public KEY_TYPE[] TO_ARRAY(KEY_TYPE[] a) { + if(a.length < size) a = new KEY_TYPE[size]; + System.arraycopy(elements, 0, a, 0, size); + if (a.length > size) a[size] = EMPTY_KEY_VALUE; + return a; + } +#endif + } + /** * Synchronized Collection Wrapper for the synchronizedCollection function * @Type(T) diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template b/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template index ff040f0a..3193973d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template @@ -7,7 +7,9 @@ import speiger.src.collections.utils.IArray; /** * Type-Specific Helper class to get the underlying array of array implementations. +#if ARRAY_LIST_FEATURE * @see speiger.src.collections.PACKAGE.lists.ARRAY_LIST +#endif * @Type(T) */ public interface IARRAY KEY_GENERIC_TYPE extends IArray diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template index de74496b..95a553f5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template @@ -10,6 +10,7 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; import speiger.src.collections.PACKAGE.collections.ITERABLE; +import speiger.src.collections.PACKAGE.collections.COLLECTION; #if !TYPE_OBJECT import speiger.src.collections.objects.collections.ObjectIterable; import speiger.src.collections.objects.collections.ObjectIterator; @@ -17,8 +18,6 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.collections.ITERATOR; -import speiger.src.collections.PACKAGE.lists.LIST; -import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #if !TYPE_BOOLEAN @@ -380,19 +379,19 @@ public class ITERABLES @Override public void forEach(CONSUMER action) { Objects.requireNonNull(action); - LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); - iterable.forEach(action.andThen(list::add)); + COLLECTION KEY_GENERIC_TYPE repeater = COLLECTIONS.wrapper(); + iterable.forEach(action.andThen(repeater::add)); for(int i = 0;i action) { Objects.requireNonNull(action); - LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); - iterable.forEach(T -> {action.accept(T); list.add(T);}); + COLLECTION KEY_GENERIC_TYPE repeater = COLLECTIONS.wrapper(); + iterable.forEach(T -> {action.accept(T); repeater.add(T);}); for(int i = 0;i action) { Objects.requireNonNull(action); - LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); - iterable.forEach(list::add); - list.unstableSort(sorter); - list.forEach(action); + COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE wrapper = COLLECTIONS.wrapper(); + iterable.forEach(wrapper::add); + wrapper.unstableSort(sorter); + wrapper.forEach(action); } #endif } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index e9c0f3a8..dad3089f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -16,8 +16,13 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#if LIST_MODULE +#if ARRAY_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; -import speiger.src.collections.PACKAGE.lists.LIST; +#else if LINKED_LIST_FEATURE +import speiger.src.collections.PACKAGE.lists.LINKED_LIST; +#endif +#endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; @@ -468,6 +473,8 @@ public class ITERATORS } #endif +#if LIST_MODULE +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE /** * A Helper function to pours all elements of a Iterator into a List * @param iter the elements that should be poured into list. @@ -486,12 +493,20 @@ public class ITERATORS * @return A list of all requested elements of the Iterator */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE pour(ITERATOR KEY_GENERIC_TYPE iter, int max) { +#if ARRAY_LIST_FEATURE ARRAY_LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); +#else + LINKED_LIST KEY_GENERIC_TYPE list = new LINKED_LISTBRACES(); +#endif pour(iter, list, max); +#if ARRAY_LIST_FEATURE list.trim(); +#endif return list; } +#endif +#endif /** * A Helper function to pours all elements of a Iterator into a Collection * @param iter the elements that should be poured into list. @@ -624,7 +639,7 @@ public class ITERATORS @Override public void remove() { it.remove(); } } - + private static class ReverseListIterator KEY_GENERIC_TYPE implements LIST_ITERATOR KEY_GENERIC_TYPE { LIST_ITERATOR KEY_GENERIC_TYPE it; @@ -747,45 +762,25 @@ public class ITERATORS return iterator.NEXT(); } } - + private static class EmptyIterator KEY_GENERIC_TYPE implements LIST_ITERATOR KEY_GENERIC_TYPE { @Override - public boolean hasNext() { - return false; - } - + public boolean hasNext() { return false; } @Override - public KEY_TYPE NEXT() { - throw new NoSuchElementException(); - } - + public KEY_TYPE NEXT() { throw new NoSuchElementException(); } @Override - public boolean hasPrevious() { - return false; - } - + public boolean hasPrevious() { return false; } @Override - public KEY_TYPE PREVIOUS() { - throw new NoSuchElementException(); - } - + public KEY_TYPE PREVIOUS() { throw new NoSuchElementException(); } @Override - public int nextIndex() { - return 0; - } - + public int nextIndex() { return 0; } @Override - public int previousIndex() { - return -1; - } - + public int previousIndex() { return -1; } @Override public void remove() { throw new UnsupportedOperationException(); } - @Override public void set(KEY_TYPE e) { throw new UnsupportedOperationException(); } - @Override public void add(KEY_TYPE e) { throw new UnsupportedOperationException(); } } @@ -925,7 +920,7 @@ public class ITERATORS final int repeats; int index = 0; ITERATOR KEY_GENERIC_TYPE iter; - LIST KEY_GENERIC_TYPE list = new ARRAY_LISTBRACES(); + COLLECTION KEY_GENERIC_TYPE repeater = COLLECTIONS.wrapper(); public RepeatingIterator(ITERATOR KEY_GENERIC_TYPE iter, int repeat) { this.iter = iter; @@ -937,7 +932,7 @@ public class ITERATORS if(iter.hasNext()) return true; if(index < repeats) { index++; - iter = list.iterator(); + iter = repeater.iterator(); return iter.hasNext(); } return false; @@ -947,7 +942,7 @@ public class ITERATORS public KEY_TYPE NEXT() { if(!hasNext()) throw new NoSuchElementException(); KEY_TYPE value = iter.NEXT(); - if(index == 0) list.add(value); + if(index == 0) repeater.add(value); return value; } } @@ -956,7 +951,7 @@ public class ITERATORS { ITERATOR KEY_GENERIC_TYPE iterator; COMPARATOR KEY_GENERIC_TYPE sorter; - LIST KEY_GENERIC_TYPE sortedElements = null; + COLLECTIONS.CollectionWrapper KEY_GENERIC_TYPE sortedElements = null; int index = 0; public SortedIterator(ITERATOR KEY_GENERIC_TYPE iterator, COMPARATOR KEY_GENERIC_TYPE sorter) { @@ -968,7 +963,11 @@ public class ITERATORS public boolean hasNext() { if(sortedElements == null) { boolean hasNext = iterator.hasNext(); - sortedElements = hasNext ? pour(iterator) : LISTS.empty(); + if(hasNext) { + sortedElements = COLLECTIONS.wrapper(); + pour(iterator, sortedElements); + } + else sortedElements = COLLECTIONS.wrapper(); if(hasNext) sortedElements.unstableSort(sorter); } return index < sortedElements.size(); From c9fc963670efdd2c6de15b36fd34868a92f10ce1 Mon Sep 17 00:00:00 2001 From: Speiger Date: Mon, 5 Dec 2022 07:10:53 +0100 Subject: [PATCH 08/20] Few changes. -Removed: BooleanSet classes are gone. (Unused anyways) -Removed: Boolean2xMaps are also now gone. (Unused Anyways) -Added: GlobalFlags that are shared across packages. --- Changelog.md | 3 +- ModulSettings.json | 722 ++++++++++++++++-- .../speiger/src/builder/ModulePackage.java | 13 +- .../builder/PrimitiveCollectionsBuilder.java | 3 +- .../src/builder/modules/BaseModule.java | 2 +- .../src/builder/modules/MapModule.java | 12 +- .../src/builder/modules/SetModule.java | 2 +- .../collections/templates/lists/List.template | 2 +- .../templates/utils/AsyncBuilder.template | 5 +- .../templates/utils/Collections.template | 47 ++ .../templates/utils/Iterators.template | 1 + .../templates/utils/maps/Maps.template | 5 +- 12 files changed, 729 insertions(+), 88 deletions(-) diff --git a/Changelog.md b/Changelog.md index 8e0630ed..3659f18a 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,7 +6,8 @@ - Added: ToArray function into Iterable which uses ISizeProvider to reduce overhead of duplicating arrays. - Fixed: putIfAbsent now replaces defaultValues - Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations. -- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant. +- Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant. +- Removed: BooleanSet and Maps that start with a Boolean classes since they can not be used anyways. ### Version 0.7.0 - Added: Over 11 Million Unit Tests to this library to ensure quality. diff --git a/ModulSettings.json b/ModulSettings.json index ebc5a6a3..5d84a687 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -3,7 +3,7 @@ "Base": true, "Collection": true, "Function": true, - "List": false, + "List": true, "Map": true, "Pair": true, "PriorityQueue": true, @@ -126,7 +126,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -138,7 +146,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -150,7 +166,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -162,7 +186,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -174,7 +206,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -186,7 +226,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -198,7 +246,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -210,7 +266,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -222,7 +286,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -260,7 +332,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -272,7 +352,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -284,7 +372,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -296,7 +392,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -308,7 +412,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -320,7 +432,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -332,7 +452,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -344,7 +472,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -356,7 +492,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -394,7 +538,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -406,7 +558,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -418,7 +578,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -430,7 +598,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -442,7 +618,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -454,7 +638,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -466,7 +658,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -478,7 +678,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -490,7 +698,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -528,7 +744,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -540,7 +764,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -552,7 +784,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -564,7 +804,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -576,7 +824,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -588,7 +844,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -600,7 +864,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -612,7 +884,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -624,7 +904,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -662,7 +950,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -674,7 +970,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -686,7 +990,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -698,7 +1010,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -710,7 +1030,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -722,7 +1050,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -734,7 +1070,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -746,7 +1090,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -758,7 +1110,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -796,7 +1156,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -808,7 +1176,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -820,7 +1196,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -832,7 +1216,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -844,7 +1236,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -856,7 +1256,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -868,7 +1276,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -880,7 +1296,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -892,7 +1316,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -930,7 +1362,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -942,7 +1382,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -954,7 +1402,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -966,7 +1422,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -978,7 +1442,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -990,7 +1462,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1002,7 +1482,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1014,7 +1502,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1026,7 +1522,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1064,7 +1568,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1076,7 +1588,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1088,7 +1608,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1100,7 +1628,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1112,7 +1648,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1124,7 +1668,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1136,7 +1688,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1148,7 +1708,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true @@ -1160,7 +1728,15 @@ "enabled": true }, "Map": { - "enabled": true + "enabled": true, + "HashMap": true, + "RBTreeMap": true, + "ConcurrentMap": true, + "ArrayMap": true, + "AVLTreeMap": true, + "CustomHashMap": true, + "EnumMap": true, + "ImmutableMap": true }, "Pair": { "enabled": true diff --git a/src/builder/java/speiger/src/builder/ModulePackage.java b/src/builder/java/speiger/src/builder/ModulePackage.java index e7c4b5bb..84933cdc 100644 --- a/src/builder/java/speiger/src/builder/ModulePackage.java +++ b/src/builder/java/speiger/src/builder/ModulePackage.java @@ -31,9 +31,11 @@ public class ModulePackage List> blockedFilters = new ArrayList<>(); List mappers = new ArrayList<>(); Set flags = new LinkedHashSet<>(); + Set globalFlags; BiConsumer requirements = VOID; - public ModulePackage(ClassType keyType, ClassType valueType) { + public ModulePackage(Set globalFlags, ClassType keyType, ClassType valueType) { + this.globalFlags = globalFlags; this.keyType = keyType; this.valueType = valueType; } @@ -68,6 +70,10 @@ public class ModulePackage flags.add(flag); } + public void addGlobalFlag(String flag) { + globalFlags.add(flag); + } + public void addRequirement(String fileName, RequiredType type) { requirements.accept(fileName, type); } @@ -99,6 +105,7 @@ public class ModulePackage TemplateProcess process = new TemplateProcess(newName+".java"); process.setPathBuilder(new PathBuilder(keyType.getPathType())); process.addFlags(flags); + process.addFlags(globalFlags); process.addMappers(mappers); result.accept(process); } @@ -111,11 +118,11 @@ public class ModulePackage return false; } - public static List createPackages() { + public static List createPackages(Set globalFlags) { List list = new ArrayList<>(); for(ClassType key : TYPE) { for(ClassType value : TYPE) { - list.add(new ModulePackage(key, value)); + list.add(new ModulePackage(globalFlags, key, value)); } } return list; diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 04a7dba2..e495c6fa 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -37,6 +37,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor private static final int LOAD = 0x2; //If Configs should be loaded private static final int ANTI_SAVE = SPECIAL | LOAD; //If save should be disabled since load/save shouldn't happen at the same time. private static final int SAVE = 0x4; //if the configuration should be created + Set globalFlags = new HashSet<>(); List simplePackages = new ArrayList<>(); List biPackages = new ArrayList<>(); List enumPackages = new ArrayList<>(); @@ -154,7 +155,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor private void prepPackages() { if((flags & LOAD) != 0) manager.load(); - for(ModulePackage entry : ModulePackage.createPackages()) + for(ModulePackage entry : ModulePackage.createPackages(globalFlags)) { entry.setRequirements(requirements::put); biPackages.add(entry); diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index 8aadcab1..bc953342 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -73,7 +73,7 @@ public abstract class BaseModule protected void addKeyFlag(String name) { entry.addFlag(name); - entry.addFlag(keyType.getCapType()+"_"+name); + entry.addGlobalFlag(keyType.getCapType()+"_"+name); } protected void addBiRequirement(String fileName) { diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index e57124fb..ce60b205 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -1,5 +1,9 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") @@ -16,6 +20,12 @@ public class MapModule extends BaseModule @Override public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } + @Override + public Set getModuleKeys(ClassType keyType, ClassType valueType) + { + return new HashSet<>(Arrays.asList("ConcurrentMap", "HashMap", "CustomHashMap", "ImmutableMap", "ArrayMap", "EnumMap", "AVLTreeMap", "RBTreeMap")); + } + @Override protected void loadBlockades() { @@ -25,7 +35,7 @@ public class MapModule extends BaseModule addBlockedFiles("SortedMap", "NavigableMap", "RBTreeMap", "AVLTreeMap"); addBlockedFiles("OrderedMap", "ArrayMap", "LinkedOpenHashMap", "LinkedOpenCustomHashMap"); addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); - addBlockedFiles("ImmutableOpenHashMap", "OpenHashMap", "OpenCustomHashMap"); + addBlockedFiles("Map", "Maps", "AbstractMap", "ImmutableOpenHashMap", "OpenHashMap", "OpenCustomHashMap"); //Test Classes addBlockedFiles("TestMap", "MapTests", "MapTestSuiteBuilder", "MapConstructorTests", "TestMapGenerator", "SimpleMapTestGenerator", "DerivedMapGenerators", "AbstractMapTester"); diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 5ef11bc3..b5723d60 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -20,7 +20,7 @@ public class SetModule extends BaseModule //Main Classes addBlockedFiles("SortedSet", "NavigableSet", "AVLTreeSet", "RBTreeSet"); addBlockedFiles("OrderedSet", "ArraySet", "LinkedOpenHashSet", "LinkedOpenCustomHashSet"); - addBlockedFiles("OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); + addBlockedFiles("Set", "Sets", "AbstractSet", "OpenHashSet", "OpenCustomHashSet", "ImmutableOpenHashSet"); //Test Classes addBlockedFiles("SetTests", "SetTestSuiteBuilder"); diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/List.template b/src/builder/resources/speiger/assets/collections/templates/lists/List.template index 6488ca27..4b821369 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/List.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/List.template @@ -20,7 +20,7 @@ import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.utils.ARRAYS; -#if LIST_FEATURE +#if LISTS_FEATURE import speiger.src.collections.PACKAGE.utils.LISTS; #endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index e2d8c211..ce3d73af 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -28,16 +28,17 @@ import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; #endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if OBJECT_ASYNC_MODULE +import speiger.src.collections.PACKAGE.lists.LIST; +#endif #if ARRAY_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #else if LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif -#if !TYPE_BOOLEAN +#if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #endif -#endif #if !TYPE_BOOLEAN && BOOLEAN_ASYNC_MODULE import speiger.src.collections.booleans.utils.BooleanAsyncBuilder; import speiger.src.collections.booleans.utils.BooleanAsyncBuilder.BaseBooleanTask; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template index 58136b18..43122c0a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -2,6 +2,7 @@ package speiger.src.collections.PACKAGE.utils; import java.util.Arrays; import java.util.Collection; +import java.util.NoSuchElementException; import java.util.Objects; #if TYPE_OBJECT import java.util.Comparator; @@ -84,6 +85,16 @@ public class COLLECTIONS return c instanceof SynchronizedCollection ? c : new SynchronizedCollectionBRACES(c, mutex); } + /** + * Creates a Singleton Collection of a given element + * @param element the element that should be converted into a singleton collection + * @Type(T) + * @return a singletoncollection of the given element + */ + public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE singleton(KEY_TYPE element) { + return new SingletonCollectionBRACES(element); + } + protected static GENERIC_KEY_BRACES CollectionWrapper KEY_GENERIC_TYPE wrapper() { return new CollectionWrapperBRACES(); } @@ -278,6 +289,42 @@ public class COLLECTIONS #endif } + private static class SingletonCollection KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE + { + KEY_TYPE element; + + SingletonCollection(KEY_TYPE element) { + this.element = element; + } + +#if !TYPE_OBJECT + @Override + public boolean REMOVE_KEY(KEY_TYPE o) { throw new UnsupportedOperationException(); } +#endif + @Override + public boolean add(KEY_TYPE o) { throw new UnsupportedOperationException(); } + @Override + public ITERATOR KEY_GENERIC_TYPE iterator() + { + return new ITERATOR KEY_GENERIC_TYPE() { + boolean next = true; + @Override + public boolean hasNext() { return next; } + @Override + public KEY_TYPE NEXT() { + if(!hasNext()) throw new NoSuchElementException(); + next = false; + return element; + } + }; + } + @Override + public int size() { return 1; } + + @Override + public SingletonCollection KEY_GENERIC_TYPE copy() { return new SingletonCollectionBRACES(element); } + } + /** * Synchronized Collection Wrapper for the synchronizedCollection function * @Type(T) diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index dad3089f..cd947132 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -22,6 +22,7 @@ import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #else if LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif +import speiger.src.collections.PACKAGE.lists.LIST; #endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template index efa8f5a5..3b7eb3ff 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template @@ -49,9 +49,6 @@ import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPER #endif import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER; import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_COLLECTIONS; -#if !SAME_TYPE && !VALUE_OBJECT -import speiger.src.collections.VALUE_PACKAGE.utils.VALUE_SETS; -#endif #endif /** @@ -344,7 +341,7 @@ public class MAPS @Override public VALUE_COLLECTION VALUE_GENERIC_TYPE values() { - if(values == null) values = VALUE_SETS.singleton(value); + if(values == null) values = VALUE_COLLECTIONS.singleton(value); return values; } @Override From 57280b828541b4290a54ff12dccee4f3c671e26c Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 6 Dec 2022 03:05:58 +0100 Subject: [PATCH 09/20] Map Generation can now be turned off. --- ModulSettings.json | 1296 +++++++++++------ .../speiger/src/builder/SettingsManager.java | 16 +- .../src/builder/modules/MapModule.java | 65 +- .../maps/abstracts/AbstractMap.template | 39 +- .../customHash/OpenCustomHashMap.template | 3 +- .../maps/impl/hash/OpenHashMap.template | 3 +- .../immutable/ImmutableOpenHashMap.template | 3 +- .../maps/impl/misc/ArrayMap.template | 5 +- .../templates/maps/impl/misc/EnumMap.template | 3 +- .../maps/impl/tree/AVLTreeMap.template | 3 +- .../maps/impl/tree/RBTreeMap.template | 3 +- .../templates/maps/interfaces/Map.template | 81 +- .../maps/interfaces/NavigableMap.template | 5 + .../maps/interfaces/OrderedMap.template | 4 + .../maps/interfaces/SortedMap.template | 4 + .../templates/utils/maps/Maps.template | 43 +- 16 files changed, 1098 insertions(+), 478 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 5d84a687..57bc98e3 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -11,97 +11,97 @@ "Boolean": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -109,205 +109,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -315,205 +369,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -521,205 +629,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -727,205 +889,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -933,205 +1149,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -1139,205 +1409,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -1345,205 +1669,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -1551,205 +1929,259 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Base": { - "enabled": true + "Enabled": true }, "Boolean": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Byte": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Short": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Character": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Integer": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Long": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Float": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Double": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Object": { "enabled": true, "Function": { - "enabled": true + "Enabled": true }, "Map": { - "enabled": true, + "Enabled": true, "HashMap": true, "RBTreeMap": true, "ConcurrentMap": true, "ArrayMap": true, "AVLTreeMap": true, "CustomHashMap": true, - "EnumMap": true, - "ImmutableMap": true + "ImmutableMap": true, + "LinkedCustomHashMap": true, + "LinkedHashMap": true, + "Maps": true, + "SortedMap": true, + "LinkedEnumMap": true, + "OrderedMap": true, + "EnumMap": true }, "Pair": { - "enabled": true + "Enabled": true } }, "Collection": { - "enabled": true + "Enabled": true }, "PriorityQueue": { - "enabled": true + "Enabled": true }, "List": { - "enabled": true, + "Enabled": true, "Lists": true, "ImmutableList": true, "CopyOnWriteList": true, @@ -1757,10 +2189,10 @@ "LinkedList": true }, "Set": { - "enabled": true + "Enabled": true }, "Async": { - "enabled": true + "Enabled": true } } } \ No newline at end of file diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index df08e47b..552e5074 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -24,13 +24,13 @@ public class SettingsManager 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(!isEnabled(result, "Enabled")) return false; if(base.isBiModule()) { result = getObject(result, valueType.getClassPath(), false); - if(!isEnabled(result, "enabled")) return false; + if(!isEnabled(result, "Enabled")) return false; } result = getObject(result, base.getModuleName(), false); - return result.size() <= 0 || isEnabled(result, "enabled"); + return result.size() <= 0 || isEnabled(result, "Enabled"); } public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry) @@ -38,13 +38,13 @@ public class SettingsManager 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(!isEnabled(result, "Enabled")) return false; if(base.isBiModule()) { result = getObject(result, valueType.getClassPath(), false); - if(!isEnabled(result, "enabled")) return false; + if(!isEnabled(result, "Enabled")) return false; } result = getObject(result, base.getModuleName(), false); - return result.size() <= 0 || (isEnabled(result, "enabled") && isEnabled(result, entry)); + return result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry)); } public void addModule(BaseModule module) { @@ -57,7 +57,7 @@ public class SettingsManager for(ClassType valueType : ModulePackage.TYPE) { if(!module.isModuleValid(keyType, valueType)) continue; JsonObject obj = new JsonObject(); - obj.addProperty("enabled", true); + obj.addProperty("Enabled", true); for(String key : module.getModuleKeys(keyType, valueType)) { obj.addProperty(key, true); } @@ -69,7 +69,7 @@ public class SettingsManager for(ClassType keyType : ModulePackage.TYPE) { if(!module.isModuleValid(keyType, keyType)) continue; JsonObject obj = new JsonObject(); - obj.addProperty("enabled", true); + obj.addProperty("Enabled", true); for(String key : module.getModuleKeys(keyType, keyType)) { obj.addProperty(key, true); } diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index ce60b205..1356449f 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -16,19 +16,78 @@ public class MapModule extends BaseModule @Override protected void loadVariables() {} @Override - protected void loadFlags() {} - @Override public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } @Override public Set getModuleKeys(ClassType keyType, ClassType valueType) { - return new HashSet<>(Arrays.asList("ConcurrentMap", "HashMap", "CustomHashMap", "ImmutableMap", "ArrayMap", "EnumMap", "AVLTreeMap", "RBTreeMap")); + Set sets = new HashSet<>(); + sets.add("Maps"); + sets.addAll(Arrays.asList("OrderedMap", "SortedMap")); + sets.addAll(Arrays.asList("ArrayMap", "ConcurrentMap", "ImmutableMap")); + sets.addAll(Arrays.asList("HashMap", "LinkedHashMap")); + sets.addAll(Arrays.asList("CustomHashMap", "LinkedCustomHashMap")); + sets.addAll(Arrays.asList("EnumMap", "LinkedEnumMap")); + sets.addAll(Arrays.asList("AVLTreeMap", "RBTreeMap")); + return sets; + } + + @Override + protected void loadFlags() { + if(isModuleEnabled()) addFlag("MAP_MODULE"); + if(isModuleEnabled("Maps")) addFlag("Maps"); + boolean hashMap = isModuleEnabled("HashMap"); + boolean customHashMap = isModuleEnabled("CustomHashMap"); + boolean enumMap = isModuleEnabled("EnumMap"); + + 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(isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE"); + if(isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE"); + } + if(isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); + if(isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); + if(hashMap) addFlag("HASH_MAP_FEATURE"); + if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE"); + if(enumMap) addFlag("ENUM_MAP_FEATURE"); } @Override protected void loadBlockades() { + if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap"); + if(!isModuleEnabled("Maps")) addBlockedFiles("Maps"); + if(!isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap"); + if(!isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); + + boolean ordered = !isModuleEnabled("OrderedMap"); + if(ordered) addBlockedFiles("OrderedMap"); + boolean hashMap = !isModuleEnabled("HashMap"); + if(hashMap) addBlockedFiles("OpenHashMap"); + if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap"); + + boolean customHashMap = !isModuleEnabled("CustomHashMap"); + if(customHashMap) addBlockedFiles("OpenCustomHashMap"); + if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap"); + + boolean enumMap = !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(sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap"); + if(sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap"); + if(keyType == ClassType.BOOLEAN) { //Main Classes diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template index 01530d90..d2fb3b9c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/abstracts/AbstractMap.template @@ -11,7 +11,9 @@ import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.SET; +#if MAPS_FEATURE import speiger.src.collections.PACKAGE.utils.maps.MAPS; +#endif import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; #if !SAME_TYPE @@ -19,6 +21,7 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR; #endif import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_SUPPLIER; +import speiger.src.collections.objects.collections.ObjectIterable; #if !TYPE_OBJECT && !VALUE_OBJECT import speiger.src.collections.objects.collections.ObjectIterator; #endif @@ -47,6 +50,22 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap getFastIterable(MAP KEY_VALUE_GENERIC_TYPE map) { +#if MAPS_FEATURE + return MAPS.fastIterable(map); +#else + return map.ENTRY_SET(); +#endif + } + + protected ObjectIterator getFastIterator(MAP KEY_VALUE_GENERIC_TYPE map) { +#if MAPS_FEATURE + return MAPS.fastIterator(map); +#else + return map.ENTRY_SET().iterator(); +#endif + } + @Override public MAP KEY_VALUE_GENERIC_TYPE copy() { throw new UnsupportedOperationException(); @@ -63,14 +82,14 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(m);iter.hasNext();) { + for(ObjectIterator iter = getFastIterator(m);iter.hasNext();) { MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); put(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); } @@ -101,7 +120,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(this);iter.hasNext();) { + for(ObjectIterator iter = getFastIterator(this);iter.hasNext();) { MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); entry.setValue(mappingFunction.APPLY_VALUE(entry.ENTRY_KEY(), entry.ENTRY_VALUE())); } @@ -246,7 +265,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(this);iter.hasNext();) { + for(ObjectIterator iter = getFastIterator(this);iter.hasNext();) { MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); action.accept(entry.ENTRY_KEY(), entry.ENTRY_VALUE()); } @@ -332,7 +351,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(ABSTRACT_MAP.this); + ObjectIterator iter = getFastIterator(ABSTRACT_MAP.this); @Override public boolean hasNext() { return iter.hasNext(); @@ -383,7 +402,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(ABSTRACT_MAP.this); + ObjectIterator iter = getFastIterator(ABSTRACT_MAP.this); @Override public boolean hasNext() { return iter.hasNext(); @@ -423,7 +442,7 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap iter = MAPS.fastIterator(this); + ObjectIterator iter = getFastIterator(this); while(iter.hasNext()) hash += iter.next().hashCode(); return hash; } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template index 8f4c4b61..f2f536fd 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/OpenCustomHashMap.template @@ -24,7 +24,6 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; -import speiger.src.collections.PACKAGE.utils.maps.MAPS; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.SET; @@ -607,7 +606,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { KEY_TYPE key = entry.ENTRY_KEY(); int index = findIndex(key); VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template index 24e30d14..95e6aa92 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template @@ -24,7 +24,6 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP; -import speiger.src.collections.PACKAGE.utils.maps.MAPS; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.SET; @@ -568,7 +567,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { KEY_TYPE key = entry.ENTRY_KEY(); int index = findIndex(key); VALUE_TYPE newValue = index < 0 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template index 780cac6c..51360f33 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template @@ -28,7 +28,6 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.ORDERED_SET; #endif -import speiger.src.collections.PACKAGE.utils.maps.MAPS; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.utils.ARRAYS; #endif @@ -215,7 +214,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ KEY_TYPE[] keys = NEW_KEY_ARRAY(map.size()); VALUE_TYPE[] values = NEW_VALUE_ARRAY(keys.length); int index = 0; - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(map)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(map)) { keys[index] = entry.ENTRY_KEY(); values[index] = entry.ENTRY_VALUE(); index++; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template index fdc3af20..c17e99c5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template @@ -27,7 +27,6 @@ import speiger.src.collections.PACKAGE.maps.interfaces.MAP; import speiger.src.collections.PACKAGE.maps.interfaces.ORDERED_MAP; import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.ORDERED_SET; -import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; @@ -176,7 +175,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN */ public ARRAY_MAP(MAP KEY_VALUE_GENERIC_TYPE map) { this(map.size()); - for(ObjectIterator iter = MAPS.fastIterator(map);iter.hasNext();size++) { + for(ObjectIterator iter = getFastIterator(map);iter.hasNext();size++) { MAP.Entry KEY_VALUE_GENERIC_TYPE entry = iter.next(); keys[size] = entry.ENTRY_KEY(); values[size] = entry.ENTRY_VALUE(); @@ -566,7 +565,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { KEY_TYPE key = entry.ENTRY_KEY(); int index = findIndex(key); VALUE_TYPE newValue = index == -1 || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/EnumMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/EnumMap.template index eb71035c..a8cc1ef2 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/EnumMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/EnumMap.template @@ -19,7 +19,6 @@ import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #endif import speiger.src.collections.PACKAGE.functions.function.FUNCTION; -import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.objects.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.objects.maps.interfaces.MAP; import speiger.src.collections.objects.sets.AbstractObjectSet; @@ -449,7 +448,7 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { T key = entry.ENTRY_KEY(); int index = key.ordinal(); VALUE_TYPE newValue = !isSet(index) || VALUE_EQUALS(values[index], getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(values[index], entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template index f2c57b43..eb7fcc8c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/AVLTreeMap.template @@ -33,7 +33,6 @@ import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; #if TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.SET; #endif -import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; @@ -627,7 +626,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { KEY_TYPE key = entry.ENTRY_KEY(); Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key); VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template index d8e94c85..7524e3d5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/tree/RBTreeMap.template @@ -33,7 +33,6 @@ import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; #if TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.SET; #endif -import speiger.src.collections.PACKAGE.utils.maps.MAPS; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; @@ -630,7 +629,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G @Override public void BULK_MERGE(MAP KEY_VALUE_GENERIC_TYPE m, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction) { Objects.requireNonNull(mappingFunction); - for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : MAPS.fastIterable(m)) { + for(MAP.Entry KEY_VALUE_GENERIC_TYPE entry : getFastIterable(m)) { KEY_TYPE key = entry.ENTRY_KEY(); Node KEY_VALUE_GENERIC_TYPE subEntry = findNode(key); VALUE_TYPE newValue = subEntry == null || VALUE_EQUALS(subEntry.value, getDefaultReturnValue()) ? entry.ENTRY_VALUE() : mappingFunction.APPLY_VALUE(subEntry.value, entry.ENTRY_VALUE()); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/Map.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/Map.template index 1d3e2f53..9f3a8dd9 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/Map.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/Map.template @@ -12,34 +12,65 @@ import java.util.function.Consumer; import java.util.function.Function; #if TYPE_OBJECT +#if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE import java.util.Comparator; #endif +#endif import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; -#if !TYPE_OBJECT && !TYPE_BOOLEAN +#if !TYPE_OBJECT && !TYPE_BOOLEAN && SORTED_MAP_FEATURE +#if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif +#endif #if !TYPE_BOOLEAN +#if LINKED_CUSTOM_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.customHash.LINKED_CUSTOM_HASH_MAP; +#endif +#if CUSTOM_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.customHash.CUSTOM_HASH_MAP; +#endif +#if LINKED_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.hash.LINKED_HASH_MAP; +#endif +#if MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.hash.HASH_MAP; +#endif +#if IMMUTABLE_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.immutable.IMMUTABLE_HASH_MAP; +#endif +#if AVL_TREE_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.tree.AVL_TREE_MAP; +#endif +#if RB_TREE_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.tree.RB_TREE_MAP; +#endif +#if ARRAY_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.misc.ARRAY_MAP; +#endif +#if CONCURRENT_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.concurrent.CONCURRENT_HASH_MAP; +#endif #if TYPE_OBJECT +#if ENUM_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.misc.ENUM_MAP; +#endif +#if LINKED_ENUM_MAP_FEATURE import speiger.src.collections.PACKAGE.maps.impl.misc.LINKED_ENUM_MAP; #endif +#endif + import speiger.src.collections.objects.collections.ObjectIterable; +#if CUSTOM_MAP_FEATURE || LINKED_CUSTOM_MAP_FEATURE import speiger.src.collections.PACKAGE.utils.STRATEGY; +#endif +#if MAPS_FEATURE import speiger.src.collections.PACKAGE.utils.maps.MAPS; #endif +#endif import speiger.src.collections.PACKAGE.sets.SET; #if !SAME_TYPE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR; @@ -505,7 +536,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map ENTRY_SET(); -#if !TYPE_BOOLEAN +#if MAPS_FEATURE /** * Creates a Wrapped Map that is Synchronized * @return a new Map that is synchronized @@ -658,6 +689,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map map, COMPARATOR KEY_GENERIC_TYPE comp) { return new AVL_TREE_MAPKV_BRACES(map, comp); } +#endif } /** @@ -1454,7 +1505,11 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map E putElements(E e){ e.putAll(keys, values, 0, size); return e; } +#endif +#if MAP_FEATURE /** * Builds the Keys and Values into a Hash Map * @return a HASH_MAP @@ -1496,6 +1554,8 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map ENTRY_SET(); +#if MAPS_FEATURE /** * Creates a Wrapped SortedMap that is Synchronized * @return a new SortedMap that is synchronized @@ -127,6 +130,7 @@ public interface ORDERED_MAP KEY_VALUE_GENERIC_TYPE extends MAP KEY_VALUE_GENERI @Override public default ORDERED_MAP KEY_VALUE_GENERIC_TYPE unmodifiable() { return MAPS.unmodifiable(this); } +#endif /** * Fast Ordered Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value * @Type(T) diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template index d186f366..4cabf571 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/interfaces/SortedMap.template @@ -10,7 +10,9 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.sets.SORTED_SET; +#if MAPS_FEATURE import speiger.src.collections.PACKAGE.utils.maps.MAPS; +#endif #if !TYPE_OBJECT import speiger.src.collections.objects.sets.ObjectSortedSet; #endif @@ -37,6 +39,7 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap Date: Tue, 6 Dec 2022 03:21:48 +0100 Subject: [PATCH 10/20] Fixed a small bug where generic types can not be disabled. --- ModulSettings.json | 180 +++++++++--------- .../speiger/src/builder/SettingsManager.java | 2 +- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 57bc98e3..ec1c9e10 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -9,12 +9,12 @@ "PriorityQueue": true, "Set": true, "Boolean": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -23,7 +23,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -32,7 +32,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -41,7 +41,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -50,7 +50,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -59,7 +59,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -68,7 +68,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -77,7 +77,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -86,7 +86,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -116,12 +116,12 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -147,7 +147,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -173,7 +173,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -199,7 +199,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -225,7 +225,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -251,7 +251,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -277,7 +277,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -303,7 +303,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -329,7 +329,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -376,12 +376,12 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -407,7 +407,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -433,7 +433,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -459,7 +459,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -485,7 +485,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -511,7 +511,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -537,7 +537,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -563,7 +563,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -589,7 +589,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -636,12 +636,12 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -667,7 +667,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -693,7 +693,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -719,7 +719,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -745,7 +745,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -771,7 +771,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -797,7 +797,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -823,7 +823,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -849,7 +849,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -896,12 +896,12 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -927,7 +927,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -953,7 +953,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -979,7 +979,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1005,7 +1005,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1031,7 +1031,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1057,7 +1057,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1083,7 +1083,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1109,7 +1109,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1156,12 +1156,12 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1187,7 +1187,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1213,7 +1213,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1239,7 +1239,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1265,7 +1265,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1291,7 +1291,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1317,7 +1317,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1343,7 +1343,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1369,7 +1369,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1416,12 +1416,12 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1447,7 +1447,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1473,7 +1473,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1499,7 +1499,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1525,7 +1525,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1551,7 +1551,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1577,7 +1577,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1603,7 +1603,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1629,7 +1629,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1676,12 +1676,12 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1707,7 +1707,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1733,7 +1733,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1759,7 +1759,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1785,7 +1785,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1811,7 +1811,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1837,7 +1837,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1863,7 +1863,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1889,7 +1889,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1936,12 +1936,12 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Base": { "Enabled": true }, "Boolean": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1967,7 +1967,7 @@ } }, "Byte": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -1993,7 +1993,7 @@ } }, "Short": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2019,7 +2019,7 @@ } }, "Character": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2045,7 +2045,7 @@ } }, "Integer": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2071,7 +2071,7 @@ } }, "Long": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2097,7 +2097,7 @@ } }, "Float": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2123,7 +2123,7 @@ } }, "Double": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, @@ -2149,7 +2149,7 @@ } }, "Object": { - "enabled": true, + "Enabled": true, "Function": { "Enabled": true }, diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index 552e5074..59cbe6a8 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -113,7 +113,7 @@ public class SettingsManager if(obj == null) { obj = new JsonObject(); data.add(name, obj); - if(create) obj.addProperty("enabled", true); + if(create) obj.addProperty("Enabled", true); } return obj; } From 2ed090e98929a1ab98fb80e0dc573e4b9ff01e22 Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 6 Dec 2022 04:09:40 +0100 Subject: [PATCH 11/20] Fixed a few bugs and Started the Set compilation. --- ModulSettings.json | 107 ++++++++++++++++-- .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../src/builder/modules/MapModule.java | 5 +- .../src/builder/modules/SetModule.java | 70 +++++++++++- .../templates/utils/maps/Maps.template | 5 +- 5 files changed, 169 insertions(+), 20 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index ec1c9e10..ef317355 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -108,9 +108,6 @@ "ArrayList": true, "LinkedList": true }, - "Set": { - "Enabled": true - }, "Async": { "Enabled": true } @@ -369,7 +366,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -629,7 +637,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -889,7 +908,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -1149,7 +1179,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -1409,7 +1450,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -1669,7 +1721,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -1929,7 +1992,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true @@ -2189,7 +2263,18 @@ "LinkedList": true }, "Set": { - "Enabled": true + "Enabled": true, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, + "OrderedSet": true, + "ArraySet": true, + "AVLTreeSet": true, + "ImmutableSet": true, + "CustomHashSet": true, + "Sets": true, + "SortedSet": true, + "HashSet": true, + "RBTreeSet": true }, "Async": { "Enabled": true diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index e495c6fa..bf6e8ecb 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -240,7 +240,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); boolean load = flags.contains("load"); - boolean save = flags.contains("save"); + boolean save = !flags.contains("save"); int flag = (load ? LOAD : 0) | (save ? SAVE : 0); new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); if(tests) { diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index 1356449f..25d396e1 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -33,7 +33,8 @@ public class MapModule extends BaseModule } @Override - protected void loadFlags() { + protected void loadFlags() + { if(isModuleEnabled()) addFlag("MAP_MODULE"); if(isModuleEnabled("Maps")) addFlag("Maps"); boolean hashMap = isModuleEnabled("HashMap"); @@ -81,7 +82,7 @@ public class MapModule extends BaseModule if(enumMap) addBlockedFiles("EnumMap"); if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap"); - if(ordered || isModuleEnabled("ArrayMap")) addBlockedFiles("ArrayMap"); + if(ordered || !isModuleEnabled("ArrayMap")) addBlockedFiles("ArrayMap"); boolean sorted = !isModuleEnabled("SortedMap"); if(sorted) addBlockedFiles("SortedMap", "NavigableMap"); diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index b5723d60..9d880ae5 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -1,5 +1,9 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; + import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") @@ -9,12 +13,74 @@ public class SetModule extends BaseModule public String getModuleName() { return "Set"; } @Override protected void loadVariables() {} + @Override - protected void loadFlags() {} + public boolean isModuleValid(ClassType keyType, ClassType valueType) + { + return keyType != ClassType.BOOLEAN; + } + + @Override + public Set getModuleKeys(ClassType keyType, ClassType valueType) + { + Set sets = new HashSet<>(); + sets.add("Sets"); + sets.addAll(Arrays.asList("OrderedSet", "SortedSet")); + sets.addAll(Arrays.asList("ArraySet", "ImmutableSet")); + sets.addAll(Arrays.asList("HashSet", "LinkedHashSet")); + sets.addAll(Arrays.asList("CustomHashSet", "LinkedCustomHashSet")); + sets.addAll(Arrays.asList("AVLTreeSet", "RBTreeSet")); + return sets; + } + + @Override + protected void loadFlags() + { + if(isModuleEnabled()) addFlag("SET_MODULE"); + if(isModuleEnabled("Sets")) addFlag("Sets"); + boolean hashSet = isModuleEnabled("HashSet"); + boolean customHashSet = isModuleEnabled("CustomHashSet"); + + if(isModuleEnabled("OrderedSet")) { + addFlag("ORDERED_SET_FEATURE"); + if(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(isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE"); + if(isModuleEnabled("RBTreeSet")) addFlag("RB_TREE_SET_FEATURE"); + } + if(isModuleEnabled("ImmutableSet")) addFlag("IMMUTABLE_SET_FEATURE"); + if(hashSet) addFlag("HASH_SET_FEATURE"); + if(customHashSet) addFlag("CUSTOM_HASH_SET_FEATURE"); + } @Override protected void loadBlockades() { + if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet"); + if(!isModuleEnabled("Sets")) addBlockedFiles("Sets"); + if(!isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet"); + + boolean ordered = !isModuleEnabled("OrderedSet"); + if(ordered) addBlockedFiles("OrderedSet"); + boolean hashSet = !isModuleEnabled("HashSet"); + if(hashSet) addBlockedFiles("OpenHashSet"); + if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet"); + + boolean customHashSet = !isModuleEnabled("CustomHashSet"); + if(customHashSet) addBlockedFiles("OpenCustomHashSet"); + if(customHashSet || ordered || !isModuleEnabled("LinkedCustomHashSet")) addBlockedFiles("LinkedOpenCustomHashSet"); + + if(ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet"); + + boolean sorted = !isModuleEnabled("SortedSet"); + if(sorted) addBlockedFiles("SortedSet", "NavigableSet"); + if(sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet"); + if(sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet"); + if(keyType == ClassType.BOOLEAN) { //Main Classes @@ -24,7 +90,7 @@ public class SetModule extends BaseModule //Test Classes addBlockedFiles("SetTests", "SetTestSuiteBuilder"); - addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedMapNavigationTester", "OrderedMapTestSuiteBuilder", "OrderedSetIterationTester"); + addBlockedFiles("OrderedSetTestSuiteBuilder", "TestOrderedSetGenerator", "OrderedSetMoveTester", "OrderedSetNavigationTester", "OrderedSetIterationTester"); addBlockedFiles("SortedSetTestSuiteBuilder", "TestSortedSetGenerator", "SortedSetNaviationTester", "SortedSetSubsetTestSetGenerator", "SortedSetIterationTester", "SortedSetNaviationTester"); addBlockedFiles("NavigableSetTestSuiteBuilder", "TestNavigableSetGenerator", "NavigableSetNavigationTester"); } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template index ea7954e7..d60338cf 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/maps/Maps.template @@ -126,8 +126,6 @@ public class MAPS else entries.forEach(action); } -#if !TYPE_BOOLEAN - /** * Helper function that creates a Helper wrapper to synchronize access into the map. * @param map the map that should be synchronized @@ -198,7 +196,7 @@ public class MAPS public static GENERIC_KEY_VALUE_BRACES ORDERED_MAP KEY_VALUE_GENERIC_TYPE synchronize(ORDERED_MAP KEY_VALUE_GENERIC_TYPE map, Object mutex) { return map instanceof SynchronizedOrderedMap ? map : new SynchronizedOrderedMapKV_BRACES(map, mutex); } #endif -#if NAVIGABLE_MAP_FEATURE +#if SORTED_MAP_FEATURE /** * Helper function that creates a Helper wrapper to synchronize access into the NavigableMap. * @param map the NavigableMap that should be synchronized @@ -1174,5 +1172,4 @@ public class MAPS public void forEach(BiConsumer action) { synchronized(mutex) { map.forEach(action); } } #endif } -#endif } \ No newline at end of file From d44ad2d42e0119dabb895c264f0a11fd6b2e4f6c Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 6 Dec 2022 04:57:43 +0100 Subject: [PATCH 12/20] 99% of the Set Module done. The 1% is the Distinct Iterator that relies on a Set implementation. So I have to make a dedicated set implementation. --- ModulSettings.json | 52 +++++++++---------- .../builder/PrimitiveCollectionsBuilder.java | 4 +- .../templates/collections/Iterable.template | 42 +++++++++++++-- .../templates/sets/NavigableSet.template | 4 +- .../templates/sets/OrderedSet.template | 4 +- .../collections/templates/sets/Set.template | 4 +- .../templates/sets/SortedSet.template | 4 +- .../templates/utils/AsyncBuilder.template | 36 ++++++++++++- .../collections/templates/utils/Sets.template | 41 ++++++++++----- .../templates/utils/Strategy.template | 26 ++++++++++ 10 files changed, 167 insertions(+), 50 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index ef317355..634f21db 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -4,10 +4,10 @@ "Collection": true, "Function": true, "List": true, - "Map": true, + "Map": false, "Pair": true, "PriorityQueue": true, - "Set": true, + "Set": false, "Boolean": { "Enabled": true, "Base": { @@ -367,15 +367,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -638,15 +638,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -909,15 +909,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -1180,15 +1180,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -1451,15 +1451,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -1722,15 +1722,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -1993,15 +1993,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, @@ -2264,15 +2264,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, + "LinkedHashSet": false, + "LinkedCustomHashSet": false, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": true, + "SortedSet": false, "HashSet": true, "RBTreeSet": true }, diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index bf6e8ecb..e8623a64 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -239,8 +239,8 @@ 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 save = !flags.contains("save"); + 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); if(tests) { diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index afb91941..631850e5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -25,9 +25,25 @@ import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif #endif -#if !TYPE_BOOLEAN +#if SET_MODULE && !TYPE_BOOLEAN import speiger.src.collections.PACKAGE.sets.SET; +#if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE +#if LINKED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; +#else if LINKED_CUSTOM_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.LINKED_CUSTOM_HASH_SET; +#else if SET_FEATURE +import speiger.src.collections.PACKAGE.sets.HASH_SET; +#else if CUSTOM_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.CUSTOM_HASH_SET; +#else if RB_TREE_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.RB_TREE_SET; +#else if AVL_TREE_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.AVL_TREE_SET; +#else if ARRAY_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.ARRAY_SET; +#endif +#endif #endif import speiger.src.collections.PACKAGE.utils.ARRAYS; #if ASYNC_MODULE @@ -36,6 +52,9 @@ import speiger.src.collections.PACKAGE.utils.ASYNC_BUILDER; import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; import speiger.src.collections.PACKAGE.utils.ITERABLES; import speiger.src.collections.PACKAGE.utils.ITERATORS; +#if !LINKED_HASH_SET_FEATURE && LINKED_CUSTOM_HASH_SET_FEATURE +import speiger.src.collections.PACKAGE.utils.STRATEGY; +#endif import speiger.src.collections.utils.ISizeProvider; /** @@ -227,17 +246,32 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable } #endif -#if !TYPE_BOOLEAN +#if !TYPE_BOOLEAN && SET_MODULE +#if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE /** * A Helper function that reduces the usage of streams and allows to collect all elements as a LinkedHashSet * @return a new LinkedHashSet of all elements */ default SET KEY_GENERIC_TYPE pourAsSet() { - return pour(new LINKED_HASH_SETBRACES()); +#if LINKED_SET_FEATURE + return pour(new LINKED_HASH_SETBRACES()); +#else if LINKED_CUSTOM_SET_FEATURE + return pour(new LINKED_CUSTOM_HASH_SETBRACES(STRATEGY.normalStrategy())); +#else if SET_FEATURE + return pour(new HASH_SETBRACES()); +#else if CUSTOM_SET_FEATURE + return pour(new CUSTOM_HASH_SETBRACES(STRATEGY.normalStrategy())); +#else if RB_TREE_SET_FEATURE + return pour(new RB_Tree_SETBRACES()); +#else if AVL_TREE_SET_FEATURE + return pour(new AVL_Tree_SETBRACES()); +#else if ARRAY_SET_FEATURE + return pour(new ARRAY_SETBRACES()); +#endif } #endif - +#endif #if TYPE_OBJECT /** * A Helper function that reduces the usage of streams and allows to collect all elements as a Array diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/NavigableSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/NavigableSet.template index 7ef6d3e5..eaa07b73 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/NavigableSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/NavigableSet.template @@ -4,7 +4,9 @@ import java.util.NavigableSet; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; +#if SETS_FEATURE import speiger.src.collections.PACKAGE.utils.SETS; +#endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; /** @@ -119,7 +121,7 @@ public interface NAVIGABLE_SET KEY_GENERIC_TYPE extends NavigableSet @Override public NAVIGABLE_SET KEY_GENERIC_TYPE copy(); -#if !TYPE_BOOLEAN +#if SETS_FEATURE /** * Creates a Wrapped NavigableSet that is Synchronized * @return a new NavigableSet that is synchronized diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/OrderedSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/OrderedSet.template index 03ca7039..f98bf742 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OrderedSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OrderedSet.template @@ -2,7 +2,9 @@ package speiger.src.collections.PACKAGE.sets; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; +#if SETS_FEATURE import speiger.src.collections.PACKAGE.utils.SETS; +#endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; /** @@ -87,7 +89,7 @@ public interface ORDERED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE */ public KEY_TYPE POLL_LAST_KEY(); -#if !TYPE_BOOLEAN +#if SETS_FEATURE /** * Creates a Wrapped OrderedSet that is Synchronized * @return a new OrderedSet that is synchronized diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/Set.template b/src/builder/resources/speiger/assets/collections/templates/sets/Set.template index 97681f1d..a83e5c6e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/Set.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/Set.template @@ -5,7 +5,7 @@ import java.util.Set; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; -#if !TYPE_BOOLEAN +#if SETS_FEATURE import speiger.src.collections.PACKAGE.utils.SETS; #endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; @@ -64,7 +64,7 @@ public interface SET KEY_GENERIC_TYPE extends Set, COLLECTION KEY_GE public KEY_TYPE addOrGet(KEY_TYPE o); #endif -#if !TYPE_BOOLEAN +#if SETS_FEATURE /** * Creates a Wrapped Set that is Synchronized * @return a new Set that is synchronized diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template index 884505d5..01cc4f91 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/SortedSet.template @@ -9,7 +9,9 @@ import java.util.Comparator; #else import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif +#if SETS_FEATURE import speiger.src.collections.PACKAGE.utils.SETS; +#endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; /** @@ -41,7 +43,7 @@ public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, Sorte */ public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement); -#if !TYPE_BOOLEAN +#if SETS_FEATURE /** * Creates a Wrapped SortedSet that is Synchronized * @return a new SortedSet that is synchronized diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index ce3d73af..12c6fedc 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -36,8 +36,26 @@ import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif #if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE +#if SET_MODULE import speiger.src.collections.PACKAGE.sets.SET; +#if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE +#if LINKED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; +#else if LINKED_CUSTOM_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.LINKED_CUSTOM_HASH_SET; +#else if SET_FEATURE +import speiger.src.collections.PACKAGE.sets.HASH_SET; +#else if CUSTOM_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.CUSTOM_HASH_SET; +#else if RB_TREE_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.RB_TREE_SET; +#else if AVL_TREE_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.AVL_TREE_SET; +#else if ARRAY_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.ARRAY_SET; +#endif +#endif +#endif #endif #if !TYPE_BOOLEAN && BOOLEAN_ASYNC_MODULE import speiger.src.collections.booleans.utils.BooleanAsyncBuilder; @@ -288,15 +306,31 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE } #endif -#if !TYPE_BOOLEAN +#if !TYPE_BOOLEAN && SET_MODULE +#if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE /** * Pours all elements into a Set that can be later * @return a new Builder with the pour function applied */ public ObjectAsyncBuilder pourAsSet() { +#if LINKED_SET_FEATURE return pour(new LINKED_HASH_SETBRACES()); +#else if LINKED_CUSTOM_SET_FEATURE + return pour(new LINKED_CUSTOM_HASH_SETBRACES(STRATEGY.normalStrategy())); +#else if SET_FEATURE + return pour(new HASH_SETBRACES()); +#else if CUSTOM_SET_FEATURE + return pour(new CUSTOM_HASH_SETBRACES(STRATEGY.normalStrategy())); +#else if RB_TREE_SET_FEATURE + return pour(new RB_Tree_SETBRACES()); +#else if AVL_TREE_SET_FEATURE + return pour(new AVL_Tree_SETBRACES()); +#else if ARRAY_SET_FEATURE + return pour(new ARRAY_SETBRACES()); +#endif } +#endif #endif /** * Pours all elements into a collection that can be later diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template index 8d63b4c5..14e62c05 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Sets.template @@ -2,31 +2,30 @@ package speiger.src.collections.PACKAGE.utils; import java.util.NoSuchElementException; import java.util.Set; -#if TYPE_BOOLEAN -import speiger.src.collections.booleans.collections.BooleanIterator; -import speiger.src.collections.booleans.sets.AbstractBooleanSet; -import speiger.src.collections.booleans.sets.BooleanSet; -import speiger.src.collections.booleans.utils.BooleanCollections.EmptyCollection; -#else -#if TYPE_OBJECT +#if TYPE_OBJECT && SORTED_SET_FEATURE import java.util.Comparator; #endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; -#if !TYPE_OBJECT +#if !TYPE_OBJECT && SORTED_SET_FEATURE import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.collections.ITERATOR; +#if SORTED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET; +#endif import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; import speiger.src.collections.PACKAGE.sets.SET; +#if ORDERED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.ORDERED_SET; +#endif +#if SORTED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.SORTED_SET; +#endif import speiger.src.collections.PACKAGE.utils.COLLECTIONS.EmptyCollection; import speiger.src.collections.PACKAGE.utils.COLLECTIONS.SynchronizedCollection; import speiger.src.collections.PACKAGE.utils.COLLECTIONS.UnmodifiableCollection; import speiger.src.collections.utils.ITrimmable; -#endif /** * A Helper class for sets @@ -51,7 +50,6 @@ public class SETS #endif } -#if !TYPE_BOOLEAN /** * Creates a Synchronized set while preserving the ITrimmable interface * @param s the set that should be synchronized @@ -75,6 +73,7 @@ public class SETS return s instanceof SynchronizedSet ? s : (s instanceof ITrimmable ? new SynchronizedTrimSetBRACES(s, mutex) : new SynchronizedSetBRACES(s, mutex)); } +#if SORTED_SET_FEATURE /** * Creates a Synchronized SortedSet while preserving the ITrimmable interface * @param s the set that should be synchronized @@ -98,6 +97,8 @@ public class SETS return s instanceof SynchronizedSortedSet ? s : (s instanceof ITrimmable ? new SynchronizedSortedTrimSetBRACES(s, mutex) : new SynchronizedSortedSetBRACES(s, mutex)); } +#endif +#if ORDERED_SET_FEATURE /** * Creates a Synchronized OrderedSet while preserving the ITrimmable interface * @param s the set that should be synchronized @@ -121,6 +122,8 @@ public class SETS return s instanceof SynchronizedOrderedSet ? s : (s instanceof ITrimmable ? new SynchronizedOrderedTrimSetBRACES(s, mutex) : new SynchronizedOrderedSetBRACES(s, mutex)); } +#endif +#if SORTED_SET_FEATURE /** * Creates a Synchronized NavigableSet while preserving the ITrimmable interface * @param s the set that should be synchronized @@ -144,6 +147,7 @@ public class SETS return s instanceof SynchronizedNavigableSet ? s : (s instanceof ITrimmable ? new SynchronizedNavigableTrimSetBRACES(s, mutex) : new SynchronizedNavigableSetBRACES(s, mutex)); } +#endif /** * Creates Unmodifyable Set wrapper * @param s set that should be made unmodifiable @@ -154,6 +158,7 @@ public class SETS return s instanceof UnmodifiableSet ? s : new UnmodifiableSetBRACES(s); } +#if SORTED_SET_FEATURE /** * Creates Unmodifyable SortedSet wrapper * @param s sortedSet that should be made unmodifiable @@ -164,6 +169,8 @@ public class SETS return s instanceof UnmodifiableSortedSet ? s : new UnmodifiableSortedSetBRACES(s); } +#endif +#if ORDERED_SET_FEATURE /** * Creates Unmodifyable OrderedSet wrapper * @param s OrderedSet that should be made unmodifiable @@ -174,6 +181,8 @@ public class SETS return s instanceof UnmodifiableOrderedSet ? s : new UnmodifiableOrderedSetBRACES(s); } +#endif +#if SORTED_SET_FEATURE /** * Creates Unmodifyable NavigableSet wrapper * @param s navigableSet that should be made unmodifiable @@ -254,7 +263,7 @@ public class SETS public EmptySet KEY_GENERIC_TYPE copy() { return this; } } -#if !TYPE_BOOLEAN +#if SORTED_SET_FEATURE private static class UnmodifiableNavigableSet KEY_GENERIC_TYPE extends UnmodifiableSortedSet KEY_GENERIC_TYPE implements NAVIGABLE_SET KEY_GENERIC_TYPE { NAVIGABLE_SET KEY_GENERIC_TYPE n; @@ -340,6 +349,8 @@ public class SETS public NAVIGABLE_SET KEY_GENERIC_TYPE tailSet(KEY_TYPE fromElement) { return SETS.unmodifiable(n.tailSet(fromElement)); } } +#endif +#if ORDERED_SET_FEATURE private static class UnmodifiableOrderedSet KEY_GENERIC_TYPE extends UnmodifiableSet KEY_GENERIC_TYPE implements ORDERED_SET KEY_GENERIC_TYPE { ORDERED_SET KEY_GENERIC_TYPE s; @@ -373,6 +384,8 @@ public class SETS public KEY_TYPE POLL_LAST_KEY() { throw new UnsupportedOperationException(); } } +#endif +#if SORTED_SET_FEATURE private static class UnmodifiableSortedSet KEY_GENERIC_TYPE extends UnmodifiableSet KEY_GENERIC_TYPE implements SORTED_SET KEY_GENERIC_TYPE { SORTED_SET KEY_GENERIC_TYPE s; @@ -406,6 +419,7 @@ public class SETS public KEY_TYPE POLL_LAST_KEY() { throw new UnsupportedOperationException(); } } +#endif /** * Unmodifyable Set wrapper that helps is used with unmodifyableSet function * @Type(T) @@ -434,6 +448,7 @@ public class SETS #endif } +#if SORTED_SET_FEATURE private static class SynchronizedNavigableTrimSet KEY_GENERIC_TYPE extends SynchronizedNavigableSet KEY_GENERIC_TYPE implements ITrimmable { ITrimmable trim; @@ -597,6 +612,8 @@ public class SETS public KEY_TYPE POLL_LAST_KEY() { synchronized(mutex) { return s.POLL_LAST_KEY(); } } } +#endif +#if ORDERED_SET_FEATURE private static class SynchronizedOrderedTrimSet KEY_GENERIC_TYPE extends SynchronizedOrderedSet KEY_GENERIC_TYPE implements ITrimmable { ITrimmable trim; @@ -656,6 +673,7 @@ public class SETS public KEY_TYPE POLL_LAST_KEY() { synchronized(mutex) { return s.POLL_LAST_KEY(); } } } +#endif private static class SynchronizedTrimSet KEY_GENERIC_TYPE extends SynchronizedSet KEY_GENERIC_TYPE implements ITrimmable { ITrimmable trim; @@ -704,5 +722,4 @@ public class SETS public boolean remove(KEY_TYPE o) { synchronized(mutex) { return s.remove(o); } } #endif } -#endif } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Strategy.template b/src/builder/resources/speiger/assets/collections/templates/utils/Strategy.template index 8fc4af5b..b49581b9 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Strategy.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Strategy.template @@ -1,5 +1,7 @@ package speiger.src.collections.PACKAGE.utils; +import java.util.Objects; + /** * A Type Specific Strategy class that allows to give control hashcode generation and equals comparason for maps * @Type(T) @@ -19,6 +21,17 @@ public interface STRATEGY KEY_GENERIC_TYPE public static GENERIC_KEY_BRACES STRATEGY KEY_GENERIC_TYPE identityStrategy() { return (STRATEGY)IDENTITY; } #endif + /** + * Normal Strategy + */ + public static final STRATEGY NO_GENERIC_TYPE NORMAL = new NormalStrategyBRACES(); + + /** + * @Type(T) + * @return a Normal Strategy that is behaving exactly like the normal Hash Strategy in the Hash Collections + */ + public static GENERIC_KEY_BRACES STRATEGY KEY_GENERIC_TYPE normalStrategy() { return (STRATEGY KEY_GENERIC_TYPE)NORMAL; } + /** * Type Specific HashCode function * @param o the element that the hashcode is requested for (if object may be null) @@ -47,5 +60,18 @@ public interface STRATEGY KEY_GENERIC_TYPE @Override public boolean equals(KEY_TYPE key, KEY_TYPE value) { return key == value; } } + #endif + /** + * A Strategy that simulates the normal Hash Collection Behavior if you want to use Hash Control Collections to replace normal ones. + * Only real reason to do that is you have to use this and want to get rid of implementations. + * @Type(T) + */ + public static class NormalStrategy KEY_GENERIC_TYPE implements STRATEGY KEY_GENERIC_TYPE + { + @Override + public int hashCode(KEY_TYPE o) { return KEY_TO_HASH(o); } + @Override + public boolean equals(KEY_TYPE key, KEY_TYPE value) { return EQUALS_KEY_TYPE(key, value); } + } } \ No newline at end of file From 8d8c30c9a7029e7880cd08100b5cba63266e0960 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 02:50:42 +0100 Subject: [PATCH 13/20] Finishing the Set configuration. --- .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../templates/utils/Collections.template | 317 ++++++++++++++++++ .../templates/utils/Iterables.template | 8 +- .../templates/utils/Iterators.template | 7 +- 4 files changed, 322 insertions(+), 12 deletions(-) diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index e8623a64..e495c6fa 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -239,7 +239,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); diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template index 43122c0a..7b13c5d4 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -2,6 +2,9 @@ package speiger.src.collections.PACKAGE.utils; import java.util.Arrays; import java.util.Collection; +#if !TYPE_BOOLEAN +import java.util.ConcurrentModificationException; +#endif import java.util.NoSuchElementException; import java.util.Objects; #if TYPE_OBJECT @@ -28,6 +31,9 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !TYPE_BOOLEAN +import speiger.src.collections.utils.HashUtil; +#endif import speiger.src.collections.utils.ITrimmable; import speiger.src.collections.utils.SanityChecks; @@ -103,6 +109,16 @@ public class COLLECTIONS return new CollectionWrapperBRACES(size); } +#if !TYPE_BOOLEAN + protected static GENERIC_KEY_BRACES DistinctCollectionWrapper KEY_GENERIC_TYPE distinctWrapper() { + return new DistinctCollectionWrapperBRACES(); + } + + protected static GENERIC_KEY_BRACES DistinctCollectionWrapper KEY_GENERIC_TYPE distinctWrapper(int size) { + return new DistinctCollectionWrapperBRACES(size); + } + +#endif protected static class CollectionWrapper KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE implements ITrimmable { KEY_TYPE[] elements; int size = 0; @@ -289,6 +305,307 @@ public class COLLECTIONS #endif } +#if !TYPE_BOOLEAN + protected static class DistinctCollectionWrapper KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE { + KEY_TYPE[] keys; + boolean containsNull; + int minCapacity; + int nullIndex; + int maxFill; + int mask; + int size; + + public DistinctCollectionWrapper() { + this(HashUtil.DEFAULT_MIN_CAPACITY); + } + + public DistinctCollectionWrapper(int size) { + if(minCapacity < 0) throw new IllegalStateException("Minimum Capacity is negative. This is not allowed"); + minCapacity = nullIndex = HashUtil.arraySize(minCapacity, HashUtil.DEFAULT_LOAD_FACTOR); + mask = nullIndex - 1; + maxFill = Math.min((int)Math.ceil(nullIndex * HashUtil.DEFAULT_LOAD_FACTOR), nullIndex - 1); + keys = NEW_KEY_ARRAY(nullIndex + 1); + } + + @Override + public boolean add(KEY_TYPE o) { + if(KEY_EQUALS_NULL(o)) { + if(containsNull) return false; + containsNull = true; + } + else { + int pos = HashUtil.mix(KEY_TO_HASH(o)) & mask; + KEY_TYPE current = keys[pos]; + if(KEY_EQUALS_NOT_NULL(current)) { + if(KEY_EQUALS(current, o)) return false; + while(KEY_EQUALS_NOT_NULL((current = keys[pos = (++pos & mask)]))) + if(KEY_EQUALS(current, o)) return false; + } + keys[pos] = o; + } + if(size++ >= maxFill) rehash(HashUtil.arraySize(size+1, HashUtil.DEFAULT_LOAD_FACTOR)); + return true; + } + + @Override + public boolean contains(Object o) { +#if TYPE_OBJECT + if(o == null) return containsNull; +#else + if(o == null) return false; + if(o instanceof CLASS_TYPE && KEY_EQUALS(CLASS_TO_KEY(o), EMPTY_KEY_VALUE)) return containsNull; +#endif + int pos = HashUtil.mix(o.hashCode()) & mask; + KEY_TYPE current = keys[pos]; + if(KEY_EQUALS_NULL(current)) return false; + if(EQUALS_KEY_TYPE(current, o)) return true; + while(true) { + if(KEY_EQUALS_NULL((current = keys[pos = (++pos & mask)]))) return false; + else if(EQUALS_KEY_TYPE(current, o)) return true; + } + } + + @Override + public boolean remove(Object o) { +#if TYPE_OBJECT + if(o == null) return (containsNull ? removeNullIndex() : false); +#else + if(o == null) return false; + if(o instanceof CLASS_TYPE && KEY_EQUALS(CLASS_TO_KEY(o), EMPTY_KEY_VALUE)) return (containsNull ? removeNullIndex() : false); +#endif + int pos = HashUtil.mix(o.hashCode()) & mask; + KEY_TYPE current = keys[pos]; + if(KEY_EQUALS_NULL(current)) return false; + if(EQUALS_KEY_TYPE(current, o)) return removeIndex(pos); + while(true) { + if(KEY_EQUALS_NULL((current = keys[pos = (++pos & mask)]))) return false; + else if(EQUALS_KEY_TYPE(current, o)) return removeIndex(pos); + } + } + +#if !TYPE_OBJECT + @Override + public boolean contains(KEY_TYPE o) { + if(KEY_EQUALS_NULL(o)) return containsNull; + int pos = HashUtil.mix(KEY_TO_HASH(o)) & mask; + KEY_TYPE current = keys[pos]; + if(KEY_EQUALS_NULL(current)) return false; + if(KEY_EQUALS(current, o)) return true; + while(true) { + if(KEY_EQUALS_NULL((current = keys[pos = (++pos & mask)]))) return false; + else if(KEY_EQUALS(current, o)) return true; + } + } + + @Override + public boolean REMOVE_KEY(KEY_TYPE o) { + if(KEY_EQUALS_NULL(o)) return containsNull ? removeNullIndex() : false; + int pos = HashUtil.mix(KEY_TO_HASH(o)) & mask; + KEY_TYPE current = keys[pos]; + if(KEY_EQUALS_NULL(current)) return false; + if(KEY_EQUALS(current, o)) return removeIndex(pos); + while(true) { + if(KEY_EQUALS_NULL((current = keys[pos = (++pos & mask)]))) return false; + else if(KEY_EQUALS(current, o)) return removeIndex(pos); + } + } + +#endif + protected boolean removeIndex(int pos) { + if(pos == nullIndex) return containsNull ? removeNullIndex() : false; + keys[pos] = EMPTY_KEY_VALUE; + size--; + shiftKeys(pos); + if(nullIndex > minCapacity && size < maxFill / 4 && nullIndex > HashUtil.DEFAULT_MIN_CAPACITY) rehash(nullIndex / 2); + return true; + } + + protected boolean removeNullIndex() { + containsNull = false; + keys[nullIndex] = EMPTY_KEY_VALUE; + size--; + if(nullIndex > minCapacity && size < maxFill / 4 && nullIndex > HashUtil.DEFAULT_MIN_CAPACITY) rehash(nullIndex / 2); + return true; + } + + @Override + public ITERATOR KEY_GENERIC_TYPE iterator() { + return new SetIterator(); + } + + @Override + public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) { + if(size() <= 0) return; + if(containsNull) action.accept(keys[nullIndex]); + for(int i = nullIndex-1;i>=0;i--) { + if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(keys[i]); + } + } + + @Override + public DistinctCollectionWrapper KEY_GENERIC_TYPE copy() { + DistinctCollectionWrapper KEY_GENERIC_TYPE set = new DistinctCollectionWrapperBRACES(0); + set.minCapacity = minCapacity; + set.mask = mask; + set.maxFill = maxFill; + set.nullIndex = nullIndex; + set.containsNull = containsNull; + set.size = size; + set.keys = Arrays.copyOf(keys, keys.length); + return set; + } + + protected void shiftKeys(int startPos) { + int slot, last; + KEY_TYPE current; + while(true) { + startPos = ((last = startPos) + 1) & mask; + while(true){ + if(KEY_EQUALS_NULL((current = keys[startPos]))) { + keys[last] = EMPTY_KEY_VALUE; + return; + } + slot = HashUtil.mix(KEY_TO_HASH(current)) & mask; + if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; + startPos = ++startPos & mask; + } + keys[last] = current; + } + } + + protected void rehash(int newSize) { + int newMask = newSize - 1; + KEY_TYPE[] newKeys = NEW_KEY_ARRAY(newSize + 1); + for(int i = nullIndex, pos = 0, j = (size - (containsNull ? 1 : 0));j-- != 0;) { + while(true) { + if(--i < 0) throw new ConcurrentModificationException("Set was modified during rehash"); + if(KEY_EQUALS_NOT_NULL(keys[i])) break; + } + if(KEY_EQUALS_NOT_NULL(newKeys[pos = HashUtil.mix(KEY_TO_HASH(keys[i])) & newMask])) + while(KEY_EQUALS_NOT_NULL(newKeys[pos = (++pos & newMask)])); + newKeys[pos] = keys[i]; + } + nullIndex = newSize; + mask = newMask; + maxFill = Math.min((int)Math.ceil(nullIndex * HashUtil.DEFAULT_LOAD_FACTOR), nullIndex - 1); + keys = newKeys; + } + + @Override + public void clear() { + if(size == 0) return; + size = 0; + containsNull = false; + Arrays.fill(keys, EMPTY_KEY_VALUE); + } + + @Override + public int size() { + return size; + } + + private class SetIterator implements ITERATOR KEY_GENERIC_TYPE { + int pos = nullIndex; + int returnedPos = -1; + int lastReturned = -1; + int nextIndex = Integer.MIN_VALUE; + boolean returnNull = containsNull; + KEY_TYPE[] wrapped = null; + int wrappedIndex = 0; + + @Override + public boolean hasNext() { + if(nextIndex == Integer.MIN_VALUE) { + if(returnNull) { + returnNull = false; + nextIndex = nullIndex; + } + else + { + while(true) { + if(--pos < 0) { + if(wrapped == null || wrappedIndex <= -pos - 1) break; + nextIndex = -pos - 1; + break; + } + if(KEY_EQUALS_NOT_NULL(keys[pos])){ + nextIndex = pos; + break; + } + } + } + } + return nextIndex != Integer.MIN_VALUE; + } + + @Override + public KEY_TYPE NEXT() { + if(!hasNext()) throw new NoSuchElementException(); + returnedPos = pos; + if(nextIndex < 0){ + lastReturned = Integer.MAX_VALUE; + KEY_TYPE value = wrapped[nextIndex]; + nextIndex = Integer.MIN_VALUE; + return value; + } + KEY_TYPE value = keys[(lastReturned = nextIndex)]; + nextIndex = Integer.MIN_VALUE; + return value; + } + + @Override + public void remove() { + if(lastReturned == -1) throw new IllegalStateException(); + if(lastReturned == nullIndex) { + containsNull = false; + keys[nullIndex] = EMPTY_KEY_VALUE; + } + else if(returnedPos >= 0) shiftKeys(returnedPos); + else { +#if TYPE_OBJECT + DistinctCollectionWrapper.this.remove(wrapped[-returnedPos - 1]); +#else + DistinctCollectionWrapper.this.REMOVE_KEY(wrapped[-returnedPos - 1]); +#endif + lastReturned = -1; + return; + } + size--; + lastReturned = -1; + } + + private void shiftKeys(int startPos) { + int slot, last; + KEY_TYPE current; + while(true) { + startPos = ((last = startPos) + 1) & mask; + while(true){ + if(KEY_EQUALS_NULL((current = keys[startPos]))) { + keys[last] = EMPTY_KEY_VALUE; + return; + } + slot = HashUtil.mix(KEY_TO_HASH(current)) & mask; + if(last <= startPos ? (last >= slot || slot > startPos) : (last >= slot && slot > startPos)) break; + startPos = ++startPos & mask; + } + if(startPos < last) addWrapper(keys[startPos]); + keys[last] = current; + } + } + + private void addWrapper(KEY_TYPE value) { + if(wrapped == null) wrapped = NEW_KEY_ARRAY(2); + else if(wrappedIndex >= wrapped.length) { + KEY_TYPE[] newArray = NEW_KEY_ARRAY(wrapped.length * 2); + System.arraycopy(wrapped, 0, newArray, 0, wrapped.length); + wrapped = newArray; + } + wrapped[wrappedIndex++] = value; + } + } + } + +#endif private static class SingletonCollection KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE { KEY_TYPE element; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template index 95a553f5..b0793964 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template @@ -20,10 +20,6 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; -#if !TYPE_BOOLEAN -import speiger.src.collections.PACKAGE.sets.HASH_SET; -import speiger.src.collections.PACKAGE.sets.SET; -#endif import speiger.src.collections.utils.ISizeProvider; /** @@ -537,14 +533,14 @@ public class ITERABLES action.accept(T); }); #else - SET KEY_GENERIC_TYPE filtered = new HASH_SETBRACES(); + COLLECTION KEY_GENERIC_TYPE filtered = COLLECTIONS.distinctWrapper(); iterable.forEach(T -> { if(filtered.add(T)) action.accept(T); }); #endif } #else public void forEach(Consumer action) { Objects.requireNonNull(action); - SET KEY_GENERIC_TYPE filtered = new HASH_SETBRACES(); + COLLECTION KEY_GENERIC_TYPE filtered = COLLECTIONS.distinctWrapper(); iterable.forEach(T -> { if(filtered.add(T)) action.accept(T); }); } #endif diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index cd947132..4c33ae7f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -22,15 +22,12 @@ import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #else if LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif + import speiger.src.collections.PACKAGE.lists.LIST; #endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; -#if !TYPE_BOOLEAN -import speiger.src.collections.PACKAGE.sets.HASH_SET; -import speiger.src.collections.PACKAGE.sets.SET; -#endif /** * A Helper class for Iterators @@ -987,7 +984,7 @@ public class ITERATORS #if TYPE_BOOLEAN int filtered; #else - SET KEY_GENERIC_TYPE filtered = new HASH_SETBRACES(); + COLLECTION KEY_GENERIC_TYPE filtered = COLLECTIONS.distinctWrapper(); #endif KEY_TYPE lastFound; boolean foundNext = false; From cc92ef953a71db2cb27f11479244a176b46401da Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 03:23:19 +0100 Subject: [PATCH 14/20] Added Dependency Checks into the Module System. Why a Dependency Check system was added? --- ModulSettings.json | 52 +++++++++---------- .../builder/PrimitiveCollectionsBuilder.java | 45 +++++++++++----- .../src/builder/modules/AsyncModule.java | 4 ++ .../src/builder/modules/BaseModule.java | 16 +++++- .../src/builder/modules/CollectionModule.java | 2 + .../src/builder/modules/FunctionModule.java | 2 + .../src/builder/modules/JavaModule.java | 2 + .../src/builder/modules/ListModule.java | 10 +++- .../src/builder/modules/MapModule.java | 7 +++ .../src/builder/modules/PairModule.java | 1 + .../src/builder/modules/PrioQueueModule.java | 5 +- .../src/builder/modules/SetModule.java | 13 +++-- 12 files changed, 107 insertions(+), 52 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 634f21db..ef317355 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -4,10 +4,10 @@ "Collection": true, "Function": true, "List": true, - "Map": false, + "Map": true, "Pair": true, "PriorityQueue": true, - "Set": false, + "Set": true, "Boolean": { "Enabled": true, "Base": { @@ -367,15 +367,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -638,15 +638,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -909,15 +909,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -1180,15 +1180,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -1451,15 +1451,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -1722,15 +1722,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -1993,15 +1993,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, @@ -2264,15 +2264,15 @@ }, "Set": { "Enabled": true, - "LinkedHashSet": false, - "LinkedCustomHashSet": false, + "LinkedHashSet": true, + "LinkedCustomHashSet": true, "OrderedSet": true, "ArraySet": true, "AVLTreeSet": true, "ImmutableSet": true, "CustomHashSet": true, "Sets": true, - "SortedSet": false, + "SortedSet": true, "HashSet": true, "RBTreeSet": true }, diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index e495c6fa..cd50dc57 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -122,28 +122,45 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor } } + public List createModules() + { + List modules = new ArrayList<>(); + modules.add(JavaModule.INSTANCE); + modules.add(FunctionModule.INSTANCE); + modules.add(CollectionModule.INSTANCE); + modules.add(PrioQueueModule.INSTANCE); + modules.add(ListModule.INSTANCE); + modules.add(SetModule.INSTANCE); + modules.add(MapModule.INSTANCE); + modules.add(PairModule.INSTANCE); + modules.add(AsyncModule.INSTANCE); + return modules; + } + + @Override protected void init() { prepPackages(); //Init Modules here - addModule(new JavaModule()); - addModule(new FunctionModule()); - addModule(new CollectionModule()); - addModule(new PrioQueueModule()); - addModule(new ListModule()); - addModule(new SetModule()); - addModule(new MapModule()); - addModule(new PairModule()); - addModule(new AsyncModule()); + addModules(createModules()); finishPackages(); } - public void addModule(BaseModule module) + public void addModules(List modules) { - module.setManager(manager); - biPackages.forEach(module::init); - module.cleanup(); + if((flags & LOAD) != 0) + { + for(int i = 0,m=modules.size();i getModuleKeys(ClassType keyType, ClassType valueType) - { + public Set getModuleKeys(ClassType keyType, ClassType valueType) { return new HashSet<>(Arrays.asList("Lists", "ArrayList", "LinkedList", "ImmutableList", "CopyOnWriteList")); } + @Override + protected boolean areDependenciesLoaded() { + return isDependencyLoaded(CollectionModule.INSTANCE); + } + @Override protected void loadRemappers() { diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index 25d396e1..a5234b03 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -9,6 +9,8 @@ import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") public class MapModule extends BaseModule { + public static final BaseModule INSTANCE = new MapModule(); + @Override public String getModuleName() { return "Map"; } @Override @@ -32,6 +34,11 @@ public class MapModule extends BaseModule return sets; } + @Override + protected boolean areDependenciesLoaded() { + return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); + } + @Override protected void loadFlags() { diff --git a/src/builder/java/speiger/src/builder/modules/PairModule.java b/src/builder/java/speiger/src/builder/modules/PairModule.java index 6af75532..513ef176 100644 --- a/src/builder/java/speiger/src/builder/modules/PairModule.java +++ b/src/builder/java/speiger/src/builder/modules/PairModule.java @@ -3,6 +3,7 @@ package speiger.src.builder.modules; @SuppressWarnings("javadoc") public class PairModule extends BaseModule { + public static final BaseModule INSTANCE = new PairModule(); @Override public String getModuleName() { return "Pair"; } @Override diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java index 0b2d1322..2feba225 100644 --- a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -5,6 +5,8 @@ import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") public class PrioQueueModule extends BaseModule { + public static final BaseModule INSTANCE = new PrioQueueModule(); + @Override public String getModuleName() { return "PriorityQueue"; } @Override @@ -13,7 +15,8 @@ public class PrioQueueModule extends BaseModule protected void loadFlags() {} @Override protected void loadFunctions() {} - + @Override + protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } @Override protected void loadBlockades() { diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 9d880ae5..469a5d83 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -9,20 +9,19 @@ import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") public class SetModule extends BaseModule { + public static final BaseModule INSTANCE = new SetModule(); + @Override public String getModuleName() { return "Set"; } @Override protected void loadVariables() {} @Override - public boolean isModuleValid(ClassType keyType, ClassType valueType) - { - return keyType != ClassType.BOOLEAN; - } - + public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } @Override - public Set getModuleKeys(ClassType keyType, ClassType valueType) - { + protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } + @Override + public Set getModuleKeys(ClassType keyType, ClassType valueType) { Set sets = new HashSet<>(); sets.add("Sets"); sets.addAll(Arrays.asList("OrderedSet", "SortedSet")); From 1b1ec4b87a7a9c874eac8ff183726a9a7dff3ae4 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 03:30:29 +0100 Subject: [PATCH 15/20] Improving Dependency Checks to be more recursive. --- src/builder/java/speiger/src/builder/SettingsManager.java | 4 ++-- .../java/speiger/src/builder/modules/AsyncModule.java | 2 +- .../java/speiger/src/builder/modules/BaseModule.java | 6 +++--- .../java/speiger/src/builder/modules/CollectionModule.java | 3 ++- .../java/speiger/src/builder/modules/ListModule.java | 2 +- .../java/speiger/src/builder/modules/MapModule.java | 7 ++----- .../java/speiger/src/builder/modules/PrioQueueModule.java | 2 +- .../java/speiger/src/builder/modules/SetModule.java | 2 +- 8 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/builder/java/speiger/src/builder/SettingsManager.java b/src/builder/java/speiger/src/builder/SettingsManager.java index 59cbe6a8..1fcfd3c1 100644 --- a/src/builder/java/speiger/src/builder/SettingsManager.java +++ b/src/builder/java/speiger/src/builder/SettingsManager.java @@ -30,7 +30,7 @@ public class SettingsManager if(!isEnabled(result, "Enabled")) return false; } result = getObject(result, base.getModuleName(), false); - return result.size() <= 0 || isEnabled(result, "Enabled"); + return (result.size() <= 0 || isEnabled(result, "Enabled")) && base.areDependenciesLoaded(); } public boolean isModuleEnabled(BaseModule base, ClassType keyType, ClassType valueType, String entry) @@ -44,7 +44,7 @@ public class SettingsManager if(!isEnabled(result, "Enabled")) return false; } result = getObject(result, base.getModuleName(), false); - return result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry)); + return (result.size() <= 0 || (isEnabled(result, "Enabled") && isEnabled(result, entry))) && base.areDependenciesLoaded(); } public void addModule(BaseModule module) { diff --git a/src/builder/java/speiger/src/builder/modules/AsyncModule.java b/src/builder/java/speiger/src/builder/modules/AsyncModule.java index 6feee4d3..fd257751 100644 --- a/src/builder/java/speiger/src/builder/modules/AsyncModule.java +++ b/src/builder/java/speiger/src/builder/modules/AsyncModule.java @@ -16,7 +16,7 @@ public class AsyncModule extends BaseModule @Override protected void loadFunctions() {} @Override - protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } + public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } @Override protected void loadBlockades() { if(!isModuleEnabled()) { diff --git a/src/builder/java/speiger/src/builder/modules/BaseModule.java b/src/builder/java/speiger/src/builder/modules/BaseModule.java index a51b95c0..a3ffc0d8 100644 --- a/src/builder/java/speiger/src/builder/modules/BaseModule.java +++ b/src/builder/java/speiger/src/builder/modules/BaseModule.java @@ -60,11 +60,11 @@ public abstract class BaseModule public boolean isModuleValid(ClassType keyType, ClassType valueType) { return true; } protected boolean isModuleEnabled() { - return manager == null || (manager.isModuleEnabled(this, keyType, valueType) && areDependenciesLoaded()); + return manager == null || manager.isModuleEnabled(this, keyType, valueType); } protected boolean isModuleEnabled(String name) { - return manager == null || (manager.isModuleEnabled(this, keyType, valueType, name) && areDependenciesLoaded()); + return manager == null || manager.isModuleEnabled(this, keyType, valueType, name); } protected boolean isDependencyLoaded(BaseModule module) { @@ -75,7 +75,7 @@ public abstract class BaseModule return manager == null || (module.isBiModule() ? manager.isModuleEnabled(module, keyType, valueType) : (key ? manager.isModuleEnabled(module, keyType, keyType) : manager.isModuleEnabled(module, valueType, valueType))); } - protected boolean areDependenciesLoaded() { + public boolean areDependenciesLoaded() { return true; } diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java index 47c43172..3dcfb8ac 100644 --- a/src/builder/java/speiger/src/builder/modules/CollectionModule.java +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -13,7 +13,8 @@ public class CollectionModule extends BaseModule protected void loadVariables() {} @Override protected void loadFlags() {} - + @Override + public boolean areDependenciesLoaded(){ return isDependencyLoaded(JavaModule.INSTANCE); } @Override protected void loadBlockades() { diff --git a/src/builder/java/speiger/src/builder/modules/ListModule.java b/src/builder/java/speiger/src/builder/modules/ListModule.java index 6f42ec11..32e15fce 100644 --- a/src/builder/java/speiger/src/builder/modules/ListModule.java +++ b/src/builder/java/speiger/src/builder/modules/ListModule.java @@ -45,7 +45,7 @@ public class ListModule extends BaseModule } @Override - protected boolean areDependenciesLoaded() { + public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index a5234b03..bccb8189 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -19,6 +19,8 @@ public class MapModule extends BaseModule protected void loadVariables() {} @Override public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } + @Override + public boolean areDependenciesLoaded() { return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); } @Override public Set getModuleKeys(ClassType keyType, ClassType valueType) @@ -34,11 +36,6 @@ public class MapModule extends BaseModule return sets; } - @Override - protected boolean areDependenciesLoaded() { - return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); - } - @Override protected void loadFlags() { diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java index 2feba225..2179af92 100644 --- a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -16,7 +16,7 @@ public class PrioQueueModule extends BaseModule @Override protected void loadFunctions() {} @Override - protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } + public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } @Override protected void loadBlockades() { diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index 469a5d83..ba846900 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -19,7 +19,7 @@ public class SetModule extends BaseModule @Override public boolean isModuleValid(ClassType keyType, ClassType valueType) { return keyType != ClassType.BOOLEAN; } @Override - protected boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } + public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } @Override public Set getModuleKeys(ClassType keyType, ClassType valueType) { Set sets = new HashSet<>(); From 8d9f7a6761a3840059eb83d53f6f10b78ba8d411 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 04:07:11 +0100 Subject: [PATCH 16/20] Improved Settings a bit. -Added: "Implementations" configuration to turn of all "Implementations" keeping the interfaces/wrappers/abstract classes. Reducing the amount of configurations that need to be set. -Changed: removed "Sets/Maps/Lists" configuration and replaced it with "Wrappers" since they are wrappers. -Changed: Category Specific settings (except "Enabled") is sorted by Name. --- ModulSettings.json | 1441 +++++++++-------- .../builder/PrimitiveCollectionsBuilder.java | 11 +- .../src/builder/modules/ListModule.java | 26 +- .../src/builder/modules/MapModule.java | 43 +- .../src/builder/modules/SetModule.java | 36 +- .../templates/utils/AsyncBuilder.template | 4 +- .../templates/utils/Iterators.template | 4 +- 7 files changed, 828 insertions(+), 737 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index ef317355..34fba853 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -102,11 +102,12 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -124,20 +125,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -150,20 +152,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -176,20 +179,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -202,20 +206,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -228,20 +233,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -254,20 +260,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -280,20 +287,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -306,20 +314,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -332,20 +341,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -359,25 +369,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -395,20 +407,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -421,20 +434,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -447,20 +461,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -473,20 +488,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -499,20 +515,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -525,20 +542,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -551,20 +569,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -577,20 +596,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -603,20 +623,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -630,25 +651,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -666,20 +689,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -692,20 +716,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -718,20 +743,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -744,20 +770,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -770,20 +797,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -796,20 +824,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -822,20 +851,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -848,20 +878,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -874,20 +905,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -901,25 +933,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -937,20 +971,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -963,20 +998,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -989,20 +1025,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1015,20 +1052,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1041,20 +1079,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1067,20 +1106,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1093,20 +1133,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1119,20 +1160,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1145,20 +1187,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1172,25 +1215,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -1208,20 +1253,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1234,20 +1280,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1260,20 +1307,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1286,20 +1334,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1312,20 +1361,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1338,20 +1388,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1364,20 +1415,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1390,20 +1442,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1416,20 +1469,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1443,25 +1497,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -1479,20 +1535,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1505,20 +1562,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1531,20 +1589,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1557,20 +1616,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1583,20 +1643,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1609,20 +1670,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1635,20 +1697,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1661,20 +1724,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1687,20 +1751,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1714,25 +1779,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -1750,20 +1817,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1776,20 +1844,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1802,20 +1871,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1828,20 +1898,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1854,20 +1925,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1880,20 +1952,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1906,20 +1979,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1932,20 +2006,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1958,20 +2033,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -1985,25 +2061,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true @@ -2021,20 +2099,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2047,20 +2126,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2073,20 +2153,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2099,20 +2180,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2125,20 +2207,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2151,20 +2234,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2177,20 +2261,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2203,20 +2288,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2229,20 +2315,21 @@ }, "Map": { "Enabled": true, - "HashMap": true, - "RBTreeMap": true, - "ConcurrentMap": true, - "ArrayMap": true, "AVLTreeMap": true, + "ArrayMap": true, + "ConcurrentMap": true, "CustomHashMap": true, + "EnumMap": true, + "HashMap": true, "ImmutableMap": true, + "Implementations": true, "LinkedCustomHashMap": true, - "LinkedHashMap": true, - "Maps": true, - "SortedMap": true, "LinkedEnumMap": true, + "LinkedHashMap": true, "OrderedMap": true, - "EnumMap": true + "RBTreeMap": true, + "SortedMap": true, + "Wrappers": true }, "Pair": { "Enabled": true @@ -2256,25 +2343,27 @@ }, "List": { "Enabled": true, - "Lists": true, - "ImmutableList": true, - "CopyOnWriteList": true, "ArrayList": true, - "LinkedList": true + "CopyOnWriteList": true, + "ImmutableList": true, + "Implementations": true, + "LinkedList": true, + "Wrappers": true }, "Set": { "Enabled": true, - "LinkedHashSet": true, - "LinkedCustomHashSet": true, - "OrderedSet": true, - "ArraySet": true, "AVLTreeSet": true, - "ImmutableSet": true, + "ArraySet": true, "CustomHashSet": true, - "Sets": true, - "SortedSet": true, "HashSet": true, - "RBTreeSet": true + "ImmutableSet": true, + "Implementations": true, + "LinkedCustomHashSet": true, + "LinkedHashSet": true, + "OrderedSet": true, + "RBTreeSet": true, + "SortedSet": true, + "Wrappers": true }, "Async": { "Enabled": true diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index cd50dc57..ff638d51 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -149,11 +149,8 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor public void addModules(List modules) { - if((flags & LOAD) != 0) - { - for(int i = 0,m=modules.size();i getModuleKeys(ClassType keyType, ClassType valueType) { - return new HashSet<>(Arrays.asList("Lists", "ArrayList", "LinkedList", "ImmutableList", "CopyOnWriteList")); + return new TreeSet<>(Arrays.asList("Implementations", "Wrappers", "ArrayList", "LinkedList", "ImmutableList", "CopyOnWriteList")); } @Override diff --git a/src/builder/java/speiger/src/builder/modules/MapModule.java b/src/builder/java/speiger/src/builder/modules/MapModule.java index bccb8189..f325adc2 100644 --- a/src/builder/java/speiger/src/builder/modules/MapModule.java +++ b/src/builder/java/speiger/src/builder/modules/MapModule.java @@ -1,8 +1,8 @@ package speiger.src.builder.modules; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; +import java.util.TreeSet; import speiger.src.builder.ClassType; @@ -23,10 +23,9 @@ public class MapModule extends BaseModule public boolean areDependenciesLoaded() { return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); } @Override - public Set getModuleKeys(ClassType keyType, ClassType valueType) - { - Set sets = new HashSet<>(); - sets.add("Maps"); + public Set getModuleKeys(ClassType keyType, ClassType valueType) { + Set 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")); @@ -40,10 +39,11 @@ public class MapModule extends BaseModule protected void loadFlags() { if(isModuleEnabled()) addFlag("MAP_MODULE"); - if(isModuleEnabled("Maps")) addFlag("Maps"); - boolean hashMap = isModuleEnabled("HashMap"); - boolean customHashMap = isModuleEnabled("CustomHashMap"); - boolean enumMap = isModuleEnabled("EnumMap"); + 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(isModuleEnabled("OrderedMap")) { addFlag("ORDERED_MAP_FEATURE"); @@ -54,11 +54,11 @@ public class MapModule extends BaseModule } if(isModuleEnabled("SortedMap")) { addFlag("SORTED_MAP_FEATURE"); - if(isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE"); - if(isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE"); + if(implementations && isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE"); + if(implementations && isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE"); } - if(isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); - if(isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); + if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); + if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); if(hashMap) addFlag("HASH_MAP_FEATURE"); if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE"); if(enumMap) addFlag("ENUM_MAP_FEATURE"); @@ -68,21 +68,22 @@ public class MapModule extends BaseModule protected void loadBlockades() { if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap"); - if(!isModuleEnabled("Maps")) addBlockedFiles("Maps"); - if(!isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap"); - if(!isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); + 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 = !isModuleEnabled("HashMap"); + boolean hashMap = implementations || !isModuleEnabled("HashMap"); if(hashMap) addBlockedFiles("OpenHashMap"); if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap"); - boolean customHashMap = !isModuleEnabled("CustomHashMap"); + boolean customHashMap = implementations || !isModuleEnabled("CustomHashMap"); if(customHashMap) addBlockedFiles("OpenCustomHashMap"); if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap"); - boolean enumMap = !isModuleEnabled("EnumMap"); + boolean enumMap = implementations || !isModuleEnabled("EnumMap"); if(enumMap) addBlockedFiles("EnumMap"); if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap"); @@ -90,8 +91,8 @@ public class MapModule extends BaseModule boolean sorted = !isModuleEnabled("SortedMap"); if(sorted) addBlockedFiles("SortedMap", "NavigableMap"); - if(sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap"); - if(sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap"); + if(implementations || sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap"); + if(implementations || sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap"); if(keyType == ClassType.BOOLEAN) { diff --git a/src/builder/java/speiger/src/builder/modules/SetModule.java b/src/builder/java/speiger/src/builder/modules/SetModule.java index ba846900..6e06b98b 100644 --- a/src/builder/java/speiger/src/builder/modules/SetModule.java +++ b/src/builder/java/speiger/src/builder/modules/SetModule.java @@ -1,8 +1,8 @@ package speiger.src.builder.modules; import java.util.Arrays; -import java.util.HashSet; import java.util.Set; +import java.util.TreeSet; import speiger.src.builder.ClassType; @@ -22,8 +22,8 @@ public class SetModule extends BaseModule public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } @Override public Set getModuleKeys(ClassType keyType, ClassType valueType) { - Set sets = new HashSet<>(); - sets.add("Sets"); + Set 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")); @@ -36,22 +36,23 @@ public class SetModule extends BaseModule protected void loadFlags() { if(isModuleEnabled()) addFlag("SET_MODULE"); - if(isModuleEnabled("Sets")) addFlag("Sets"); - boolean hashSet = isModuleEnabled("HashSet"); - boolean customHashSet = isModuleEnabled("CustomHashSet"); + 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(isModuleEnabled("ArraySet")) addFlag("ARRAY_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(isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE"); - if(isModuleEnabled("RBTreeSet")) addFlag("RB_TREE_SET_FEATURE"); + if(implementations && isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE"); + if(implementations && isModuleEnabled("RBTreeSet")) addFlag("RB_TREE_SET_FEATURE"); } - if(isModuleEnabled("ImmutableSet")) addFlag("IMMUTABLE_SET_FEATURE"); + if(implementations && isModuleEnabled("ImmutableSet")) addFlag("IMMUTABLE_SET_FEATURE"); if(hashSet) addFlag("HASH_SET_FEATURE"); if(customHashSet) addFlag("CUSTOM_HASH_SET_FEATURE"); } @@ -60,25 +61,26 @@ public class SetModule extends BaseModule protected void loadBlockades() { if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet"); - if(!isModuleEnabled("Sets")) addBlockedFiles("Sets"); - if(!isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet"); + 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 = !isModuleEnabled("HashSet"); + boolean hashSet = implementations || !isModuleEnabled("HashSet"); if(hashSet) addBlockedFiles("OpenHashSet"); if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet"); - boolean customHashSet = !isModuleEnabled("CustomHashSet"); + boolean customHashSet = implementations || !isModuleEnabled("CustomHashSet"); if(customHashSet) addBlockedFiles("OpenCustomHashSet"); if(customHashSet || ordered || !isModuleEnabled("LinkedCustomHashSet")) addBlockedFiles("LinkedOpenCustomHashSet"); - if(ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet"); + if(implementations || ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet"); boolean sorted = !isModuleEnabled("SortedSet"); if(sorted) addBlockedFiles("SortedSet", "NavigableSet"); - if(sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet"); - if(sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet"); + if(implementations || sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet"); + if(implementations || sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet"); if(keyType == ClassType.BOOLEAN) { diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index 12c6fedc..80360178 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -27,14 +27,14 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; #endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; -#if OBJECT_ASYNC_MODULE +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LIST; -#endif #if ARRAY_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #else if LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif +#endif #if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE #if SET_MODULE import speiger.src.collections.PACKAGE.sets.SET; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index 4c33ae7f..ea354fed 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -16,14 +16,14 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; -#if LIST_MODULE +#if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE +import speiger.src.collections.PACKAGE.lists.LIST; #if ARRAY_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; #else if LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif -import speiger.src.collections.PACKAGE.lists.LIST; #endif import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; From ce9343348eea30adcf0436a8b64058a749c2d881 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 04:35:29 +0100 Subject: [PATCH 17/20] Pair Module is now done. --- ModulSettings.json | 324 +++++++++++++----- .../builder/PrimitiveCollectionsBuilder.java | 4 +- .../src/builder/modules/PairModule.java | 32 +- .../templates/misc/pairs/Pair.template | 9 + 4 files changed, 278 insertions(+), 91 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 34fba853..75ee3d3b 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -19,7 +19,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -28,7 +30,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -37,7 +41,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -46,7 +52,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -55,7 +63,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -64,7 +74,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -73,7 +85,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -82,7 +96,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -91,7 +107,9 @@ "Enabled": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -142,7 +160,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -169,7 +189,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -196,7 +218,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -223,7 +247,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -250,7 +276,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -277,7 +305,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -304,7 +334,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -331,7 +363,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -358,7 +392,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -424,7 +460,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -451,7 +489,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -478,7 +518,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -505,7 +547,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -532,7 +576,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -559,7 +605,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -586,7 +634,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -613,7 +663,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -640,7 +692,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -706,7 +760,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -733,7 +789,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -760,7 +818,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -787,7 +847,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -814,7 +876,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -841,7 +905,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -868,7 +934,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -895,7 +963,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -922,7 +992,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -988,7 +1060,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -1015,7 +1089,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -1042,7 +1118,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -1069,7 +1147,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -1096,7 +1176,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -1123,7 +1205,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -1150,7 +1234,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -1177,7 +1263,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -1204,7 +1292,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -1270,7 +1360,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -1297,7 +1389,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -1324,7 +1418,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -1351,7 +1447,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -1378,7 +1476,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -1405,7 +1505,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -1432,7 +1534,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -1459,7 +1563,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -1486,7 +1592,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -1552,7 +1660,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -1579,7 +1689,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -1606,7 +1718,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -1633,7 +1747,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -1660,7 +1776,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -1687,7 +1805,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -1714,7 +1834,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -1741,7 +1863,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -1768,7 +1892,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -1834,7 +1960,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -1861,7 +1989,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -1888,7 +2018,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -1915,7 +2047,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -1942,7 +2076,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -1969,7 +2105,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -1996,7 +2134,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -2023,7 +2163,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -2050,7 +2192,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { @@ -2116,7 +2260,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Byte": { @@ -2143,7 +2289,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Short": { @@ -2170,7 +2318,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Character": { @@ -2197,7 +2347,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Integer": { @@ -2224,7 +2376,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Long": { @@ -2251,7 +2405,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Float": { @@ -2278,7 +2434,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Double": { @@ -2305,7 +2463,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Object": { @@ -2332,7 +2492,9 @@ "Wrappers": true }, "Pair": { - "Enabled": true + "Enabled": true, + "Immutable": false, + "Mutable": true } }, "Collection": { diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index ff638d51..97b50b83 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -253,8 +253,8 @@ 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 save = !flags.contains("save"); + 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); if(tests) { diff --git a/src/builder/java/speiger/src/builder/modules/PairModule.java b/src/builder/java/speiger/src/builder/modules/PairModule.java index 513ef176..b17efbc7 100644 --- a/src/builder/java/speiger/src/builder/modules/PairModule.java +++ b/src/builder/java/speiger/src/builder/modules/PairModule.java @@ -1,5 +1,11 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.Set; +import java.util.TreeSet; + +import speiger.src.builder.ClassType; + @SuppressWarnings("javadoc") public class PairModule extends BaseModule { @@ -11,17 +17,28 @@ public class PairModule extends BaseModule @Override protected void loadVariables() {} @Override - protected void loadBlockades() {} - @Override - protected void loadFlags() {} - @Override protected void loadFunctions() {} @Override protected void loadTestClasses() {} + @Override + public Set getModuleKeys(ClassType keyType, ClassType valueType) { return new TreeSet<>(Arrays.asList("Mutable", "Immutable")); } @Override - protected void loadRemappers() - { + protected void loadFlags() { + if(isModuleEnabled()) addFlag("PAIR_MODULE"); + if(isModuleEnabled("Mutable")) addFlag("MUTABLE_PAIR"); + if(isModuleEnabled("Immutable")) addFlag("IMMUTABLE_PAIR"); + } + + @Override + protected void loadBlockades() { + if(!isModuleEnabled()) addBlockedFiles("Pair"); + if(!isModuleEnabled("Mutable")) addBlockedFiles("MutablePair"); + if(!isModuleEnabled("Immutable")) addBlockedFiles("ImmutablePair"); + } + + @Override + protected void loadRemappers() { //Main Classes addBiRequirement("Pair", ""); addBiRequirement("MutablePair", ""); @@ -32,8 +49,7 @@ public class PairModule extends BaseModule } @Override - protected void loadClasses() - { + protected void loadClasses() { //Implementations addBiClassMapper("IMMUTABLE_PAIR", "ImmutablePair", ""); addBiClassMapper("MUTABLE_PAIR", "MutablePair", ""); diff --git a/src/builder/resources/speiger/assets/collections/templates/misc/pairs/Pair.template b/src/builder/resources/speiger/assets/collections/templates/misc/pairs/Pair.template index 32a1b77c..a11906dd 100644 --- a/src/builder/resources/speiger/assets/collections/templates/misc/pairs/Pair.template +++ b/src/builder/resources/speiger/assets/collections/templates/misc/pairs/Pair.template @@ -1,7 +1,12 @@ package speiger.src.collections.PACKAGE.misc.pairs; +#if IMMUTABLE_PAIR import speiger.src.collections.PACKAGE.misc.pairs.impl.IMMUTABLE_PAIR; +#endif +#if MUTABLE_PAIR import speiger.src.collections.PACKAGE.misc.pairs.impl.MUTABLE_PAIR; +#endif + /** * Key Value Pair Interface that allows to reduce boxing/unboxing. * @Type(T) @@ -9,6 +14,7 @@ import speiger.src.collections.PACKAGE.misc.pairs.impl.MUTABLE_PAIR; */ public interface PAIR KEY_VALUE_GENERIC_TYPE { +#if IMMUTABLE_PAIR /** * Empty Reference for Immutable Pairs */ @@ -68,6 +74,8 @@ public interface PAIR KEY_VALUE_GENERIC_TYPE return new IMMUTABLE_PAIRKV_BRACES(pair.ENTRY_KEY(), pair.ENTRY_VALUE()); } +#endif +#if MUTABLE_PAIR /** * @Type(T) * @ValueType(V) @@ -118,6 +126,7 @@ public interface PAIR KEY_VALUE_GENERIC_TYPE return new MUTABLE_PAIRKV_BRACES(pair.ENTRY_KEY(), pair.ENTRY_VALUE()); } +#endif /** * Sets the Key of the Pair. * @param key the key that should be set. From 3ce52668df6c4a66e13dcd2431c6601fa97f6828 Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 05:30:23 +0100 Subject: [PATCH 18/20] Added Priority Queue Module --- ModulSettings.json | 412 ++++++++++-------- .../src/builder/modules/CollectionModule.java | 3 +- .../src/builder/modules/PrioQueueModule.java | 43 +- .../templates/collections/Iterable.template | 2 +- .../templates/lists/LinkedList.template | 53 ++- .../templates/queues/PriorityDequeue.template | 4 + .../templates/queues/PriorityQueue.template | 8 +- .../templates/utils/AsyncBuilder.template | 2 +- .../templates/utils/PriorityQueues.template | 6 + 9 files changed, 323 insertions(+), 210 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index 75ee3d3b..bcffe153 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -20,7 +20,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -31,7 +31,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -42,7 +42,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -53,7 +53,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -64,7 +64,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -75,7 +75,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -86,7 +86,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -97,7 +97,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -108,7 +108,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -116,14 +116,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -150,7 +156,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -161,7 +167,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -179,7 +185,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -190,7 +196,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -208,7 +214,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -219,7 +225,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -237,7 +243,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -248,7 +254,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -266,7 +272,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -277,7 +283,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -295,7 +301,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -306,7 +312,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -324,7 +330,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -335,7 +341,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -353,7 +359,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -364,7 +370,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -382,7 +388,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -393,7 +399,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -401,14 +407,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -419,7 +431,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -450,7 +462,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -461,7 +473,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -479,7 +491,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -490,7 +502,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -508,7 +520,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -519,7 +531,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -537,7 +549,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -548,7 +560,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -566,7 +578,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -577,7 +589,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -595,7 +607,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -606,7 +618,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -624,7 +636,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -635,7 +647,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -653,7 +665,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -664,7 +676,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -682,7 +694,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -693,7 +705,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -701,14 +713,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -719,7 +737,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -750,7 +768,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -761,7 +779,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -779,7 +797,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -790,7 +808,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -808,7 +826,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -819,7 +837,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -837,7 +855,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -848,7 +866,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -866,7 +884,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -877,7 +895,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -895,7 +913,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -906,7 +924,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -924,7 +942,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -935,7 +953,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -953,7 +971,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -964,7 +982,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -982,7 +1000,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -993,7 +1011,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1001,14 +1019,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -1019,7 +1043,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1050,7 +1074,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1061,7 +1085,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1079,7 +1103,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1090,7 +1114,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1108,7 +1132,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1119,7 +1143,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1137,7 +1161,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1148,7 +1172,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1166,7 +1190,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1177,7 +1201,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1195,7 +1219,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1206,7 +1230,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1224,7 +1248,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1235,7 +1259,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1253,7 +1277,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1264,7 +1288,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1282,7 +1306,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1293,7 +1317,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1301,14 +1325,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -1319,7 +1349,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1350,7 +1380,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1361,7 +1391,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1379,7 +1409,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1390,7 +1420,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1408,7 +1438,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1419,7 +1449,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1437,7 +1467,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1448,7 +1478,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1466,7 +1496,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1477,7 +1507,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1495,7 +1525,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1506,7 +1536,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1524,7 +1554,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1535,7 +1565,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1553,7 +1583,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1564,7 +1594,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1582,7 +1612,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1593,7 +1623,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1601,14 +1631,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -1619,7 +1655,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1650,7 +1686,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1661,7 +1697,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1679,7 +1715,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1690,7 +1726,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1708,7 +1744,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1719,7 +1755,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1737,7 +1773,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1748,7 +1784,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1766,7 +1802,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1777,7 +1813,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1795,7 +1831,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1806,7 +1842,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1824,7 +1860,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1835,7 +1871,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1853,7 +1889,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1864,7 +1900,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1882,7 +1918,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1893,7 +1929,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1901,14 +1937,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -1919,7 +1961,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1950,7 +1992,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1961,7 +2003,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -1979,7 +2021,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1990,7 +2032,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2008,7 +2050,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2019,7 +2061,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2037,7 +2079,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2048,7 +2090,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2066,7 +2108,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2077,7 +2119,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2095,7 +2137,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2106,7 +2148,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2124,7 +2166,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2135,7 +2177,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2153,7 +2195,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2164,7 +2206,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2182,7 +2224,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2193,7 +2235,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2201,14 +2243,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -2219,7 +2267,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -2250,7 +2298,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2261,7 +2309,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2279,7 +2327,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2290,7 +2338,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2308,7 +2356,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2319,7 +2367,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2337,7 +2385,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2348,7 +2396,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2366,7 +2414,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2377,7 +2425,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2395,7 +2443,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2406,7 +2454,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2424,7 +2472,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2435,7 +2483,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2453,7 +2501,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2464,7 +2512,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2482,7 +2530,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2493,7 +2541,7 @@ }, "Pair": { "Enabled": true, - "Immutable": false, + "Immutable": true, "Mutable": true } }, @@ -2501,14 +2549,20 @@ "Enabled": true }, "PriorityQueue": { - "Enabled": true + "Enabled": true, + "ArrayPrioQueue": true, + "Dequeue": true, + "FiFoQueue": true, + "HeapQueue": true, + "Implementations": false, + "Wrappers": true }, "List": { "Enabled": true, "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": true, + "Implementations": false, "LinkedList": true, "Wrappers": true }, @@ -2519,7 +2573,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": true, + "Implementations": false, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java index 3dcfb8ac..a2c9afae 100644 --- a/src/builder/java/speiger/src/builder/modules/CollectionModule.java +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -75,7 +75,8 @@ public class CollectionModule extends BaseModule addClassMapper("LIST_ITERATOR", "ListIterator"); addClassMapper("BI_ITERATOR", "BidirectionalIterator"); addClassMapper("ITERATOR", "Iterator"); - addClassMapper("STACK", "Stack"); + if(keyType.isObject()) addSimpleMapper("STACK", "Stack"); + else addClassMapper("STACK", "Stack"); addClassMapper("STRATEGY", "Strategy"); } diff --git a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java index 2179af92..d8cba687 100644 --- a/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java +++ b/src/builder/java/speiger/src/builder/modules/PrioQueueModule.java @@ -1,5 +1,9 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.Set; +import java.util.TreeSet; + import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") @@ -12,22 +16,46 @@ public class PrioQueueModule extends BaseModule @Override protected void loadVariables() {} @Override - protected void loadFlags() {} - @Override protected void loadFunctions() {} @Override public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } + @Override - protected void loadBlockades() - { + public Set getModuleKeys(ClassType keyType, ClassType valueType) { + return new TreeSet<>(Arrays.asList("Wrappers", "Implementations", "Dequeue", "FiFoQueue", "HeapQueue", "ArrayPrioQueue")); + } + + @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"); + } + + @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(keyType == ClassType.BOOLEAN) { addBlockedFiles("QueueTests"); } } @Override - protected void loadRemappers() - { + protected void loadRemappers() { //Main Classes addRemapper("AbstractPriorityQueue", "Abstract%sPriorityQueue"); @@ -38,8 +66,7 @@ public class PrioQueueModule extends BaseModule } @Override - protected void loadClasses() - { + protected void loadClasses() { //Implementation Classes addClassMapper("ARRAY_FIFO_QUEUE", "ArrayFIFOQueue"); addClassMapper("ARRAY_PRIORITY_QUEUE", "ArrayPriorityQueue"); diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index 631850e5..fbfee5db 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -26,8 +26,8 @@ import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif #endif #if SET_MODULE && !TYPE_BOOLEAN -import speiger.src.collections.PACKAGE.sets.SET; #if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.SET; #if LINKED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #else if LINKED_CUSTOM_SET_FEATURE diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template b/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template index 2320766c..89fd2d58 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template @@ -1,7 +1,9 @@ package speiger.src.collections.PACKAGE.lists; #if TYPE_OBJECT +#if DEQUEUE_FEATURE import java.util.Comparator; +#endif import java.util.function.BiFunction; #else if PRIMITIVES import java.nio.JAVA_BUFFER; @@ -31,9 +33,13 @@ import speiger.src.collections.PACKAGE.collections.STACK; import speiger.src.collections.ints.functions.function.Int2ObjectFunction; #endif import speiger.src.collections.PACKAGE.collections.ITERATOR; +#if DEQUEUE_FEATURE import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE; +#endif #if !TYPE_OBJECT +#if DEQUEUE_FEATURE import speiger.src.collections.PACKAGE.functions.COMPARATOR; +#endif import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.PACKAGE.utils.ARRAYS; @@ -62,10 +68,10 @@ import speiger.src.collections.utils.SanityChecks; * * @Type(T) */ -#if TYPE_OBJECT -public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements PRIORITY_DEQUEUE KEY_GENERIC_TYPE, Stack KEY_GENERIC_TYPE -#else +#if DEQUEUE_FEATURE public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements PRIORITY_DEQUEUE KEY_GENERIC_TYPE, STACK KEY_GENERIC_TYPE +#else +public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements STACK KEY_GENERIC_TYPE #endif { Entry KEY_GENERIC_TYPE first; @@ -222,6 +228,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return true; } +#if DEQUEUE_FEATURE @Override public void enqueue(KEY_TYPE e) { add(e); @@ -232,6 +239,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE add(0, e); } +#endif @Override public void push(KEY_TYPE e) { add(e); @@ -291,6 +299,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return a; } +#if DEQUEUE_FEATURE @Override public KEY_TYPE first() { if(first == null) throw new NoSuchElementException(); @@ -303,11 +312,11 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return last.value; } +#endif @Override public KEY_TYPE peek(int index) { return GET_KEY((size() - 1) - index); } - @Override public KEY_TYPE GET_KEY(int index) { checkRange(index); @@ -525,6 +534,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE } #endif +#if DEQUEUE_FEATURE @Override public void onChanged() {} @Override @@ -538,25 +548,24 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE @Override public KEY_TYPE dequeueLast() { + return pop(); + } + +#endif + @Override + public KEY_TYPE pop() { if(last == null) throw new NoSuchElementException(); return unlinkLast(last); } - @Override - public KEY_TYPE pop() { - return dequeueLast(); - } - +#if DEQUEUE_FEATURE @Override public boolean removeFirst(KEY_TYPE e) { - if(size == 0) return false; - for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) { - if(KEY_EQUALS(entry.value, e)) { - unlink(entry); - return true; - } - } - return false; +#if TYPE_OBJECT + return remove(e); +#else + return REMOVE_KEY(e); +#endif } @Override @@ -571,6 +580,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return false; } +#endif @Override public KEY_TYPE swapRemove(int index) { checkRange(index); @@ -653,7 +663,14 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE #else @Override public boolean REMOVE_KEY(KEY_TYPE e) { - return removeFirst(e); + if(size == 0) return false; + for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) { + if(KEY_EQUALS(entry.value, e)) { + unlink(entry); + return true; + } + } + return false; } #endif diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityDequeue.template b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityDequeue.template index 9453db9d..510ab8c4 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityDequeue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityDequeue.template @@ -6,7 +6,9 @@ import java.util.Iterator; #endif import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; +#if QUEUES_FEATURE import speiger.src.collections.PACKAGE.utils.PRIORITY_QUEUES; +#endif /** * A Type Speciifc PriorityDeque or Dequeue interface to allow implementations like FIFO queues. @@ -81,6 +83,7 @@ public interface PRIORITY_DEQUEUE KEY_GENERIC_TYPE extends PRIORITY_QUEUE KEY_GE */ public default KEY_TYPE last() { return peek(size()-1); } +#if QUEUES_FEATURE /** * Creates a Wrapped PriorityDequeue that is Synchronized * @return a new PriorityDequeue that is synchronized @@ -96,6 +99,7 @@ public interface PRIORITY_DEQUEUE KEY_GENERIC_TYPE extends PRIORITY_QUEUE KEY_GE */ public default PRIORITY_DEQUEUE KEY_GENERIC_TYPE synchronizeQueue(Object mutex) { return PRIORITY_QUEUES.synchronize(this, mutex); } +#endif @Override public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy(); } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template index 78ac1ec9..a1712324 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/PriorityQueue.template @@ -12,7 +12,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERABLE; import speiger.src.collections.PACKAGE.collections.ITERATOR; +#if QUEUES_FEATURE import speiger.src.collections.PACKAGE.utils.PRIORITY_QUEUES; +#endif /** @@ -147,8 +149,9 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY * @return draining iterator of the PriorityQueue */ public ITERATOR KEY_GENERIC_TYPE iterator(); + #endif - +#if QUEUES_FEATURE /** * Creates a Wrapped PriorityQueue that is Synchronized * @return a new PriorityQueue that is synchronized @@ -163,7 +166,8 @@ public interface PRIORITY_QUEUE KEY_GENERIC_TYPE extends ITERABLE KEY_GENERIC_TY * @see PRIORITY_QUEUES#synchronize */ public default PRIORITY_QUEUE KEY_GENERIC_TYPE synchronizeQueue(Object mutex) { return PRIORITY_QUEUES.synchronize(this, mutex); } - + +#endif /** * A method to drop the contents of the Queue without clearing the queue * @Type(E) diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index 80360178..e9903c07 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -37,8 +37,8 @@ import speiger.src.collections.PACKAGE.lists.LINKED_LIST; #endif #if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE #if SET_MODULE -import speiger.src.collections.PACKAGE.sets.SET; #if LINKED_SET_FEATURE || LINKED_CUSTOM_SET_FEATURE || SET_FEATURE || CUSTOM_SET_FEATURE || RB_TREE_SET_FEATURE || AVL_TREE_SET_FEATURE || ARRAY_SET_FEATURE +import speiger.src.collections.PACKAGE.sets.SET; #if LINKED_SET_FEATURE import speiger.src.collections.PACKAGE.sets.LINKED_HASH_SET; #else if LINKED_CUSTOM_SET_FEATURE diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template b/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template index 61f7d325..03ba1276 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template @@ -11,7 +11,9 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif +#if DEQUEUE_FEATURE import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE; +#endif import speiger.src.collections.PACKAGE.queues.PRIORITY_QUEUE; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; @@ -46,6 +48,7 @@ public class PRIORITY_QUEUES return queue instanceof SynchronizedPriorityQueue ? (SynchronizedPriorityQueue KEY_GENERIC_TYPE)queue : new SynchronizedPriorityQueueBRACES(queue, mutex); } +#if DEQUEUE_FEATURE /** * Returns a synchronized PriorityDequeue instance based on the instance given. * @param dequeue that should be synchronized @@ -67,6 +70,7 @@ public class PRIORITY_QUEUES return dequeue instanceof SynchronizedPriorityDequeue ? (SynchronizedPriorityDequeue KEY_GENERIC_TYPE)dequeue : new SynchronizedPriorityDequeueBRACES(dequeue, mutex); } +#endif /** * Wrapper class for synchronization * @Type(T) @@ -134,6 +138,7 @@ public class PRIORITY_QUEUES public int count(PREDICATE KEY_GENERIC_TYPE filter) { synchronized(mutex) { return queue.count(filter); } } } +#if DEQUEUE_FEATURE /** * Wrapper class for synchronization * @Type(T) @@ -166,4 +171,5 @@ public class PRIORITY_QUEUES @Override public PRIORITY_DEQUEUE KEY_GENERIC_TYPE copy() { synchronized(mutex) { return dequeue.copy(); } } } +#endif } From 342b0cece98090281f7c6a2fc0b99e246bad863f Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 06:27:47 +0100 Subject: [PATCH 19/20] Collection Module Works now. (Least Configurable for obvious Reasons) --- ModulSettings.json | 250 ++++++++++-------- .../src/builder/modules/AsyncModule.java | 2 +- .../src/builder/modules/CollectionModule.java | 30 ++- .../templates/collections/Collection.template | 9 + .../templates/collections/Iterable.template | 4 + .../templates/lists/ArrayList.template | 39 ++- .../templates/lists/CopyOnWriteList.template | 12 +- .../templates/lists/ImmutableList.template | 8 +- .../templates/utils/Lists.template | 22 +- 9 files changed, 245 insertions(+), 131 deletions(-) diff --git a/ModulSettings.json b/ModulSettings.json index bcffe153..9ea747b7 100644 --- a/ModulSettings.json +++ b/ModulSettings.json @@ -113,7 +113,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -121,7 +125,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -129,7 +133,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -156,7 +160,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -185,7 +189,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -214,7 +218,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -243,7 +247,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -272,7 +276,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -301,7 +305,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -330,7 +334,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -359,7 +363,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -388,7 +392,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -404,7 +408,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -412,7 +420,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -420,7 +428,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -431,7 +439,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -462,7 +470,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -491,7 +499,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -520,7 +528,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -549,7 +557,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -578,7 +586,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -607,7 +615,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -636,7 +644,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -665,7 +673,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -694,7 +702,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -710,7 +718,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -718,7 +730,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -726,7 +738,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -737,7 +749,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -768,7 +780,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -797,7 +809,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -826,7 +838,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -855,7 +867,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -884,7 +896,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -913,7 +925,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -942,7 +954,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -971,7 +983,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1000,7 +1012,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1016,7 +1028,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -1024,7 +1040,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -1032,7 +1048,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -1043,7 +1059,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1074,7 +1090,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1103,7 +1119,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1132,7 +1148,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1161,7 +1177,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1190,7 +1206,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1219,7 +1235,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1248,7 +1264,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1277,7 +1293,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1306,7 +1322,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1322,7 +1338,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -1330,7 +1350,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -1338,7 +1358,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -1349,7 +1369,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1380,7 +1400,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1409,7 +1429,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1438,7 +1458,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1467,7 +1487,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1496,7 +1516,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1525,7 +1545,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1554,7 +1574,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1583,7 +1603,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1612,7 +1632,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1628,7 +1648,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -1636,7 +1660,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -1644,7 +1668,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -1655,7 +1679,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1686,7 +1710,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1715,7 +1739,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1744,7 +1768,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1773,7 +1797,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1802,7 +1826,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1831,7 +1855,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1860,7 +1884,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1889,7 +1913,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1918,7 +1942,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -1934,7 +1958,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -1942,7 +1970,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -1950,7 +1978,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -1961,7 +1989,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -1992,7 +2020,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2021,7 +2049,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2050,7 +2078,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2079,7 +2107,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2108,7 +2136,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2137,7 +2165,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2166,7 +2194,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2195,7 +2223,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2224,7 +2252,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2240,7 +2268,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -2248,7 +2280,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -2256,7 +2288,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -2267,7 +2299,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, @@ -2298,7 +2330,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2327,7 +2359,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2356,7 +2388,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2385,7 +2417,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2414,7 +2446,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2443,7 +2475,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2472,7 +2504,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2501,7 +2533,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2530,7 +2562,7 @@ "EnumMap": true, "HashMap": true, "ImmutableMap": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashMap": true, "LinkedEnumMap": true, "LinkedHashMap": true, @@ -2546,7 +2578,11 @@ } }, "Collection": { - "Enabled": true + "Enabled": true, + "IArray": true, + "Splititerators": true, + "Strategy": true, + "Streams": true }, "PriorityQueue": { "Enabled": true, @@ -2554,7 +2590,7 @@ "Dequeue": true, "FiFoQueue": true, "HeapQueue": true, - "Implementations": false, + "Implementations": true, "Wrappers": true }, "List": { @@ -2562,7 +2598,7 @@ "ArrayList": true, "CopyOnWriteList": true, "ImmutableList": true, - "Implementations": false, + "Implementations": true, "LinkedList": true, "Wrappers": true }, @@ -2573,7 +2609,7 @@ "CustomHashSet": true, "HashSet": true, "ImmutableSet": true, - "Implementations": false, + "Implementations": true, "LinkedCustomHashSet": true, "LinkedHashSet": true, "OrderedSet": true, diff --git a/src/builder/java/speiger/src/builder/modules/AsyncModule.java b/src/builder/java/speiger/src/builder/modules/AsyncModule.java index fd257751..75a0eb57 100644 --- a/src/builder/java/speiger/src/builder/modules/AsyncModule.java +++ b/src/builder/java/speiger/src/builder/modules/AsyncModule.java @@ -20,7 +20,7 @@ public class AsyncModule extends BaseModule @Override protected void loadBlockades() { if(!isModuleEnabled()) { - addBlockedFiles("AsyncBuilder"); + addBlockedFiles("AsyncBuilder", "Task"); } } @Override diff --git a/src/builder/java/speiger/src/builder/modules/CollectionModule.java b/src/builder/java/speiger/src/builder/modules/CollectionModule.java index a2c9afae..4987a423 100644 --- a/src/builder/java/speiger/src/builder/modules/CollectionModule.java +++ b/src/builder/java/speiger/src/builder/modules/CollectionModule.java @@ -1,5 +1,9 @@ package speiger.src.builder.modules; +import java.util.Arrays; +import java.util.Set; +import java.util.TreeSet; + import speiger.src.builder.ClassType; @SuppressWarnings("javadoc") @@ -12,12 +16,32 @@ public class CollectionModule extends BaseModule @Override protected void loadVariables() {} @Override - protected void loadFlags() {} - @Override public boolean areDependenciesLoaded(){ return isDependencyLoaded(JavaModule.INSTANCE); } + @Override - protected void loadBlockades() + public Set getModuleKeys(ClassType keyType, ClassType valueType) { + return new TreeSet<>(Arrays.asList("Streams", "Splititerators", "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"); + } + + @Override + protected void loadBlockades() { + if(!isModuleEnabled()) { + 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(keyType.isObject()) { addBlockedFiles("Stack"); addBlockedFiles("CollectionStreamTester"); diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template index f3154cb9..85817e7d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -5,16 +5,20 @@ import java.util.Collection; import java.util.Objects; import java.util.function.JAVA_PREDICATE; import java.util.function.Predicate; +#if SPLIT_ITERATOR_FEATURE && STREAM_FEATURE import java.util.stream.JAVA_STREAM; import java.util.stream.StreamSupport; #endif +#endif #if TYPE_OBJECT import java.util.function.Consumer; import speiger.src.collections.ints.functions.function.Int2ObjectFunction; #else import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif +#if SPLIT_ITERATOR_FEATURE import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; +#endif import speiger.src.collections.PACKAGE.utils.COLLECTIONS; import speiger.src.collections.utils.ISizeProvider; import speiger.src.collections.utils.SanityChecks; @@ -291,6 +295,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE */ public default COLLECTION KEY_GENERIC_TYPE unmodifiable() { return COLLECTIONS.unmodifiable(this); } +#if SPLIT_ITERATOR_FEATURE #if PRIMITIVES /** * Returns a Java-Type-Specific Stream to reduce boxing/unboxing. @@ -303,11 +308,15 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE * @return a Stream of the closest java type */ default JAVA_STREAM parallelPrimitiveStream() { return StreamSupport.NEW_STREAM(SPLIT_ITERATORS.createJavaSplititerator(this, 0), true); } + #endif +#if STREAM_FEATURE /** * A Type Specific Type Splititerator to reduce boxing/unboxing * @return type specific splititerator */ @Override default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); } +#endif +#endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index fbfee5db..fecdeff3 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -49,7 +49,9 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS; #if ASYNC_MODULE import speiger.src.collections.PACKAGE.utils.ASYNC_BUILDER; #endif +#if SPLIT_ITERATOR_FEATURE import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; +#endif import speiger.src.collections.PACKAGE.utils.ITERABLES; import speiger.src.collections.PACKAGE.utils.ITERATORS; #if !LINKED_HASH_SET_FEATURE && LINKED_CUSTOM_HASH_SET_FEATURE @@ -114,6 +116,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable iterator().forEachRemaining(input, action); } +#if SPLIT_ITERATOR_FEATURE /** * A Type Specific Type Splititerator to reduce boxing/unboxing * @return type specific splititerator @@ -121,6 +124,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable @Override default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createUnknownSplititerator(iterator(), 0); } +#endif #if ASYNC_MODULE /** * Creates a Async Builder for moving work of the thread. diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template index 1ec1b2b6..21b1cc67 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -8,7 +8,10 @@ import java.util.Collection; import java.util.Iterator; import java.util.Objects; #if TYPE_OBJECT +#if IARRAY_FEATURE || TYPE_OBJECT import java.util.function.Consumer; +#endif + import java.util.function.BiFunction; #endif import java.util.function.Predicate; @@ -38,33 +41,38 @@ import speiger.src.collections.utils.Stack; #else import speiger.src.collections.objects.utils.ObjectArrays; #endif -#if PRIMITIVES +#if PRIMITIVES && SPLIT_ITERATOR_FEATURE && STREAM_FEATURE import java.util.stream.JAVA_STREAM; import java.util.stream.StreamSupport; #endif +#if IARRAY_FEATURE import speiger.src.collections.PACKAGE.utils.IARRAY; +#endif +#if SPLIT_ITERATOR_FEATURE import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; +#endif +#if !IARRAY_FEATURE +import speiger.src.collections.utils.IArray; +#endif import speiger.src.collections.utils.SanityChecks; -#if TYPE_OBJECT /** * A Type-Specific Array-based implementation of list that is written to reduce (un)boxing * - *

This implementation is optimized to improve how data is processed with interfaces like {@link IARRAY}, {@link Stack} +#if IARRAY_FEATURE + *

This implementation is optimized to improve how data is processed with interfaces like {@link IARRAY}, {@link STACK} +#else + *

This implementation is optimized to improve how data is processed with interfaces like {@link IArray}, {@link STACK} +#endif * and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions. - * + * * @Type(T) */ -public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements IARRAY, Stack +#if IARRAY_FEATURE +public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements IARRAY KEY_GENERIC_TYPE, STACK KEY_GENERIC_TYPE #else -/** - * A Type-Specific Array-based implementation of list that is written to reduce (un)boxing - * - *

This implementation is optimized to improve how data is processed with interfaces like {@link IARRAY}, {@link STACK} - * and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions. - */ -public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements IARRAY, STACK +public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements IArray, STACK KEY_GENERIC_TYPE #endif { static final int DEFAULT_ARRAY_SIZE = 10; @@ -587,6 +595,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return data[(size() - 1) - index]; } +#if IARRAY_FEATURE /** * Provides the Underlying Array in the Implementation * @return underlying Array @@ -606,6 +615,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return data.getClass() != Object[].class; } +#endif #endif /** * A Type Specific foreach function that reduces (un)boxing @@ -1159,8 +1169,8 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); } - -#if PRIMITIVES +#if SPLIT_ITERATOR_FEATURE +#if PRIMITIVES && STREAM_FEATURE /** * Returns a Java-Type-Specific Stream to reduce boxing/unboxing. * @return a Stream of the closest java type @@ -1177,4 +1187,5 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE */ @Override public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createArraySplititerator(data, size, 16464); } +#endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template b/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template index 0e49659f..346e56a2 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template @@ -41,12 +41,14 @@ import speiger.src.collections.utils.Stack; #else import speiger.src.collections.objects.utils.ObjectArrays; #endif -#if PRIMITIVES +#if PRIMITIVES && STREAM_FEATURE && SPLIT_ITERATOR_FEATURE import java.util.stream.JAVA_STREAM; import java.util.stream.StreamSupport; #endif +#if SPLIT_ITERATOR_FEATURE import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; +#endif import speiger.src.collections.utils.ITrimmable; import speiger.src.collections.utils.SanityChecks; @@ -1408,8 +1410,9 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER if (index < 0 || index > data.length) throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + data.length); } - -#if PRIMITIVES + +#if SPLIT_ITERATOR_FEATURE +#if PRIMITIVES && STREAM_FEATURE /** * Returns a Java-Type-Specific Stream to reduce boxing/unboxing. * @return a Stream of the closest java type @@ -1427,6 +1430,7 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER @Override public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createArraySplititerator(data, data.length, 16464); } +#endif static final class COWIterator KEY_GENERIC_TYPE implements LIST_ITERATOR KEY_GENERIC_TYPE { KEY_TYPE[] data; @@ -2080,9 +2084,11 @@ public class COPY_ON_WRITE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENER } } +#if SPLIT_ITERATOR_FEATURE @Override public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 16464); } +#endif @Override public LIST_ITERATOR KEY_GENERIC_TYPE listIterator(int index) { if(index < 0 || index > size()) throw new IndexOutOfBoundsException(); diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template b/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template index 6476bafd..e3496dd8 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template @@ -29,12 +29,14 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.objects.utils.ObjectArrays; import speiger.src.collections.PACKAGE.utils.ITERATORS; -#if PRIMITIVES +#if PRIMITIVES && SPLIT_ITERATOR_FEATURE && STREAM_FEATURE import java.util.stream.JAVA_STREAM; import java.util.stream.StreamSupport; #endif +#if SPLIT_ITERATOR_FEATURE import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR; import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; +#endif import speiger.src.collections.utils.SanityChecks; #if TYPE_OBJECT @@ -487,7 +489,8 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + data.length); } -#if PRIMITIVES +#if SPLIT_ITERATOR_FEATURE +#if PRIMITIVES && STREAM_FEATURE /** * Returns a Java-Type-Specific Stream to reduce boxing/unboxing. * @return a Stream of the closest java type @@ -505,6 +508,7 @@ public class IMMUTABLE_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_T @Override public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createArraySplititerator(data, data.length, 16464); } +#endif private class LIST_ITER implements LIST_ITERATOR KEY_GENERIC_TYPE { int index; diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template index 2663a000..19f2d53b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template @@ -2,10 +2,14 @@ package speiger.src.collections.PACKAGE.utils; import java.util.Collection; import java.util.List; +#if IARRAY_FEATURE import java.util.Objects; +#endif import java.util.Random; import java.util.RandomAccess; +#if IARRAY_FEATURE || TYPE_OBJECT import java.util.function.Consumer; +#endif #if PRIMITIVES import java.nio.JAVA_BUFFER; #endif @@ -17,7 +21,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.lists.ABSTRACT_LIST; import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; +#if IARRAY_FEATURE import speiger.src.collections.PACKAGE.utils.ARRAYS; +#endif import speiger.src.collections.utils.SanityChecks; /** @@ -60,7 +66,11 @@ public class LISTS * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronize(LIST KEY_GENERIC_TYPE l) { +#if IARRAY_FEATURE return l instanceof SynchronizedList ? l : (l instanceof IARRAY ? new SynchronizedArrayListBRACES(l) : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l) : new SynchronizedListBRACES(l))); +#else + return l instanceof SynchronizedList ? l : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l) : new SynchronizedListBRACES(l)); +#endif } /** @@ -71,7 +81,11 @@ public class LISTS * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronize(LIST KEY_GENERIC_TYPE l, Object mutex) { +#if IARRAY_FEATURE return l instanceof SynchronizedList ? l : (l instanceof IARRAY ? new SynchronizedArrayListBRACES(l, mutex) : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l, mutex) : new SynchronizedListBRACES(l, mutex))); +#else + return l instanceof SynchronizedList ? l : (l instanceof RandomAccess ? new SynchronizedRandomAccessListBRACES(l, mutex) : new SynchronizedListBRACES(l, mutex)); +#endif } /** @@ -92,6 +106,7 @@ public class LISTS */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE reverse(LIST KEY_GENERIC_TYPE list) { int size = list.size(); +#if IARRAY_FEATURE if(list instanceof IARRAY) { IARRAY KEY_GENERIC_TYPE array = (IARRAY KEY_GENERIC_TYPE)list; #if TYPE_OBJECT @@ -106,6 +121,7 @@ public class LISTS return list; #endif } +#endif if(list instanceof RandomAccess) { for (int i = 0, mid = size >> 1, j = size - 1; i < mid; i++, j--) { KEY_TYPE t = list.GET_KEY(i); @@ -143,6 +159,7 @@ public class LISTS */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE shuffle(LIST KEY_GENERIC_TYPE list, Random random) { int size = list.size(); +#if IARRAY_FEATURE if(list instanceof IARRAY) { IARRAY KEY_GENERIC_TYPE array = (IARRAY KEY_GENERIC_TYPE)list; #if TYPE_OBJECT @@ -164,7 +181,8 @@ public class LISTS #endif return list; } - for(int i = list.size(); i-- != 0;) { +#endif + for(int i = size; i-- != 0;) { int p = random.nextInt(i + 1); KEY_TYPE t = list.GET_KEY(i); list.set(i, list.GET_KEY(p)); @@ -231,6 +249,7 @@ public class LISTS public SingletonList KEY_GENERIC_TYPE copy() { return new SingletonListBRACES(element); } } +#if IARRAY_FEATURE private static class SynchronizedArrayList KEY_GENERIC_TYPE extends SynchronizedList KEY_GENERIC_TYPE implements IARRAY KEY_GENERIC_TYPE { IARRAY KEY_GENERIC_TYPE l; @@ -271,6 +290,7 @@ public class LISTS } } +#endif private static class SynchronizedRandomAccessList KEY_GENERIC_TYPE extends SynchronizedList KEY_GENERIC_TYPE implements RandomAccess { SynchronizedRandomAccessList(LIST KEY_GENERIC_TYPE l) { From 8f7d49b280f418c030c79df2b29c0c6d2d940acc Mon Sep 17 00:00:00 2001 From: Speiger Date: Wed, 7 Dec 2022 07:31:30 +0100 Subject: [PATCH 20/20] Finished Function module and added breaking change. --- Changelog.md | 1 + .../java/speiger/src/builder/ClassType.java | 6 ++ .../builder/PrimitiveCollectionsBuilder.java | 2 +- .../src/builder/modules/FunctionModule.java | 3 +- .../src/builder/modules/JavaModule.java | 1 - .../templates/collections/Collection.template | 2 +- .../templates/collections/Iterable.template | 12 ++-- .../functions/function/Function.template | 26 ++------ .../templates/lists/ArrayList.template | 10 +-- .../templates/lists/CopyOnWriteList.template | 10 +-- .../templates/lists/ImmutableList.template | 10 +-- .../templates/lists/LinkedList.template | 10 +-- .../maps/abstracts/AbstractMap.template | 2 +- .../concurrent/ConcurrentOpenHashMap.template | 34 +++++----- .../LinkedOpenCustomHashMap.template | 30 ++++----- .../customHash/OpenCustomHashMap.template | 64 +++++++++---------- .../maps/impl/hash/LinkedOpenHashMap.template | 30 ++++----- .../maps/impl/hash/OpenHashMap.template | 64 +++++++++---------- .../immutable/ImmutableOpenHashMap.template | 30 ++++----- .../maps/impl/misc/ArrayMap.template | 34 +++++----- .../templates/maps/impl/misc/EnumMap.template | 4 +- .../maps/impl/tree/AVLTreeMap.template | 54 ++++++++-------- .../maps/impl/tree/RBTreeMap.template | 54 ++++++++-------- .../templates/maps/interfaces/Map.template | 8 ++- .../templates/queues/ArrayFIFOQueue.template | 10 +-- .../queues/ArrayPriorityQueue.template | 10 +-- .../queues/HeapPriorityQueue.template | 10 +-- .../templates/queues/PriorityQueue.template | 2 +- .../templates/sets/AVLTreeSet.template | 20 +++--- .../templates/sets/ArraySet.template | 10 +-- .../sets/ImmutableOpenHashSet.template | 10 +-- .../sets/LinkedOpenCustomHashSet.template | 10 +-- .../templates/sets/LinkedOpenHashSet.template | 10 +-- .../templates/sets/OpenCustomHashSet.template | 20 +++--- .../templates/sets/OpenHashSet.template | 20 +++--- .../templates/sets/RBTreeSet.template | 20 +++--- .../templates/utils/AsyncBuilder.template | 26 ++------ .../templates/utils/Iterables.template | 10 +-- .../templates/utils/Iterators.template | 8 +-- 39 files changed, 340 insertions(+), 357 deletions(-) diff --git a/Changelog.md b/Changelog.md index 3659f18a..05c6ed12 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ - Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations. - Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant. - Removed: BooleanSet and Maps that start with a Boolean classes since they can not be used anyways. +- Breaking Change: Function classes now use the "apply/applyAs/test" format from Java itself, instead of the "get" format. This cleans up a lot of things. But will break existing function class implementations ### Version 0.7.0 - Added: Over 11 Million Unit Tests to this library to ensure quality. diff --git a/src/builder/java/speiger/src/builder/ClassType.java b/src/builder/java/speiger/src/builder/ClassType.java index 139d1306..b015fc0d 100644 --- a/src/builder/java/speiger/src/builder/ClassType.java +++ b/src/builder/java/speiger/src/builder/ClassType.java @@ -133,6 +133,12 @@ public enum ClassType } } + public String getApply(ClassType other) { + if(other == BOOLEAN) return "test"; + if(other == ClassType.OBJECT) return "apply"; + return "applyAs"+other.getFileType(); + } + public String getEquals(boolean not) { switch(this) diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 97b50b83..8ab7a343 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -253,7 +253,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); diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index 6829ccd4..2633e8ad 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -34,8 +34,7 @@ public class FunctionModule extends BaseModule @Override protected void loadFunctions() { - addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); - addSimpleMapper("TEST_VALUE", keyType.isObject() ? "getBoolean" : "get"); + addSimpleMapper("APPLY", keyType.getApply(valueType)); } @Override diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index 3dc2b672..59e95844 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -41,7 +41,6 @@ public class JavaModule extends BaseModule addSimpleMapper("APPLY_KEY_VALUE", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType()); addSimpleMapper("APPLY_CAST", "applyAs"+keyType.getCustomJDKType().getNonFileType()); - addSimpleMapper("APPLY", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); //Shared by Maps and Pairs so moved to java. addFunctionMappers("ENTRY_KEY", "get%sKey"); diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template index 85817e7d..efcbf6b8 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -183,7 +183,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE * @see Collection#toArray(Object[]) */ default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction action) { - return TO_ARRAY(action.get(size())); + return TO_ARRAY(action.apply(size())); } #else diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index fecdeff3..0c0fd314 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -287,7 +287,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable if(prov != null) { int size = prov.size(); if(size >= 0) { - KEY_TYPE[] array = action.get(size); + KEY_TYPE[] array = action.apply(size); ITERATORS.unwrap(array, iterator()); return array; } @@ -321,7 +321,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) return true; + if(filter.test(iter.NEXT())) return true; } return false; } @@ -334,7 +334,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) return false; + if(filter.test(iter.NEXT())) return false; } return true; } @@ -347,7 +347,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(!filter.TEST_VALUE(iter.NEXT())) return false; + if(!filter.test(iter.NEXT())) return false; } return true; } @@ -361,7 +361,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { KEY_TYPE entry = iter.NEXT(); - if(filter.TEST_VALUE(entry)) return entry; + if(filter.test(entry)) return entry; } return EMPTY_VALUE; } @@ -432,7 +432,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable Objects.requireNonNull(filter); int result = 0; for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) result++; + if(filter.test(iter.NEXT())) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template b/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template index e43c825a..d7ed74c3 100644 --- a/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template +++ b/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template @@ -21,12 +21,9 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE * @param k the value that should be processed * @return the result of the function */ - public VALUE_TYPE GET_VALUE(KEY_TYPE k); + public VALUE_TYPE APPLY(KEY_TYPE k); -#if JDK_FUNCTION -#if VALUE_BOOLEAN - @Override - public default VALUE_TYPE test(KEY_TYPE k) { return GET_VALUE(k); } +#if JDK_FUNCTION && VALUE_BOOLEAN /** * A Type specific and-function helper function that reduces boxing/unboxing @@ -35,19 +32,19 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE */ public default FUNCTION KEY_VALUE_GENERIC_TYPE andType(FUNCTION KEY_VALUE_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) && other.GET_VALUE(T); + return T -> APPLY(T) && other.APPLY(T); } @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE and(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) && other.test(T); + return T -> APPLY(T) && other.APPLY(T); } @Override public default FUNCTION KEY_VALUE_GENERIC_TYPE negate() { - return T -> !GET_VALUE(T); + return T -> !APPLY(T); } /** @@ -57,23 +54,14 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE */ public default FUNCTION KEY_VALUE_GENERIC_TYPE orType(FUNCTION KEY_VALUE_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) || other.GET_VALUE(T); + return T -> APPLY(T) || other.APPLY(T); } @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE or(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) || other.test(T); + return T -> APPLY(T) || other.APPLY(T); } -#else if VALUE_OBJECT - - @Override - public default VALUE_TYPE apply(KEY_TYPE k) { return GET_VALUE(k); } -#else - - @Override - public default VALUE_TYPE APPLY_VALUE(KEY_TYPE k) { return GET_VALUE(k); } -#endif #endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template index 21b1cc67..020f9dbd 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -649,7 +649,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(int i = 0;i=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } } return false; @@ -901,12 +901,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } } return true; @@ -919,12 +919,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } } return true; @@ -970,12 +970,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } } return null; @@ -989,12 +989,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL int result = 0; if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } } return result; @@ -1117,9 +1117,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true; } return false; } @@ -1128,9 +1128,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false; } return true; } @@ -1139,9 +1139,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false; } return true; } @@ -1198,9 +1198,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_KEY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i]; } return EMPTY_KEY_VALUE; } @@ -1210,9 +1210,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++; } return result; } @@ -1273,9 +1273,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true; + if(containsNull && filter.test(values[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return true; } return false; } @@ -1284,9 +1284,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return false; } return true; } @@ -1295,9 +1295,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && !filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.VALUE_TEST_VALUE(values[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(values[i])) return false; } return true; } @@ -1354,9 +1354,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex]; + if(containsNull && filter.test(values[nullIndex])) return values[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return values[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return values[i]; } return EMPTY_VALUE; } @@ -1366,9 +1366,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++; + if(containsNull && filter.test(values[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template index f52b091a..d32ad5dc 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template @@ -706,7 +706,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; index = (int)links[index]; } return false; @@ -720,7 +720,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -734,7 +734,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -779,7 +779,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; index = (int)links[index]; } return null; @@ -794,7 +794,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; index = (int)links[index]; } return result; @@ -960,7 +960,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return true; + if(filter.test(keys[index])) return true; index = (int)links[index]; } return false; @@ -972,7 +972,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return false; + if(filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -984,7 +984,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(!filter.TEST_VALUE(keys[index])) return false; + if(!filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -1042,7 +1042,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return EMPTY_KEY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return keys[index]; + if(filter.test(keys[index])) return keys[index]; index = (int)links[index]; } return EMPTY_KEY_VALUE; @@ -1055,7 +1055,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int result = 0; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) result++; + if(filter.test(keys[index])) result++; index = (int)links[index]; } return result; @@ -1124,7 +1124,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return true; + if(filter.test(values[index])) return true; index = (int)links[index]; } return false; @@ -1136,7 +1136,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(filter.VALUE_TEST_VALUE(values[index])) return false; + if(filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1148,7 +1148,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(!filter.VALUE_TEST_VALUE(values[index])) return false; + if(!filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1206,7 +1206,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return EMPTY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return values[index]; + if(filter.test(values[index])) return values[index]; index = (int)links[index]; } return EMPTY_VALUE; @@ -1219,7 +1219,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int result = 0; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) result++; + if(filter.test(values[index])) result++; index = (int)links[index]; } return result; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template index 95e6aa92..165ac32f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template @@ -500,14 +500,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(mappingFunction); int index = findIndex(key); if(index < 0) { - VALUE_TYPE newValue = mappingFunction.GET_VALUE(key); + VALUE_TYPE newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; insert(-index-1, key, newValue); return newValue; } VALUE_TYPE newValue = values[index]; if(VALUE_EQUALS(newValue, getDefaultReturnValue())) { - newValue = mappingFunction.GET_VALUE(key); + newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; values[index] = newValue; } @@ -843,12 +843,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } } return false; @@ -861,12 +861,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } } return true; @@ -879,12 +879,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } } return true; @@ -930,12 +930,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } } return null; @@ -949,12 +949,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE int result = 0; if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } } return result; @@ -1073,9 +1073,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true; } return false; } @@ -1084,9 +1084,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false; } return true; } @@ -1095,9 +1095,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false; } return true; } @@ -1154,9 +1154,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_KEY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i]; } return EMPTY_KEY_VALUE; } @@ -1166,9 +1166,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++; } return result; } @@ -1229,9 +1229,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true; + if(containsNull && filter.test(values[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return true; } return false; } @@ -1240,9 +1240,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return false; } return true; } @@ -1251,9 +1251,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && !filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.VALUE_TEST_VALUE(values[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(values[i])) return false; } return true; } @@ -1310,9 +1310,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex]; + if(containsNull && filter.test(values[nullIndex])) return values[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return values[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return values[i]; } return EMPTY_VALUE; } @@ -1322,9 +1322,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++; + if(containsNull && filter.test(values[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template index 51360f33..82e6d214 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template @@ -677,7 +677,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; index = (int)links[index]; } return false; @@ -691,7 +691,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -705,7 +705,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -750,7 +750,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; index = (int)links[index]; } return null; @@ -765,7 +765,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; index = (int)links[index]; } return result; @@ -903,7 +903,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return true; + if(filter.test(keys[index])) return true; index = (int)links[index]; } return false; @@ -915,7 +915,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return false; + if(filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -927,7 +927,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(!filter.TEST_VALUE(keys[index])) return false; + if(!filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -985,7 +985,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return EMPTY_KEY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return keys[index]; + if(filter.test(keys[index])) return keys[index]; index = (int)links[index]; } return EMPTY_KEY_VALUE; @@ -998,7 +998,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; int result = 0; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) result++; + if(filter.test(keys[index])) result++; index = (int)links[index]; } return result; @@ -1064,7 +1064,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return true; + if(filter.test(values[index])) return true; index = (int)links[index]; } return false; @@ -1076,7 +1076,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return false; + if(filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1088,7 +1088,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(!filter.VALUE_TEST_VALUE(values[index])) return false; + if(!filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1146,7 +1146,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return EMPTY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return values[index]; + if(filter.test(values[index])) return values[index]; index = (int)links[index]; } return EMPTY_VALUE; @@ -1159,7 +1159,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int result = 0; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) result++; + if(filter.test(values[index])) result++; index = (int)links[index]; } return result; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template index c17e99c5..c99c3e6c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template @@ -498,14 +498,14 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN Objects.requireNonNull(mappingFunction); int index = findIndex(key); if(index == -1) { - VALUE_TYPE newValue = mappingFunction.GET_VALUE(key); + VALUE_TYPE newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; insertIndex(size++, key, newValue); return newValue; } VALUE_TYPE newValue = values[index]; if(VALUE_EQUALS(newValue, getDefaultReturnValue())) { - newValue = mappingFunction.GET_VALUE(key); + newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; values[index] = newValue; } @@ -802,7 +802,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0;i action) { - return TO_ARRAY(action.get(size())); + return TO_ARRAY(action.apply(size())); } #endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template index 89c3f789..c35d1712 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template @@ -364,7 +364,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -373,7 +373,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -382,7 +382,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -391,7 +391,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -440,7 +440,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } @@ -1203,7 +1203,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -1212,7 +1212,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -1221,7 +1221,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -1269,7 +1269,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -1279,7 +1279,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template index 31cf0c90..f3cfaf65 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template @@ -402,7 +402,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(int i = 0;i=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true; } return false; } @@ -533,9 +533,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false; } return true; } @@ -544,9 +544,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false; } return true; } @@ -603,9 +603,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i]; } return EMPTY_VALUE; } @@ -615,9 +615,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template index b5646b03..507131b5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template @@ -385,9 +385,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true; } return false; } @@ -396,9 +396,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false; } return true; } @@ -407,9 +407,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false; } return true; } @@ -466,9 +466,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i]; } return EMPTY_VALUE; } @@ -478,9 +478,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template index b6cc387e..cddc6689 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template @@ -364,7 +364,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -373,7 +373,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -382,7 +382,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -430,7 +430,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -440,7 +440,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } @@ -1264,7 +1264,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -1273,7 +1273,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -1282,7 +1282,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -1330,7 +1330,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -1340,7 +1340,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index e9903c07..3538fb04 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -593,11 +593,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE switch(type) { case 0: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(true); return true; } @@ -605,11 +601,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE break; case 1: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(false); return true; } @@ -617,11 +609,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE break; case 2: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(!filter.getBoolean(iter.NEXT())) { -#else - if(!filter.GET_VALUE(iter.NEXT())) { -#endif + if(!filter.test(iter.NEXT())) { setResult(false); return true; } @@ -658,11 +646,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE protected boolean execute() throws Exception { while(shouldRun() && iter.hasNext()) { KEY_TYPE entry = iter.NEXT(); -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(entry); return true; } @@ -693,7 +677,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE @Override protected boolean execute() throws Exception { while(shouldRun() && iter.hasNext()) { - if(filter.TEST_VALUE(iter.NEXT())) { + if(filter.test(iter.NEXT())) { counted++; } } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template index b0793964..d5f02be6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template @@ -298,7 +298,7 @@ public class ITERABLES @Override public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(E -> action.accept(mapper.GET_VALUE(E))); + iterable.forEach(E -> action.accept(mapper.apply(E))); } } @@ -320,7 +320,7 @@ public class ITERABLES @Override public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(E -> mapper.GET_VALUE(E).forEach(action)); + iterable.forEach(E -> mapper.apply(E).forEach(action)); } } @@ -344,7 +344,7 @@ public class ITERABLES public void forEach(Consumer action) { Objects.requireNonNull(action); iterable.forEach(E -> { - T[] array = mapper.GET_VALUE(E); + T[] array = mapper.apply(E); for(int i = 0,m=array.length;i { if(!filter.TEST_VALUE(T)) action.accept(T); } ); + iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } ); } #else public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(T -> { if(!filter.TEST_VALUE(T)) action.accept(T); } ); + iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } ); } #endif } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index ea354fed..805d18f2 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -832,7 +832,7 @@ public class ITERATORS @Override public T next() { - return mapper.GET_VALUE(iterator.NEXT()); + return mapper.apply(iterator.NEXT()); } @Override @@ -858,7 +858,7 @@ public class ITERATORS foundNext = true; while(iterator.hasNext()) { if(last != null && last.hasNext()) return; - last = mapper.GET_VALUE(iterator.NEXT()).iterator(); + last = mapper.apply(iterator.NEXT()).iterator(); } } @@ -894,7 +894,7 @@ public class ITERATORS foundNext = true; while(iterator.hasNext()) { if(last != null && last.hasNext()) return; - last = ObjectIterators.wrap(mapper.GET_VALUE(iterator.NEXT())); + last = ObjectIterators.wrap(mapper.apply(iterator.NEXT())); } } @@ -1045,7 +1045,7 @@ public class ITERATORS if(foundNext) return; while(iterator.hasNext()) { lastFound = iterator.NEXT(); - if(filter.TEST_VALUE(lastFound)) { + if(filter.test(lastFound)) { foundNext = true; break; }