diff --git a/src/builder/java/speiger/src/builder/GlobalVariables.java b/src/builder/java/speiger/src/builder/GlobalVariables.java index 86498b70..4ecb8300 100644 --- a/src/builder/java/speiger/src/builder/GlobalVariables.java +++ b/src/builder/java/speiger/src/builder/GlobalVariables.java @@ -69,6 +69,8 @@ public class GlobalVariables { addSimpleMapper("SANITY_CAST_VALUE", "castTo"+valueType.getFileType()); } + addComment("@ArrayType", "@param <%s> the type of array that the operation should be applied"); + addComment("@Type", "@param <%s> the type of elements maintained by this Collection"); addAnnontion("@PrimitiveOverride", "@Override"); addSimpleMapper("@PrimitiveDoc", ""); addAnnontion("@Primitive", "@Deprecated"); @@ -323,6 +325,12 @@ public class GlobalVariables else operators.add(new SimpleMapper(type.name()+"["+pattern+"]", pattern, value)); } + private void addComment(String pattern, String value) + { + if(type == ClassType.OBJECT) operators.add(new InjectMapper(type.name()+"["+pattern+"]", pattern, value).removeBraces()); + else operators.add(new LineMapper(type.name()+"["+pattern+"]", pattern)); + } + private InjectMapper addInjectMapper(String pattern, String replacement) { InjectMapper mapper = new InjectMapper(type.name()+"["+pattern+"]", pattern, replacement); diff --git a/src/builder/resources/speiger/assets/collections/templates/collections/BidirectionalIterator.template b/src/builder/resources/speiger/assets/collections/templates/collections/BidirectionalIterator.template index b8fcb9a0..8509c5cd 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/BidirectionalIterator.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/BidirectionalIterator.template @@ -10,8 +10,7 @@ public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE, /** * This is a basically a {@link java.util.ListIterator} without the index functions. * Allowing to have a simple Bidirectional Iterator without having to keep track of the Iteration index. - * - * @param the type of elements maintained by this Collection + * @Type(T) */ public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE #endif 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 c240181e..12746921 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Collection.template @@ -13,10 +13,7 @@ import speiger.src.collections.utils.SanityChecks; #endif /** * A Type-Specific {@link Collection} that reduces (un)boxing -#if TYPE_OBJECT - * - * @param the type of elements maintained by this Collection -#endif + * @Type(T) */ public interface COLLECTION KEY_GENERIC_TYPE extends Collection, ITERABLE KEY_GENERIC_TYPE { 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 0a321b03..0984e11e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterable.template @@ -9,10 +9,7 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; /** * A Type-Specific {@link Iterable} that reduces (un)boxing -#if TYPE_OBJECT - * - * @param the type of elements maintained by this Collection -#endif + * @Type(T) */ public interface ITERABLE KEY_GENERIC_TYPE extends Iterable { 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 26e0b3fa..07fb25a5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template +++ b/src/builder/resources/speiger/assets/collections/templates/collections/Iterator.template @@ -11,10 +11,7 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER; /** * A Type-Specific {@link Iterator} that reduces (un)boxing -#if TYPE_OBJECT - * - * @param the type of elements maintained by this Collection -#endif + * @Type(T) */ public interface ITERATOR KEY_GENERIC_TYPE extends Iterator { 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 ab43e825..8dc8266a 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/AbstractList.template @@ -11,10 +11,7 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR; /** * Abstract implementation of the {@link LIST} interface. -#if TYPE_OBJECT - * - * @param the type of elements maintained by this Collection -#endif + * @Type(T) */ public abstract class ABSTRACT_LIST KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE implements LIST KEY_GENERIC_TYPE { 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 7d8ef844..d24e3041 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/ArrayList.template @@ -43,7 +43,7 @@ import speiger.src.collections.utils.SanityChecks; *

This implementation is optimized to improve how data is processed with interfaces like {@link IARRAY}, {@link Stack} * and with optimized functions that use type-specific implementations for primitives and optimized logic for bulkactions. * - * @param the type of elements maintained by this Collection + * @Type(T) */ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE implements IARRAY, Stack #else @@ -141,7 +141,8 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE /** * Creates a wrapped arraylist that uses the array as backing array * @param a elements that should be wrapped - * @return a Wrapped list using the input array + * @Type(T) + * @return a Wrapped list using the input array */ public static GENERIC_KEY_BRACES ARRAY_LIST KEY_GENERIC_TYPE wrap(KEY_TYPE... a) { return wrap(a, a.length); @@ -151,6 +152,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE * Creates a wrapped arraylist that uses the array as backing array and a custom fill size * @param a elements that should be wrapped * @param length the size of the elements within the array + * @Type(T) * @return a Wrapped list using the input array */ public static GENERIC_KEY_BRACES ARRAY_LIST KEY_GENERIC_TYPE wrap(KEY_TYPE[] a, int length) { @@ -165,6 +167,7 @@ public class ARRAY_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE /** * Creates a new ArrayList with a EmptyObject array of the Type requested * @param c the type of the array + * @Type(T) * @return a typed List */ public static GENERIC_KEY_BRACES ARRAY_LIST KEY_GENERIC_TYPE of(Class c) { 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 516aea1a..66c6652e 100644 --- a/src/builder/resources/speiger/assets/collections/templates/lists/List.template +++ b/src/builder/resources/speiger/assets/collections/templates/lists/List.template @@ -205,7 +205,8 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List * @param to the end index of where the elements should be fetched to (exclusive) * @param type the type of the OutputArray * @return a array of the elements that were fetched - */ + * @Type(K) + */ public K[] extractElements(int from, int to, Class type); /** diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template index 377478dc..d26897c5 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Arrays.template @@ -98,6 +98,7 @@ public class ARRAYS * Function to create a new Array of a given size * @param clz the class type of array that is requested * @param length the lenght the array should be. + * @ArrayType(T) * @return a Array with the requested type and length */ public static GENERIC_KEY_BRACES KEY_TYPE[] newArray(Class clz, int length) { @@ -183,6 +184,7 @@ public class ARRAYS * potentially dynamically choosing an appropriate algorithm given the type and size of the array. * Stable sort referres to Mergesort or Insertionsort * @param array the array that needs to be sorted + * @ArrayType(T) * @param comp the Comparator that decides the sorting order */ public static GENERIC_KEY_BRACES void stableSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { @@ -196,6 +198,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void stableSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { stableSort(array, 0, length, comp); @@ -209,6 +212,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void stableSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { mergeSort(array, null, from, to, comp); @@ -219,6 +223,7 @@ public class ARRAYS * potentially dynamically choosing an appropriate algorithm given the type and size of the array. * Stable sort referres to Mergesort or Insertionsort * @param array the array that needs to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void stableSort(KEY_TYPE[] array) { stableSort(array, 0, array.length); @@ -230,6 +235,7 @@ public class ARRAYS * Stable sort referres to Mergesort or Insertionsort * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void stableSort(KEY_TYPE[] array, int length) { stableSort(array, 0, length); @@ -242,6 +248,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void stableSort(KEY_TYPE[] array, int from, int to) { mergeSort(array, null, from, to); @@ -253,6 +260,7 @@ public class ARRAYS * Unstable sort referres to QuickSort or SelectionSort * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void unstableSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { unstableSort(array, 0, array.length, comp); @@ -265,6 +273,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void unstableSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { unstableSort(array, 0, length, comp); @@ -278,6 +287,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void unstableSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { quickSort(array, from, to, comp); @@ -288,6 +298,7 @@ public class ARRAYS * potentially dynamically choosing an appropriate algorithm given the type and size of the array. * Unstable sort referres to QuickSort or SelectionSort * @param array the array that needs to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void unstableSort(KEY_TYPE[] array) { unstableSort(array, 0, array.length); @@ -299,6 +310,7 @@ public class ARRAYS * Unstable sort referres to QuickSort or SelectionSort * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void unstableSort(KEY_TYPE[] array, int length) { unstableSort(array, 0, length); @@ -311,6 +323,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void unstableSort(KEY_TYPE[] array, int from, int to) { quickSort(array, from, to); @@ -320,6 +333,7 @@ public class ARRAYS * Sorts the specified range of elements according to the order induced by the specified comparator using Insertion Sort, * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void insertionSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { insertionSort(array, 0, array.length, comp); @@ -330,6 +344,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void insertionSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { insertionSort(array, 0, length, comp); @@ -341,6 +356,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void insertionSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { for (int i = from+1;iFastUtil with a couple custom optimizations * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void mergeSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { mergeSort(array, null, 0, array.length, comp); @@ -484,6 +510,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void mergeSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { mergeSort(array, null, 0, length, comp); @@ -497,6 +524,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void mergeSort(KEY_TYPE[] array, KEY_TYPE[] supp, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { if(to - from < BASE_THRESHOLD) { @@ -522,6 +550,7 @@ public class ARRAYS * Sorts an array according to the natural ascending order using Merge Sort, * This implementation was copied from FastUtil with a couple custom optimizations * @param array the array that needs to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void mergeSort(KEY_TYPE[] array) { mergeSort(array, null, 0, array.length); @@ -532,6 +561,7 @@ public class ARRAYS * This implementation was copied from FastUtil with a couple custom optimizations * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void mergeSort(KEY_TYPE[] array, int length) { mergeSort(array, null, 0, length); @@ -544,6 +574,7 @@ public class ARRAYS * @param supp the auxillary array that is used to simplify the sorting * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void mergeSort(KEY_TYPE[] array, KEY_TYPE[] supp, int from, int to) { if(to - from < BASE_THRESHOLD) { @@ -571,6 +602,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { parallelMergeSort(array, null, 0, array.length, comp); @@ -583,6 +615,7 @@ public class ARRAYS * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { parallelMergeSort(array, null, 0, length, comp); @@ -597,6 +630,7 @@ public class ARRAYS * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array, KEY_TYPE[] supp, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { if(SanityChecks.canParallelTask() && to - from >= PARALLEL_THRESHOLD) { @@ -611,6 +645,7 @@ public class ARRAYS * This implementation was copied from FastUtil with a couple custom optimizations * @param array the array that needs to be sorted * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array) { parallelMergeSort(array, null, 0, array.length); @@ -622,6 +657,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array, int length) { parallelMergeSort(array, null, 0, length); @@ -635,6 +671,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMergeSort(KEY_TYPE[] array, KEY_TYPE[] supp, int from, int to) { if(SanityChecks.canParallelTask() && to - from >= PARALLEL_THRESHOLD) { @@ -649,6 +686,7 @@ public class ARRAYS * This implementation is inspired by FastUtil original merge sort, but without the need to allocate a copy of the original Array. It is in Very Unsorted Instances 50% slower then Mergesort, otherwise it as fast. * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { memFreeMergeSort(array, 0, array.length, comp); @@ -660,6 +698,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { memFreeMergeSort(array, 0, length, comp); @@ -672,6 +711,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { if(to - from < BASE_THRESHOLD) { @@ -719,6 +759,7 @@ public class ARRAYS * It does stack allocate tiny amounts of data for shifting around elements. * @author Speiger * @param array the array that needs to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array) { memFreeMergeSort(array, 0, array.length); @@ -732,6 +773,7 @@ public class ARRAYS * @author Speiger * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array, int length) { memFreeMergeSort(array, 0, length); @@ -746,6 +788,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void memFreeMergeSort(KEY_TYPE[] array, int from, int to) { if(to - from < BASE_THRESHOLD) { @@ -795,6 +838,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { parallelMemFreeMergeSort(array, 0, array.length, comp); @@ -810,6 +854,7 @@ public class ARRAYS * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { parallelMemFreeMergeSort(array, 0, length, comp); @@ -826,6 +871,7 @@ public class ARRAYS * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { if(SanityChecks.canParallelTask() && to - from >= PARALLEL_THRESHOLD) { @@ -843,6 +889,7 @@ public class ARRAYS * @author Speiger * @param array the array that needs to be sorted * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array) { parallelMemFreeMergeSort(array, 0, array.length); @@ -857,6 +904,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array, int length) { parallelMemFreeMergeSort(array, 0, length); @@ -872,6 +920,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void parallelMemFreeMergeSort(KEY_TYPE[] array, int from, int to) { if(SanityChecks.canParallelTask() && to - from >= PARALLEL_THRESHOLD) { @@ -887,6 +936,7 @@ public class ARRAYS * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void quickSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { quickSort(array, 0, array.length, comp); @@ -899,6 +949,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void quickSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { quickSort(array, 0, length, comp); @@ -912,6 +963,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) */ public static GENERIC_KEY_BRACES void quickSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { int length = to - from; @@ -942,6 +994,7 @@ public class ARRAYS * This implementation is a custom of FastUtil quicksort but with a different code structure, * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void quickSort(KEY_TYPE[] array) { quickSort(array, 0, array.length); @@ -953,6 +1006,7 @@ public class ARRAYS * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void quickSort(KEY_TYPE[] array, int length) { quickSort(array, 0, length); @@ -965,6 +1019,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) */ public static COMPAREABLE_KEY_BRACES void quickSort(KEY_TYPE[] array, int from, int to) { int length = to - from; @@ -996,6 +1051,7 @@ public class ARRAYS * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static GENERIC_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) { @@ -1009,6 +1065,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted * @param comp the Comparator that decides the sorting order + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static GENERIC_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) { @@ -1023,6 +1080,7 @@ public class ARRAYS * @param from where the array should be sorted from * @param to where the array should be sorted to * @param comp the Comparator that decides the sorting order + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static GENERIC_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) { @@ -1038,6 +1096,7 @@ public class ARRAYS * This implementation is a custom of FastUtil quicksort but with a different code structure, * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static COMPAREABLE_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array) { @@ -1050,6 +1109,7 @@ public class ARRAYS * and that sorting Algorithm is based on the tuned quicksort adapted from Jon L. Bentley and M. DouglasMcIlroy, "Engineering a Sort Function", Software: Practice and Experience, 23(11), pages1249−1265, 1993. * @param array the array that needs to be sorted * @param length the maxmium size of the array to be sorted + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static COMPAREABLE_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array, int length) { @@ -1063,6 +1123,7 @@ public class ARRAYS * @param array the array that needs to be sorted * @param from where the array should be sorted from * @param to where the array should be sorted to + * @ArrayType(T) * @note This parallelization is invoked through {@link SanityChecks#invokeTask} which the threadpool can be changed as needed */ public static COMPAREABLE_KEY_BRACES void parallelQuickSort(KEY_TYPE[] array, int from, int to) { 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 f3d96733..a210a315 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Collections.template @@ -23,6 +23,7 @@ public class COLLECTIONS /** * Returns a Immutable EmptyCollection instance that is automatically casted. + * @Type(T) * @return an empty collection */ public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE emptyCollection() { @@ -36,6 +37,7 @@ public class COLLECTIONS /** * Returns a Immutable Collection instance based on the instance given. * @param c that should be made immutable/unmodifiable + * @Type(T) * @return a unmodifiable collection wrapper. If the Collection already a unmodifiable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE unmodifiableCollection(COLLECTION KEY_GENERIC_TYPE c) { @@ -45,6 +47,7 @@ public class COLLECTIONS /** * Returns a synchronized Collection instance based on the instance given. * @param c that should be synchronized + * @Type(T) * @return a synchronized collection wrapper. If the Collection already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronizedCollection(COLLECTION KEY_GENERIC_TYPE c) { @@ -55,6 +58,7 @@ public class COLLECTIONS * Returns a synchronized Collection instance based on the instance given. * @param c that should be synchronized * @param mutex is the controller of the synchronization block. + * @Type(T) * @return a synchronized collection wrapper. If the Collection already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES COLLECTION KEY_GENERIC_TYPE synchronizedCollection(COLLECTION KEY_GENERIC_TYPE c, Object mutex) { diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template b/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template index 72378029..3cc3b023 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/IArray.template @@ -8,10 +8,7 @@ import speiger.src.collections.utils.IArray; /** * Type-Specific Helper class to get the underlying array of array implementations. * @see speiger.src.collections.PACKAGE.lists.ARRAY_LIST -#if TYPE_OBJECT - * - * @param the type of elements maintained by this Collection -#endif + * @Type(T) */ public interface IARRAY KEY_GENERIC_TYPE extends IArray { 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 d9d10382..9e3d53fc 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Iterators.template @@ -14,6 +14,7 @@ public class ITERATORS /** * Returns a Immutable EmptyIterator instance that is automatically casted. + * @Type(T) * @return an empty iterator */ public static GENERIC_KEY_BRACES EmptyIterator KEY_GENERIC_TYPE emptyIterator() { @@ -65,6 +66,7 @@ public class ITERATORS /** * Returns a Immutable Iterator instance based on the instance given. * @param iterator that should be made immutable/unmodifyable + * @Type(T) * @return a unmodifiable iterator wrapper. If the Iterator already a unmodifyable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES ITERATOR KEY_GENERIC_TYPE unmodifiable(ITERATOR KEY_GENERIC_TYPE iterator) { @@ -78,6 +80,7 @@ public class ITERATORS /** * Returns a Immutable ListIterator instance based on the instance given. * @param iterator that should be made immutable/unmodifyable + * @Type(T) * @return a unmodifiable listiterator wrapper. If the ListIterator already a unmodifyable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST_ITERATOR KEY_GENERIC_TYPE unmodifiable(LIST_ITERATOR KEY_GENERIC_TYPE iterator) { @@ -93,6 +96,7 @@ public class ITERATORS /** * Returns a Array Wrapping iterator * @param a the array that should be wrapped + * @ArrayType(T) * @return a Iterator that is wrapping a array. */ public static GENERIC_KEY_BRACES ArrayIterator KEY_GENERIC_TYPE wrap(KEY_TYPE[] a) { @@ -104,6 +108,7 @@ public class ITERATORS * @param a the array that should be wrapped. * @param start the index to be started from. * @param end the index that should be ended. + * @ArrayType(T) * @return a Iterator that is wrapping a array. */ public static GENERIC_KEY_BRACES ArrayIterator KEY_GENERIC_TYPE wrap(KEY_TYPE[] a, int start, int end) { @@ -114,6 +119,7 @@ public class ITERATORS * Iterates over a iterator and inserts the values into the array and returns the amount that was inserted * @param a where the elements should be inserted * @param i the source iterator + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(KEY_TYPE[] a, Iterator i) { @@ -125,6 +131,7 @@ public class ITERATORS * @param a where the elements should be inserted * @param i the source iterator * @param offset the array offset where the start should be + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(KEY_TYPE[] a, Iterator i, int offset) { @@ -137,6 +144,7 @@ public class ITERATORS * @param i the source iterator * @param offset the array offset where the start should be * @param max the maximum values that should be extracted from the source + * @ArrayType(T) * @return the amount of elements that were inserted into the array. * @throws IllegalStateException if max is smaller the 0 or if the maximum index is larger then the array */ @@ -153,6 +161,7 @@ public class ITERATORS * Iterates over a iterator and inserts the values into the array and returns the amount that was inserted * @param a where the elements should be inserted * @param i the source iterator + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(KEY_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i) { @@ -165,6 +174,7 @@ public class ITERATORS * @param a where the elements should be inserted * @param i the source iterator * @param offset the array offset where the start should be + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(KEY_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset) { @@ -178,6 +188,7 @@ public class ITERATORS * @param i the source iterator * @param offset the array offset where the start should be * @param max the maximum values that should be extracted from the source + * @ArrayType(T) * @return the amount of elements that were inserted into the array. * @throws IllegalStateException if max is smaller the 0 or if the maximum index is larger then the array */ @@ -195,6 +206,7 @@ public class ITERATORS * Iterates over a iterator and inserts the values into the array and returns the amount that was inserted * @param a where the elements should be inserted * @param i the source iterator + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(CLASS_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i) { @@ -207,6 +219,7 @@ public class ITERATORS * @param a where the elements should be inserted * @param i the source iterator * @param offset the array offset where the start should be + * @ArrayType(T) * @return the amount of elements that were inserted into the array. */ public static GENERIC_KEY_BRACES int unwrap(CLASS_TYPE[] a, ITERATOR KEY_GENERIC_TYPE i, int offset) { @@ -220,6 +233,7 @@ public class ITERATORS * @param i the source iterator * @param offset the array offset where the start should be * @param max the maximum values that should be extracted from the source + * @ArrayType(T) * @return the amount of elements that were inserted into the array. * @throws IllegalStateException if max is smaller the 0 or if the maximum index is larger then the array */ diff --git a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template index 9f8f602d..896ac319 100644 --- a/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template +++ b/src/builder/resources/speiger/assets/collections/templates/utils/Lists.template @@ -22,6 +22,7 @@ public class LISTS /** * Returns a Immutable EmptyList instance that is automatically casted. + * @Type(T) * @return an empty list */ public static GENERIC_KEY_BRACES EmptyList KEY_GENERIC_TYPE emptyList() { @@ -35,6 +36,7 @@ public class LISTS /** * Returns a Immutable List instance based on the instance given. * @param l that should be made immutable/unmodifyable + * @Type(T) * @return a unmodifiable list wrapper. If the list is implementing RandomAccess that is also transferred. If the List already a unmodifyable wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE unmodifiableList(LIST KEY_GENERIC_TYPE l) { @@ -44,6 +46,7 @@ public class LISTS /** * Returns a synchronized List instance based on the instance given. * @param l that should be synchronized + * @Type(T) * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronizedList(LIST KEY_GENERIC_TYPE l) { @@ -54,6 +57,7 @@ public class LISTS * Returns a synchronized List instance based on the instance given. * @param l that should be synchronized * @param mutex is the controller of the synchronization block. + * @Type(T) * @return a synchronized list wrapper. If the list is implementing RandomAccess or IARRAY that is also transferred. If the List already a synchronized wrapper then it just returns itself. */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE synchronizedList(LIST KEY_GENERIC_TYPE l, Object mutex) { @@ -63,6 +67,7 @@ public class LISTS /** * Creates a Unmodifiable Singleton list * @param element that should be used in the Singleton + * @Type(T) * @return a singleton list that is unmodifiable */ public static GENERIC_KEY_BRACES LIST KEY_GENERIC_TYPE singletonList(KEY_TYPE element) { diff --git a/src/main/java/speiger/src/collections/utils/SanityChecks.java b/src/main/java/speiger/src/collections/utils/SanityChecks.java index f6ec6fed..f779c73b 100644 --- a/src/main/java/speiger/src/collections/utils/SanityChecks.java +++ b/src/main/java/speiger/src/collections/utils/SanityChecks.java @@ -87,6 +87,7 @@ public class SanityChecks /** * Helper method to start a ForkJoinTask. This method will await the finalization of said task * @param task the Task to invoke + * @param the type of the task */ public static void invokeTask(ForkJoinTask task) { if(FORCE_ASYNC.get().booleanValue()) invokeAsyncTask(task); @@ -96,6 +97,7 @@ public class SanityChecks /** * Helper method to start a ForkJoinTask. This method will not await the finalization of said task * @param task the Task to invoke + * @param the type of the task */ public static void invokeAsyncTask(ForkJoinTask task) { getPool().execute(task);