diff --git a/Changelog.md b/Changelog.md index 3659f18..05c6ed1 100644 --- a/Changelog.md +++ b/Changelog.md @@ -8,6 +8,7 @@ - Fixed: OpenHashSet/Map and their Custom Variants no longer rely on List implementations. - Fixed: ObjectCopyOnWriteList.of did create a ObjectArrayList instead of the CopyOnWrite variant. - Removed: BooleanSet and Maps that start with a Boolean classes since they can not be used anyways. +- Breaking Change: Function classes now use the "apply/applyAs/test" format from Java itself, instead of the "get" format. This cleans up a lot of things. But will break existing function class implementations ### Version 0.7.0 - Added: Over 11 Million Unit Tests to this library to ensure quality. diff --git a/src/builder/java/speiger/src/builder/ClassType.java b/src/builder/java/speiger/src/builder/ClassType.java index 139d130..b015fc0 100644 --- a/src/builder/java/speiger/src/builder/ClassType.java +++ b/src/builder/java/speiger/src/builder/ClassType.java @@ -133,6 +133,12 @@ public enum ClassType } } + public String getApply(ClassType other) { + if(other == BOOLEAN) return "test"; + if(other == ClassType.OBJECT) return "apply"; + return "applyAs"+other.getFileType(); + } + public String getEquals(boolean not) { switch(this) diff --git a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java index 97b50b8..8ab7a34 100644 --- a/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java +++ b/src/builder/java/speiger/src/builder/PrimitiveCollectionsBuilder.java @@ -253,7 +253,7 @@ public class PrimitiveCollectionsBuilder extends TemplateProcessor boolean force = flags.contains("force"); boolean tests = flags.contains("tests"); boolean forceTests = flags.contains("force-tests"); - boolean load = !flags.contains("load"); + boolean load = flags.contains("load"); boolean save = flags.contains("save"); int flag = (load ? LOAD : 0) | (save ? SAVE : 0); new PrimitiveCollectionsBuilder(silent).setFlags(flag).process(force); diff --git a/src/builder/java/speiger/src/builder/modules/FunctionModule.java b/src/builder/java/speiger/src/builder/modules/FunctionModule.java index 6829ccd..2633e8a 100644 --- a/src/builder/java/speiger/src/builder/modules/FunctionModule.java +++ b/src/builder/java/speiger/src/builder/modules/FunctionModule.java @@ -34,8 +34,7 @@ public class FunctionModule extends BaseModule @Override protected void loadFunctions() { - addSimpleMapper("VALUE_TEST_VALUE", valueType.isObject() ? "getBoolean" : "get"); - addSimpleMapper("TEST_VALUE", keyType.isObject() ? "getBoolean" : "get"); + addSimpleMapper("APPLY", keyType.getApply(valueType)); } @Override diff --git a/src/builder/java/speiger/src/builder/modules/JavaModule.java b/src/builder/java/speiger/src/builder/modules/JavaModule.java index 3dc2b67..59e9584 100644 --- a/src/builder/java/speiger/src/builder/modules/JavaModule.java +++ b/src/builder/java/speiger/src/builder/modules/JavaModule.java @@ -41,7 +41,6 @@ public class JavaModule extends BaseModule addSimpleMapper("APPLY_KEY_VALUE", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); addSimpleMapper("APPLY_VALUE", valueType.isObject() ? "apply" : "applyAs"+valueType.getNonFileType()); addSimpleMapper("APPLY_CAST", "applyAs"+keyType.getCustomJDKType().getNonFileType()); - addSimpleMapper("APPLY", keyType.isObject() ? "apply" : "applyAs"+keyType.getNonFileType()); //Shared by Maps and Pairs so moved to java. addFunctionMappers("ENTRY_KEY", "get%sKey"); diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template index 85817e7..efcbf6b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -183,7 +183,7 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE * @see Collection#toArray(Object[]) */ default KEY_TYPE[] TO_ARRAY(Int2ObjectFunction action) { - return TO_ARRAY(action.get(size())); + return TO_ARRAY(action.apply(size())); } #else diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template index fecdeff..0c0fd31 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -287,7 +287,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable if(prov != null) { int size = prov.size(); if(size >= 0) { - KEY_TYPE[] array = action.get(size); + KEY_TYPE[] array = action.apply(size); ITERATORS.unwrap(array, iterator()); return array; } @@ -321,7 +321,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) return true; + if(filter.test(iter.NEXT())) return true; } return false; } @@ -334,7 +334,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) return false; + if(filter.test(iter.NEXT())) return false; } return true; } @@ -347,7 +347,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable default boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(!filter.TEST_VALUE(iter.NEXT())) return false; + if(!filter.test(iter.NEXT())) return false; } return true; } @@ -361,7 +361,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable Objects.requireNonNull(filter); for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { KEY_TYPE entry = iter.NEXT(); - if(filter.TEST_VALUE(entry)) return entry; + if(filter.test(entry)) return entry; } return EMPTY_VALUE; } @@ -432,7 +432,7 @@ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable Objects.requireNonNull(filter); int result = 0; for(ITERATOR KEY_GENERIC_TYPE iter = iterator();iter.hasNext();) { - if(filter.TEST_VALUE(iter.NEXT())) result++; + if(filter.test(iter.NEXT())) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template b/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template index e43c825..d7ed74c 100644 --- a/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template +++ b/src/builder/resources/speiger/assets/collections/templates/functions/function/Function.template @@ -21,12 +21,9 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE * @param k the value that should be processed * @return the result of the function */ - public VALUE_TYPE GET_VALUE(KEY_TYPE k); + public VALUE_TYPE APPLY(KEY_TYPE k); -#if JDK_FUNCTION -#if VALUE_BOOLEAN - @Override - public default VALUE_TYPE test(KEY_TYPE k) { return GET_VALUE(k); } +#if JDK_FUNCTION && VALUE_BOOLEAN /** * A Type specific and-function helper function that reduces boxing/unboxing @@ -35,19 +32,19 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE */ public default FUNCTION KEY_VALUE_GENERIC_TYPE andType(FUNCTION KEY_VALUE_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) && other.GET_VALUE(T); + return T -> APPLY(T) && other.APPLY(T); } @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE and(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) && other.test(T); + return T -> APPLY(T) && other.APPLY(T); } @Override public default FUNCTION KEY_VALUE_GENERIC_TYPE negate() { - return T -> !GET_VALUE(T); + return T -> !APPLY(T); } /** @@ -57,23 +54,14 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE */ public default FUNCTION KEY_VALUE_GENERIC_TYPE orType(FUNCTION KEY_VALUE_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) || other.GET_VALUE(T); + return T -> APPLY(T) || other.APPLY(T); } @Override @Deprecated public default FUNCTION KEY_VALUE_GENERIC_TYPE or(JAVA_FUNCTION KEY_VALUE_SUPER_GENERIC_TYPE other) { Objects.requireNonNull(other); - return T -> GET_VALUE(T) || other.test(T); + return T -> APPLY(T) || other.APPLY(T); } -#else if VALUE_OBJECT - - @Override - public default VALUE_TYPE apply(KEY_TYPE k) { return GET_VALUE(k); } -#else - - @Override - public default VALUE_TYPE APPLY_VALUE(KEY_TYPE k) { return GET_VALUE(k); } -#endif #endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template index 21b1cc6..020f9db 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -649,7 +649,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(int i = 0;i=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } } return false; @@ -901,12 +901,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } } return true; @@ -919,12 +919,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } } return true; @@ -970,12 +970,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } } return null; @@ -989,12 +989,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL int result = 0; if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } for(int i = nullIndex-1;i>=0;i--) { if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } } return result; @@ -1117,9 +1117,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true; } return false; } @@ -1128,9 +1128,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false; } return true; } @@ -1139,9 +1139,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false; } return true; } @@ -1198,9 +1198,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_KEY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i]; } return EMPTY_KEY_VALUE; } @@ -1210,9 +1210,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++; } return result; } @@ -1273,9 +1273,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true; + if(containsNull && filter.test(values[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return true; } return false; } @@ -1284,9 +1284,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return false; } return true; } @@ -1295,9 +1295,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && !filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.VALUE_TEST_VALUE(values[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(values[i])) return false; } return true; } @@ -1354,9 +1354,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex]; + if(containsNull && filter.test(values[nullIndex])) return values[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) return values[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) return values[i]; } return EMPTY_VALUE; } @@ -1366,9 +1366,9 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++; + if(containsNull && filter.test(values[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.VALUE_TEST_VALUE(values[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(values[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template index f52b091..d32ad5d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/LinkedOpenHashMap.template @@ -706,7 +706,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; index = (int)links[index]; } return false; @@ -720,7 +720,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -734,7 +734,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -779,7 +779,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; index = (int)links[index]; } return null; @@ -794,7 +794,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; index = (int)links[index]; } return result; @@ -960,7 +960,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return true; + if(filter.test(keys[index])) return true; index = (int)links[index]; } return false; @@ -972,7 +972,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return false; + if(filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -984,7 +984,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(!filter.TEST_VALUE(keys[index])) return false; + if(!filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -1042,7 +1042,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return EMPTY_KEY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return keys[index]; + if(filter.test(keys[index])) return keys[index]; index = (int)links[index]; } return EMPTY_KEY_VALUE; @@ -1055,7 +1055,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int result = 0; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) result++; + if(filter.test(keys[index])) result++; index = (int)links[index]; } return result; @@ -1124,7 +1124,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return true; + if(filter.test(values[index])) return true; index = (int)links[index]; } return false; @@ -1136,7 +1136,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(filter.VALUE_TEST_VALUE(values[index])) return false; + if(filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1148,7 +1148,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return true; int index = firstIndex; while(index != -1) { - if(!filter.VALUE_TEST_VALUE(values[index])) return false; + if(!filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1206,7 +1206,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G if(size() <= 0) return EMPTY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return values[index]; + if(filter.test(values[index])) return values[index]; index = (int)links[index]; } return EMPTY_VALUE; @@ -1219,7 +1219,7 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G int result = 0; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) result++; + if(filter.test(values[index])) result++; index = (int)links[index]; } return result; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template index 95e6aa9..165ac32 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/hash/OpenHashMap.template @@ -500,14 +500,14 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(mappingFunction); int index = findIndex(key); if(index < 0) { - VALUE_TYPE newValue = mappingFunction.GET_VALUE(key); + VALUE_TYPE newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; insert(-index-1, key, newValue); return newValue; } VALUE_TYPE newValue = values[index]; if(VALUE_EQUALS(newValue, getDefaultReturnValue())) { - newValue = mappingFunction.GET_VALUE(key); + newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; values[index] = newValue; } @@ -843,12 +843,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; } } return false; @@ -861,12 +861,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; } } return true; @@ -879,12 +879,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; } } return true; @@ -930,12 +930,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; } } return null; @@ -949,12 +949,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE int result = 0; if(containsNull) { entry.set(keys[nullIndex], values[nullIndex]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } for(int i = nullIndex-1;i>=0;i--) { if(KEY_EQUALS_NOT_NULL(keys[i])) { entry.set(keys[i], values[i]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; } } return result; @@ -1073,9 +1073,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true; } return false; } @@ -1084,9 +1084,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false; } return true; } @@ -1095,9 +1095,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false; } return true; } @@ -1154,9 +1154,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_KEY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i]; } return EMPTY_KEY_VALUE; } @@ -1166,9 +1166,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++; } return result; } @@ -1229,9 +1229,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAny(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return true; + if(containsNull && filter.test(values[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return true; } return false; } @@ -1240,9 +1240,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesNone(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return false; } return true; } @@ -1251,9 +1251,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public boolean matchesAll(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.VALUE_TEST_VALUE(values[nullIndex])) return false; + if(containsNull && !filter.test(values[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.VALUE_TEST_VALUE(values[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(values[i])) return false; } return true; } @@ -1310,9 +1310,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE public VALUE_TYPE findFirst(VALUE_PREDICATE VALUE_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) return values[nullIndex]; + if(containsNull && filter.test(values[nullIndex])) return values[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) return values[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) return values[i]; } return EMPTY_VALUE; } @@ -1322,9 +1322,9 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.VALUE_TEST_VALUE(values[nullIndex])) result++; + if(containsNull && filter.test(values[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.VALUE_TEST_VALUE(values[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(values[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template index 51360f3..82e6d21 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/immutable/ImmutableOpenHashMap.template @@ -677,7 +677,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return true; + if(filter.test(entry)) return true; index = (int)links[index]; } return false; @@ -691,7 +691,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return false; + if(filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -705,7 +705,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(!filter.getBoolean(entry)) return false; + if(!filter.test(entry)) return false; index = (int)links[index]; } return true; @@ -750,7 +750,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) return entry; + if(filter.test(entry)) return entry; index = (int)links[index]; } return null; @@ -765,7 +765,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; while(index != -1) { entry.set(keys[index], values[index]); - if(filter.getBoolean(entry)) result++; + if(filter.test(entry)) result++; index = (int)links[index]; } return result; @@ -903,7 +903,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return true; + if(filter.test(keys[index])) return true; index = (int)links[index]; } return false; @@ -915,7 +915,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return false; + if(filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -927,7 +927,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(!filter.TEST_VALUE(keys[index])) return false; + if(!filter.test(keys[index])) return false; index = (int)links[index]; } return true; @@ -985,7 +985,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return EMPTY_KEY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) return keys[index]; + if(filter.test(keys[index])) return keys[index]; index = (int)links[index]; } return EMPTY_KEY_VALUE; @@ -998,7 +998,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int index = firstIndex; int result = 0; while(index != -1){ - if(filter.TEST_VALUE(keys[index])) result++; + if(filter.test(keys[index])) result++; index = (int)links[index]; } return result; @@ -1064,7 +1064,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return false; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return true; + if(filter.test(values[index])) return true; index = (int)links[index]; } return false; @@ -1076,7 +1076,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return false; + if(filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1088,7 +1088,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return true; int index = firstIndex; while(index != -1){ - if(!filter.VALUE_TEST_VALUE(values[index])) return false; + if(!filter.test(values[index])) return false; index = (int)links[index]; } return true; @@ -1146,7 +1146,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ if(size() <= 0) return EMPTY_VALUE; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) return values[index]; + if(filter.test(values[index])) return values[index]; index = (int)links[index]; } return EMPTY_VALUE; @@ -1159,7 +1159,7 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ int result = 0; int index = firstIndex; while(index != -1){ - if(filter.VALUE_TEST_VALUE(values[index])) result++; + if(filter.test(values[index])) result++; index = (int)links[index]; } return result; diff --git a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template index c17e99c..c99c3e6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template +++ b/src/builder/resources/speiger/assets/collections/templates/maps/impl/misc/ArrayMap.template @@ -498,14 +498,14 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN Objects.requireNonNull(mappingFunction); int index = findIndex(key); if(index == -1) { - VALUE_TYPE newValue = mappingFunction.GET_VALUE(key); + VALUE_TYPE newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; insertIndex(size++, key, newValue); return newValue; } VALUE_TYPE newValue = values[index]; if(VALUE_EQUALS(newValue, getDefaultReturnValue())) { - newValue = mappingFunction.GET_VALUE(key); + newValue = mappingFunction.APPLY(key); if(VALUE_EQUALS(newValue, getDefaultReturnValue())) return newValue; values[index] = newValue; } @@ -802,7 +802,7 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN BasicEntry KEY_VALUE_GENERIC_TYPE entry = new BasicEntryKV_BRACES(); for(int i = 0;i action) { - return TO_ARRAY(action.get(size())); + return TO_ARRAY(action.apply(size())); } #endif } \ No newline at end of file diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template index 89c3f78..c35d171 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/AVLTreeSet.template @@ -364,7 +364,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -373,7 +373,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -382,7 +382,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -391,7 +391,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -440,7 +440,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } @@ -1203,7 +1203,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -1212,7 +1212,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -1221,7 +1221,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -1269,7 +1269,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -1279,7 +1279,7 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template index 31cf0c9..f3cfaf6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template @@ -402,7 +402,7 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(int i = 0;i=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return true; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return true; } return false; } @@ -533,9 +533,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return false; } return true; } @@ -544,9 +544,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.TEST_VALUE(keys[i])) return false; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && !filter.test(keys[i])) return false; } return true; } @@ -603,9 +603,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) return keys[i]; } return EMPTY_VALUE; } @@ -615,9 +615,9 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.TEST_VALUE(keys[i])) result++; + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE) && filter.test(keys[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template index b5646b0..507131b 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template @@ -385,9 +385,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return false; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return true; + if(containsNull && filter.test(keys[nullIndex])) return true; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return true; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return true; } return false; } @@ -396,9 +396,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return false; } return true; } @@ -407,9 +407,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return true; - if(containsNull && !filter.TEST_VALUE(keys[nullIndex])) return false; + if(containsNull && !filter.test(keys[nullIndex])) return false; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.TEST_VALUE(keys[i])) return false; + if(KEY_EQUALS_NOT_NULL(keys[i]) && !filter.test(keys[i])) return false; } return true; } @@ -466,9 +466,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); if(size() <= 0) return EMPTY_VALUE; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) return keys[nullIndex]; + if(containsNull && filter.test(keys[nullIndex])) return keys[nullIndex]; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) return keys[i]; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) return keys[i]; } return EMPTY_VALUE; } @@ -478,9 +478,9 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp Objects.requireNonNull(filter); if(size() <= 0) return 0; int result = 0; - if(containsNull && filter.TEST_VALUE(keys[nullIndex])) result++; + if(containsNull && filter.test(keys[nullIndex])) result++; for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.TEST_VALUE(keys[i])) result++; + if(KEY_EQUALS_NOT_NULL(keys[i]) && filter.test(keys[i])) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template index b6cc387..cddc668 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template @@ -364,7 +364,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -373,7 +373,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -382,7 +382,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -430,7 +430,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -440,7 +440,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } @@ -1264,7 +1264,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAny(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return true; + if(filter.test(entry.key)) return true; } return false; } @@ -1273,7 +1273,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesNone(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return false; + if(filter.test(entry.key)) return false; } return true; } @@ -1282,7 +1282,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public boolean matchesAll(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(!filter.TEST_VALUE(entry.key)) return false; + if(!filter.test(entry.key)) return false; } return true; } @@ -1330,7 +1330,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE public KEY_TYPE findFirst(PREDICATE KEY_GENERIC_TYPE filter) { Objects.requireNonNull(filter); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) return entry.key; + if(filter.test(entry.key)) return entry.key; } return EMPTY_VALUE; } @@ -1340,7 +1340,7 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE Objects.requireNonNull(filter); int result = 0; for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) { - if(filter.TEST_VALUE(entry.key)) result++; + if(filter.test(entry.key)) result++; } return result; } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template index e9903c0..3538fb0 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/AsyncBuilder.template @@ -593,11 +593,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE switch(type) { case 0: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(true); return true; } @@ -605,11 +601,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE break; case 1: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(false); return true; } @@ -617,11 +609,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE break; case 2: while(shouldRun() && iter.hasNext()) { -#if TYPE_OBJECT - if(!filter.getBoolean(iter.NEXT())) { -#else - if(!filter.GET_VALUE(iter.NEXT())) { -#endif + if(!filter.test(iter.NEXT())) { setResult(false); return true; } @@ -658,11 +646,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE protected boolean execute() throws Exception { while(shouldRun() && iter.hasNext()) { KEY_TYPE entry = iter.NEXT(); -#if TYPE_OBJECT - if(filter.getBoolean(iter.NEXT())) { -#else - if(filter.GET_VALUE(iter.NEXT())) { -#endif + if(filter.test(iter.NEXT())) { setResult(entry); return true; } @@ -693,7 +677,7 @@ public class ASYNC_BUILDER KEY_GENERIC_TYPE @Override protected boolean execute() throws Exception { while(shouldRun() && iter.hasNext()) { - if(filter.TEST_VALUE(iter.NEXT())) { + if(filter.test(iter.NEXT())) { counted++; } } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template index b079396..d5f02be 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterables.template @@ -298,7 +298,7 @@ public class ITERABLES @Override public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(E -> action.accept(mapper.GET_VALUE(E))); + iterable.forEach(E -> action.accept(mapper.apply(E))); } } @@ -320,7 +320,7 @@ public class ITERABLES @Override public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(E -> mapper.GET_VALUE(E).forEach(action)); + iterable.forEach(E -> mapper.apply(E).forEach(action)); } } @@ -344,7 +344,7 @@ public class ITERABLES public void forEach(Consumer action) { Objects.requireNonNull(action); iterable.forEach(E -> { - T[] array = mapper.GET_VALUE(E); + T[] array = mapper.apply(E); for(int i = 0,m=array.length;i { if(!filter.TEST_VALUE(T)) action.accept(T); } ); + iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } ); } #else public void forEach(Consumer action) { Objects.requireNonNull(action); - iterable.forEach(T -> { if(!filter.TEST_VALUE(T)) action.accept(T); } ); + iterable.forEach(T -> { if(!filter.test(T)) action.accept(T); } ); } #endif } diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template index ea354fe..805d18f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -832,7 +832,7 @@ public class ITERATORS @Override public T next() { - return mapper.GET_VALUE(iterator.NEXT()); + return mapper.apply(iterator.NEXT()); } @Override @@ -858,7 +858,7 @@ public class ITERATORS foundNext = true; while(iterator.hasNext()) { if(last != null && last.hasNext()) return; - last = mapper.GET_VALUE(iterator.NEXT()).iterator(); + last = mapper.apply(iterator.NEXT()).iterator(); } } @@ -894,7 +894,7 @@ public class ITERATORS foundNext = true; while(iterator.hasNext()) { if(last != null && last.hasNext()) return; - last = ObjectIterators.wrap(mapper.GET_VALUE(iterator.NEXT())); + last = ObjectIterators.wrap(mapper.apply(iterator.NEXT())); } } @@ -1045,7 +1045,7 @@ public class ITERATORS if(foundNext) return; while(iterator.hasNext()) { lastFound = iterator.NEXT(); - if(filter.TEST_VALUE(lastFound)) { + if(filter.test(lastFound)) { foundNext = true; break; }