Fixed a few bugs and Started the Set compilation.

This commit is contained in:
Speiger 2022-12-06 04:09:40 +01:00
parent dafb162797
commit 2ed090e989
5 changed files with 169 additions and 20 deletions

View File

@ -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

View File

@ -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) {

View File

@ -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");

View File

@ -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<String> getModuleKeys(ClassType keyType, ClassType valueType)
{
Set<String> 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");
}

View File

@ -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<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE> action) { synchronized(mutex) { map.forEach(action); } }
#endif
}
#endif
}