First batch of JavaDoc that is being done.
-Added: JavaDoc for Map Interfaces. -Added: JavaDoc for Abstract Map/Collection/Set -Added: Ignore JavaDoc for tests/builder code. -Added: More JavaDoc for Arrays.
This commit is contained in:
parent
199f50eb32
commit
2ca14f4d4f
|
@ -76,7 +76,7 @@ javadoc.failOnError = false
|
||||||
javadoc.options.quiet()
|
javadoc.options.quiet()
|
||||||
|
|
||||||
artifacts {
|
artifacts {
|
||||||
// archives javadocJar
|
archives javadocJar
|
||||||
archives srcJar
|
archives srcJar
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.builder;
|
package speiger.src.builder;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum ClassType
|
public enum ClassType
|
||||||
{
|
{
|
||||||
BOOLEAN("boolean", "Boolean", "Boolean", "booleans", "BOOLEAN", "false"),
|
BOOLEAN("boolean", "Boolean", "Boolean", "booleans", "BOOLEAN", "false"),
|
||||||
|
|
|
@ -14,6 +14,7 @@ import speiger.src.builder.mappers.LineMapper;
|
||||||
import speiger.src.builder.mappers.SimpleMapper;
|
import speiger.src.builder.mappers.SimpleMapper;
|
||||||
import speiger.src.builder.processor.TemplateProcess;
|
import speiger.src.builder.processor.TemplateProcess;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class GlobalVariables
|
public class GlobalVariables
|
||||||
{
|
{
|
||||||
List<IMapper> operators = new ArrayList<>();
|
List<IMapper> operators = new ArrayList<>();
|
||||||
|
@ -71,6 +72,8 @@ public class GlobalVariables
|
||||||
}
|
}
|
||||||
addComment("@ArrayType", "@param <%s> the type of array that the operation should be applied");
|
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");
|
addComment("@Type", "@param <%s> the type of elements maintained by this Collection");
|
||||||
|
addValueComment("@ValueArrayType", "@param <%s> the type of array that the operation should be applied");
|
||||||
|
addValueComment("@ValueType", "@param <%s> the type of elements maintained by this Collection");
|
||||||
addAnnontion("@PrimitiveOverride", "@Override");
|
addAnnontion("@PrimitiveOverride", "@Override");
|
||||||
addSimpleMapper("@PrimitiveDoc", "");
|
addSimpleMapper("@PrimitiveDoc", "");
|
||||||
addAnnontion("@Primitive", "@Deprecated");
|
addAnnontion("@Primitive", "@Deprecated");
|
||||||
|
@ -331,6 +334,12 @@ public class GlobalVariables
|
||||||
else operators.add(new LineMapper(type.name()+"["+pattern+"]", pattern));
|
else operators.add(new LineMapper(type.name()+"["+pattern+"]", pattern));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addValueComment(String pattern, String value)
|
||||||
|
{
|
||||||
|
if(valueType == ClassType.OBJECT) operators.add(new InjectMapper(valueType.name()+"["+pattern+"]", pattern, value).removeBraces());
|
||||||
|
else operators.add(new LineMapper(valueType.name()+"["+pattern+"]", pattern));
|
||||||
|
}
|
||||||
|
|
||||||
private InjectMapper addInjectMapper(String pattern, String replacement)
|
private InjectMapper addInjectMapper(String pattern, String replacement)
|
||||||
{
|
{
|
||||||
InjectMapper mapper = new InjectMapper(type.name()+"["+pattern+"]", pattern, replacement);
|
InjectMapper mapper = new InjectMapper(type.name()+"["+pattern+"]", pattern, replacement);
|
||||||
|
|
|
@ -15,6 +15,7 @@ import java.util.function.Consumer;
|
||||||
import speiger.src.builder.processor.TemplateProcess;
|
import speiger.src.builder.processor.TemplateProcess;
|
||||||
import speiger.src.builder.processor.TemplateProcessor;
|
import speiger.src.builder.processor.TemplateProcessor;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
public class PrimitiveCollectionsBuilder extends TemplateProcessor
|
||||||
{
|
{
|
||||||
Map<String, EnumSet<ClassType>> blocked = new HashMap<>();
|
Map<String, EnumSet<ClassType>> blocked = new HashMap<>();
|
||||||
|
|
|
@ -9,6 +9,10 @@ import speiger.src.collections.PACKAGE.collections.COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
import speiger.src.collections.PACKAGE.utils.ITERATORS;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Type Specific Collection that reduces boxing/unboxing
|
||||||
|
* @Type(T)
|
||||||
|
*/
|
||||||
public abstract class ABSTRACT_COLLECTION KEY_GENERIC_TYPE extends AbstractCollection<CLASS_TYPE> implements COLLECTION KEY_GENERIC_TYPE
|
public abstract class ABSTRACT_COLLECTION KEY_GENERIC_TYPE extends AbstractCollection<CLASS_TYPE> implements COLLECTION KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,11 @@ package speiger.src.collections.PACKAGE.functions.function;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific Function interface that reduces boxing/unboxing and fills the gaps of interfaces that are missing.
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
@FunctionalInterface
|
@FunctionalInterface
|
||||||
#if JDK_FUNCTION
|
#if JDK_FUNCTION
|
||||||
public interface FUNCTION KEY_VALUE_GENERIC_TYPE extends JAVA_FUNCTION KEY_VALUE_GENERIC_TYPE
|
public interface FUNCTION KEY_VALUE_GENERIC_TYPE extends JAVA_FUNCTION KEY_VALUE_GENERIC_TYPE
|
||||||
|
@ -11,13 +16,23 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE extends JAVA_FUNCTION KEY_VALUE
|
||||||
public interface FUNCTION KEY_VALUE_GENERIC_TYPE
|
public interface FUNCTION KEY_VALUE_GENERIC_TYPE
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Type Specific get function to reduce boxing/unboxing
|
||||||
|
* @param k the value that should be processed
|
||||||
|
* @return the result of the function
|
||||||
|
*/
|
||||||
public VALUE_TYPE GET_VALUE(KEY_TYPE k);
|
public VALUE_TYPE GET_VALUE(KEY_TYPE k);
|
||||||
|
|
||||||
#if JDK_FUNCTION
|
#if JDK_FUNCTION
|
||||||
#if VALUE_BOOLEAN
|
#if VALUE_BOOLEAN
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public default VALUE_TYPE test(KEY_TYPE k) { return GET_VALUE(k); }
|
public default VALUE_TYPE test(KEY_TYPE k) { return GET_VALUE(k); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type specific and-function helper function that reduces boxing/unboxing
|
||||||
|
* @param other the other function that should be merged with.
|
||||||
|
* @return a function that compares values in a and comparason
|
||||||
|
*/
|
||||||
public default FUNCTION KEY_VALUE_GENERIC_TYPE andType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
|
public default FUNCTION KEY_VALUE_GENERIC_TYPE andType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
|
||||||
Objects.requireNonNull(other);
|
Objects.requireNonNull(other);
|
||||||
return T -> GET_VALUE(T) && other.GET_VALUE(T);
|
return T -> GET_VALUE(T) && other.GET_VALUE(T);
|
||||||
|
@ -35,6 +50,11 @@ public interface FUNCTION KEY_VALUE_GENERIC_TYPE
|
||||||
return T -> !GET_VALUE(T);
|
return T -> !GET_VALUE(T);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type specific or-function helper function that reduces boxing/unboxing
|
||||||
|
* @param other the other function that should be merged with.
|
||||||
|
* @return a function that compares values in a or comparason
|
||||||
|
*/
|
||||||
public default FUNCTION KEY_VALUE_GENERIC_TYPE orType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
|
public default FUNCTION KEY_VALUE_GENERIC_TYPE orType(FUNCTION KEY_VALUE_GENERIC_TYPE other) {
|
||||||
Objects.requireNonNull(other);
|
Objects.requireNonNull(other);
|
||||||
return T -> GET_VALUE(T) || other.GET_VALUE(T);
|
return T -> GET_VALUE(T) || other.GET_VALUE(T);
|
||||||
|
|
|
@ -25,6 +25,11 @@ import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Base Implementation of a Type Specific Map to reduce boxing/unboxing
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CLASS_TYPE, CLASS_VALUE_TYPE> implements MAP KEY_VALUE_GENERIC_TYPE
|
public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CLASS_TYPE, CLASS_VALUE_TYPE> implements MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
protected VALUE_TYPE defaultReturnValue = EMPTY_VALUE;
|
protected VALUE_TYPE defaultReturnValue = EMPTY_VALUE;
|
||||||
|
@ -332,23 +337,46 @@ public abstract class ABSTRACT_MAP KEY_VALUE_GENERIC_TYPE extends AbstractMap<CL
|
||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Simple Type Specific Entry class to reduce boxing/unboxing
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public static class BasicEntry KEY_VALUE_GENERIC_TYPE implements MAP.Entry KEY_VALUE_GENERIC_TYPE {
|
public static class BasicEntry KEY_VALUE_GENERIC_TYPE implements MAP.Entry KEY_VALUE_GENERIC_TYPE {
|
||||||
protected KEY_TYPE key;
|
protected KEY_TYPE key;
|
||||||
protected VALUE_TYPE value;
|
protected VALUE_TYPE value;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A basic Empty constructor
|
||||||
|
*/
|
||||||
public BasicEntry() {}
|
public BasicEntry() {}
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* A Boxed Constructor for supporting java variants
|
||||||
|
* @param key the key of a entry
|
||||||
|
* @param value the value of a entry
|
||||||
|
*/
|
||||||
public BasicEntry(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
public BasicEntry(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
this.key = OBJ_TO_KEY(key);
|
this.key = OBJ_TO_KEY(key);
|
||||||
this.value = OBJ_TO_VALUE(value);
|
this.value = OBJ_TO_VALUE(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* A Type Specific Constructor
|
||||||
|
* @param key the key of a entry
|
||||||
|
* @param value the value of a entry
|
||||||
|
*/
|
||||||
public BasicEntry(KEY_TYPE key, VALUE_TYPE value) {
|
public BasicEntry(KEY_TYPE key, VALUE_TYPE value) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper method for fast replacing values
|
||||||
|
* @param key the key that should be replaced
|
||||||
|
* @param value the value that should be replaced
|
||||||
|
*/
|
||||||
public void set(KEY_TYPE key, VALUE_TYPE value) {
|
public void set(KEY_TYPE key, VALUE_TYPE value) {
|
||||||
this.key = key;
|
this.key = key;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
|
|
|
@ -22,22 +22,73 @@ import speiger.src.collections.objects.collections.ObjectIterator;
|
||||||
import speiger.src.collections.objects.sets.ObjectSet;
|
import speiger.src.collections.objects.sets.ObjectSet;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific Map that reduces memory overhead due to boxing/unboxing of Primitives
|
||||||
|
* and some extra helper functions.
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_TYPE>, FUNCTION KEY_VALUE_GENERIC_TYPE
|
public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_TYPE>, FUNCTION KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Method to see what the default return value is.
|
||||||
|
* @return default return value
|
||||||
|
*/
|
||||||
public VALUE_TYPE getDefaultReturnValue();
|
public VALUE_TYPE getDefaultReturnValue();
|
||||||
|
/**
|
||||||
|
* Method to define the default return value if a requested key isn't present
|
||||||
|
* @param v value that should be the default return value
|
||||||
|
* @return itself
|
||||||
|
*/
|
||||||
public MAP KEY_VALUE_GENERIC_TYPE setDefaultReturnValue(VALUE_TYPE v);
|
public MAP KEY_VALUE_GENERIC_TYPE setDefaultReturnValue(VALUE_TYPE v);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type Specific method to reduce boxing/unboxing of values
|
||||||
|
* @param key the key that should be inserted,
|
||||||
|
* @param value the value that should be inserted
|
||||||
|
* @return the last present value or default return value.
|
||||||
|
* @see Map#put(Object, Object)
|
||||||
|
*/
|
||||||
public VALUE_TYPE put(KEY_TYPE key, VALUE_TYPE value);
|
public VALUE_TYPE put(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
/**
|
||||||
|
* Type Specific method to reduce boxing/unboxing of values
|
||||||
|
* @param key the key that should be inserted,
|
||||||
|
* @param value the value that should be inserted
|
||||||
|
* @return the last present value or default return value.
|
||||||
|
* @see Map#putIfAbsent(Object, Object)
|
||||||
|
*/
|
||||||
public VALUE_TYPE putIfAbsent(KEY_TYPE key, VALUE_TYPE value);
|
public VALUE_TYPE putIfAbsent(KEY_TYPE key, VALUE_TYPE value);
|
||||||
#if VALUE_PRIMITIVES
|
|
||||||
public VALUE_TYPE addTo(KEY_TYPE key, VALUE_TYPE value);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
#if VALUE_PRIMITIVES
|
||||||
|
/**
|
||||||
|
* A Helper method to add a primitives together. If key is not present then this functions as a put.
|
||||||
|
* @param key the key that should be inserted,
|
||||||
|
* @param value the value that should be inserted / added
|
||||||
|
* @return the last present value or default return value.
|
||||||
|
*/
|
||||||
|
public VALUE_TYPE addTo(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
/**
|
||||||
|
* Type Specific function for the bull putting of values
|
||||||
|
* @param m the elements that should be inserted
|
||||||
|
*/
|
||||||
public void putAll(MAP KEY_VALUE_GENERIC_TYPE m);
|
public void putAll(MAP KEY_VALUE_GENERIC_TYPE m);
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific method to reduce boxing/unboxing of values
|
||||||
|
* @param key element that is searched for
|
||||||
|
* @return if the key is present
|
||||||
|
*/
|
||||||
public boolean containsKey(KEY_TYPE key);
|
public boolean containsKey(KEY_TYPE key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Map#containsKey(Object)
|
||||||
|
* @param key that is searched for.
|
||||||
|
* @return true if found
|
||||||
|
* @note in some implementations key does not have to be CLASS_TYPE but just have to support equals with CLASS_TYPE.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public default boolean containsKey(Object key) {
|
public default boolean containsKey(Object key) {
|
||||||
return key instanceof CLASS_TYPE && containsKey(CLASS_TO_KEY(key));
|
return key instanceof CLASS_TYPE && containsKey(CLASS_TO_KEY(key));
|
||||||
|
@ -45,16 +96,38 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if !VALUE_OBJECT
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific method to reduce boxing/unboxing of values
|
||||||
|
* @param value element that is searched for
|
||||||
|
* @return if the value is present
|
||||||
|
*/
|
||||||
public boolean containsValue(VALUE_TYPE value);
|
public boolean containsValue(VALUE_TYPE value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Map#containsValue(Object)
|
||||||
|
* @param value that is searched for.
|
||||||
|
* @return true if found
|
||||||
|
* @note in some implementations key does not have to be CLASS_VALUE but just have to support equals with CLASS_VALUE.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public default boolean containsValue(Object value) {
|
public default boolean containsValue(Object value) {
|
||||||
return value instanceof CLASS_VALUE_TYPE && containsValue(CLASS_TO_VALUE(value));
|
return value instanceof CLASS_VALUE_TYPE && containsValue(CLASS_TO_VALUE(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* Type Specific remove function to reduce boxing/unboxing
|
||||||
|
* @param key the element that should be removed
|
||||||
|
* @return the value that was removed or default return value
|
||||||
|
*/
|
||||||
public VALUE_TYPE REMOVE_KEY(KEY_TYPE key);
|
public VALUE_TYPE REMOVE_KEY(KEY_TYPE key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Map#remove(Object)
|
||||||
|
* @param key the element that should be removed
|
||||||
|
* @return the value that was removed or default return value
|
||||||
|
* @note in some implementations key does not have to be CLASS_TYPE but just have to support equals with CLASS_TYPE.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public default CLASS_VALUE_TYPE remove(Object key) {
|
public default CLASS_VALUE_TYPE remove(Object key) {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
|
@ -65,8 +138,21 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific remove function to reduce boxing/unboxing
|
||||||
|
* @param key the element that should be removed
|
||||||
|
* @param value the expected value that should be found
|
||||||
|
* @return true if the key & value was found and removed
|
||||||
|
* @see Map#remove(Object, Object)
|
||||||
|
*/
|
||||||
public boolean remove(KEY_TYPE key, VALUE_TYPE value);
|
public boolean remove(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see Map#remove(Object, Object)
|
||||||
|
* @param key the element that should be removed
|
||||||
|
* @param value the expected value that should be found
|
||||||
|
* @return true if the key & value was found and removed
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public default boolean remove(Object key, Object value) {
|
public default boolean remove(Object key, Object value) {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
|
@ -79,30 +165,90 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific replace method to replace an existing value
|
||||||
|
* @param key the element that should be searched for
|
||||||
|
* @param oldValue the expected value to be replaced
|
||||||
|
* @param newValue the value to replace the oldValue with.
|
||||||
|
* @return true if the value got replaced
|
||||||
|
* @note this fails if the value is not present even if it matches the oldValue
|
||||||
|
*/
|
||||||
public boolean replace(KEY_TYPE key, VALUE_TYPE oldValue, VALUE_TYPE newValue);
|
public boolean replace(KEY_TYPE key, VALUE_TYPE oldValue, VALUE_TYPE newValue);
|
||||||
|
/**
|
||||||
|
* A Type Specific replace method to reduce boxing/unboxing replace an existing value
|
||||||
|
* @param key the element that should be searched for
|
||||||
|
* @param value the value to replace with.
|
||||||
|
* @return the present value or default return value
|
||||||
|
* @note this fails if the value is not present
|
||||||
|
*/
|
||||||
public VALUE_TYPE replace(KEY_TYPE key, VALUE_TYPE value);
|
public VALUE_TYPE replace(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
/**
|
||||||
|
* A Type Specific mass replace method to reduce boxing/unboxing
|
||||||
|
* @param mappingFunction operation to replace all values
|
||||||
|
*/
|
||||||
public void REPLACE_VALUES(UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
public void REPLACE_VALUES(UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value
|
||||||
|
* @return the result of the computation
|
||||||
|
*/
|
||||||
public VALUE_TYPE COMPUTE(KEY_TYPE key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
public VALUE_TYPE COMPUTE(KEY_TYPE key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if not present
|
||||||
|
* @return the result of the computed value or present value
|
||||||
|
*/
|
||||||
public VALUE_TYPE COMPUTE_IF_ABSENT(KEY_TYPE key, FUNCTION KEY_VALUE_GENERIC_TYPE mappingFunction);
|
public VALUE_TYPE COMPUTE_IF_ABSENT(KEY_TYPE key, FUNCTION KEY_VALUE_GENERIC_TYPE mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific compute method to reduce boxing/unboxing
|
||||||
|
* @param key the key that should be computed
|
||||||
|
* @param mappingFunction the operator that should generate the value if present
|
||||||
|
* @return the result of the default return value or present value
|
||||||
|
* @note if not present then compute is not executed
|
||||||
|
*/
|
||||||
public VALUE_TYPE COMPUTE_IF_PRESENT(KEY_TYPE key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
public VALUE_TYPE COMPUTE_IF_PRESENT(KEY_TYPE key, UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE mappingFunction);
|
||||||
|
/**
|
||||||
|
* A Type Specific merge method to reduce boxing/unboxing
|
||||||
|
* @param key the key that should be be searched for
|
||||||
|
* @param value the value that should be merged with
|
||||||
|
* @param mappingFunction the operator that should generate the new Value
|
||||||
|
* @return the result of the merge
|
||||||
|
* @note if the result matches the default return value then the key is removed from the map
|
||||||
|
*/
|
||||||
public VALUE_TYPE MERGE(KEY_TYPE key, VALUE_TYPE value, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction);
|
public VALUE_TYPE MERGE(KEY_TYPE key, VALUE_TYPE value, VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE mappingFunction);
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default boolean replace(CLASS_TYPE key, CLASS_VALUE_TYPE oldValue, CLASS_VALUE_TYPE newValue) {
|
public default boolean replace(CLASS_TYPE key, CLASS_VALUE_TYPE oldValue, CLASS_VALUE_TYPE newValue) {
|
||||||
return replace(OBJ_TO_KEY(key), OBJ_TO_VALUE(oldValue), OBJ_TO_VALUE(newValue));
|
return replace(OBJ_TO_KEY(key), OBJ_TO_VALUE(oldValue), OBJ_TO_VALUE(newValue));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE replace(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
public default CLASS_VALUE_TYPE replace(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
return VALUE_TO_OBJ(replace(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
return VALUE_TO_OBJ(replace(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific get method to reduce boxing/unboxing
|
||||||
|
* @param key the key that is searched for
|
||||||
|
* @return the searched value or default return value
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public VALUE_TYPE GET_VALUE(KEY_TYPE key);
|
public VALUE_TYPE GET_VALUE(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific getOrDefault method to reduce boxing/unboxing
|
||||||
|
* @param key the key that is searched for
|
||||||
|
* @param defaultValue the value that should be returned if the key is not present
|
||||||
|
* @return the searched value or defaultValue value
|
||||||
|
*/
|
||||||
public VALUE_TYPE getOrDefault(KEY_TYPE key, VALUE_TYPE defaultValue);
|
public VALUE_TYPE getOrDefault(KEY_TYPE key, VALUE_TYPE defaultValue);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE get(Object key) {
|
public default CLASS_VALUE_TYPE get(Object key) {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
return VALUE_TO_OBJ(GET_VALUE((CLASS_TYPE)key));
|
return VALUE_TO_OBJ(GET_VALUE((CLASS_TYPE)key));
|
||||||
|
@ -112,6 +258,7 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE getOrDefault(Object key, CLASS_VALUE_TYPE defaultValue) {
|
public default CLASS_VALUE_TYPE getOrDefault(Object key, CLASS_VALUE_TYPE defaultValue) {
|
||||||
#if TYPE_OBJECT
|
#if TYPE_OBJECT
|
||||||
CLASS_VALUE_TYPE value = VALUE_TO_OBJ(GET_VALUE((CLASS_TYPE)key));
|
CLASS_VALUE_TYPE value = VALUE_TO_OBJ(GET_VALUE((CLASS_TYPE)key));
|
||||||
|
@ -123,33 +270,43 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default void replaceAll(BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
public default void replaceAll(BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
REPLACE_VALUES(mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V))));
|
REPLACE_VALUES(mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE compute(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
public default CLASS_VALUE_TYPE compute(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
return VALUE_TO_OBJ(COMPUTE(OBJ_TO_KEY(key), mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
return VALUE_TO_OBJ(COMPUTE(OBJ_TO_KEY(key), mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE computeIfAbsent(CLASS_TYPE key, Function<? super CLASS_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
public default CLASS_VALUE_TYPE computeIfAbsent(CLASS_TYPE key, Function<? super CLASS_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
return VALUE_TO_OBJ(COMPUTE_IF_ABSENT(OBJ_TO_KEY(key), mappingFunction instanceof FUNCTION ? (FUNCTION KEY_VALUE_GENERIC_TYPE)mappingFunction : K -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K)))));
|
return VALUE_TO_OBJ(COMPUTE_IF_ABSENT(OBJ_TO_KEY(key), mappingFunction instanceof FUNCTION ? (FUNCTION KEY_VALUE_GENERIC_TYPE)mappingFunction : K -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE computeIfPresent(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
public default CLASS_VALUE_TYPE computeIfPresent(CLASS_TYPE key, BiFunction<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
return VALUE_TO_OBJ(COMPUTE_IF_PRESENT(OBJ_TO_KEY(key), mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
return VALUE_TO_OBJ(COMPUTE_IF_PRESENT(OBJ_TO_KEY(key), mappingFunction instanceof UNARY_OPERATOR ? (UNARY_OPERATOR KEY_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE merge(CLASS_TYPE key, CLASS_VALUE_TYPE value, BiFunction<? super CLASS_VALUE_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
public default CLASS_VALUE_TYPE merge(CLASS_TYPE key, CLASS_VALUE_TYPE value, BiFunction<? super CLASS_VALUE_TYPE, ? super CLASS_VALUE_TYPE, ? extends CLASS_VALUE_TYPE> mappingFunction) {
|
||||||
return VALUE_TO_OBJ(MERGE(OBJ_TO_KEY(key), OBJ_TO_VALUE(value), mappingFunction instanceof VALUE_UNARY_OPERATOR ? (VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(VALUE_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
return VALUE_TO_OBJ(MERGE(OBJ_TO_KEY(key), OBJ_TO_VALUE(value), mappingFunction instanceof VALUE_UNARY_OPERATOR ? (VALUE_UNARY_OPERATOR VALUE_VALUE_GENERIC_TYPE)mappingFunction : (K, V) -> OBJ_TO_VALUE(mappingFunction.apply(VALUE_TO_OBJ(K), VALUE_TO_OBJ(V)))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type Specific forEach method to reduce boxing/unboxing
|
||||||
|
* @param action processor of the values that are iterator over
|
||||||
|
*/
|
||||||
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action);
|
public void forEach(BI_CONSUMER KEY_VALUE_GENERIC_TYPE action);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default void forEach(BiConsumer<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE> action) {
|
public default void forEach(BiConsumer<? super CLASS_TYPE, ? super CLASS_VALUE_TYPE> action) {
|
||||||
forEach(action instanceof BI_CONSUMER ? (BI_CONSUMER KEY_VALUE_GENERIC_TYPE)action : (K, V) -> action.accept(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)));
|
forEach(action instanceof BI_CONSUMER ? (BI_CONSUMER KEY_VALUE_GENERIC_TYPE)action : (K, V) -> action.accept(KEY_TO_OBJ(K), VALUE_TO_OBJ(V)));
|
||||||
}
|
}
|
||||||
|
@ -159,37 +316,76 @@ public interface MAP KEY_VALUE_GENERIC_TYPE extends Map<CLASS_TYPE, CLASS_VALUE_
|
||||||
@Override
|
@Override
|
||||||
public VALUE_COLLECTION VALUE_GENERIC_TYPE values();
|
public VALUE_COLLECTION VALUE_GENERIC_TYPE values();
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public ObjectSet<Map.Entry<CLASS_TYPE, CLASS_VALUE_TYPE>> entrySet();
|
public ObjectSet<Map.Entry<CLASS_TYPE, CLASS_VALUE_TYPE>> entrySet();
|
||||||
|
/**
|
||||||
|
* Type Sensitive EntrySet to reduce boxing/unboxing and optionally Temp Object Allocation.
|
||||||
|
* @return a EntrySet of the collection
|
||||||
|
*/
|
||||||
public ObjectSet<Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET();
|
public ObjectSet<Entry KEY_VALUE_GENERIC_TYPE> ENTRY_SET();
|
||||||
|
|
||||||
#if !TYPE_OBJECT || !VALUE_OBJECT
|
#if !TYPE_OBJECT || !VALUE_OBJECT
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE put(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
public default CLASS_VALUE_TYPE put(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
return VALUE_TO_OBJ(put(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
return VALUE_TO_OBJ(put(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Primitive
|
||||||
public default CLASS_VALUE_TYPE putIfAbsent(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
public default CLASS_VALUE_TYPE putIfAbsent(CLASS_TYPE key, CLASS_VALUE_TYPE value) {
|
||||||
return VALUE_TO_OBJ(put(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
return VALUE_TO_OBJ(put(OBJ_TO_KEY(key), OBJ_TO_VALUE(value)));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* Fast Entry set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public interface FastEntrySet KEY_VALUE_GENERIC_TYPE extends ObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE>
|
public interface FastEntrySet KEY_VALUE_GENERIC_TYPE extends ObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE>
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* Fast iterator that recycles the given Entry object to improve speed and reduce object allocation
|
||||||
|
* @return a Recycling ObjectIterator of the given set
|
||||||
|
*/
|
||||||
public ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
public ObjectIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
||||||
|
/**
|
||||||
|
* Fast for each that recycles the given Entry object to improve speed and reduce object allocation
|
||||||
|
* @param action the action that should be applied to each given entry
|
||||||
|
*/
|
||||||
public default void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
public default void fastForEach(Consumer<? super MAP.Entry KEY_VALUE_GENERIC_TYPE> action) {
|
||||||
forEach(action);
|
forEach(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Type Specific Map Entry that reduces boxing/unboxing
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public interface Entry KEY_VALUE_GENERIC_TYPE extends Map.Entry<CLASS_TYPE, CLASS_VALUE_TYPE>
|
public interface Entry KEY_VALUE_GENERIC_TYPE extends Map.Entry<CLASS_TYPE, CLASS_VALUE_TYPE>
|
||||||
{
|
{
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific getKey method that reduces boxing/unboxing
|
||||||
|
* @return the key of a given Entry
|
||||||
|
*/
|
||||||
public KEY_TYPE ENTRY_KEY();
|
public KEY_TYPE ENTRY_KEY();
|
||||||
public default CLASS_TYPE getKey() { return KEY_TO_OBJ(ENTRY_KEY()); }
|
public default CLASS_TYPE getKey() { return KEY_TO_OBJ(ENTRY_KEY()); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !VALUE_OBJECT
|
#if !VALUE_OBJECT
|
||||||
|
/**
|
||||||
|
* Type Specific getValue method that reduces boxing/unboxing
|
||||||
|
* @return the value of a given Entry
|
||||||
|
*/
|
||||||
public VALUE_TYPE ENTRY_VALUE();
|
public VALUE_TYPE ENTRY_VALUE();
|
||||||
|
/**
|
||||||
|
* Type Specific setValue method that reduces boxing/unboxing
|
||||||
|
* @param value the new Value that should be placed in the given entry
|
||||||
|
* @return the old value of a given entry
|
||||||
|
* @throws UnsupportedOperationException if the Entry is immutable or not supported
|
||||||
|
*/
|
||||||
public VALUE_TYPE setValue(VALUE_TYPE value);
|
public VALUE_TYPE setValue(VALUE_TYPE value);
|
||||||
public default CLASS_VALUE_TYPE getValue() { return VALUE_TO_OBJ(ENTRY_VALUE()); }
|
public default CLASS_VALUE_TYPE getValue() { return VALUE_TO_OBJ(ENTRY_VALUE()); }
|
||||||
public default CLASS_VALUE_TYPE setValue(CLASS_VALUE_TYPE value) { return VALUE_TO_OBJ(setValue(OBJ_TO_VALUE(value))); }
|
public default CLASS_VALUE_TYPE setValue(CLASS_VALUE_TYPE value) { return VALUE_TO_OBJ(setValue(OBJ_TO_VALUE(value))); }
|
||||||
|
|
|
@ -3,26 +3,58 @@ package speiger.src.collections.PACKAGE.maps.interfaces;
|
||||||
import java.util.NavigableMap;
|
import java.util.NavigableMap;
|
||||||
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
|
import speiger.src.collections.PACKAGE.sets.NAVIGABLE_SET;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific Navigable Map interface with a couple helper methods
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VALUE_GENERIC_TYPE, NavigableMap<CLASS_TYPE, CLASS_VALUE_TYPE>
|
public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VALUE_GENERIC_TYPE, NavigableMap<CLASS_TYPE, CLASS_VALUE_TYPE>
|
||||||
{
|
{
|
||||||
|
/** @return a Type Specific desendingMap */
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap();
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE descendingMap();
|
||||||
|
/** @return a Type Specific Navigable Key Set */
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet();
|
public NAVIGABLE_SET KEY_GENERIC_TYPE navigableKeySet();
|
||||||
|
/** @return a Type Specific Desending Key Set */
|
||||||
@Override
|
@Override
|
||||||
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet();
|
public NAVIGABLE_SET KEY_GENERIC_TYPE descendingKeySet();
|
||||||
|
/** @return a Type Specific firstEntry */
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry();
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE firstEntry();
|
||||||
|
/** @return a Type Specific lastEntry */
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry();
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE lastEntry();
|
||||||
|
/** @return a Type Specific pollFirstEntry */
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirstEntry();
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollFirstEntry();
|
||||||
|
/** @return a Type Specific pollLastEntry */
|
||||||
@Override
|
@Override
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry();
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE pollLastEntry();
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* A Type Specific SubMap method to reduce boxing/unboxing
|
||||||
|
* @param fromKey where the submap should start
|
||||||
|
* @param fromInclusive if the fromKey is inclusive or not
|
||||||
|
* @param toKey where the subMap should end
|
||||||
|
* @param toInclusive if the toKey is inclusive or not
|
||||||
|
* @return a SubMap that is within the range of the desired range
|
||||||
|
*/
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive);
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, boolean fromInclusive, KEY_TYPE toKey, boolean toInclusive);
|
||||||
|
/**
|
||||||
|
* A Type Specific HeadMap method to reduce boxing/unboxing
|
||||||
|
* @param toKey where the HeadMap should end
|
||||||
|
* @param inclusive if the toKey is inclusive or not
|
||||||
|
* @return a HeadMap that is within the range of the desired range
|
||||||
|
*/
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive);
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey, boolean inclusive);
|
||||||
|
/**
|
||||||
|
* A Type Specific TailMap method to reduce boxing/unboxing
|
||||||
|
* @param fromKey where the TailMap should start
|
||||||
|
* @param inclusive if the fromKey is inclusive or not
|
||||||
|
* @return a TailMap that is within the range of the desired range
|
||||||
|
*/
|
||||||
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive);
|
public NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey, boolean inclusive);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -32,51 +64,121 @@ public interface NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE extends SORTED_MAP KEY_VAL
|
||||||
@Override
|
@Override
|
||||||
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return tailMap(fromKey, true); }
|
public default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey) { return tailMap(fromKey, true); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper method to set the max value for SubMaps. (Default: KEY_TYPE.MIN_VALUE)
|
||||||
|
* @param e the new max value
|
||||||
|
*/
|
||||||
public void setDefaultMaxValue(KEY_TYPE e);
|
public void setDefaultMaxValue(KEY_TYPE e);
|
||||||
|
/**
|
||||||
|
* A Helper method to get the max value for SubMaps.
|
||||||
|
* @return the default max value.
|
||||||
|
*/
|
||||||
public KEY_TYPE getDefaultMaxValue();
|
public KEY_TYPE getDefaultMaxValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Helper method to set the min value for SubMaps. (Default: KEY_TYPE.MAX_VALUE)
|
||||||
|
* @param e the new min value
|
||||||
|
*/
|
||||||
public void setDefaultMinValue(KEY_TYPE e);
|
public void setDefaultMinValue(KEY_TYPE e);
|
||||||
|
/**
|
||||||
|
* A Helper method to get the min value for SubMaps.
|
||||||
|
* @return the default min value.
|
||||||
|
*/
|
||||||
public KEY_TYPE getDefaultMinValue();
|
public KEY_TYPE getDefaultMinValue();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific lowerKey method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the greatest lower key that can be found
|
||||||
|
*/
|
||||||
public KEY_TYPE lowerKey(KEY_TYPE key);
|
public KEY_TYPE lowerKey(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific higherKey method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the lowest higher key that can be found
|
||||||
|
*/
|
||||||
public KEY_TYPE higherKey(KEY_TYPE key);
|
public KEY_TYPE higherKey(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific floorKey method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the greatest lower or equal key that can be found
|
||||||
|
*/
|
||||||
public KEY_TYPE floorKey(KEY_TYPE key);
|
public KEY_TYPE floorKey(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific ceilingKey method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the lowest higher or equal key that can be found
|
||||||
|
*/
|
||||||
public KEY_TYPE ceilingKey(KEY_TYPE key);
|
public KEY_TYPE ceilingKey(KEY_TYPE key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific lowerEntry method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the greatest lower entry that can be found, or null
|
||||||
|
*/
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key);
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific higherEntry method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the lowest higher entry that can be found, or null
|
||||||
|
*/
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key);
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific floorEntry method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the greatest lower or equal entry that can be found, or null
|
||||||
|
*/
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key);
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Type Specific ceilingEntry method to reduce boxing/unboxing.
|
||||||
|
* @param key that should be compared with.
|
||||||
|
* @return the lowest higher or equal entry that can be found, or null
|
||||||
|
*/
|
||||||
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key);
|
public MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(KEY_TYPE key);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE lowerKey(CLASS_TYPE key) { return KEY_TO_OBJ(lowerKey(OBJ_TO_KEY(key)));}
|
public default CLASS_TYPE lowerKey(CLASS_TYPE key) { return KEY_TO_OBJ(lowerKey(OBJ_TO_KEY(key)));}
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE floorKey(CLASS_TYPE key) { return KEY_TO_OBJ(floorKey(OBJ_TO_KEY(key)));}
|
public default CLASS_TYPE floorKey(CLASS_TYPE key) { return KEY_TO_OBJ(floorKey(OBJ_TO_KEY(key)));}
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE ceilingKey(CLASS_TYPE key) { return KEY_TO_OBJ(ceilingKey(OBJ_TO_KEY(key)));}
|
public default CLASS_TYPE ceilingKey(CLASS_TYPE key) { return KEY_TO_OBJ(ceilingKey(OBJ_TO_KEY(key)));}
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE higherKey(CLASS_TYPE key) { return KEY_TO_OBJ(higherKey(OBJ_TO_KEY(key)));}
|
public default CLASS_TYPE higherKey(CLASS_TYPE key) { return KEY_TO_OBJ(higherKey(OBJ_TO_KEY(key)));}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(CLASS_TYPE key) { return lowerEntry(OBJ_TO_KEY(key)); }
|
default MAP.Entry KEY_VALUE_GENERIC_TYPE lowerEntry(CLASS_TYPE key) { return lowerEntry(OBJ_TO_KEY(key)); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(CLASS_TYPE key) { return floorEntry(OBJ_TO_KEY(key)); }
|
default MAP.Entry KEY_VALUE_GENERIC_TYPE floorEntry(CLASS_TYPE key) { return floorEntry(OBJ_TO_KEY(key)); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(CLASS_TYPE key) { return ceilingEntry(OBJ_TO_KEY(key)); }
|
default MAP.Entry KEY_VALUE_GENERIC_TYPE ceilingEntry(CLASS_TYPE key) { return ceilingEntry(OBJ_TO_KEY(key)); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(CLASS_TYPE key) { return higherEntry(OBJ_TO_KEY(key)); }
|
default MAP.Entry KEY_VALUE_GENERIC_TYPE higherEntry(CLASS_TYPE key) { return higherEntry(OBJ_TO_KEY(key)); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, boolean fromInclusive, CLASS_TYPE toKey, boolean toInclusive) { return subMap(OBJ_TO_KEY(fromKey), fromInclusive, OBJ_TO_KEY(toKey), toInclusive); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, boolean fromInclusive, CLASS_TYPE toKey, boolean toInclusive) { return subMap(OBJ_TO_KEY(fromKey), fromInclusive, OBJ_TO_KEY(toKey), toInclusive); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { return headMap(OBJ_TO_KEY(toKey), inclusive); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey, boolean inclusive) { return headMap(OBJ_TO_KEY(toKey), inclusive); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { return tailMap(OBJ_TO_KEY(fromKey), inclusive); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey, boolean inclusive) { return tailMap(OBJ_TO_KEY(fromKey), inclusive); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { return subMap(OBJ_TO_KEY(fromKey), true, OBJ_TO_KEY(toKey), false); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE subMap(CLASS_TYPE fromKey, CLASS_TYPE toKey) { return subMap(OBJ_TO_KEY(fromKey), true, OBJ_TO_KEY(toKey), false); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { return headMap(OBJ_TO_KEY(toKey), false); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE headMap(CLASS_TYPE toKey) { return headMap(OBJ_TO_KEY(toKey), false); }
|
||||||
@Override
|
@Override
|
||||||
|
@Deprecated
|
||||||
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey), true); }
|
default NAVIGABLE_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey), true); }
|
||||||
#else
|
#else
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -13,15 +13,63 @@ import speiger.src.collections.PACKAGE.sets.SET;
|
||||||
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
import speiger.src.collections.objects.sets.ObjectSortedSet;
|
||||||
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
import speiger.src.collections.objects.collections.ObjectBidirectionalIterator;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Type Specific {@link SortedMap} interface to reduce boxing/unboxing, with a couple extra methods that allow greater control over maps.
|
||||||
|
*
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE, CLASS_VALUE_TYPE>, MAP KEY_VALUE_GENERIC_TYPE
|
public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE, CLASS_VALUE_TYPE>, MAP KEY_VALUE_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* A customized put method that allows you to insert into the first index.
|
||||||
|
* @param key the key that should be inserted
|
||||||
|
* @param value the value that should be inserted
|
||||||
|
* @return the previous present or default return value
|
||||||
|
* @see java.util.Map#put(Object, Object)
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value);
|
public VALUE_TYPE putAndMoveToFirst(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
/**
|
||||||
|
* A customized put method that allows you to insert into the last index. (This may be nessesary depending on the implementation)
|
||||||
|
* @param key the key that should be inserted
|
||||||
|
* @param value the value that should be inserted
|
||||||
|
* @return the previous present or default return value
|
||||||
|
* @see java.util.Map#put(Object, Object)
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value);
|
public VALUE_TYPE putAndMoveToLast(KEY_TYPE key, VALUE_TYPE value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A specific move method to move a given key/value to the first index.
|
||||||
|
* @param key that should be moved to the first index
|
||||||
|
* @return true if the value was moved.
|
||||||
|
* @note returns false if the value was not present in the first place
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public boolean moveToFirst(KEY_TYPE key);
|
public boolean moveToFirst(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A specific move method to move a given key/value to the last index.
|
||||||
|
* @param key that should be moved to the first last
|
||||||
|
* @return true if the value was moved.
|
||||||
|
* @note returns false if the value was not present in the first place
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public boolean moveToLast(KEY_TYPE key);
|
public boolean moveToLast(KEY_TYPE key);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A Specific get method that allows to move teh given key/value int the first index.
|
||||||
|
* @param key that is searched for
|
||||||
|
* @return the given value for the requested key or default return value
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key);
|
public VALUE_TYPE getAndMoveToFirst(KEY_TYPE key);
|
||||||
|
/**
|
||||||
|
* A Specific get method that allows to move teh given key/value int the last index.
|
||||||
|
* @param key that is searched for
|
||||||
|
* @return the given value for the requested key or default return value
|
||||||
|
* @note some implementations do not support this method
|
||||||
|
*/
|
||||||
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key);
|
public VALUE_TYPE getAndMoveToLast(KEY_TYPE key);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -33,19 +81,69 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
|
||||||
public VALUE_COLLECTION VALUE_GENERIC_TYPE values();
|
public VALUE_COLLECTION VALUE_GENERIC_TYPE values();
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/**
|
||||||
|
* A Type Specific SubMap method to reduce boxing/unboxing
|
||||||
|
* @param fromKey where the submap should start
|
||||||
|
* @param toKey where the subMap should end
|
||||||
|
* @return a SubMap that is within the range of the desired range
|
||||||
|
* @note Some implementations may not support this method.
|
||||||
|
* @note Some implementations may not keep the desired range when the original is changed.
|
||||||
|
*/
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey);
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE subMap(KEY_TYPE fromKey, KEY_TYPE toKey);
|
||||||
|
/**
|
||||||
|
* A Type Specific HeadMap method to reduce boxing/unboxing
|
||||||
|
* @param toKey where the headMap should end
|
||||||
|
* @return a HeadMap that is within the range of the desired range
|
||||||
|
* @note Some implementations may not support this method.
|
||||||
|
* @note Some implementations may not keep the desired range when the original is changed.
|
||||||
|
*/
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey);
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE headMap(KEY_TYPE toKey);
|
||||||
|
/**
|
||||||
|
* A Type Specific TailMap method to reduce boxing/unboxing
|
||||||
|
* @param fromKey where the TailMap should start
|
||||||
|
* @return a TailMap that is within the range of the desired range
|
||||||
|
* @note Some implementations may not support this method.
|
||||||
|
* @note Some implementations may not keep the desired range when the original is changed.
|
||||||
|
*/
|
||||||
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey);
|
public SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(KEY_TYPE fromKey);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A method to get the first Key of a Map.
|
||||||
|
* @return the first key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE FIRST_ENTRY_KEY();
|
public KEY_TYPE FIRST_ENTRY_KEY();
|
||||||
|
/**
|
||||||
|
* A method to get and remove the first Key of a Map.
|
||||||
|
* @return the first key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE POLL_FIRST_ENTRY_KEY();
|
public KEY_TYPE POLL_FIRST_ENTRY_KEY();
|
||||||
|
/**
|
||||||
|
* A method to get the last Key of a Map.
|
||||||
|
* @return the last key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE LAST_ENTRY_KEY();
|
public KEY_TYPE LAST_ENTRY_KEY();
|
||||||
|
/**
|
||||||
|
* A method to get and remove the last Key of a Map.
|
||||||
|
* @return the last key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE POLL_LAST_ENTRY_KEY();
|
public KEY_TYPE POLL_LAST_ENTRY_KEY();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A method to get the first Value of a Map.
|
||||||
|
* @return the first key in the map
|
||||||
|
*/
|
||||||
public VALUE_TYPE FIRST_ENTRY_VALUE();
|
public VALUE_TYPE FIRST_ENTRY_VALUE();
|
||||||
|
/**
|
||||||
|
* A method to get the last Value of a Map.
|
||||||
|
* @return the last key in the map
|
||||||
|
*/
|
||||||
public VALUE_TYPE LAST_ENTRY_VALUE();
|
public VALUE_TYPE LAST_ENTRY_VALUE();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE firstKey() { return KEY_TO_OBJ(FIRST_ENTRY_KEY()); }
|
public default CLASS_TYPE firstKey() { return KEY_TO_OBJ(FIRST_ENTRY_KEY()); }
|
||||||
|
@Override
|
||||||
|
@Deprecated
|
||||||
public default CLASS_TYPE lastKey() { return KEY_TO_OBJ(LAST_ENTRY_KEY()); }
|
public default CLASS_TYPE lastKey() { return KEY_TO_OBJ(LAST_ENTRY_KEY()); }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -58,10 +156,25 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
|
||||||
@Deprecated
|
@Deprecated
|
||||||
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey)); }
|
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey)); }
|
||||||
#else
|
#else
|
||||||
|
/**
|
||||||
|
* A method to get and remove the first Key of a Map.
|
||||||
|
* @return the first key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE POLL_FIRST_ENTRY_KEY();
|
public KEY_TYPE POLL_FIRST_ENTRY_KEY();
|
||||||
|
/**
|
||||||
|
* A method to get and remove the last Key of a Map.
|
||||||
|
* @return the last key in the map
|
||||||
|
*/
|
||||||
public KEY_TYPE POLL_LAST_ENTRY_KEY();
|
public KEY_TYPE POLL_LAST_ENTRY_KEY();
|
||||||
|
/**
|
||||||
|
* A method to get the first Value of a Map.
|
||||||
|
* @return the first key in the map
|
||||||
|
*/
|
||||||
public VALUE_TYPE FIRST_ENTRY_VALUE();
|
public VALUE_TYPE FIRST_ENTRY_VALUE();
|
||||||
|
/**
|
||||||
|
* A method to get the last Value of a Map.
|
||||||
|
* @return the last key in the map
|
||||||
|
*/
|
||||||
public VALUE_TYPE LAST_ENTRY_VALUE();
|
public VALUE_TYPE LAST_ENTRY_VALUE();
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -72,6 +185,11 @@ public interface SORTED_MAP KEY_VALUE_GENERIC_TYPE extends SortedMap<CLASS_TYPE,
|
||||||
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey)); }
|
public default SORTED_MAP KEY_VALUE_GENERIC_TYPE tailMap(CLASS_TYPE fromKey) { return tailMap(OBJ_TO_KEY(fromKey)); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fast Sorted Entry Set that allows for a faster Entry Iterator by recycling the Entry Object and just exchanging 1 internal value
|
||||||
|
* @Type(T)
|
||||||
|
* @ValueType(V)
|
||||||
|
*/
|
||||||
interface FastSortedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {
|
interface FastSortedSet KEY_VALUE_GENERIC_TYPE extends MAP.FastEntrySet KEY_VALUE_GENERIC_TYPE, ObjectSortedSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {
|
||||||
@Override
|
@Override
|
||||||
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
public ObjectBidirectionalIterator<MAP.Entry KEY_VALUE_GENERIC_TYPE> fastIterator();
|
||||||
|
|
|
@ -7,6 +7,10 @@ import java.util.Set;
|
||||||
import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION;
|
import speiger.src.collections.PACKAGE.collections.ABSTRACT_COLLECTION;
|
||||||
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
import speiger.src.collections.PACKAGE.collections.ITERATOR;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Abstract Type Specific Set that reduces boxing/unboxing
|
||||||
|
* @Type(T)
|
||||||
|
*/
|
||||||
public abstract class ABSTRACT_SET KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE implements SET KEY_GENERIC_TYPE
|
public abstract class ABSTRACT_SET KEY_GENERIC_TYPE extends ABSTRACT_COLLECTION KEY_GENERIC_TYPE implements SET KEY_GENERIC_TYPE
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,10 +17,13 @@ import speiger.src.collections.utils.SanityChecks;
|
||||||
*/
|
*/
|
||||||
public class ARRAYS
|
public class ARRAYS
|
||||||
{
|
{
|
||||||
|
/** Default Limit for Insertion/Selection Sort */
|
||||||
public static final int BASE_THRESHOLD = 16;
|
public static final int BASE_THRESHOLD = 16;
|
||||||
|
/** Default Threshold for Multithreaded Sorting Algorythm options*/
|
||||||
public static final int PARALLEL_THRESHOLD = 8192;
|
public static final int PARALLEL_THRESHOLD = 8192;
|
||||||
|
|
||||||
#if !TYPE_OBJECT
|
#if !TYPE_OBJECT
|
||||||
|
/** Empty Array Reference used for Uninitialized Collections */
|
||||||
public static final KEY_TYPE[] EMPTY_ARRAY = new KEY_TYPE[0];
|
public static final KEY_TYPE[] EMPTY_ARRAY = new KEY_TYPE[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -92,6 +95,7 @@ public class ARRAYS
|
||||||
}
|
}
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
/** Empty Array Reference used for Uninitialized Collections */
|
||||||
public static final Object[] EMPTY_ARRAY = new Object[0];
|
public static final Object[] EMPTY_ARRAY = new Object[0];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -107,6 +111,15 @@ public class ARRAYS
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
/**
|
||||||
|
* Method to validate if the current value is the lowest value in the heap
|
||||||
|
* @param data the current heap.
|
||||||
|
* @param size the size of the heap
|
||||||
|
* @param index the index that should be validated
|
||||||
|
* @param comp the comparator to sort the heap. Can be null
|
||||||
|
* @ArrayType(T)
|
||||||
|
* @return the index the element was shifted to
|
||||||
|
*/
|
||||||
public static GENERIC_KEY_BRACES int shiftDown(KEY_TYPE[] data, int size, int index, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
public static GENERIC_KEY_BRACES int shiftDown(KEY_TYPE[] data, int size, int index, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
||||||
int half = size >>> 1;
|
int half = size >>> 1;
|
||||||
KEY_TYPE value = data[index];
|
KEY_TYPE value = data[index];
|
||||||
|
@ -136,6 +149,14 @@ public class ARRAYS
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method to sort a specific value into the heap.
|
||||||
|
* @param data the heap itself.
|
||||||
|
* @param index that should be heapified.
|
||||||
|
* @param comp the comparator to sort the heap. Can be null
|
||||||
|
* @ArrayType(T)
|
||||||
|
* @return the index the element was shifted to
|
||||||
|
*/
|
||||||
public static GENERIC_KEY_BRACES int shiftUp(KEY_TYPE[] data, int index, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
public static GENERIC_KEY_BRACES int shiftUp(KEY_TYPE[] data, int index, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
||||||
KEY_TYPE value = data[index];
|
KEY_TYPE value = data[index];
|
||||||
if(comp != null) {
|
if(comp != null) {
|
||||||
|
@ -160,15 +181,37 @@ public class ARRAYS
|
||||||
return index;
|
return index;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper function to create a Heap out of an array.
|
||||||
|
* @param data the array to heapify
|
||||||
|
* @param size the current size of elements within the array.
|
||||||
|
* @param comp the Comparator to sort the array. Can be null
|
||||||
|
* @ArrayType(T)
|
||||||
|
* @return the input array
|
||||||
|
*/
|
||||||
public static GENERIC_KEY_BRACES KEY_TYPE[] heapify(KEY_TYPE[] data, int size, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
public static GENERIC_KEY_BRACES KEY_TYPE[] heapify(KEY_TYPE[] data, int size, COMPARATOR KEY_SUPER_GENERIC_TYPE comp) {
|
||||||
for(int i = (size >>> 1) - 1;i>=0;shiftDown(data, size, i--, comp));
|
for(int i = (size >>> 1) - 1;i>=0;shiftDown(data, size, i--, comp));
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Shuffle method for Arrays.
|
||||||
|
* @param array the elements that should be shuffled
|
||||||
|
* @ArrayType(T)
|
||||||
|
* @note This uses the SanityChecks#getRandom
|
||||||
|
* @return the provided sorted array
|
||||||
|
*/
|
||||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array) {
|
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array) {
|
||||||
return shuffle(array, SanityChecks.getRandom());
|
return shuffle(array, SanityChecks.getRandom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simple Shuffle method for Arrays.
|
||||||
|
* @param array the elements that should be shuffled
|
||||||
|
* @param random the Random Number Generator that should be used for the shuffling
|
||||||
|
* @ArrayType(T)
|
||||||
|
* @return the provided sorted array
|
||||||
|
*/
|
||||||
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, Random random) {
|
public static GENERIC_KEY_BRACES KEY_TYPE[] shuffle(KEY_TYPE[] array, Random random) {
|
||||||
for(int i = array.length-1; i>=0;i--) {
|
for(int i = array.length-1; i>=0;i--) {
|
||||||
int p = random.nextInt(i + 1);
|
int p = random.nextInt(i + 1);
|
||||||
|
|
|
@ -10,6 +10,7 @@ import speiger.src.collections.ints.maps.interfaces.Int2IntMap;
|
||||||
import speiger.src.collections.ints.utils.IntStrategy;
|
import speiger.src.collections.ints.utils.IntStrategy;
|
||||||
import speiger.src.collections.tests.MapTests;
|
import speiger.src.collections.tests.MapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseInt2IntMapTest
|
public abstract class BaseInt2IntMapTest
|
||||||
{
|
{
|
||||||
protected static final IntStrategy STRATEGY = new Strategy();
|
protected static final IntStrategy STRATEGY = new Strategy();
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.Test;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
||||||
import speiger.src.collections.tests.NavigableSetTest;
|
import speiger.src.collections.tests.NavigableSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseInt2IntNavigableMapTest extends BaseInt2IntSortedMapTest
|
public abstract class BaseInt2IntNavigableMapTest extends BaseInt2IntSortedMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.Test;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
||||||
import speiger.src.collections.tests.SortedMapTests;
|
import speiger.src.collections.tests.SortedMapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseInt2IntSortedMapTest extends BaseInt2IntMapTest
|
public abstract class BaseInt2IntSortedMapTest extends BaseInt2IntMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -14,6 +14,7 @@ import speiger.src.collections.ints.utils.IntCollections.SynchronizedCollection;
|
||||||
import speiger.src.collections.ints.utils.IntCollections.UnmodifiableCollection;
|
import speiger.src.collections.ints.utils.IntCollections.UnmodifiableCollection;
|
||||||
import speiger.src.collections.tests.CollectionTest;
|
import speiger.src.collections.tests.CollectionTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntCollectionTest extends BaseIntIterableTest
|
public abstract class BaseIntCollectionTest extends BaseIntIterableTest
|
||||||
{
|
{
|
||||||
protected static final int[] ADD_ARRAY = new int[]{3212, -12, 423, -182, -4912};
|
protected static final int[] ADD_ARRAY = new int[]{3212, -12, 423, -182, -4912};
|
||||||
|
|
|
@ -10,6 +10,7 @@ import speiger.src.collections.ints.collections.IntIterable;
|
||||||
import speiger.src.collections.ints.collections.IntIterator;
|
import speiger.src.collections.ints.collections.IntIterator;
|
||||||
import speiger.src.collections.tests.IterableTest;
|
import speiger.src.collections.tests.IterableTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntIterableTest
|
public abstract class BaseIntIterableTest
|
||||||
{
|
{
|
||||||
protected static final int[] EMPTY_ARRAY = new int[0];
|
protected static final int[] EMPTY_ARRAY = new int[0];
|
||||||
|
|
|
@ -12,6 +12,7 @@ import speiger.src.collections.ints.lists.IntListIterator;
|
||||||
import speiger.src.collections.ints.utils.IntCollections;
|
import speiger.src.collections.ints.utils.IntCollections;
|
||||||
import speiger.src.collections.tests.ListTest;
|
import speiger.src.collections.tests.ListTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntListTest extends BaseIntCollectionTest
|
public abstract class BaseIntListTest extends BaseIntCollectionTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.Test;
|
||||||
import speiger.src.collections.ints.sets.IntNavigableSet;
|
import speiger.src.collections.ints.sets.IntNavigableSet;
|
||||||
import speiger.src.collections.tests.NavigableSetTest;
|
import speiger.src.collections.tests.NavigableSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntNavigableSetTest extends BaseIntSortedSetTest
|
public abstract class BaseIntNavigableSetTest extends BaseIntSortedSetTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -11,6 +11,7 @@ import speiger.src.collections.ints.utils.IntArrays;
|
||||||
import speiger.src.collections.tests.IterableTest;
|
import speiger.src.collections.tests.IterableTest;
|
||||||
import speiger.src.collections.tests.PriorityQueueTest;
|
import speiger.src.collections.tests.PriorityQueueTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntPriorityQueueTest extends BaseIntIterableTest
|
public abstract class BaseIntPriorityQueueTest extends BaseIntIterableTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import org.junit.Test;
|
||||||
import speiger.src.collections.ints.sets.IntSortedSet;
|
import speiger.src.collections.ints.sets.IntSortedSet;
|
||||||
import speiger.src.collections.tests.SortedSetTest;
|
import speiger.src.collections.tests.SortedSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public abstract class BaseIntSortedSetTest extends BaseIntCollectionTest
|
public abstract class BaseIntSortedSetTest extends BaseIntCollectionTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import speiger.src.collections.ints.utils.IIntArray;
|
import speiger.src.collections.ints.utils.IIntArray;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public interface IIntArrayTest
|
public interface IIntArrayTest
|
||||||
{
|
{
|
||||||
static final int[] TEST_ARRAY = IntStream.range(0, 100).toArray();
|
static final int[] TEST_ARRAY = IntStream.range(0, 100).toArray();
|
||||||
|
|
|
@ -7,6 +7,7 @@ import org.junit.Test;
|
||||||
|
|
||||||
import speiger.src.collections.ints.collections.IntStack;
|
import speiger.src.collections.ints.collections.IntStack;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public interface IIntStackTests
|
public interface IIntStackTests
|
||||||
{
|
{
|
||||||
static final int[] TEST_ARRAY = IntStream.range(0, 100).toArray();
|
static final int[] TEST_ARRAY = IntStream.range(0, 100).toArray();
|
||||||
|
|
|
@ -6,6 +6,7 @@ import speiger.src.collections.ints.base.BaseIntListTest;
|
||||||
import speiger.src.collections.ints.base.IIntArrayTest;
|
import speiger.src.collections.ints.base.IIntArrayTest;
|
||||||
import speiger.src.collections.ints.base.IIntStackTests;
|
import speiger.src.collections.ints.base.IIntStackTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntArrayListTest extends BaseIntListTest implements IIntStackTests, IIntArrayTest
|
public class IntArrayListTest extends BaseIntListTest implements IIntStackTests, IIntArrayTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import speiger.src.collections.ints.maps.impl.tree.Int2IntAVLTreeMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
||||||
import speiger.src.collections.tests.SortedMapTests;
|
import speiger.src.collections.tests.SortedMapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntAVLTreeMapTest extends BaseInt2IntNavigableMapTest
|
public class Int2IntAVLTreeMapTest extends BaseInt2IntNavigableMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import speiger.src.collections.ints.base.BaseInt2IntSortedMapTest;
|
||||||
import speiger.src.collections.ints.maps.impl.misc.Int2IntArrayMap;
|
import speiger.src.collections.ints.maps.impl.misc.Int2IntArrayMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntArrayMapTest extends BaseInt2IntSortedMapTest
|
public class Int2IntArrayMapTest extends BaseInt2IntSortedMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import speiger.src.collections.ints.base.BaseInt2IntMapTest;
|
||||||
import speiger.src.collections.ints.maps.impl.customHash.Int2IntOpenCustomHashMap;
|
import speiger.src.collections.ints.maps.impl.customHash.Int2IntOpenCustomHashMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntMap;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntCustomHashMapTest extends BaseInt2IntMapTest
|
public class Int2IntCustomHashMapTest extends BaseInt2IntMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -4,6 +4,7 @@ import speiger.src.collections.ints.base.BaseInt2IntMapTest;
|
||||||
import speiger.src.collections.ints.maps.impl.hash.Int2IntOpenHashMap;
|
import speiger.src.collections.ints.maps.impl.hash.Int2IntOpenHashMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntMap;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntHashMapTest extends BaseInt2IntMapTest
|
public class Int2IntHashMapTest extends BaseInt2IntMapTest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import speiger.src.collections.ints.maps.impl.customHash.Int2IntLinkedOpenCustom
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
||||||
import speiger.src.collections.tests.SortedMapTests;
|
import speiger.src.collections.tests.SortedMapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntLinkedOpenCustomHashMapTest extends BaseInt2IntSortedMapTest
|
public class Int2IntLinkedOpenCustomHashMapTest extends BaseInt2IntSortedMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import speiger.src.collections.ints.maps.impl.hash.Int2IntLinkedOpenHashMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntSortedMap;
|
||||||
import speiger.src.collections.tests.SortedMapTests;
|
import speiger.src.collections.tests.SortedMapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntLinkedOpenHashMapTest extends BaseInt2IntSortedMapTest
|
public class Int2IntLinkedOpenHashMapTest extends BaseInt2IntSortedMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -7,6 +7,7 @@ import speiger.src.collections.ints.maps.impl.tree.Int2IntRBTreeMap;
|
||||||
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
import speiger.src.collections.ints.maps.interfaces.Int2IntNavigableMap;
|
||||||
import speiger.src.collections.tests.SortedMapTests;
|
import speiger.src.collections.tests.SortedMapTests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class Int2IntRBTreeMapTest extends BaseInt2IntNavigableMapTest
|
public class Int2IntRBTreeMapTest extends BaseInt2IntNavigableMapTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package speiger.src.collections.ints.queues;
|
||||||
|
|
||||||
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntArrayFIFOQueueTests extends BaseIntPriorityQueueTest
|
public class IntArrayFIFOQueueTests extends BaseIntPriorityQueueTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package speiger.src.collections.ints.queues;
|
||||||
|
|
||||||
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntArrayPriorityQueueTests extends BaseIntPriorityQueueTest
|
public class IntArrayPriorityQueueTests extends BaseIntPriorityQueueTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package speiger.src.collections.ints.queues;
|
||||||
|
|
||||||
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
import speiger.src.collections.ints.base.BaseIntPriorityQueueTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntHeapPriorityQueueTests extends BaseIntPriorityQueueTest
|
public class IntHeapPriorityQueueTests extends BaseIntPriorityQueueTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.EnumSet;
|
||||||
import speiger.src.collections.ints.base.BaseIntNavigableSetTest;
|
import speiger.src.collections.ints.base.BaseIntNavigableSetTest;
|
||||||
import speiger.src.collections.tests.SortedSetTest;
|
import speiger.src.collections.tests.SortedSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntAVLTreeSetTests extends BaseIntNavigableSetTest
|
public class IntAVLTreeSetTests extends BaseIntNavigableSetTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -2,6 +2,7 @@ package speiger.src.collections.ints.sets;
|
||||||
|
|
||||||
import speiger.src.collections.ints.base.BaseIntSortedSetTest;
|
import speiger.src.collections.ints.base.BaseIntSortedSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntArraySetTests extends BaseIntSortedSetTest
|
public class IntArraySetTests extends BaseIntSortedSetTest
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -8,6 +8,7 @@ import speiger.src.collections.ints.collections.IntCollection;
|
||||||
import speiger.src.collections.ints.utils.IntStrategy;
|
import speiger.src.collections.ints.utils.IntStrategy;
|
||||||
import speiger.src.collections.tests.SortedSetTest;
|
import speiger.src.collections.tests.SortedSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntHashSetTests
|
public class IntHashSetTests
|
||||||
{
|
{
|
||||||
public static abstract class BaseIntOpenHashSetTests extends BaseIntSortedSetTest
|
public static abstract class BaseIntOpenHashSetTests extends BaseIntSortedSetTest
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.EnumSet;
|
||||||
import speiger.src.collections.ints.base.BaseIntNavigableSetTest;
|
import speiger.src.collections.ints.base.BaseIntNavigableSetTest;
|
||||||
import speiger.src.collections.tests.SortedSetTest;
|
import speiger.src.collections.tests.SortedSetTest;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class IntRBTreeSetTests extends BaseIntNavigableSetTest
|
public class IntRBTreeSetTests extends BaseIntNavigableSetTest
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import java.util.stream.IntStream;
|
||||||
import org.junit.Assert;
|
import org.junit.Assert;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public class SortingTests
|
public class SortingTests
|
||||||
{
|
{
|
||||||
public static final int[] SMALL_TEST = IntStream.range(0, 5000).toArray();
|
public static final int[] SMALL_TEST = IntStream.range(0, 5000).toArray();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum CollectionTest
|
public enum CollectionTest
|
||||||
{
|
{
|
||||||
ADD,
|
ADD,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum IterableTest
|
public enum IterableTest
|
||||||
{
|
{
|
||||||
FOR_EACH,
|
FOR_EACH,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum ListTest
|
public enum ListTest
|
||||||
{
|
{
|
||||||
ADD_INDEX,
|
ADD_INDEX,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum MapTests
|
public enum MapTests
|
||||||
{
|
{
|
||||||
PUT,
|
PUT,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum NavigableMapTests
|
public enum NavigableMapTests
|
||||||
{
|
{
|
||||||
DESENDING,
|
DESENDING,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum NavigableSetTest
|
public enum NavigableSetTest
|
||||||
{
|
{
|
||||||
DESENDING,
|
DESENDING,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum PriorityQueueTest
|
public enum PriorityQueueTest
|
||||||
{
|
{
|
||||||
IN_OUT,
|
IN_OUT,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum SortedMapTests
|
public enum SortedMapTests
|
||||||
{
|
{
|
||||||
PUT_MOVE,
|
PUT_MOVE,
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package speiger.src.collections.tests;
|
package speiger.src.collections.tests;
|
||||||
|
|
||||||
|
@SuppressWarnings("javadoc")
|
||||||
public enum SortedSetTest
|
public enum SortedSetTest
|
||||||
{
|
{
|
||||||
ADD_MOVE,
|
ADD_MOVE,
|
||||||
|
|
Loading…
Reference in New Issue