diff --git a/Changelog.md b/Changelog.md index 05c6ed1..7824cf9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -1,14 +1,17 @@ # Changelog of versions -### Version 0.7.1 (Unreleased) +### Version 0.8.0 (Unreleased) - Added: ISizeProvider interface (Optimization Helper) - 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. +- Added: Functions that have the same type, Int2IntFunction as example, have now a identity function. +- Added: Functions of a BooleanValue have now alwaysTrue/False function. - 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. - 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 +- Breaking Change: Classes that used PrimitiveCollection functions now default to java functions where applicable, this is to increase compat. ### 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 b015fc0..17a728f 100644 --- a/src/builder/java/speiger/src/builder/ClassType.java +++ b/src/builder/java/speiger/src/builder/ClassType.java @@ -114,7 +114,7 @@ public enum ClassType public boolean needsCustomJDKType() { - return this == BYTE || this == SHORT || this == CHAR || this == FLOAT; + return this == BOOLEAN || this == BYTE || this == SHORT || this == CHAR || this == FLOAT; } public boolean needsCast() 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 963f4b9..0000000 --- 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/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index 2633e8a..3d70cf1 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -1,5 +1,8 @@ package speiger.src.builder.modules; +import speiger.src.builder.ClassType; +import speiger.src.builder.RequiredType; + @SuppressWarnings("javadoc") public class FunctionModule extends BaseModule { @@ -27,7 +30,11 @@ public class FunctionModule extends BaseModule { addBiRequirement("BiConsumer", ""); addBiRequirement("UnaryOperator", ""); - addBiRequirement("Function"); + if(valueType == ClassType.BOOLEAN) { + addRequirement("Function", "%1$s", RequiredType.BI_CLASS); + addRemapper("Function", (keyType.isObject() ? "" : "%s")+"Predicate"); + } + else addBiRequirement("Function"); addRemapper("BiConsumer", "%sConsumer"); } @@ -45,8 +52,10 @@ public class FunctionModule extends BaseModule 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"); + if(valueType == ClassType.BOOLEAN) addFunctionMappers("FUNCTION", "%sPredicate"); + else addBiClassMapper("FUNCTION", "Function", "2"); + + addFunctionMappers("PREDICATE", "%sPredicate"); addClassMapper("SUPPLIER", "Supplier"); addAbstractMapper("SINGLE_UNARY_OPERATOR", "%1$s%1$sUnaryOperator"); addBiClassMapper("UNARY_OPERATOR", "UnaryOperator", ""); diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index 59e9584..9b6e1ee 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -27,7 +27,7 @@ public class JavaModule extends BaseModule if(!keyType.needsCustomJDKType()) addFlag("JDK_TYPE"); if(!keyType.isPrimitiveBlocking()) addFlag("PRIMITIVES"); if(!valueType.isPrimitiveBlocking()) addFlag("VALUE_PRIMITIVES"); - if(valueType.needsCustomJDKType()) addFlag("JDK_VALUE"); + if(!valueType.needsCustomJDKType()) addFlag("JDK_VALUE"); } @Override @@ -100,7 +100,9 @@ public class JavaModule extends BaseModule 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_SAME_GENERIC_TYPE", keyType.isObject() ? "" : ""); + addSimpleMapper(" VALUE_SAME_GENERIC_TYPE", keyType.isObject() ? "" : ""); addSimpleMapper(" KEY_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+">" : ""); addSimpleMapper(" KEY_KEY_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+", "+keyType.getKeyType()+">" : ""); @@ -135,9 +137,14 @@ public class JavaModule extends BaseModule 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(" SK_GENERIC_TYPE", keyType.isObject() ? "<%s, "+keyType.getKeyType()+">" : "").removeBraces().setBraceType("<>"); + addInjectMapper(" KS_GENERIC_TYPE", keyType.isObject() ? "<"+keyType.getKeyType()+", %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("<>"); + addArgumentMapper(" VSS_GENERIC_TYPE", valueType.isObject() ? "<%1$s, %2$s>" : "<%2$s>").removeBraces().setBraceType("<>"); + addInjectMapper(" SV_GENERIC_TYPE", valueType.isObject() ? "<%s, "+valueType.getValueType()+">" : "").removeBraces().setBraceType("<>"); + addInjectMapper(" VS_GENERIC_TYPE", valueType.isObject() ? "<"+valueType.getValueType()+", %s>" : "").removeBraces().setBraceType("<>"); + addSimpleMapper(" GENERIC_KEY_BRACES", keyType.isObject() ? " <"+keyType.getKeyType()+">" : ""); addSimpleMapper(" GENERIC_VALUE_BRACES", valueType.isObject() ? " <"+valueType.getValueType()+">" : ""); 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 0c0fd31..fca6c79 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -2,6 +2,10 @@ package speiger.src.collections.PACKAGE.collections; import java.util.Objects; import java.util.function.Consumer; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif + #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; @@ -15,7 +19,9 @@ import speiger.src.collections.ints.functions.function.Int2ObjectFunction; #endif import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LIST; 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 d7ed74c..7e5c8e6 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 @@ -1,6 +1,6 @@ package speiger.src.collections.PACKAGE.functions.function; -#if JDK_FUNCTION && VALUE_BOOLEAN +#if VALUE_BOOLEAN || SAME_TYPE import java.util.Objects; #endif @@ -23,7 +23,65 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE */ public VALUE_TYPE APPLY(KEY_TYPE k); -#if JDK_FUNCTION && VALUE_BOOLEAN +#if SAME_TYPE + /** + * Creates a Default function that returns the input provided. + * @Type(T) + * @return a input returning function + */ + public static GENERIC_KEY_BRACES FUNCTION KEY_SAME_GENERIC_TYPE identity() { + return T -> T; + } + + /** + * Returns a composed function that first applies the {@code before} + * function to its input, and then applies this function to the result. + * If evaluation of either function throws an exception, it is relayed to + * the caller of the composed function. + * + * @Type(I) + * @param before the function that should be used first + * @return a composed function with a different starting function. + */ + public default GENERIC_SPECIAL_VALUE_BRACES FUNCTION SV_GENERIC_TYPE compose(FUNCTION SK_GENERIC_TYPE before) { + Objects.requireNonNull(before); + return T -> APPLY(before.APPLY(T)); + } + + /** + * Returns a composed function that first applies this function to + * its input, and then applies the {@code after} function to the result. + * If evaluation of either function throws an exception, it is relayed to + * the caller of the composed function. + * + * @Type(I) + * @param after the function that should be used last + * @return a composed function with a different starting function. + */ + public default GENERIC_SPECIAL_VALUE_BRACES FUNCTION KS_GENERIC_TYPE andThen(FUNCTION VS_GENERIC_TYPE after) { + Objects.requireNonNull(after); + return T -> after.APPLY(APPLY(T)); + } + +#endif +#if VALUE_BOOLEAN + /** + * Creates a Always true function that may be useful if you don't need to process information or just want a default. + * @Type(T) + * @return a default returning function + */ + public static GENERIC_KEY_BRACES FUNCTION KEY_GENERIC_TYPE alwaysTrue() { + return T -> true; + } + + /** + * Creates a Always false function that may be useful if you don't need to process information or just want a default. + * @Type(T) + * @return a default returning function + */ + public static GENERIC_KEY_BRACES FUNCTION KEY_GENERIC_TYPE alwaysFalse() { + return T -> false; + } /** * A Type specific and-function helper function that reduces boxing/unboxing @@ -35,6 +93,7 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE return T -> APPLY(T) && other.APPLY(T); } +#if JDK_FUNCTION @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE and(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { @@ -43,6 +102,12 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE } @Override +#else + /** + * A type specific inverter function + * @return the same function but inverts the result + */ +#endif public default FUNCTION KEY_VALUE_GENERIC_TYPE negate() { return T -> !APPLY(T); } @@ -57,6 +122,7 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE return T -> APPLY(T) || other.APPLY(T); } +#if JDK_FUNCTION @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE or(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { @@ -64,4 +130,5 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE return T -> APPLY(T) || other.APPLY(T); } #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 020f9db..58b21d8 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -14,10 +14,15 @@ import java.util.function.Consumer; import java.util.function.BiFunction; #endif +#if !TYPE_OBJECT && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import java.util.function.Predicate; import java.util.function.UnaryOperator; #if PRIMITIVES +#if !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; +#endif import java.util.function.JAVA_UNARY_OPERATOR; import java.nio.JAVA_BUFFER; #endif @@ -32,7 +37,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.utils.ITERATORS; 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 2d8f5df..cf49c2f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/CopyOnWriteList.template @@ -14,10 +14,15 @@ import java.util.function.Supplier; #if TYPE_OBJECT import java.util.function.BiFunction; #endif +#if !TYPE_OBJECT && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import java.util.function.Predicate; import java.util.function.UnaryOperator; #if PRIMITIVES +#if !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; +#endif import java.util.function.JAVA_UNARY_OPERATOR; import java.nio.JAVA_BUFFER; #endif @@ -32,7 +37,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.utils.ITERATORS; 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 22c8e9b..9b73a9e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ImmutableList.template @@ -13,8 +13,13 @@ import java.util.function.Consumer; #endif import java.util.function.Predicate; import java.util.function.UnaryOperator; +#if !TYPE_OBJECT && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif #if PRIMITIVES +#if !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; +#endif import java.util.function.JAVA_UNARY_OPERATOR; #endif @@ -25,7 +30,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.utils.ARRAYS; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.objects.utils.ObjectArrays; import speiger.src.collections.PACKAGE.utils.ITERATORS; 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 523e101..fdfb220 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/LinkedList.template @@ -18,13 +18,20 @@ import java.util.Spliterator.JAVA_SPLIT_ITERATOR; #endif import java.util.function.Consumer; import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import java.util.function.UnaryOperator; #if PRIMITIVES +#if !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; +#endif import java.util.function.JAVA_UNARY_OPERATOR; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; #if !TYPE_OBJECT @@ -40,6 +47,7 @@ import speiger.src.collections.PACKAGE.queues.PRIORITY_DEQUEUE; #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; 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 96333aa..0916c8e 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 @@ -3,10 +3,15 @@ package speiger.src.collections.PACKAGE.maps.abstracts; import java.util.AbstractMap; import java.util.Map; import java.util.Objects; +#if VALUE_BOOLEAN && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif 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; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/concurrent/ConcurrentOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/concurrent/ConcurrentOpenHashMap.template index 412d63e..8d586ae 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/concurrent/ConcurrentOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/concurrent/ConcurrentOpenHashMap.template @@ -6,8 +6,14 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.concurrent.locks.StampedLock; import java.util.function.Consumer; - +import java.util.function.Predicate; import java.util.function.BiFunction; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; @@ -18,12 +24,14 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; @@ -43,6 +51,7 @@ import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPER #if !TYPE_OBJECT import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOperator; #endif + import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_BI_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER; @@ -54,18 +63,14 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif - +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if VALUE_OBJECT import speiger.src.collections.objects.collections.ObjectIterator; #endif @@ -688,7 +693,7 @@ public class CONCURRENT_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0,m=segments.length;i filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0,m=segments.length;i filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0,m=segments.length;i filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0,m=segments.length;i filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); int result = 0; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template index a515eb8..a53409b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/customHash/LinkedOpenCustomHashMap.template @@ -3,16 +3,23 @@ package speiger.src.collections.PACKAGE.maps.impl.customHash; import java.util.Arrays; import java.util.Map; import java.util.NoSuchElementException; +import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; -import java.util.Objects; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT || VALUE_BOOLEAN +#if !TYPE_OBJECT && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; @@ -36,18 +43,15 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !TYPE_OBJECT #if !VALUE_OBJECT import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOperator; @@ -695,7 +699,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -709,7 +713,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -723,7 +727,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -768,7 +772,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -782,7 +786,7 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); 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 ff50bd7..1338b1f 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 @@ -7,6 +7,13 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -14,12 +21,14 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; @@ -39,6 +48,7 @@ import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPER #if !TYPE_OBJECT import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOperator; #endif + import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER; #endif @@ -49,18 +59,15 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif import speiger.src.collections.objects.collections.ObjectIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; import speiger.src.collections.objects.sets.ObjectSet; @@ -877,7 +884,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -895,7 +902,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -913,7 +920,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -964,7 +971,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -982,7 +989,7 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); 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 d32ad5d..a46646a 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 @@ -3,16 +3,23 @@ package speiger.src.collections.PACKAGE.maps.impl.hash; import java.util.Arrays; import java.util.Map; import java.util.NoSuchElementException; +import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; -import java.util.Objects; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT || VALUE_BOOLEAN +#if !TYPE_OBJECT && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; @@ -35,18 +42,15 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !TYPE_OBJECT #if !VALUE_OBJECT import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOperator; @@ -699,7 +703,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -713,7 +717,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -727,7 +731,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -772,7 +776,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -786,7 +790,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; 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 165ac32..5ac1cac 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 @@ -7,6 +7,13 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -14,12 +21,14 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; @@ -48,18 +57,15 @@ import speiger.src.collections.objects.functions.function.ObjectObjectUnaryOpera #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif import speiger.src.collections.objects.collections.ObjectIterator; import speiger.src.collections.objects.sets.AbstractObjectSet; import speiger.src.collections.objects.sets.ObjectSet; @@ -837,7 +843,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -855,7 +861,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -873,7 +879,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -924,7 +930,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -942,7 +948,7 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); 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 82e6d21..f74237f 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 @@ -6,17 +6,26 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; @@ -34,18 +43,15 @@ import speiger.src.collections.PACKAGE.utils.ARRAYS; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.sets.ABSTRACT_SET; #endif @@ -670,7 +676,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -684,7 +690,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -698,7 +704,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -743,7 +749,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -757,7 +763,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); 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 c99c3e6..2875def 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 @@ -6,17 +6,26 @@ import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; @@ -41,18 +50,15 @@ import speiger.src.collections.VALUE_PACKAGE.lists.VALUE_LIST_ITERATOR; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !VALUE_OBJECT import speiger.src.collections.objects.collections.ObjectIterator; #endif @@ -796,7 +802,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -808,7 +814,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -820,7 +826,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -858,7 +864,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); @@ -870,7 +876,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; 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 ff1a70e..937f652 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 @@ -5,6 +5,10 @@ import java.util.Map; import java.util.NoSuchElementException; import java.util.Objects; import java.util.function.Consumer; +#if VALUE_BOOLEAN +import java.util.function.Predicate; +#endif + import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTION; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; @@ -18,7 +22,9 @@ import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; #if !VALUE_OBJECT import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #endif +#if !VALUE_BOOLEAN import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.objects.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.objects.maps.interfaces.MAP; import speiger.src.collections.objects.sets.AbstractObjectSet; 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 f66067b..e701a96 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 @@ -9,6 +9,14 @@ import java.util.Objects; import java.util.NoSuchElementException; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif + import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT @@ -16,11 +24,13 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN -import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#if !VALUE_BOOLEAN || !JDK_TYPE +import speiger.src.collections.PACKAGE.functions.function.FUNCTION; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; -import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE +import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; @@ -47,18 +57,15 @@ import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !TYPE_OBJECT && !VALUE_OBJECT import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; #endif @@ -1842,7 +1849,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1854,7 +1861,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1866,7 +1873,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1904,7 +1911,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1916,7 +1923,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; @@ -2479,7 +2486,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2491,7 +2498,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2503,7 +2510,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2541,7 +2548,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2553,7 +2560,7 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; 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 d7d9a5e..deeeb07 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 @@ -9,6 +9,13 @@ import java.util.Objects; import java.util.NoSuchElementException; import java.util.function.Consumer; import java.util.function.BiFunction; +import java.util.function.Predicate; +#if !TYPE_OBJECT && JDK_TYPE +import java.util.function.PREDICATE; +#endif +#if !SAME_TYPE && JDK_VALUE && !VALUE_OBJECT +import java.util.function.VALUE_PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT @@ -16,11 +23,13 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #endif -#if !TYPE_OBJECT && !VALUE_BOOLEAN -import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#if !VALUE_BOOLEAN || !JDK_TYPE +import speiger.src.collections.PACKAGE.functions.function.FUNCTION; #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; -import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#if !TYPE_OBJECT && !VALUE_BOOLEAN && !JDK_TYPE +import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !SAME_TYPE import speiger.src.collections.PACKAGE.functions.function.SINGLE_UNARY_OPERATOR; @@ -47,18 +56,15 @@ import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER; #if !TYPE_OBJECT && !VALUE_OBJECT || !VALUE_OBJECT import speiger.src.collections.objects.functions.consumer.ObjectObjectConsumer; #endif -#if !TYPE_OBJECT || !VALUE_BOOLEAN -#if !VALUE_OBJECT || SAME_TYPE -import speiger.src.collections.objects.functions.function.Object2BooleanFunction; -#endif -#endif #if !SAME_TYPE #if !TYPE_OBJECT import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; #endif +#if !JDK_VALUE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif +#endif #if !TYPE_OBJECT && !VALUE_OBJECT import speiger.src.collections.objects.collections.ObjectBidirectionalIterator; #endif @@ -1909,7 +1915,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1921,7 +1927,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1933,7 +1939,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1971,7 +1977,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -1983,7 +1989,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; @@ -2546,7 +2552,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesAny(Object2BooleanFunction filter) { + public boolean matchesAny(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2558,7 +2564,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesNone(Object2BooleanFunction filter) { + public boolean matchesNone(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2570,7 +2576,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public boolean matchesAll(Object2BooleanFunction filter) { + public boolean matchesAll(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2608,7 +2614,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Object2BooleanFunction filter) { + public MAP.Entry KEY_VALUE_GENERIC_TYPE findFirst(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return null; BasicEntry KEY_VALUE_GENERIC_TYPE subEntry = new BasicEntryKV_BRACES(); @@ -2620,7 +2626,7 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public int count(Object2BooleanFunction filter) { + public int count(Predicate filter) { Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; 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 2cf50ed..b876f61 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 @@ -10,6 +10,9 @@ import java.util.function.BiConsumer; import java.util.function.BiFunction; import java.util.function.Consumer; import java.util.function.Function; +#if VALUE_BOOLEAN && JDK_FUNCTION +import java.util.function.PREDICATE; +#endif #if TYPE_OBJECT #if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE @@ -19,7 +22,9 @@ import java.util.Comparator; import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !TYPE_OBJECT && !TYPE_BOOLEAN && SORTED_MAP_FEATURE #if AVL_TREE_MAP_FEATURE || RB_TREE_MAP_FEATURE diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template b/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template index 330250a..55ef4d1 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template @@ -8,6 +8,9 @@ import java.util.function.BiFunction; #endif import java.util.Objects; import java.util.NoSuchElementException; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.ITERATOR; #if !TYPE_OBJECT @@ -15,7 +18,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.utils.ITrimmable; diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/ArrayPriorityQueue.template b/src/builder/resources/speiger/assets/collections/templates/queues/ArrayPriorityQueue.template index 25705b3..b2831a6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/ArrayPriorityQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/ArrayPriorityQueue.template @@ -8,6 +8,9 @@ import java.util.function.Consumer; import java.util.function.BiFunction; #endif import java.util.Objects; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -16,7 +19,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.utils.SanityChecks; diff --git a/src/builder/resources/speiger/assets/collections/templates/queues/HeapPriorityQueue.template b/src/builder/resources/speiger/assets/collections/templates/queues/HeapPriorityQueue.template index b1f6eeb..4d8cdea 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/HeapPriorityQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/HeapPriorityQueue.template @@ -8,6 +8,9 @@ import java.util.function.Consumer; import java.util.function.BiFunction; #endif import java.util.Objects; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -16,7 +19,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.utils.SanityChecks; 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 c35d171..1d7b99e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template @@ -10,13 +10,19 @@ import java.util.function.BiFunction; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Objects; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif + import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; 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 f3cfaf6..79adf83 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template @@ -9,7 +9,10 @@ import java.util.function.BiFunction; import java.util.NoSuchElementException; import java.util.Objects; import java.util.Set; -#if PRIMITIVES +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif +#if PRIMITIVES && !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; #endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; @@ -17,7 +20,9 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template index 69d5438..5f6bd61 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ImmutableOpenHashSet.template @@ -9,6 +9,9 @@ import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Objects; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; @@ -17,7 +20,9 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.utils.ARRAYS; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template index b2e9037..ee1398e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template @@ -9,6 +9,9 @@ import java.util.Objects; import java.util.Collection; import java.util.Iterator; import java.util.NoSuchElementException; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; #if !TYPE_OBJECT @@ -21,7 +24,9 @@ import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.STRATEGY; import speiger.src.collections.utils.HashUtil; diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template index da9fbb4..d63c051 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template @@ -9,6 +9,9 @@ import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; #endif +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; #if !TYPE_OBJECT @@ -19,7 +22,9 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; #if !TYPE_OBJECT 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 801001f..31426da 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template @@ -10,6 +10,9 @@ import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; #endif +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -18,7 +21,9 @@ import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.utils.STRATEGY; 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 507131b..d59c123 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template @@ -10,6 +10,9 @@ import java.util.Objects; import java.util.function.Consumer; import java.util.function.BiFunction; #endif +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -18,7 +21,9 @@ import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.utils.HashUtil; import speiger.src.collections.utils.ITrimmable; 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 cddc668..18f62c0 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template @@ -10,13 +10,19 @@ import java.util.function.BiFunction; import java.util.Iterator; import java.util.NoSuchElementException; import java.util.Objects; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif + import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; 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 66ca802..69c9bef 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -13,7 +13,10 @@ import java.util.Comparator; import java.util.function.BiFunction; #endif import java.util.function.Predicate; -#if PRIMITIVES +#if JDK_FUNCTION && !TYPE_OBJECT +import java.util.function.PREDICATE; +#endif +#if PRIMITIVES && !JDK_FUNCTION import java.util.function.JAVA_PREDICATE; #endif import java.util.function.Consumer; @@ -29,7 +32,9 @@ import speiger.src.collections.objects.utils.ObjectArrays; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.utils.ARRAYS; #endif +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; #if !TYPE_BOOLEAN 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 d5f02be..84f4aee 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template @@ -8,6 +8,9 @@ import java.util.Comparator; #endif import java.util.concurrent.atomic.AtomicLong; import java.util.function.Consumer; +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.ITERABLE; import speiger.src.collections.PACKAGE.collections.COLLECTION; @@ -19,7 +22,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.utils.ISizeProvider; /** 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 805d18f..d9aebe7 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -6,6 +6,9 @@ import java.util.NoSuchElementException; import java.util.Comparator; import java.util.function.CONSUMER; #endif +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.ITERATOR; #if !TYPE_OBJECT @@ -15,7 +18,9 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif import speiger.src.collections.PACKAGE.functions.function.TO_OBJECT_FUNCTION; +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif #if ARRAY_LIST_FEATURE || LINKED_LIST_FEATURE import speiger.src.collections.PACKAGE.lists.LIST; #if ARRAY_LIST_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 03ba127..7289a6d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/PriorityQueues.template @@ -5,6 +5,9 @@ import java.util.Collection; import java.util.Comparator; import java.util.function.Consumer; #endif +#if JDK_FUNCTION +import java.util.function.PREDICATE; +#endif import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; @@ -18,7 +21,9 @@ import speiger.src.collections.PACKAGE.queues.PRIORITY_QUEUE; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif +#if !JDK_FUNCTION import speiger.src.collections.PACKAGE.functions.function.PREDICATE; +#endif import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; /** 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 d60338c..768845d 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 @@ -14,6 +14,9 @@ import java.util.function.Consumer; #if !TYPE_OBJECT && !TYPE_BOOLEAN import java.util.function.Function; #endif +#if VALUE_BOOLEAN && JDK_TYPE +import java.util.function.PREDICATE; +#endif import speiger.src.collections.objects.collections.ObjectIterable; import speiger.src.collections.objects.collections.ObjectIterator; @@ -28,7 +31,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR; #endif #endif import speiger.src.collections.PACKAGE.functions.consumer.BI_CONSUMER; +#if !VALUE_BOOLEAN || !JDK_TYPE import speiger.src.collections.PACKAGE.functions.function.FUNCTION; +#endif import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; import speiger.src.collections.PACKAGE.maps.abstracts.ABSTRACT_MAP; import speiger.src.collections.PACKAGE.maps.interfaces.MAP;