Added Missing javaDoc for generic types. (Automated)

This commit is contained in:
Speiger 2021-04-24 20:13:25 +02:00
parent 52d5155565
commit 199f50eb32
14 changed files with 107 additions and 25 deletions

View File

@ -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);

View File

@ -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 <T> the type of elements maintained by this Collection
* @Type(T)
*/
public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE
#endif

View File

@ -13,10 +13,7 @@ import speiger.src.collections.utils.SanityChecks;
#endif
/**
* A Type-Specific {@link Collection} that reduces (un)boxing
#if TYPE_OBJECT
*
* @param <T> the type of elements maintained by this Collection
#endif
* @Type(T)
*/
public interface COLLECTION KEY_GENERIC_TYPE extends Collection<CLASS_TYPE>, ITERABLE KEY_GENERIC_TYPE
{

View File

@ -9,10 +9,7 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
/**
* A Type-Specific {@link Iterable} that reduces (un)boxing
#if TYPE_OBJECT
*
* @param <T> the type of elements maintained by this Collection
#endif
* @Type(T)
*/
public interface ITERABLE KEY_GENERIC_TYPE extends Iterable<CLASS_TYPE>
{

View File

@ -11,10 +11,7 @@ import speiger.src.collections.PACKAGE.functions.CONSUMER;
/**
* A Type-Specific {@link Iterator} that reduces (un)boxing
#if TYPE_OBJECT
*
* @param <T> the type of elements maintained by this Collection
#endif
* @Type(T)
*/
public interface ITERATOR KEY_GENERIC_TYPE extends Iterator<CLASS_TYPE>
{

View File

@ -11,10 +11,7 @@ import speiger.src.collections.PACKAGE.collections.ITERATOR;
/**
* Abstract implementation of the {@link LIST} interface.
#if TYPE_OBJECT
*
* @param <T> 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
{

View File

@ -43,7 +43,7 @@ import speiger.src.collections.utils.SanityChecks;
* <p>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 <T> 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<KEY_TYPE>, Stack<KEY_TYPE>
#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<KEY_TYPE> c) {

View File

@ -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> K[] extractElements(int from, int to, Class<K> type);
/**

View File

@ -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<KEY_TYPE> 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;i<to; i++) {
@ -356,6 +372,7 @@ public class ARRAYS
/**
* Sorts an array according to the natural ascending order using InsertionSort,
* @param array the array that needs to be sorted
* @ArrayType(T)
*/
public static COMPAREABLE_KEY_BRACES void insertionSort(KEY_TYPE[] array) {
insertionSort(array, 0, array.length);
@ -365,6 +382,7 @@ public class ARRAYS
* Sorts an array according to the natural ascending order using 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 insertionSort(KEY_TYPE[] array, int length) {
insertionSort(array, 0, length);
@ -375,6 +393,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 insertionSort(KEY_TYPE[] array, int from, int to) {
for (int i = from+1;i<to; i++) {
@ -391,6 +410,7 @@ public class ARRAYS
* Sorts the specified range of elements according to the order induced by the specified comparator using Selection 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 selectionSort(KEY_TYPE[] array, COMPARATOR KEY_GENERIC_TYPE comp) {
selectionSort(array, 0, array.length, comp);
@ -401,6 +421,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 selectionSort(KEY_TYPE[] array, int length, COMPARATOR KEY_GENERIC_TYPE comp) {
selectionSort(array, 0, length, comp);
@ -412,6 +433,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 selectionSort(KEY_TYPE[] array, int from, int to, COMPARATOR KEY_GENERIC_TYPE comp) {
for (int i = from; i < to; i++) {
@ -432,6 +454,7 @@ public class ARRAYS
/**
* Sorts an array according to the natural ascending order using Selection Sort,
* @param array the array that needs to be sorted
* @ArrayType(T)
*/
public static COMPAREABLE_KEY_BRACES void selectionSort(KEY_TYPE[] array) {
selectionSort(array, 0, array.length);
@ -441,6 +464,7 @@ public class ARRAYS
* Sorts an array according to the natural ascending order using Selection Sort,
* @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 selectionSort(KEY_TYPE[] array, int length) {
selectionSort(array, 0, length);
@ -451,6 +475,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 selectionSort(KEY_TYPE[] array, int from, int to) {
for (int i = from; i < to; i++) {
@ -473,6 +498,7 @@ public class ARRAYS
* This implementation was copied from <a href="https://github.com/vigna/fastutil">FastUtil</a> 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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), pages12491265, 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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), pages12491265, 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), pages12491265, 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), pages12491265, 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 <a href="https://github.com/vigna/fastutil">FastUtil</a> 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), pages12491265, 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), pages12491265, 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) {

View File

@ -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) {

View File

@ -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 <T> the type of elements maintained by this Collection
#endif
* @Type(T)
*/
public interface IARRAY KEY_GENERIC_TYPE extends IArray
{

View File

@ -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<? extends CLASS_TYPE> 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<? extends CLASS_TYPE> 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
*/

View File

@ -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) {

View File

@ -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 <T> the type of the task
*/
public static <T> void invokeTask(ForkJoinTask<T> 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 <T> the type of the task
*/
public static <T> void invokeAsyncTask(ForkJoinTask<T> task) {
getPool().execute(task);