Skip to content

Commit

Permalink
CapacityStrategy implementations: <Item> Parametrization removed
Browse files Browse the repository at this point in the history
  • Loading branch information
igorakkerman committed Feb 11, 2015
1 parent 49be344 commit f49b96d
Show file tree
Hide file tree
Showing 10 changed files with 29 additions and 40 deletions.
7 changes: 4 additions & 3 deletions jlib-container.iml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="jlib-core" />
<orderEntry type="module" module-name="jlib-codequality" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:1.8.10" level="project" />
<orderEntry type="module" module-name="jlib-basefunctions" />
<orderEntry type="module" module-name="jlib-operator" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="Maven: com.google.guava:guava:18.0" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-lang3:3.3.2" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-collections4:4.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: org.checkerframework:checker-qual:1.8.10" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.assertj:assertj-core:1.7.1" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.mockito:mockito-core:2.0.3-beta" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.objenesis:objenesis:2.1" level="project" />
<orderEntry type="module" module-name="jlib-codequality" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public class InvalidCapacityException

InvalidCapacityException(final LinearIndexStorage<?> storage, final String capacityName,
final int invalidCapacity) {

super(storage, message().with(capacityName, invalidCapacity));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,19 @@
import org.jlib.basefunctions.ApplicationObject;
import static org.jlib.core.message.MessageUtility.mfmessage;

public abstract class AbstractCapacityStrategy<Item>
public abstract class AbstractCapacityStrategy
extends ApplicationObject {

private final LinearIndexStorage<Item> storage;
private final LinearIndexStorage<?> storage;

private final IndexRange contentIndexRange;

protected AbstractCapacityStrategy(final LinearIndexStorage<Item> storage,
final IndexRange contentIndexRange) {
protected AbstractCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
this.storage = storage;
this.contentIndexRange = contentIndexRange;
}

protected LinearIndexStorage<Item> getStorage() {
protected LinearIndexStorage<?> getStorage() {
return storage;
}

Expand All @@ -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
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@
import org.jlib.container.storage.InvalidIndexException;
import org.jlib.container.storage.LinearIndexStorage;

public abstract class AbstractSplitCapacityStrategy<Item>
extends AbstractCapacityStrategy<Item>
public abstract class AbstractSplitCapacityStrategy
extends AbstractCapacityStrategy
implements SplitCapacityStrategy {

protected AbstractSplitCapacityStrategy(final LinearIndexStorage<Item> storage,
final IndexRange contentIndexRange) {
protected AbstractSplitCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
super(storage, contentIndexRange);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@
* @author Igor Akkerman
*/
public class MinimalHeadCapacityStrategy<Item>
extends AbstractCapacityStrategy<Item>
extends AbstractCapacityStrategy
implements HeadCapacityStrategy {

public MinimalHeadCapacityStrategy(final LinearIndexStorage<Item> storage,
final IndexRange contentIndexRange) {
public MinimalHeadCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
super(storage, contentIndexRange);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,27 +29,26 @@
import org.jlib.container.storage.capacity.InitialCapacityStrategy;

/**
* <p>
* {@link HeadCapacityStrategy} providing just as much head capacity as needed.
* </p>
* <p>
* 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 <Item>
* type of the items held in the {@link LinearIndexStorage}
*
* @author Igor Akkerman
*/
public class MinimalInitialCapacityStrategy<Item>
extends AbstractCapacityStrategy<Item>
public class MinimalInitialCapacityStrategy
extends AbstractCapacityStrategy
implements InitialCapacityStrategy {

public MinimalInitialCapacityStrategy(final LinearIndexStorage<Item> storage, final IndexRange contentIndexRange) {
public MinimalInitialCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
super(storage, contentIndexRange);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,10 @@
import org.jlib.container.storage.IndexRangeOperationDescriptor;
import org.jlib.container.storage.LinearIndexStorage;

public class MinimalSplitCapacityStrategy<Item>
extends AbstractSplitCapacityStrategy<Item> {
public class MinimalSplitCapacityStrategy
extends AbstractSplitCapacityStrategy {

public MinimalSplitCapacityStrategy(final LinearIndexStorage<Item> storage,
final IndexRange contentIndexRange) {
public MinimalSplitCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
super(storage, contentIndexRange);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
* </p>
*
* @param <Item>
* type of the items held in the {@link LinearIndexStorage}
*
* @author Igor Akkerman
*/
public class MinimalTailCapacityStrategy<Item>
extends AbstractCapacityStrategy<Item>
public class MinimalTailCapacityStrategy
extends AbstractCapacityStrategy
implements TailCapacityStrategy {

public MinimalTailCapacityStrategy(final LinearIndexStorage<Item> storage,
final IndexRange contentIndexRange) {
public MinimalTailCapacityStrategy(final LinearIndexStorage<?> storage, final IndexRange contentIndexRange) {
super(storage, contentIndexRange);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
* limitations under the License.
*/


/**
* <p>
* Interfaces for strategies of capacity provision in a
Expand Down

0 comments on commit f49b96d

Please sign in to comment.