From 0e061921e97caee3247de532476b14963231b0c4 Mon Sep 17 00:00:00 2001 From: Speiger Date: Tue, 28 Sep 2021 03:23:21 +0200 Subject: [PATCH] New Features and improvements -Added: addAll array function. -Fixed: forEach with input now puts the input at the key instead of value --- .../speiger/src/builder/GlobalVariables.java | 3 +- .../templates/collections/Collection.template | 35 +++++++++++++++++-- .../templates/collections/Iterable.template | 4 +-- .../templates/collections/Iterator.template | 6 ++-- .../templates/lists/AbstractList.template | 8 +++++ .../templates/lists/ArrayList.template | 16 +++++++-- .../templates/lists/ImmutableList.template | 8 +++-- .../templates/lists/LinkedList.template | 14 ++++++-- .../collections/templates/lists/List.template | 1 - .../LinkedOpenCustomHashMap.template | 21 +++++------ .../customHash/OpenCustomHashMap.template | 27 +++++++------- .../maps/impl/hash/LinkedOpenHashMap.template | 21 +++++------ .../maps/impl/hash/OpenHashMap.template | 27 +++++++------- .../immutable/ImmutableOpenHashMap.template | 21 +++++------ .../maps/impl/misc/ArrayMap.template | 29 +++++++-------- .../maps/impl/tree/AVLTreeMap.template | 29 +++++++-------- .../maps/impl/tree/RBTreeMap.template | 29 +++++++-------- .../templates/queues/ArrayFIFOQueue.template | 6 ++-- .../queues/ArrayPriorityQueue.template | 6 ++-- .../queues/HeapPriorityQueue.template | 6 ++-- .../templates/sets/AVLTreeSet.template | 10 +++--- .../templates/sets/ArraySet.template | 6 ++-- .../sets/ImmutableOpenHashSet.template | 6 ++-- .../sets/LinkedOpenCustomHashSet.template | 6 ++-- .../templates/sets/LinkedOpenHashSet.template | 6 ++-- .../templates/sets/OpenCustomHashSet.template | 8 ++--- .../templates/sets/OpenHashSet.template | 8 ++--- .../templates/sets/RBTreeSet.template | 10 +++--- .../collections/templates/sets/Set.template | 2 +- .../templates/utils/Collections.template | 10 +++--- 30 files changed, 228 insertions(+), 161 deletions(-) diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java index 37b7bed7..f5105551 100644 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ b/src/builder/java/speiger/src/builder/GlobalVariables.java @@ -203,7 +203,8 @@ public class GlobalVariables addClassMapper("LIST_ITERATOR", "ListIterator"); addClassMapper("BI_ITERATOR", "BidirectionalIterator"); addBiClassMapper("BI_CONSUMER", "Consumer", ""); - addClassMapper("BI_OBJECT_CONSUMER", "ObjectConsumer"); + addClassMapper("BI_TO_OBJECT_CONSUMER", "ObjectConsumer"); + addAbstractMapper("BI_FROM_OBJECT_CONSUMER", "Object%sConsumer"); addClassMapper("SPLIT_ITERATOR", "Splititerator"); addClassMapper("ITERATOR", "Iterator"); addClassMapper("ITERABLE", "Iterable"); 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 7df7ed14..35e2fc94 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -9,11 +9,8 @@ import java.util.stream.JAVA_STREAM; import java.util.stream.StreamSupport; #endif import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; - -#if TYPE_BYTE || TYPE_SHORT || TYPE_CHAR || TYPE_FLOAT import speiger.src.collections.utils.SanityChecks; -#endif /** * A Type-Specific {@link Collection} that reduces (un)boxing * @Type(T) @@ -36,6 +33,38 @@ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITE */ public boolean addAll(COLLECTION KEY_GENERIC_TYPE c); + /** + * A Type-Specific Array based addAll method to reduce the amount of Wrapping + * @param e the elements that should be added + * @return if the collection was modified + */ + public default boolean addAll(KEY_TYPE... e) { return addAll(e, 0, e.length); } + + /** + * A Type-Specific Array based addAll method to reduce the amount of Wrapping + * @param e the elements that should be added + * @param length how many elements of the array should be added + * @return if the collection was modified + */ + public default boolean addAll(KEY_TYPE[] e, int length) { return addAll(e, 0, length); } + + /** + * A Type-Specific Array based addAll method to reduce the amount of Wrapping + * @param e the elements that should be added + * @param offset where to start within the array + * @param length how many elements of the array should be added + * @return if the collection was modified + */ + public default boolean addAll(KEY_TYPE[] e, int offset, int length) { + if(length <= 0) return false; + SanityChecks.checkArrayCapacity(e.length, offset, length); + boolean added = false; + for(int i = 0;i * @param the generic type of the Object * @throws java.lang.NullPointerException if the specified action is null */ - default void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + default void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); iterator().forEachRemaining(input, action); } diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template b/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template index bd6e4145..a41dcca6 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template @@ -8,7 +8,7 @@ import java.util.function.Consumer; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; /** * A Type-Specific {@link Iterator} that reduces (un)boxing @@ -74,9 +74,9 @@ public interface ITERATOR KEY_GENERIC_TYPE extends Iterator * @param the generic type of the Object * @throws java.lang.NullPointerException if the specified action is null */ - default void forEachRemaining(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + default void forEachRemaining(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); - while(hasNext()) { action.accept(NEXT(), input); } + while(hasNext()) { action.accept(input, NEXT()); } } /** diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template b/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template index 450f1af8..7d21f5e3 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template @@ -280,6 +280,14 @@ public abstract class ABSTRACT_LIST KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION return true; } + @Override + public boolean addAll(KEY_TYPE[] e, int offset, int length) { + if(length <= 0) return false; + l.addElements(this.offset, e, offset, length); + offset += length; + return true; + } + @Override public void addElements(int from, KEY_TYPE[] a, int offset, int length) { checkRange(from); 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 13bb2495..4a04b00a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -26,7 +26,7 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.utils.ARRAYS; import speiger.src.collections.PACKAGE.utils.ITERATORS; @@ -282,6 +282,16 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE return true; } + @Override + public boolean addAll(KEY_TYPE[] e, int offset, int length) { + if(length <= 0) return false; + SanityChecks.checkArrayCapacity(e.length, offset, length); + grow(size + length); + System.arraycopy(e, offset, data, size, length); + size+=length; + return true; + } + /** * Appends the specified array elements to the index of the list. * @param from the index where to append the elements to @@ -591,10 +601,10 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(int i = 0;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(int i = 0,m=data.length;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next) - action.accept(entry.value, input); + action.accept(input, entry.value); } @Override diff --git a/src/builder/resources/speiger/assets/collections/templates/lists/List.template b/src/builder/resources/speiger/assets/collections/templates/lists/List.template index fec3652f..e90aa53e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/List.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/List.template @@ -169,7 +169,6 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List * @param offset the start index of the array should be read from * @param length how many elements should be read from * @throws IndexOutOfBoundsException if from is outside of the lists range - * @throws IllegalStateException if offset or length are smaller then 0 or exceed the array length */ public void addElements(int from, KEY_TYPE[] a, int offset, int length); 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 60038108..417a236c 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 @@ -10,9 +10,7 @@ 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 -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_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; @@ -41,7 +39,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif #if !TYPE_OBJECT @@ -673,12 +674,12 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1) { - action.accept(new BasicEntryKV_BRACES(keys[index], values[index]), input); + action.accept(input, new BasicEntryKV_BRACES(keys[index], values[index])); index = (int)links[index]; } } @@ -885,12 +886,12 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } @@ -1001,12 +1002,12 @@ public class LINKED_CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends CUSTOM_HASH_M } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(values[index], input); + action.accept(input, values[index]); index = (int)links[index]; } } 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 f8e350a2..bb34bd28 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 @@ -9,13 +9,11 @@ import java.util.function.Consumer; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.ITERATOR; 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; import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; -#endif #if !TYPE_OBJECT && !VALUE_BOOLEAN import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif @@ -47,7 +45,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif import speiger.src.collections.objects.collections.ObjectIterator; @@ -779,12 +780,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]), input); + if(containsNull) action.accept(input, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex])); for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(new BasicEntryKV_BRACES(keys[i], values[i]), input); + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, new BasicEntryKV_BRACES(keys[i], values[i])); } } @@ -949,12 +950,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(keys[nullIndex], input); + if(containsNull) action.accept(input, keys[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(keys[i], input); + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, keys[i]); } } @@ -1045,12 +1046,12 @@ public class CUSTOM_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VAL } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(values[nullIndex], input); + if(containsNull) action.accept(input, values[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(values[i], input); + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, values[i]); } } 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 94502cf5..d20a3b18 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 @@ -10,9 +10,7 @@ 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 -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_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; @@ -40,7 +38,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif #if !TYPE_OBJECT @@ -650,12 +651,12 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1) { - action.accept(new BasicEntryKV_BRACES(keys[index], values[index]), input); + action.accept(input, new BasicEntryKV_BRACES(keys[index], values[index])); index = (int)links[index]; } } @@ -862,12 +863,12 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } @@ -979,12 +980,12 @@ public class LINKED_HASH_MAP KEY_VALUE_GENERIC_TYPE extends HASH_MAP KEY_VALUE_G } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(values[index], input); + action.accept(input, values[index]); index = (int)links[index]; } } 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 7afcd718..c8bf1eaf 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 @@ -9,13 +9,11 @@ import java.util.function.Consumer; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.collections.ITERATOR; 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; import speiger.src.collections.PACKAGE.functions.function.FUNCTION; import speiger.src.collections.PACKAGE.functions.function.UNARY_OPERATOR; -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; -#endif #if !TYPE_OBJECT && !VALUE_BOOLEAN import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #endif @@ -32,6 +30,7 @@ import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ABSTRACT_COLLECTI import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_COLLECTION; #if !SAME_TYPE import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_UNARY_OPERATOR; + #if !VALUE_OBJECT import speiger.src.collections.VALUE_PACKAGE.collections.VALUE_ITERATOR; import speiger.src.collections.VALUE_PACKAGE.functions.VALUE_CONSUMER; @@ -46,7 +45,9 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif import speiger.src.collections.objects.collections.ObjectIterator; @@ -739,12 +740,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex]), input); + if(containsNull) action.accept(input, new BasicEntryKV_BRACES(keys[nullIndex], values[nullIndex])); for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(new BasicEntryKV_BRACES(keys[i], values[i]), input); + if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, new BasicEntryKV_BRACES(keys[i], values[i])); } } @@ -909,12 +910,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(keys[nullIndex], input); + if(containsNull) action.accept(input, keys[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(keys[i], input); + if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, keys[i]); } } @@ -1005,12 +1006,12 @@ public class HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GENE } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(values[nullIndex], input); + if(containsNull) action.accept(input, values[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(values[i], input); + if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, values[i]); } } 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 bb0c9276..d4dda4fa 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 @@ -10,9 +10,7 @@ import java.util.function.Consumer; import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; import speiger.src.collections.PACKAGE.functions.COMPARATOR; -#endif -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_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; @@ -38,7 +36,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif #if !TYPE_OBJECT @@ -605,12 +606,12 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1) { - action.accept(new BasicEntryKV_BRACES(keys[index], values[index]), input); + action.accept(input, new BasicEntryKV_BRACES(keys[index], values[index])); index = (int)links[index]; } } @@ -783,12 +784,12 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } @@ -897,12 +898,12 @@ public class IMMUTABLE_HASH_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_ } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; int index = firstIndex; while(index != -1){ - action.accept(values[index], input); + action.accept(input, values[index]); index = (int)links[index]; } } 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 fcc492d4..7ace1447 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 @@ -11,9 +11,7 @@ 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 -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_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; @@ -48,7 +46,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif #if !VALUE_OBJECT @@ -1138,10 +1139,10 @@ public class ARRAY_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_GEN } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(int i = 0;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - for(int i = 0;i void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); - for(int i = 0;i void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(int i = 0;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); - for(int i = 0;i void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(AVL_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = findLowest(), last = findHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) - action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input); + action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value)); } @Override @@ -1580,10 +1581,10 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); for(AVL_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = findLowest(), last = findHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) - action.accept(entry.value, input); + action.accept(input, entry.value); } @Override @@ -1799,10 +1800,10 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(AVL_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input); + action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value)); } @Override @@ -1992,10 +1993,10 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(AVL_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry)) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override @@ -2070,10 +2071,10 @@ public class AVL_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_ } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); for(AVL_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(entry.value, input); + action.accept(input, entry.value); } @Override 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 f03ed88e..6ea0e7a5 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 @@ -12,9 +12,7 @@ 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 -#if !TYPE_OBJECT && !VALUE_OBJECT -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_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; @@ -52,7 +50,10 @@ import speiger.src.collections.objects.functions.function.Object2BooleanFunction #endif #endif #if !SAME_TYPE -import speiger.src.collections.VALUE_PACKAGE.functions.consumer.VALUE_BI_OBJECT_CONSUMER; +#if !TYPE_OBJECT +import speiger.src.collections.objects.functions.consumer.VALUE_BI_FROM_OBJECT_CONSUMER; + +#endif import speiger.src.collections.VALUE_PACKAGE.functions.function.VALUE_PREDICATE; #endif #if !TYPE_OBJECT && !VALUE_OBJECT @@ -1540,10 +1541,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(RB_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = findLowest(), last = findHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) - action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input); + action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value)); } @Override @@ -1633,10 +1634,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); for(RB_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = findLowest(), last = findHighest();entry != null && (last == null || last != previous(entry));entry = next(entry)) - action.accept(entry.value, input); + action.accept(input, entry.value); } @Override @@ -1852,10 +1853,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public void forEach(E input, ObjectObjectConsumer action) { + public void forEach(E input, ObjectObjectConsumer action) { Objects.requireNonNull(action); for(RB_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(new BasicEntryKV_BRACES(entry.key, entry.value), input); + action.accept(input, new BasicEntryKV_BRACES(entry.key, entry.value)); } @Override @@ -2045,10 +2046,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(RB_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = start(), end = end();entry != null && (end == null || (end != previous(entry)));entry = next(entry)) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override @@ -2123,10 +2124,10 @@ public class RB_TREE_MAP KEY_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE_G } @Override - public void forEach(E input, VALUE_BI_OBJECT_CONSUMER VVS_GENERIC_TYPE action) { + public void forEach(E input, VALUE_BI_FROM_OBJECT_CONSUMER VSV_GENERIC_TYPE action) { Objects.requireNonNull(action); for(RB_TREE_MAP.Entry KEY_VALUE_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(entry.value, input); + action.accept(input, entry.value); } @Override 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 33f0f3d8..60b3c196 100644 --- a/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template +++ b/src/builder/resources/speiger/assets/collections/templates/queues/ArrayFIFOQueue.template @@ -13,7 +13,7 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.utils.ITrimmable; @@ -235,11 +235,11 @@ public class ARRAY_FIFO_QUEUE KEY_GENERIC_TYPE implements PRIORITY_DEQUEUE KEY_G } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(first == last) return; for(int i = 0,m=size();i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); - for(int i = 0,m=size;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); - for(int i = 0,m=size;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override @@ -1008,10 +1008,10 @@ public class AVL_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override 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 e2cd6bb8..9d1f996d 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/ArraySet.template @@ -16,7 +16,7 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; #if !TYPE_OBJECT import speiger.src.collections.PACKAGE.functions.COMPARATOR; @@ -350,10 +350,10 @@ public class ARRAY_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE im } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(int i = 0;i void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); int index = firstIndex; while(index != -1) { - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } 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 f0653977..e31fbda7 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenCustomHashSet.template @@ -22,7 +22,7 @@ import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.utils.STRATEGY; import speiger.src.collections.utils.HashUtil; @@ -534,11 +534,11 @@ public class LINKED_CUSTOM_HASH_SET KEY_GENERIC_TYPE extends CUSTOM_HASH_SET KEY } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); int index = firstIndex; while(index != -1) { - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } 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 36b87692..d2f0fa49 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/LinkedOpenHashSet.template @@ -20,7 +20,7 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.lists.LIST_ITERATOR; #if !TYPE_OBJECT @@ -389,11 +389,11 @@ public class LINKED_HASH_SET KEY_GENERIC_TYPE extends HASH_SET KEY_GENERIC_TYPE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); int index = firstIndex; while(index != -1) { - action.accept(keys[index], input); + action.accept(input, keys[index]); index = (int)links[index]; } } 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 0ac97391..16e71ac0 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenCustomHashSet.template @@ -17,7 +17,7 @@ import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.utils.STRATEGY; @@ -468,12 +468,12 @@ public class CUSTOM_HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_T } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(keys[nullIndex], input); + if(containsNull) action.accept(input, keys[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(keys[i], input); + if(!strategy.equals(keys[i], EMPTY_KEY_VALUE)) action.accept(input, keys[i]); } } 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 d0753eb7..14d56463 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/OpenHashSet.template @@ -17,7 +17,7 @@ import speiger.src.collections.PACKAGE.lists.LIST; import speiger.src.collections.PACKAGE.utils.ITERATORS; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.utils.HashUtil; import speiger.src.collections.utils.ITrimmable; @@ -337,12 +337,12 @@ public class HASH_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE imp } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); if(size() <= 0) return; - if(containsNull) action.accept(keys[nullIndex], input); + if(containsNull) action.accept(input, keys[nullIndex]); for(int i = nullIndex-1;i>=0;i--) { - if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(keys[i], input); + if(KEY_EQUALS_NOT_NULL(keys[i])) action.accept(input, keys[i]); } } 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 049026bf..2ada1d3f 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/RBTreeSet.template @@ -13,7 +13,7 @@ import speiger.src.collections.PACKAGE.collections.BI_ITERATOR; import speiger.src.collections.PACKAGE.functions.COMPARATOR; import speiger.src.collections.PACKAGE.functions.CONSUMER; #endif -import speiger.src.collections.PACKAGE.functions.consumer.BI_OBJECT_CONSUMER; +import speiger.src.collections.objects.functions.consumer.BI_FROM_OBJECT_CONSUMER; import speiger.src.collections.PACKAGE.functions.function.PREDICATE; import speiger.src.collections.PACKAGE.collections.COLLECTION; import speiger.src.collections.PACKAGE.collections.ITERATOR; @@ -304,10 +304,10 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(Entry KEY_GENERIC_TYPE entry = first;entry != null;entry = entry.next()) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override @@ -1069,10 +1069,10 @@ public class RB_TREE_SET KEY_GENERIC_TYPE extends ABSTRACT_SET KEY_GENERIC_TYPE } @Override - public void forEach(E input, BI_OBJECT_CONSUMER KKS_GENERIC_TYPE action) { + public void forEach(E input, BI_FROM_OBJECT_CONSUMER KSK_GENERIC_TYPE action) { Objects.requireNonNull(action); for(Entry KEY_GENERIC_TYPE entry = start();entry != null && inRange(entry.key);entry = next(entry)) - action.accept(entry.key, input); + action.accept(input, entry.key); } @Override diff --git a/src/builder/resources/speiger/assets/collections/templates/sets/Set.template b/src/builder/resources/speiger/assets/collections/templates/sets/Set.template index 5fca2af1..9a377361 100644 --- a/src/builder/resources/speiger/assets/collections/templates/sets/Set.template +++ b/src/builder/resources/speiger/assets/collections/templates/sets/Set.template @@ -12,7 +12,7 @@ import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS; * @Type(T) */ public interface SET KEY_GENERIC_TYPE extends Set, COLLECTION KEY_GENERIC_TYPE -{ +{ @Override public ITERATOR KEY_GENERIC_TYPE 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 b69c6b31..07492987 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -92,18 +92,16 @@ public class COLLECTIONS public boolean add(KEY_TYPE o) { synchronized(mutex) { return c.add(o); } } @Override public boolean addAll(Collection c) { synchronized(mutex) { return this.c.addAll(c); } } - @Override public boolean addAll(COLLECTION KEY_GENERIC_TYPE c) { synchronized(mutex) { return this.c.addAll(c); } } - + @Override + public boolean addAll(KEY_TYPE[] e, int offset, int length) { synchronized(mutex) { return c.addAll(e, offset, length); } } #if !TYPE_OBJECT @Override public boolean contains(KEY_TYPE o) { synchronized(mutex) { return c.contains(o); } } - #else @Override public boolean contains(Object o) { synchronized(mutex) { return c.contains(o); } } - #endif @Override @Primitive @@ -198,6 +196,8 @@ public class COLLECTIONS public boolean addAll(Collection c) { throw new UnsupportedOperationException(); } @Override public boolean addAll(COLLECTION KEY_GENERIC_TYPE c) { throw new UnsupportedOperationException(); } + @Override + public boolean addAll(KEY_TYPE[] e, int offset, int length) { throw new UnsupportedOperationException(); } #if !TYPE_OBJECT @Override public boolean contains(KEY_TYPE o) { return c.contains(o); } @@ -285,6 +285,8 @@ public class COLLECTIONS @Override public boolean addAll(COLLECTION KEY_GENERIC_TYPE c) { throw new UnsupportedOperationException(); } + @Override + public boolean addAll(KEY_TYPE[] e, int offset, int length) { throw new UnsupportedOperationException(); } #if !TYPE_OBJECT @Override