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.
This commit is contained in:
Speiger 2022-12-07 04:07:11 +01:00
parent 1b1ec4b87a
commit 8d9f7a6761
7 changed files with 828 additions and 737 deletions

File diff suppressed because it is too large Load Diff

View File

@ -148,13 +148,10 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
} }
public void addModules(List<BaseModule> modules) public void addModules(List<BaseModule> modules)
{
if((flags & LOAD) != 0)
{ {
for(int i = 0,m=modules.size();i<m;i++) { for(int i = 0,m=modules.size();i<m;i++) {
modules.get(i).setManager(manager); modules.get(i).setManager(manager);
} }
}
for(int i = 0,m=modules.size();i<m;i++) { for(int i = 0,m=modules.size();i<m;i++) {
biPackages.forEach(modules.get(i)::init); biPackages.forEach(modules.get(i)::init);
} }
@ -256,8 +253,8 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor
boolean force = flags.contains("force"); boolean force = flags.contains("force");
boolean tests = flags.contains("tests"); boolean tests = flags.contains("tests");
boolean forceTests = flags.contains("force-tests"); boolean forceTests = flags.contains("force-tests");
boolean load = !flags.contains("load"); boolean load = flags.contains("load");
boolean save = flags.contains("save"); boolean save = !flags.contains("save");
int flag = (load ? LOAD : 0) | (save ? SAVE : 0); int flag = (load ? LOAD : 0) | (save ? SAVE : 0);
new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force);
if(tests) { if(tests) {

View File

@ -1,8 +1,8 @@
package speiger.src.builder.modules; package speiger.src.builder.modules;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet;
import speiger.src.builder.ClassType; import speiger.src.builder.ClassType;
@ -18,21 +18,23 @@ public class ListModule extends BaseModule
@Override @Override
protected void loadFlags() { protected void loadFlags() {
if(isModuleEnabled()) addKeyFlag("LIST_MODULE"); if(isModuleEnabled()) addKeyFlag("LIST_MODULE");
if(isModuleEnabled("Lists")) addKeyFlag("LISTS_FEATURE"); if(isModuleEnabled("Wrappers")) addKeyFlag("LISTS_FEATURE");
if(isModuleEnabled("ArrayList")) addKeyFlag("ARRAY_LIST_FEATURE"); boolean implementations = isModuleEnabled("Implementations");
if(isModuleEnabled("LinkedList")) addKeyFlag("LINKED_LIST_FEATURE"); if(implementations && isModuleEnabled("ArrayList")) addKeyFlag("ARRAY_LIST_FEATURE");
if(isModuleEnabled("ImmutableList")) addKeyFlag("IMMUTABLE_LIST_FEATURE"); if(implementations && isModuleEnabled("LinkedList")) addKeyFlag("LINKED_LIST_FEATURE");
if(isModuleEnabled("CopyOnWriteList")) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE"); if(implementations && isModuleEnabled("ImmutableList")) addKeyFlag("IMMUTABLE_LIST_FEATURE");
if(implementations && isModuleEnabled("CopyOnWriteList")) addKeyFlag("COPY_ON_WRITE_LIST_FEATURE");
} }
@Override @Override
protected void loadBlockades() protected void loadBlockades()
{ {
if(!isModuleEnabled("Lists")) addBlockedFiles("Lists"); if(!isModuleEnabled("Wrappers")) addBlockedFiles("Lists");
if(!isModuleEnabled("ArrayList")) addBlockedFiles("ArrayList"); boolean implementations = !isModuleEnabled("Implementations");
if(!isModuleEnabled("LinkedList")) addBlockedFiles("LinkedList"); if(implementations || !isModuleEnabled("ArrayList")) addBlockedFiles("ArrayList");
if(!isModuleEnabled("ImmutableList")) addBlockedFiles("ImmutableList"); if(implementations || !isModuleEnabled("LinkedList")) addBlockedFiles("LinkedList");
if(!isModuleEnabled("CopyOnWriteList")) addBlockedFiles("CopyOnWriteList"); if(implementations || !isModuleEnabled("ImmutableList")) addBlockedFiles("ImmutableList");
if(implementations || !isModuleEnabled("CopyOnWriteList")) addBlockedFiles("CopyOnWriteList");
if(!isModuleEnabled()) addBlockedFiles("List", "AbstractList"); if(!isModuleEnabled()) addBlockedFiles("List", "AbstractList");
if(keyType.isObject()) addBlockedFiles("ListFillBufferTester"); if(keyType.isObject()) addBlockedFiles("ListFillBufferTester");
@ -41,7 +43,7 @@ public class ListModule extends BaseModule
@Override @Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { public Set<String> 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 @Override

View File

@ -1,8 +1,8 @@
package speiger.src.builder.modules; package speiger.src.builder.modules;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet;
import speiger.src.builder.ClassType; 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); } public boolean areDependenciesLoaded() { return isDependencyLoaded(SetModule.INSTANCE) && isDependencyLoaded(CollectionModule.INSTANCE, false); }
@Override @Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
{ Set<String> sets = new TreeSet<>();
Set<String> sets = new HashSet<>(); sets.addAll(Arrays.asList("Wrappers", "Implementations"));
sets.add("Maps");
sets.addAll(Arrays.asList("OrderedMap", "SortedMap")); sets.addAll(Arrays.asList("OrderedMap", "SortedMap"));
sets.addAll(Arrays.asList("ArrayMap", "ConcurrentMap", "ImmutableMap")); sets.addAll(Arrays.asList("ArrayMap", "ConcurrentMap", "ImmutableMap"));
sets.addAll(Arrays.asList("HashMap", "LinkedHashMap")); sets.addAll(Arrays.asList("HashMap", "LinkedHashMap"));
@ -40,10 +39,11 @@ public class MapModule extends BaseModule
protected void loadFlags() protected void loadFlags()
{ {
if(isModuleEnabled()) addFlag("MAP_MODULE"); if(isModuleEnabled()) addFlag("MAP_MODULE");
if(isModuleEnabled("Maps")) addFlag("Maps"); if(isModuleEnabled("Wrappers")) addFlag("MAPS_FEATURE");
boolean hashMap = isModuleEnabled("HashMap"); boolean implementations = isModuleEnabled("Implementations");
boolean customHashMap = isModuleEnabled("CustomHashMap"); boolean hashMap = implementations && isModuleEnabled("HashMap");
boolean enumMap = isModuleEnabled("EnumMap"); boolean customHashMap = implementations && isModuleEnabled("CustomHashMap");
boolean enumMap = implementations && isModuleEnabled("EnumMap");
if(isModuleEnabled("OrderedMap")) { if(isModuleEnabled("OrderedMap")) {
addFlag("ORDERED_MAP_FEATURE"); addFlag("ORDERED_MAP_FEATURE");
@ -54,11 +54,11 @@ public class MapModule extends BaseModule
} }
if(isModuleEnabled("SortedMap")) { if(isModuleEnabled("SortedMap")) {
addFlag("SORTED_MAP_FEATURE"); addFlag("SORTED_MAP_FEATURE");
if(isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE"); if(implementations && isModuleEnabled("AVLTreeMap")) addFlag("AVL_TREE_MAP_FEATURE");
if(isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE"); if(implementations && isModuleEnabled("RBTreeMap")) addFlag("RB_TREE_MAP_FEATURE");
} }
if(isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE"); if(implementations && isModuleEnabled("ConcurrentMap")) addFlag("CONCURRENT_MAP_FEATURE");
if(isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE"); if(implementations && isModuleEnabled("ImmutableMap")) addFlag("IMMUTABLE_MAP_FEATURE");
if(hashMap) addFlag("HASH_MAP_FEATURE"); if(hashMap) addFlag("HASH_MAP_FEATURE");
if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE"); if(customHashMap) addFlag("CUSTOM_HASH_MAP_FEATURE");
if(enumMap) addFlag("ENUM_MAP_FEATURE"); if(enumMap) addFlag("ENUM_MAP_FEATURE");
@ -68,21 +68,22 @@ public class MapModule extends BaseModule
protected void loadBlockades() protected void loadBlockades()
{ {
if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap"); if(!isModuleEnabled()) addBlockedFiles("Map", "AbstractMap");
if(!isModuleEnabled("Maps")) addBlockedFiles("Maps"); if(!isModuleEnabled("Wrappers")) addBlockedFiles("Maps");
if(!isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap"); boolean implementations = !isModuleEnabled("Implementations");
if(!isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap"); if(implementations || !isModuleEnabled("ImmutableMap")) addBlockedFiles("ImmutableOpenHashMap");
if(implementations || !isModuleEnabled("ConcurrentMap")) addBlockedFiles("ConcurrentMap", "ConcurrentOpenHashMap");
boolean ordered = !isModuleEnabled("OrderedMap"); boolean ordered = !isModuleEnabled("OrderedMap");
if(ordered) addBlockedFiles("OrderedMap"); if(ordered) addBlockedFiles("OrderedMap");
boolean hashMap = !isModuleEnabled("HashMap"); boolean hashMap = implementations || !isModuleEnabled("HashMap");
if(hashMap) addBlockedFiles("OpenHashMap"); if(hashMap) addBlockedFiles("OpenHashMap");
if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap"); if(hashMap || ordered || !isModuleEnabled("LinkedHashMap")) addBlockedFiles("LinkedOpenHashMap");
boolean customHashMap = !isModuleEnabled("CustomHashMap"); boolean customHashMap = implementations || !isModuleEnabled("CustomHashMap");
if(customHashMap) addBlockedFiles("OpenCustomHashMap"); if(customHashMap) addBlockedFiles("OpenCustomHashMap");
if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap"); if(customHashMap || ordered || !isModuleEnabled("LinkedCustomHashMap")) addBlockedFiles("LinkedOpenCustomHashMap");
boolean enumMap = !isModuleEnabled("EnumMap"); boolean enumMap = implementations || !isModuleEnabled("EnumMap");
if(enumMap) addBlockedFiles("EnumMap"); if(enumMap) addBlockedFiles("EnumMap");
if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap"); if(enumMap || ordered || !isModuleEnabled("LinkedEnumMap")) addBlockedFiles("LinkedEnumMap");
@ -90,8 +91,8 @@ public class MapModule extends BaseModule
boolean sorted = !isModuleEnabled("SortedMap"); boolean sorted = !isModuleEnabled("SortedMap");
if(sorted) addBlockedFiles("SortedMap", "NavigableMap"); if(sorted) addBlockedFiles("SortedMap", "NavigableMap");
if(sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap"); if(implementations || sorted || !isModuleEnabled("AVLTreeMap")) addBlockedFiles("AVLTreeMap");
if(sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap"); if(implementations || sorted || !isModuleEnabled("RBTreeMap")) addBlockedFiles("RBTreeMap");
if(keyType == ClassType.BOOLEAN) if(keyType == ClassType.BOOLEAN)
{ {

View File

@ -1,8 +1,8 @@
package speiger.src.builder.modules; package speiger.src.builder.modules;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet;
import java.util.Set; import java.util.Set;
import java.util.TreeSet;
import speiger.src.builder.ClassType; import speiger.src.builder.ClassType;
@ -22,8 +22,8 @@ public class SetModule extends BaseModule
public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); } public boolean areDependenciesLoaded() { return isDependencyLoaded(CollectionModule.INSTANCE); }
@Override @Override
public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) { public Set<String> getModuleKeys(ClassType keyType, ClassType valueType) {
Set<String> sets = new HashSet<>(); Set<String> sets = new TreeSet<>();
sets.add("Sets"); sets.addAll(Arrays.asList("Wrappers", "Implementations"));
sets.addAll(Arrays.asList("OrderedSet", "SortedSet")); sets.addAll(Arrays.asList("OrderedSet", "SortedSet"));
sets.addAll(Arrays.asList("ArraySet", "ImmutableSet")); sets.addAll(Arrays.asList("ArraySet", "ImmutableSet"));
sets.addAll(Arrays.asList("HashSet", "LinkedHashSet")); sets.addAll(Arrays.asList("HashSet", "LinkedHashSet"));
@ -36,22 +36,23 @@ public class SetModule extends BaseModule
protected void loadFlags() protected void loadFlags()
{ {
if(isModuleEnabled()) addFlag("SET_MODULE"); if(isModuleEnabled()) addFlag("SET_MODULE");
if(isModuleEnabled("Sets")) addFlag("Sets"); if(isModuleEnabled("Wrappers")) addFlag("SETS_FEATURE");
boolean hashSet = isModuleEnabled("HashSet"); boolean implementations = isModuleEnabled("Implementations");
boolean customHashSet = isModuleEnabled("CustomHashSet"); boolean hashSet = implementations && isModuleEnabled("HashSet");
boolean customHashSet = implementations && isModuleEnabled("CustomHashSet");
if(isModuleEnabled("OrderedSet")) { if(isModuleEnabled("OrderedSet")) {
addFlag("ORDERED_SET_FEATURE"); 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(hashSet && isModuleEnabled("LinkedHashSet")) addFlag("LINKED_SET_FEATURE");
if(customHashSet && isModuleEnabled("LinkedCustomHashSet")) addFlag("LINKED_CUSTOM_SET_FEATURE"); if(customHashSet && isModuleEnabled("LinkedCustomHashSet")) addFlag("LINKED_CUSTOM_SET_FEATURE");
} }
if(isModuleEnabled("SortedSet")) { if(isModuleEnabled("SortedSet")) {
addFlag("SORTED_SET_FEATURE"); addFlag("SORTED_SET_FEATURE");
if(isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE"); if(implementations && isModuleEnabled("AVLTreeSet")) addFlag("AVL_TREE_SET_FEATURE");
if(isModuleEnabled("RBTreeSet")) addFlag("RB_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(hashSet) addFlag("HASH_SET_FEATURE");
if(customHashSet) addFlag("CUSTOM_HASH_SET_FEATURE"); if(customHashSet) addFlag("CUSTOM_HASH_SET_FEATURE");
} }
@ -60,25 +61,26 @@ public class SetModule extends BaseModule
protected void loadBlockades() protected void loadBlockades()
{ {
if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet"); if(!isModuleEnabled()) addBlockedFiles("Set", "AbstractSet");
if(!isModuleEnabled("Sets")) addBlockedFiles("Sets"); if(!isModuleEnabled("Wrappers")) addBlockedFiles("Sets");
if(!isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet"); boolean implementations = !isModuleEnabled("Implementations");
if(implementations || !isModuleEnabled("ImmutableSet")) addBlockedFiles("ImmutableOpenHashSet");
boolean ordered = !isModuleEnabled("OrderedSet"); boolean ordered = !isModuleEnabled("OrderedSet");
if(ordered) addBlockedFiles("OrderedSet"); if(ordered) addBlockedFiles("OrderedSet");
boolean hashSet = !isModuleEnabled("HashSet"); boolean hashSet = implementations || !isModuleEnabled("HashSet");
if(hashSet) addBlockedFiles("OpenHashSet"); if(hashSet) addBlockedFiles("OpenHashSet");
if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet"); if(hashSet || ordered || !isModuleEnabled("LinkedHashSet")) addBlockedFiles("LinkedOpenHashSet");
boolean customHashSet = !isModuleEnabled("CustomHashSet"); boolean customHashSet = implementations || !isModuleEnabled("CustomHashSet");
if(customHashSet) addBlockedFiles("OpenCustomHashSet"); if(customHashSet) addBlockedFiles("OpenCustomHashSet");
if(customHashSet || ordered || !isModuleEnabled("LinkedCustomHashSet")) addBlockedFiles("LinkedOpenCustomHashSet"); if(customHashSet || ordered || !isModuleEnabled("LinkedCustomHashSet")) addBlockedFiles("LinkedOpenCustomHashSet");
if(ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet"); if(implementations || ordered || !isModuleEnabled("ArraySet")) addBlockedFiles("ArraySet");
boolean sorted = !isModuleEnabled("SortedSet"); boolean sorted = !isModuleEnabled("SortedSet");
if(sorted) addBlockedFiles("SortedSet", "NavigableSet"); if(sorted) addBlockedFiles("SortedSet", "NavigableSet");
if(sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet"); if(implementations || sorted || !isModuleEnabled("AVLTreeSet")) addBlockedFiles("AVLTreeSet");
if(sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet"); if(implementations || sorted || !isModuleEnabled("RBTreeSet")) addBlockedFiles("RBTreeSet");
if(keyType == ClassType.BOOLEAN) if(keyType == ClassType.BOOLEAN)
{ {

View File

@ -27,14 +27,14 @@ import speiger.src.collections.PACKAGE.functions.function.PREDICATE;
import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
#endif #endif
import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; 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; import speiger.src.collections.PACKAGE.lists.LIST;
#endif
#if ARRAY_LIST_FEATURE #if ARRAY_LIST_FEATURE
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
#else if LINKED_LIST_FEATURE #else if LINKED_LIST_FEATURE
import speiger.src.collections.PACKAGE.lists.LINKED_LIST; import speiger.src.collections.PACKAGE.lists.LINKED_LIST;
#endif #endif
#endif
#if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE #if !TYPE_BOOLEAN && OBJECT_ASYNC_MODULE
#if SET_MODULE #if SET_MODULE
import speiger.src.collections.PACKAGE.sets.SET; import speiger.src.collections.PACKAGE.sets.SET;

View File

@ -16,14 +16,14 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#endif #endif
import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION;
import speiger.src.collections.PACKAGE.functions.function.PREDICATE; 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 #if ARRAY_LIST_FEATURE
import speiger.src.collections.PACKAGE.lists.ARRAY_LIST; import speiger.src.collections.PACKAGE.lists.ARRAY_LIST;
#else if LINKED_LIST_FEATURE #else if LINKED_LIST_FEATURE
import speiger.src.collections.PACKAGE.lists.LINKED_LIST; import speiger.src.collections.PACKAGE.lists.LINKED_LIST;
#endif #endif
import speiger.src.collections.PACKAGE.lists.LIST;
#endif #endif
import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;