Reworked Module Settings System

Changelog:
- Added: Dependency System that will resolve missing classes and enable
them as needed. (This isn't perfect on some low level modules like
Functions)
- Added: Dependency Error system that will throw errors if a dependency
is that is required is specifically disabled.
- Added: Default setting for "undefined" entries.
- Fixed: A few bugs that made the dependency system unnecessary
difficult.
- Updated: Documentation
This commit is contained in:
2025-03-09 23:29:13 +01:00
parent ebe75b0fea
commit 20927a97eb
34 changed files with 3189 additions and 645 deletions
@@ -1,19 +1,11 @@
package speiger.src.collections.PACKAGE.collections;
#if !TYPE_OBJECT
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
/**
* A Type-Specific {@link ObjectBidirectionalIterator} to reduce (un)boxing
*/
public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE, ObjectBidirectionalIterator<CLASS_TYPE>
#else
/**
* 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.
* @Type(T)
*/
public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE
#endif
{
/**
* Returns true if the Iterator has a Previous element
@@ -29,11 +21,11 @@ public interface BI_ITERATOR KEY_GENERIC_TYPE extends ITERATOR KEY_GENERIC_TYPE
public KEY_TYPE PREVIOUS();
#if !TYPE_OBJECT
/** {@inheritDoc}
/**
* <p>This default implementation delegates to the corresponding type-specific function.
* @deprecated Please use the corresponding type-specific function instead.
* @return the Previous element of the iterator.+
*/
@Override
@Deprecated
public default CLASS_TYPE previous() {
return KEY_TO_OBJ(PREVIOUS());
@@ -11,11 +11,15 @@ import java.util.RandomAccess;
import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION;
import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
#endif
#if INT_LIST_MODULE && !TYPE_INT
import speiger.src.collections.ints.lists.IntList;
#endif
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
import speiger.src.collections.utils.SanityChecks;
/**
@@ -532,9 +536,10 @@ public abstract class ABSTRACT_LIST KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION
public int size() {
return size;
}
#if SPLIT_ITERATOR_FEATURE
@Override
public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 16464); }
#endif
@Override
public LIST_ITERATOR KEY_GENERIC_TYPE listIterator(int index) {
@@ -13,11 +13,13 @@ import java.util.Collection;
import java.util.Iterator;
import java.util.Objects;
import java.util.NoSuchElementException;
#if SPLIT_ITERATOR_FEATURE
import java.util.Spliterator;
#if PRIMITIVES
import java.util.Spliterator.JAVA_SPLIT_ITERATOR;
#endif
import java.util.function.Consumer;
#endif
import java.util.function.Predicate;
#if TYPE_OBJECT
import java.util.function.IntFunction;
@@ -60,12 +62,14 @@ import speiger.src.collections.objects.utils.ObjectArrays;
#if TYPE_OBJECT
import speiger.src.collections.utils.Stack;
#endif
#if SPLIT_ITERATOR_FEATURE
#if PRIMITIVES
import java.util.stream.JAVA_STREAM;
import java.util.stream.StreamSupport;
#endif
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
import speiger.src.collections.utils.SanityChecks;
/**
@@ -415,7 +419,8 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
if(index == 0) return new ListIter(first, index);
return new ListIter(getNode(index), index);
}
#if SPLIT_ITERATOR_FEATURE
#if PRIMITIVES
/**
* Returns a Java-Type-Specific Stream to reduce boxing/unboxing.
@@ -436,6 +441,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
@Override
public SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return new TypeSplitIteratorBRACES(this, first, 0); }
#endif
@Override
public void forEach(CONSUMER KEY_SUPER_GENERIC_TYPE action) {
Objects.requireNonNull(action);
@@ -1253,6 +1259,7 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
}
}
#if SPLIT_ITERATOR_FEATURE
private static class TypeSplitIterator KEY_GENERIC_TYPE implements SPLIT_ITERATOR KEY_GENERIC_TYPE
{
static final int BATCH_UNIT = 1 << 10;
@@ -1397,4 +1404,5 @@ public class LINKED_LIST KEY_GENERIC_TYPE extends ABSTRACT_LIST KEY_GENERIC_TYPE
}
}
#endif
#endif
}
@@ -15,7 +15,9 @@ import java.util.function.UnaryOperator;
#endif
import speiger.src.collections.PACKAGE.collections.COLLECTION;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
#endif
import speiger.src.collections.ints.functions.consumer.BI_FROM_INT_CONSUMER;
#if !TYPE_OBJECT
import speiger.src.collections.PACKAGE.functions.COMPARATOR;
@@ -27,7 +29,9 @@ import speiger.src.collections.PACKAGE.utils.LISTS;
#if INT_LIST_MODULE && !TYPE_INT
import speiger.src.collections.ints.lists.IntList;
#endif
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
#if TYPE_BYTE || TYPE_SHORT || TYPE_CHAR || TYPE_FLOAT
import speiger.src.collections.utils.SanityChecks;
#endif
@@ -594,10 +598,12 @@ public interface LIST KEY_GENERIC_TYPE extends COLLECTION KEY_GENERIC_TYPE, List
}
#endif
#endif
#if SPLIT_ITERATOR_FEATURE
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
*/
@Override
default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); }
#endif
}
@@ -3,11 +3,13 @@ package speiger.src.collections.PACKAGE.sets;
import java.util.NavigableSet;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
#if SETS_FEATURE
import speiger.src.collections.PACKAGE.utils.SETS;
#endif
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
* A Type Specific Navigable Set interface with a couple helper methods
@@ -145,6 +147,7 @@ public interface NAVIGABLE_SET KEY_GENERIC_TYPE extends NavigableSet<CLASS_TYPE>
public default NAVIGABLE_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
#if SPLIT_ITERATOR_FEATURE
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
@@ -152,6 +155,7 @@ public interface NAVIGABLE_SET KEY_GENERIC_TYPE extends NavigableSet<CLASS_TYPE>
@Override
default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); }
#endif
#if !TYPE_OBJECT
@Override
@Deprecated
@@ -1,11 +1,13 @@
package speiger.src.collections.PACKAGE.sets;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
#if SETS_FEATURE
import speiger.src.collections.PACKAGE.utils.SETS;
#endif
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
* A Special Set Interface giving Access to some really usefull functions
@@ -61,6 +63,7 @@ public interface ORDERED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE
*/
public BI_ITERATOR KEY_GENERIC_TYPE iterator(KEY_TYPE fromElement);
#if SPLIT_ITERATOR_FEATURE
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
@@ -68,6 +71,7 @@ public interface ORDERED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE
@Override
default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); }
#endif
/**
* A method to get the first element in the set
* @return first element in the set
@@ -4,11 +4,13 @@ import java.util.Set;
import speiger.src.collections.PACKAGE.collections.COLLECTION;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
#if SETS_FEATURE
import speiger.src.collections.PACKAGE.utils.SETS;
#endif
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
/**
@@ -88,10 +90,12 @@ public interface SET KEY_GENERIC_TYPE extends Set<CLASS_TYPE>, COLLECTION KEY_GE
public default SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
#if SPLIT_ITERATOR_FEATURE
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
*/
@Override
default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); }
}
#endif
}
@@ -3,7 +3,9 @@ package speiger.src.collections.PACKAGE.sets;
import java.util.SortedSet;
import speiger.src.collections.PACKAGE.collections.BI_ITERATOR;
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.collections.SPLIT_ITERATOR;
#endif
#if TYPE_OBJECT
import java.util.Comparator;
#else
@@ -12,7 +14,9 @@ import speiger.src.collections.PACKAGE.functions.COMPARATOR;
#if SETS_FEATURE
import speiger.src.collections.PACKAGE.utils.SETS;
#endif
#if SPLIT_ITERATOR_FEATURE
import speiger.src.collections.PACKAGE.utils.SPLIT_ITERATORS;
#endif
/**
* A Type Specific SortedSet implementation to reduce boxing/unboxing
@@ -67,6 +71,7 @@ public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, Sorte
public default SORTED_SET KEY_GENERIC_TYPE unmodifiable() { return SETS.unmodifiable(this); }
#endif
#if SPLIT_ITERATOR_FEATURE
/**
* A Type Specific Type Splititerator to reduce boxing/unboxing
* @return type specific splititerator
@@ -74,6 +79,7 @@ public interface SORTED_SET KEY_GENERIC_TYPE extends SET KEY_GENERIC_TYPE, Sorte
@Override
default SPLIT_ITERATOR KEY_GENERIC_TYPE spliterator() { return SPLIT_ITERATORS.createSplititerator(this, 0); }
#endif
#if !TYPE_OBJECT
/**
* A Type Specific SubSet method to reduce boxing/unboxing
@@ -25,7 +25,7 @@ import speiger.src.collections.booleans.collections.BooleanIterator;
#argument PACKAGE bytes shorts ints longs floats doubles
#argument MAPPER ToByteFunction ToShortFunction ToIntFunction ToLongFunction ToFloatFunction ToDoubleFunction
#argument FILTER_TYPE BYTE_COLLECTION_MODULE SHORT_COLLECTION_MODULE INT_COLLECTION_MODULE LONG_COLLECTION_MODULE FLOAT_COLLECTION_MODULE DOUBLE_COLLECTION_MODULE
#if BOOLEAN_COLLECTION_MODULE
#if FILTER_TYPE
import speiger.src.collections.objects.functions.function.MAPPER;
import speiger.src.collections.PACKAGE.collections.ITERATOR;
#endif