Few changes.
-Removed: BooleanSet classes are gone. (Unused anyways) -Removed: Boolean2xMaps are also now gone. (Unused Anyways) -Added: GlobalFlags that are shared across packages.
This commit is contained in:
parent
cc87cae145
commit
c9fc963670
|
@ -7,6 +7,7 @@
|
|||
- 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.
|
||||
- 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.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -31,9 +31,11 @@ public class ModulePackage
|
|||
List<Predicate<String>> blockedFilters = new ArrayList<>();
|
||||
List<IMapper> mappers = new ArrayList<>();
|
||||
Set<String> flags = new LinkedHashSet<>();
|
||||
Set<String> globalFlags;
|
||||
BiConsumer<String, RequiredType> requirements = VOID;
|
||||
|
||||
public ModulePackage(ClassType keyType, ClassType valueType) {
|
||||
public ModulePackage(Set<String> 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<ModulePackage> createPackages() {
|
||||
public static List<ModulePackage> createPackages(Set<String> globalFlags) {
|
||||
List<ModulePackage> 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;
|
||||
|
|
|
@ -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<String> globalFlags = new HashSet<>();
|
||||
List<ModulePackage> simplePackages = new ArrayList<>();
|
||||
List<ModulePackage> biPackages = new ArrayList<>();
|
||||
List<ModulePackage> 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);
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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<String> 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");
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue