From f49b96da2d051592903c1df0866867a471439e9b Mon Sep 17 00:00:00 2001 From: Igor Akkerman Date: Wed, 11 Feb 2015 13:42:59 +0100 Subject: [PATCH] CapacityStrategy implementations: Parametrization removed --- jlib-container.iml | 7 ++++--- .../container/storage/InvalidCapacityException.java | 1 - .../storage/LinearIndexStorageException.java | 5 ++--- .../storage/capacity/AbstractCapacityStrategy.java | 11 +++++------ .../capacity/AbstractSplitCapacityStrategy.java | 7 +++---- .../minimal/MinimalHeadCapacityStrategy.java | 5 ++--- .../minimal/MinimalInitialCapacityStrategy.java | 13 ++++++------- .../minimal/MinimalSplitCapacityStrategy.java | 7 +++---- .../minimal/MinimalTailCapacityStrategy.java | 12 ++++-------- .../container/storage/capacity/package-info.java | 1 - 10 files changed, 29 insertions(+), 40 deletions(-) diff --git a/jlib-container.iml b/jlib-container.iml index e9a920a3..707c8e5d 100644 --- a/jlib-container.iml +++ b/jlib-container.iml @@ -11,16 +11,17 @@ - - + + - + + \ No newline at end of file diff --git a/src/main/java/org/jlib/container/storage/InvalidCapacityException.java b/src/main/java/org/jlib/container/storage/InvalidCapacityException.java index 64338790..ee7adf01 100644 --- a/src/main/java/org/jlib/container/storage/InvalidCapacityException.java +++ b/src/main/java/org/jlib/container/storage/InvalidCapacityException.java @@ -37,7 +37,6 @@ public class InvalidCapacityException InvalidCapacityException(final LinearIndexStorage storage, final String capacityName, final int invalidCapacity) { - super(storage, message().with(capacityName, invalidCapacity)); } } diff --git a/src/main/java/org/jlib/container/storage/LinearIndexStorageException.java b/src/main/java/org/jlib/container/storage/LinearIndexStorageException.java index 6c26fee0..506db343 100644 --- a/src/main/java/org/jlib/container/storage/LinearIndexStorageException.java +++ b/src/main/java/org/jlib/container/storage/LinearIndexStorageException.java @@ -21,8 +21,8 @@ package org.jlib.container.storage; -import org.jlib.core.message.Message; import org.jlib.core.exception.InvalidArgumentException; +import org.jlib.core.message.Message; /** * {@link InvalidArgumentException} thrown when an invalid @@ -35,8 +35,7 @@ public abstract class LinearIndexStorageException private static final long serialVersionUID = - 1514836335986845986L; - protected LinearIndexStorageException(final LinearIndexStorage linearIndexStorage, - final Message message) { + protected LinearIndexStorageException(final LinearIndexStorage linearIndexStorage, final Message message) { super(message.with("storage", linearIndexStorage)); } } diff --git a/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java index b23d10df..99a25cdc 100644 --- a/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java @@ -29,20 +29,19 @@ import org.jlib.basefunctions.ApplicationObject; import static org.jlib.core.message.MessageUtility.mfmessage; -public abstract class AbstractCapacityStrategy +public abstract class AbstractCapacityStrategy extends ApplicationObject { - private final LinearIndexStorage storage; + private final LinearIndexStorage storage; private final IndexRange contentIndexRange; - protected AbstractCapacityStrategy(final LinearIndexStorage storage, - final IndexRange contentIndexRange) { + protected AbstractCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { this.storage = storage; this.contentIndexRange = contentIndexRange; } - protected LinearIndexStorage getStorage() { + protected LinearIndexStorage getStorage() { return storage; } @@ -51,7 +50,7 @@ protected IndexRange getContentIndexRange() { } /** - * Returns the tail capacity, that is, the number of storable {@link Item}s behind the last {@link Item}. + * Returns the tail capacity, that is, the number of storable items behind the last itme. * * @return integer specifying the tail capacity */ diff --git a/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java index add66547..b15f1c84 100644 --- a/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java @@ -25,12 +25,11 @@ import org.jlib.container.storage.InvalidIndexException; import org.jlib.container.storage.LinearIndexStorage; -public abstract class AbstractSplitCapacityStrategy -extends AbstractCapacityStrategy +public abstract class AbstractSplitCapacityStrategy +extends AbstractCapacityStrategy implements SplitCapacityStrategy { - protected AbstractSplitCapacityStrategy(final LinearIndexStorage storage, - final IndexRange contentIndexRange) { + protected AbstractSplitCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); } diff --git a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalHeadCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalHeadCapacityStrategy.java index 26a50bc2..f9e34997 100644 --- a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalHeadCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalHeadCapacityStrategy.java @@ -44,11 +44,10 @@ * @author Igor Akkerman */ public class MinimalHeadCapacityStrategy -extends AbstractCapacityStrategy +extends AbstractCapacityStrategy implements HeadCapacityStrategy { - public MinimalHeadCapacityStrategy(final LinearIndexStorage storage, - final IndexRange contentIndexRange) { + public MinimalHeadCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); } diff --git a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalInitialCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalInitialCapacityStrategy.java index 9901a670..1ea64368 100644 --- a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalInitialCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalInitialCapacityStrategy.java @@ -29,27 +29,26 @@ import org.jlib.container.storage.capacity.InitialCapacityStrategy; /** + *

* {@link HeadCapacityStrategy} providing just as much head capacity as needed. *

*

+ * FIXME: fix comment * Head capacity: * This {@link CapacityStrategy} analyzes the current head capacity to verify for the requested capacity. * If the requested head capacity is above the available head capacity, * the {@link LinearIndexStorage} is requested to re-allocate a capacity higher by the difference between requested and - * available head capacity. The {@link Item}s are shifted "right" to have exactly the requested head capacity. + * available head capacity. The items are shifted "right" to have exactly the requested head capacity. * The {@link LinearIndexStorage} is always requested to provide an additional capacity even if its tail capacity would * be sufficient. * - * @param - * type of the items held in the {@link LinearIndexStorage} - * * @author Igor Akkerman */ -public class MinimalInitialCapacityStrategy -extends AbstractCapacityStrategy +public class MinimalInitialCapacityStrategy +extends AbstractCapacityStrategy implements InitialCapacityStrategy { - public MinimalInitialCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { + public MinimalInitialCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); } diff --git a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalSplitCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalSplitCapacityStrategy.java index dcb2cd4d..393fceae 100644 --- a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalSplitCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalSplitCapacityStrategy.java @@ -26,11 +26,10 @@ import org.jlib.container.storage.IndexRangeOperationDescriptor; import org.jlib.container.storage.LinearIndexStorage; -public class MinimalSplitCapacityStrategy -extends AbstractSplitCapacityStrategy { +public class MinimalSplitCapacityStrategy +extends AbstractSplitCapacityStrategy { - public MinimalSplitCapacityStrategy(final LinearIndexStorage storage, - final IndexRange contentIndexRange) { + public MinimalSplitCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); } diff --git a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalTailCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalTailCapacityStrategy.java index e23ca5e0..d4291eae 100644 --- a/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalTailCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/minimal/MinimalTailCapacityStrategy.java @@ -37,22 +37,18 @@ * This {@link CapacityStrategy} analyzes the current head capacity to verify for the requested capacity. * If the requested head capacity is above the available head capacity, * the {@link LinearIndexStorage} is requested to re-allocate a capacity higher by the difference between requested and - * available head capacity. The {@link Item}s are shifted "right" to have exactly the requested head capacity. + * available head capacity. The items are shifted "right" to have exactly the requested head capacity. * The {@link LinearIndexStorage} is always requested to provide an additional capacity even if its tail capacity would * be sufficient. *

* - * @param - * type of the items held in the {@link LinearIndexStorage} - * * @author Igor Akkerman */ -public class MinimalTailCapacityStrategy -extends AbstractCapacityStrategy +public class MinimalTailCapacityStrategy +extends AbstractCapacityStrategy implements TailCapacityStrategy { - public MinimalTailCapacityStrategy(final LinearIndexStorage storage, - final IndexRange contentIndexRange) { + public MinimalTailCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); } diff --git a/src/main/java/org/jlib/container/storage/capacity/package-info.java b/src/main/java/org/jlib/container/storage/capacity/package-info.java index fcf4ea84..c6aed282 100644 --- a/src/main/java/org/jlib/container/storage/capacity/package-info.java +++ b/src/main/java/org/jlib/container/storage/capacity/package-info.java @@ -19,7 +19,6 @@ * limitations under the License. */ - /** *

* Interfaces for strategies of capacity provision in a