diff --git a/jlib-container.iml b/jlib-container.iml index cd475b98..46c7aaac 100644 --- a/jlib-container.iml +++ b/jlib-container.iml @@ -19,7 +19,7 @@ - + diff --git a/pom.xml b/pom.xml index 47602136..90970288 100644 --- a/pom.xml +++ b/pom.xml @@ -21,8 +21,8 @@ limitations under the License. --> - 4.0.0 diff --git a/src/main/java/org/jlib/container/Container.java b/src/main/java/org/jlib/container/Container.java index 78ec9636..dcb89efd 100644 --- a/src/main/java/org/jlib/container/Container.java +++ b/src/main/java/org/jlib/container/Container.java @@ -31,14 +31,14 @@ import org.jlib.container.operation.ToSet; public interface Container -extends Iterable, - ContainsSingle, - ContainsMultiple, - Count, - IsEmpty, - ToArray, - ToRandomAccessList, - ToSequentialList, - ToSet { + extends Iterable, + ContainsSingle, + ContainsMultiple, + Count, + IsEmpty, + ToArray, + ToRandomAccessList, + ToSequentialList, + ToSet { // unifying } diff --git a/src/main/java/org/jlib/container/iterator/IterableUtility.java b/src/main/java/org/jlib/container/iterator/IterableUtility.java index 77f87536..7077e1f7 100644 --- a/src/main/java/org/jlib/container/iterator/IterableUtility.java +++ b/src/main/java/org/jlib/container/iterator/IterableUtility.java @@ -28,7 +28,6 @@ import org.jlib.iterator.RemoveIterable; import org.jlib.iterator.RemoveIterator; import org.jlib.iterator.SingletonIterable; - import org.jlib.operator.observer.Observer; /** @@ -38,6 +37,8 @@ */ public final class IterableUtility { + private IterableUtility() {} + /** * Removes all Items of the specified {@link RemoveIterable}. * @@ -51,7 +52,7 @@ public final class IterableUtility { * if an error occurs during one of the remove operations */ public static void removeAll(final RemoveIterable iterable) - throws InvalidIterableStateException { + throws InvalidIterableStateException { for (final RemoveIterator iterator = iterable.iterator(); iterator.hasNext(); ) { iterator.next(); iterator.remove(); @@ -77,7 +78,7 @@ public static void removeAll(final RemoveIterable iterable) @SafeVarargs public static void removeAll(final ObservedRemoveIterable iterable, final Observer... observers) - throws InvalidIterableStateException { + throws InvalidIterableStateException { for (final ObservedRemoveIterator iterator = iterable.iterator(); iterator.hasNext(); ) { iterator.next(); iterator.remove(observers); @@ -87,6 +88,4 @@ public static void removeAll(final ObservedRemoveIterable iterable, public static BidiIterable singletonIterable(final Item item) { return new SingletonIterable<>(item); } - - private IterableUtility() {} } diff --git a/src/main/java/org/jlib/container/iterator/NoItemToReplaceException.java b/src/main/java/org/jlib/container/iterator/NoItemToReplaceException.java index f652ff55..7e45996a 100644 --- a/src/main/java/org/jlib/container/iterator/NoItemToReplaceException.java +++ b/src/main/java/org/jlib/container/iterator/NoItemToReplaceException.java @@ -32,7 +32,7 @@ * @author Igor Akkerman */ public class NoItemToReplaceException -extends InvalidIteratorStateException { + extends InvalidIteratorStateException { private static final long serialVersionUID = - 1299720624484946758L; diff --git a/src/main/java/org/jlib/container/iterator/ObservedRemoveIterable.java b/src/main/java/org/jlib/container/iterator/ObservedRemoveIterable.java index d3c59053..32536184 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedRemoveIterable.java +++ b/src/main/java/org/jlib/container/iterator/ObservedRemoveIterable.java @@ -32,7 +32,7 @@ * @author Igor Akkerman */ public interface ObservedRemoveIterable -extends RemoveIterable { + extends RemoveIterable { /** * Returns a new {@link ObservedRemoveIterator} over the Items of this {@link ObservedRemoveIterable}. diff --git a/src/main/java/org/jlib/container/iterator/ObservedRemoveIterator.java b/src/main/java/org/jlib/container/iterator/ObservedRemoveIterator.java index 5ced7d3f..f381963d 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedRemoveIterator.java +++ b/src/main/java/org/jlib/container/iterator/ObservedRemoveIterator.java @@ -24,7 +24,6 @@ import org.jlib.iterator.InvalidIterableStateException; import org.jlib.iterator.NoItemToRemoveException; import org.jlib.iterator.RemoveIterator; - import org.jlib.operator.observer.Observer; import org.jlib.operator.observer.ObserverException; @@ -38,7 +37,7 @@ * @author Igor Akkerman */ public interface ObservedRemoveIterator -extends RemoveIterator { + extends RemoveIterator { /** * Removes the last traversed Item. @@ -62,7 +61,7 @@ public interface ObservedRemoveIterator */ @SuppressWarnings({ "unchecked", "DuplicateThrows" }) void remove(Observer... observers) - throws NoItemToRemoveException, InvalidIterableStateException, ObserverException, RuntimeException; + throws NoItemToRemoveException, InvalidIterableStateException, ObserverException, RuntimeException; /** * Registers the specified {@link Observer} for the remove operations diff --git a/src/main/java/org/jlib/container/iterator/ObservedReplaceIterable.java b/src/main/java/org/jlib/container/iterator/ObservedReplaceIterable.java index a1ece5d1..51f4d3c1 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedReplaceIterable.java +++ b/src/main/java/org/jlib/container/iterator/ObservedReplaceIterable.java @@ -30,7 +30,7 @@ * @author Igor Akkerman */ public interface ObservedReplaceIterable -extends ReplaceIterable { + extends ReplaceIterable { /** * Returns a new {@link ObservedReplaceIterator} over the Items of this {@link ObservedReplaceIterable}. diff --git a/src/main/java/org/jlib/container/iterator/ObservedReplaceIterator.java b/src/main/java/org/jlib/container/iterator/ObservedReplaceIterator.java index 7c53147b..de9a32f2 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedReplaceIterator.java +++ b/src/main/java/org/jlib/container/iterator/ObservedReplaceIterator.java @@ -34,7 +34,7 @@ * @author Igor Akkerman */ public interface ObservedReplaceIterator -extends ReplaceIterator { + extends ReplaceIterator { /** * Replaces the last traversed Item with the specified value. @@ -54,7 +54,7 @@ public interface ObservedReplaceIterator */ @SuppressWarnings("unchecked") void replace(Item newItem, Observer... observers) - throws NoItemToReplaceException, ObserverException; + throws NoItemToReplaceException, ObserverException; /** * Registers the specified {@link Observer} for the replace operations diff --git a/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterable.java b/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterable.java index f09d7703..f486fb70 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterable.java +++ b/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterable.java @@ -30,9 +30,9 @@ * @author Igor Akkerman */ public interface ObservedReplaceRemoveIterable -extends ReplaceRemoveIterator, - ObservedReplaceIterator, - ObservedRemoveIterator { + extends ReplaceRemoveIterator, + ObservedReplaceIterator, + ObservedRemoveIterator { ObservedReplaceRemoveIterator iterator(); } diff --git a/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterator.java b/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterator.java index db554f02..364da861 100644 --- a/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterator.java +++ b/src/main/java/org/jlib/container/iterator/ObservedReplaceRemoveIterator.java @@ -30,8 +30,8 @@ * @author Igor Akkerman */ public interface ObservedReplaceRemoveIterator -extends ReplaceRemoveIterator, - ObservedReplaceIterator, - ObservedRemoveIterator { + extends ReplaceRemoveIterator, + ObservedReplaceIterator, + ObservedRemoveIterator { // unifying interface } diff --git a/src/main/java/org/jlib/container/iterator/ReplaceIterable.java b/src/main/java/org/jlib/container/iterator/ReplaceIterable.java index 23a05cd8..97efdea3 100644 --- a/src/main/java/org/jlib/container/iterator/ReplaceIterable.java +++ b/src/main/java/org/jlib/container/iterator/ReplaceIterable.java @@ -30,7 +30,7 @@ * @author Igor Akkerman */ public interface ReplaceIterable -extends Iterable { + extends Iterable { /** * Returns a new {@link ReplaceIterator} over the Items of this {@link ReplaceIterable}. diff --git a/src/main/java/org/jlib/container/iterator/ReplaceIterator.java b/src/main/java/org/jlib/container/iterator/ReplaceIterator.java index 6911f7e5..079e7b02 100644 --- a/src/main/java/org/jlib/container/iterator/ReplaceIterator.java +++ b/src/main/java/org/jlib/container/iterator/ReplaceIterator.java @@ -34,7 +34,7 @@ * @author Igor Akkerman */ public interface ReplaceIterator -extends Iterator { + extends Iterator { /** * Replaces the last traversed Item with the specified Item. @@ -46,5 +46,5 @@ public interface ReplaceIterator * if no Item has been traversed by this {@link ReplaceIterator} */ void replace(Item newItem) - throws InvalidIteratorStateException; + throws InvalidIteratorStateException; } diff --git a/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterable.java b/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterable.java index 548e57ab..aa17d10e 100644 --- a/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterable.java +++ b/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterable.java @@ -32,8 +32,8 @@ * @author Igor Akkerman */ public interface ReplaceRemoveIterable -extends ReplaceIterable, - RemoveIterable { + extends ReplaceIterable, + RemoveIterable { /** * Returns a new {@link ReplaceRemoveIterator} over the Items of this {@link ReplaceRemoveIterable}. diff --git a/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterator.java b/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterator.java index ef4ed454..84fe9832 100644 --- a/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterator.java +++ b/src/main/java/org/jlib/container/iterator/ReplaceRemoveIterator.java @@ -32,7 +32,7 @@ * @author Igor Akkerman */ public interface ReplaceRemoveIterator -extends ReplaceIterator, - RemoveIterator { + extends ReplaceIterator, + RemoveIterator { // unifying interface } diff --git a/src/main/java/org/jlib/container/operation/AlmightyContainer.java b/src/main/java/org/jlib/container/operation/AlmightyContainer.java index 562457ab..8f2e7de5 100644 --- a/src/main/java/org/jlib/container/operation/AlmightyContainer.java +++ b/src/main/java/org/jlib/container/operation/AlmightyContainer.java @@ -22,21 +22,21 @@ package org.jlib.container.operation; public interface AlmightyContainer -extends ContainsSingle, - ContainsMultiple, - Count, - IsEmpty, - ObservedRemoveMultiple, - ObservedRemoveAll, - ObservedRetain, - RemoveSingleByValue, - RemoveMultipleByValue, - RemoveAll, - Retain, - ToArray, - ToRandomAccessList, - ToSequentialList, - ToSet, - Iterable { + extends ContainsSingle, + ContainsMultiple, + Count, + IsEmpty, + ObservedRemoveMultiple, + ObservedRemoveAll, + ObservedRetain, + RemoveSingleByValue, + RemoveMultipleByValue, + RemoveAll, + Retain, + ToArray, + ToRandomAccessList, + ToSequentialList, + ToSet, + Iterable { // unifying } diff --git a/src/main/java/org/jlib/container/operation/BaseFunctionsIterableHashCode.java b/src/main/java/org/jlib/container/operation/BaseFunctionsIterableHashCode.java index 96173efc..a5411ef8 100644 --- a/src/main/java/org/jlib/container/operation/BaseFunctionsIterableHashCode.java +++ b/src/main/java/org/jlib/container/operation/BaseFunctionsIterableHashCode.java @@ -26,17 +26,17 @@ import org.jlib.basefunctions.HashCodeEngine; public class BaseFunctionsIterableHashCode -implements HashCode> { + implements HashCode> { private static final BaseFunctionsIterableHashCode INSTANCE = new BaseFunctionsIterableHashCode<>(); + private BaseFunctionsIterableHashCode() {} + @SuppressWarnings("unchecked") public static BaseFunctionsIterableHashCode getInstance() { return (BaseFunctionsIterableHashCode) INSTANCE; } - private BaseFunctionsIterableHashCode() {} - @Override public int hashCode(final Iterable items) { final HashCodeEngine> hashCodeEngine = /* diff --git a/src/main/java/org/jlib/container/operation/ContainsMultiple.java b/src/main/java/org/jlib/container/operation/ContainsMultiple.java index bbc5a026..4426446e 100644 --- a/src/main/java/org/jlib/container/operation/ContainsMultiple.java +++ b/src/main/java/org/jlib/container/operation/ContainsMultiple.java @@ -41,5 +41,5 @@ public interface ContainsMultiple { */ & ContainsSingle> /* */ boolean contains(ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/ContainsSingle.java b/src/main/java/org/jlib/container/operation/ContainsSingle.java index d4cef964..408163c9 100644 --- a/src/main/java/org/jlib/container/operation/ContainsSingle.java +++ b/src/main/java/org/jlib/container/operation/ContainsSingle.java @@ -24,5 +24,5 @@ public interface ContainsSingle { boolean contains(Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/Count.java b/src/main/java/org/jlib/container/operation/Count.java index ffb8c637..4d1954e8 100644 --- a/src/main/java/org/jlib/container/operation/Count.java +++ b/src/main/java/org/jlib/container/operation/Count.java @@ -21,8 +21,7 @@ package org.jlib.container.operation; -public interface Count - { +public interface Count { /** * Returns the number of Items in this {@link Object}. @@ -33,5 +32,5 @@ public interface Count * if an error occurs during the operation */ int count() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/CountIterableToArray.java b/src/main/java/org/jlib/container/operation/CountIterableToArray.java index db49cb00..d0759663 100644 --- a/src/main/java/org/jlib/container/operation/CountIterableToArray.java +++ b/src/main/java/org/jlib/container/operation/CountIterableToArray.java @@ -24,8 +24,8 @@ import org.jlib.basefunctions.ApplicationObject; public final class CountIterableToArray & Iterable> -extends ApplicationObject -implements ToArray { + extends ApplicationObject + implements ToArray { private final DelegateContainer delegateIterable; diff --git a/src/main/java/org/jlib/container/operation/DefaultContainsMultiple.java b/src/main/java/org/jlib/container/operation/DefaultContainsMultiple.java index 7c3d2db7..a70a8af1 100644 --- a/src/main/java/org/jlib/container/operation/DefaultContainsMultiple.java +++ b/src/main/java/org/jlib/container/operation/DefaultContainsMultiple.java @@ -22,7 +22,7 @@ package org.jlib.container.operation; public class DefaultContainsMultiple -implements ContainsMultiple { + implements ContainsMultiple { private final ContainsSingle containedItems; @@ -34,7 +34,7 @@ public DefaultContainsMultiple(final ContainsSingle containedItems) { @Override public & ContainsSingle> /* */ boolean contains(final ContainsIterable lookupItems) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { for (final Item lookupItem : lookupItems) if (! containedItems.contains(lookupItem)) diff --git a/src/main/java/org/jlib/container/operation/DefaultRemoveMultipleByMultiple.java b/src/main/java/org/jlib/container/operation/DefaultRemoveMultipleByMultiple.java index 8701a1f0..39238b82 100644 --- a/src/main/java/org/jlib/container/operation/DefaultRemoveMultipleByMultiple.java +++ b/src/main/java/org/jlib/container/operation/DefaultRemoveMultipleByMultiple.java @@ -22,7 +22,7 @@ package org.jlib.container.operation; public class DefaultRemoveMultipleByMultiple -implements RemoveMultipleByValue { + implements RemoveMultipleByValue { private final Iterable containedItems; @@ -38,7 +38,7 @@ public class DefaultRemoveMultipleByMultiple @Override public & ContainsSingle> /* */ void remove(final ContainsIterable removedItems) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { for (final Item containedItem : containedItems) if (removedItems.contains(containedItem)) diff --git a/src/main/java/org/jlib/container/operation/DefaultRetain.java b/src/main/java/org/jlib/container/operation/DefaultRetain.java index b611ef49..255fa201 100644 --- a/src/main/java/org/jlib/container/operation/DefaultRetain.java +++ b/src/main/java/org/jlib/container/operation/DefaultRetain.java @@ -24,7 +24,7 @@ import org.jlib.container.operation.containsadapter.IterativeContainsAdapter; public class DefaultRetain -implements Retain { + implements Retain { private final RemoveSingleByValue removableContainedItems; @@ -40,7 +40,7 @@ public class DefaultRetain @Override @SuppressWarnings("TypeMayBeWeakened") public void retain(final IterativeContainsAdapter retainedItems) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { for (final Item containedItem : containedItems) if (! retainedItems.contains(containedItem)) diff --git a/src/main/java/org/jlib/container/operation/EqualCount.java b/src/main/java/org/jlib/container/operation/EqualCount.java index 0d39b3ca..fee4c002 100644 --- a/src/main/java/org/jlib/container/operation/EqualCount.java +++ b/src/main/java/org/jlib/container/operation/EqualCount.java @@ -27,13 +27,13 @@ public class EqualCount { private static final EqualCount INSTANCE = new EqualCount<>(); + private EqualCount() {} + @SuppressWarnings("unchecked") public static EqualCount getInstance() { return (EqualCount) INSTANCE; } - private EqualCount() {} - public boolean haveEqualCount(final Count thisObject, @Nullable final Object otherObject) { return otherObject instanceof Count && // thisObject.count() == ((Count) otherObject).count(); diff --git a/src/main/java/org/jlib/container/operation/ForbiddenCastException.java b/src/main/java/org/jlib/container/operation/ForbiddenCastException.java index acb4b730..751250ca 100644 --- a/src/main/java/org/jlib/container/operation/ForbiddenCastException.java +++ b/src/main/java/org/jlib/container/operation/ForbiddenCastException.java @@ -22,11 +22,10 @@ package org.jlib.container.operation; import org.jlib.exception.InvalidStateException; - -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; public class ForbiddenCastException -extends InvalidStateException { + extends InvalidStateException { private static final long serialVersionUID = - 2378979200033998213L; diff --git a/src/main/java/org/jlib/container/operation/ForwardingAlmightyContainer.java b/src/main/java/org/jlib/container/operation/ForwardingAlmightyContainer.java index 39878eb7..4e9fdf2d 100644 --- a/src/main/java/org/jlib/container/operation/ForwardingAlmightyContainer.java +++ b/src/main/java/org/jlib/container/operation/ForwardingAlmightyContainer.java @@ -41,27 +41,27 @@ * @author Igor Akkerman */ public class ForwardingAlmightyContainer -extends ApplicationObject -implements AlmightyContainer { + extends ApplicationObject + implements AlmightyContainer { private final AlmightyContainer disabledAlmightyContainer = new AlmightyContainer() { @Override public & ContainsSingle> /* */ boolean contains(final ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public int count() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public boolean isEmpty() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @@ -74,76 +74,76 @@ public Iterator iterator() { @Override public final & ContainsSingle> /* */ void remove(final ContainsIterable items, final Observer... observers) - throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { + throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { throw new ForbiddenCastException(this); } @SafeVarargs @Override public final void removeAll(final Observer... observers) - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public & ContainsSingle> /* */ void remove(final ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public void removeAll() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public Item[] toArray() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public List toRandomAccessList() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public List toSequentialList() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public Set toSet() - throws InvalidContainerStateException { + throws InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public void remove(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { throw new ForbiddenCastException(this); } @Override public void retain(final IterativeContainsAdapter items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { throw new ForbiddenCastException(this); } @SafeVarargs @Override public final void retain(final Iterable items, final Observer... observers) - throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { + throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { throw new ForbiddenCastException(this); } }; @@ -182,57 +182,57 @@ public final void retain(final Iterable items, final Observer... obs @Override public void removeAll() - throws InvalidContainerStateException { + throws InvalidContainerStateException { delegateRemoveAll.removeAll(); } @Override @SuppressWarnings("unchecked") public void removeAll(final Observer... observers) - throws InvalidContainerStateException { + throws InvalidContainerStateException { delegateObservedRemoveAll.removeAll(observers); } @Override public boolean isEmpty() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateIsEmpty.isEmpty(); } @Override public Set toSet() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateToSet.toSet(); } @Override public List toSequentialList() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateToSequentialList.toSequentialList(); } @Override public Item[] toArray() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateToArray.toArray(); } @Override public int count() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateCount.count(); } @Override public List toRandomAccessList() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateToRandomAccessList.toRandomAccessList(); } @Override public & ContainsSingle> /* */ boolean contains(final ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return delegateContainsMultiple.contains(items); } @@ -240,27 +240,27 @@ public List toRandomAccessList() @SuppressWarnings({ "unchecked", "DuplicateThrows" }) public & ContainsSingle> /* */ void remove(final ContainsIterable items, final Observer... observers) - throws ItemToRemoveNotContainedException, InvalidContainerArgumentException, InvalidContainerStateException, - ObserverException { + throws ItemToRemoveNotContainedException, InvalidContainerArgumentException, InvalidContainerStateException, + ObserverException { delegateObservedRemoveMultiple.remove(items, observers); } @Override public & ContainsSingle> /* */ void remove(final ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { delegateRemoveMultipleByValue.remove(items); } @Override public void remove(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { delegateRemoveSingleByValue.remove(item); } @Override public boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return delegateContainsSingle.contains(item); } @@ -335,14 +335,14 @@ public void setDelegateContainsSingle(final ContainsSingle delegateContain @Override public void retain(final IterativeContainsAdapter items) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { delegateRetain.retain(items); } @SafeVarargs @Override public final void retain(final Iterable items, final Observer... observers) - throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { + throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException { delegateObservedRetain.retain(items, observers); } } diff --git a/src/main/java/org/jlib/container/operation/FromIteratorIsEmpty.java b/src/main/java/org/jlib/container/operation/FromIteratorIsEmpty.java index 393ae68e..f77d3ae8 100644 --- a/src/main/java/org/jlib/container/operation/FromIteratorIsEmpty.java +++ b/src/main/java/org/jlib/container/operation/FromIteratorIsEmpty.java @@ -24,7 +24,7 @@ import org.jlib.iterator.IterableUtility; public class FromIteratorIsEmpty -implements IsEmpty { + implements IsEmpty { private final Iterable iterable; @@ -35,7 +35,7 @@ public FromIteratorIsEmpty(final Iterable iterable) { @Override public boolean isEmpty() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return IterableUtility.isEmpty(iterable); } } diff --git a/src/main/java/org/jlib/container/operation/InvalidContainerArgumentException.java b/src/main/java/org/jlib/container/operation/InvalidContainerArgumentException.java index 81f68a94..0e7441a6 100644 --- a/src/main/java/org/jlib/container/operation/InvalidContainerArgumentException.java +++ b/src/main/java/org/jlib/container/operation/InvalidContainerArgumentException.java @@ -23,11 +23,10 @@ import org.jlib.exception.InvalidArgumentException; import org.jlib.message.Message; - -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; public abstract class InvalidContainerArgumentException -extends InvalidArgumentException { + extends InvalidArgumentException { private static final long serialVersionUID = - 6765111335075525788L; diff --git a/src/main/java/org/jlib/container/operation/InvalidContainerStateException.java b/src/main/java/org/jlib/container/operation/InvalidContainerStateException.java index 2c39ac03..46110356 100644 --- a/src/main/java/org/jlib/container/operation/InvalidContainerStateException.java +++ b/src/main/java/org/jlib/container/operation/InvalidContainerStateException.java @@ -23,11 +23,10 @@ import org.jlib.exception.InvalidStateException; import org.jlib.message.Message; - -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; public abstract class InvalidContainerStateException -extends InvalidStateException { + extends InvalidStateException { private static final long serialVersionUID = - 6765111335075525788L; diff --git a/src/main/java/org/jlib/container/operation/IsEmpty.java b/src/main/java/org/jlib/container/operation/IsEmpty.java index 1ff9c5cf..5bce1d8a 100644 --- a/src/main/java/org/jlib/container/operation/IsEmpty.java +++ b/src/main/java/org/jlib/container/operation/IsEmpty.java @@ -33,5 +33,5 @@ public interface IsEmpty { * if an error occurs during the operation */ boolean isEmpty() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/IsEmptyFromItemsCount.java b/src/main/java/org/jlib/container/operation/IsEmptyFromItemsCount.java index f22bf423..1af83622 100644 --- a/src/main/java/org/jlib/container/operation/IsEmptyFromItemsCount.java +++ b/src/main/java/org/jlib/container/operation/IsEmptyFromItemsCount.java @@ -22,7 +22,7 @@ package org.jlib.container.operation; public class IsEmptyFromItemsCount -implements IsEmpty { + implements IsEmpty { private final Count delegateContainer; @@ -32,7 +32,7 @@ public IsEmptyFromItemsCount(final Count count) { @Override public boolean isEmpty() - throws InvalidContainerStateException { + throws InvalidContainerStateException { return delegateContainer.count() == 0; } } diff --git a/src/main/java/org/jlib/container/operation/ItemAlreadyContainedException.java b/src/main/java/org/jlib/container/operation/ItemAlreadyContainedException.java index e3dc9a5b..ef3790bc 100644 --- a/src/main/java/org/jlib/container/operation/ItemAlreadyContainedException.java +++ b/src/main/java/org/jlib/container/operation/ItemAlreadyContainedException.java @@ -21,8 +21,7 @@ package org.jlib.container.operation; - -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; /** * {@link InvalidContainerArgumentException} thrown when trying to invalidly add @@ -31,7 +30,7 @@ * @author Igor Akkerman */ public class ItemAlreadyContainedException -extends InvalidContainerArgumentException { + extends InvalidContainerArgumentException { private static final long serialVersionUID = 1090527595338576596L; diff --git a/src/main/java/org/jlib/container/operation/ItemToRemoveNotContainedException.java b/src/main/java/org/jlib/container/operation/ItemToRemoveNotContainedException.java index 5fe923ab..33906e2f 100644 --- a/src/main/java/org/jlib/container/operation/ItemToRemoveNotContainedException.java +++ b/src/main/java/org/jlib/container/operation/ItemToRemoveNotContainedException.java @@ -21,7 +21,7 @@ package org.jlib.container.operation; -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; /** * {@link InvalidContainerArgumentException} thrown when a {@link RemoveSingleByValue} does not contain @@ -30,7 +30,7 @@ * @author Igor Akkerman */ public class ItemToRemoveNotContainedException -extends InvalidContainerArgumentException { + extends InvalidContainerArgumentException { private static final long serialVersionUID = - 2921569537644842654L; @@ -44,13 +44,13 @@ public class ItemToRemoveNotContainedException * Item to retain */ public ItemToRemoveNotContainedException( - final RemoveMultipleByValue container, final Object item) { + final RemoveMultipleByValue container, final Object item) { super(container, message(item)); } public ItemToRemoveNotContainedException( - final RemoveMultipleByValue container, final Object item, - final Exception cause) { + final RemoveMultipleByValue container, final Object item, + final Exception cause) { super(container, message(item), cause); } } diff --git a/src/main/java/org/jlib/container/operation/IterableToRandomAccessList.java b/src/main/java/org/jlib/container/operation/IterableToRandomAccessList.java index c39d9177..28e87bf1 100644 --- a/src/main/java/org/jlib/container/operation/IterableToRandomAccessList.java +++ b/src/main/java/org/jlib/container/operation/IterableToRandomAccessList.java @@ -27,8 +27,8 @@ import org.jlib.basefunctions.ApplicationObject; public class IterableToRandomAccessList -extends ApplicationObject -implements ToRandomAccessList { + extends ApplicationObject + implements ToRandomAccessList { private static final int DEFAULT_EXPECTED_ITEMS_COUNT = 20; diff --git a/src/main/java/org/jlib/container/operation/IterativeEquals.java b/src/main/java/org/jlib/container/operation/IterativeEquals.java index ff6762bf..317ee572 100644 --- a/src/main/java/org/jlib/container/operation/IterativeEquals.java +++ b/src/main/java/org/jlib/container/operation/IterativeEquals.java @@ -21,23 +21,22 @@ package org.jlib.container.operation; -import org.jlib.basefunctions.Equals; - import org.checkerframework.checker.nullness.qual.Nullable; +import org.jlib.basefunctions.Equals; import static org.jlib.iterator.IterableUtility.provideEqualItems; public final class IterativeEquals -implements Equals> { + implements Equals> { private static final IterativeEquals INSTANCE = new IterativeEquals<>(); + private IterativeEquals() {} + @SuppressWarnings("unchecked") public static IterativeEquals getInstance() { return (IterativeEquals) INSTANCE; } - private IterativeEquals() {} - @Override @SuppressWarnings("unchecked") public boolean areEqual(final Iterable iterable1, @Nullable final Object iterable2) { diff --git a/src/main/java/org/jlib/container/operation/ObservedRemoveAll.java b/src/main/java/org/jlib/container/operation/ObservedRemoveAll.java index 7acba180..7cbe4355 100644 --- a/src/main/java/org/jlib/container/operation/ObservedRemoveAll.java +++ b/src/main/java/org/jlib/container/operation/ObservedRemoveAll.java @@ -46,5 +46,5 @@ public interface ObservedRemoveAll { */ @SuppressWarnings("unchecked") void removeAll(Observer... observers) - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/ObservedRemoveMultiple.java b/src/main/java/org/jlib/container/operation/ObservedRemoveMultiple.java index c3fc0bbb..0a8aa826 100644 --- a/src/main/java/org/jlib/container/operation/ObservedRemoveMultiple.java +++ b/src/main/java/org/jlib/container/operation/ObservedRemoveMultiple.java @@ -36,7 +36,7 @@ public interface ObservedRemoveMultiple { & ContainsSingle> /* */ void remove(ContainsIterable items, Observer... observers) - throws ItemToRemoveNotContainedException, InvalidContainerArgumentException, InvalidContainerStateException, - ObserverException; + throws ItemToRemoveNotContainedException, InvalidContainerArgumentException, InvalidContainerStateException, + ObserverException; } diff --git a/src/main/java/org/jlib/container/operation/ObservedRetain.java b/src/main/java/org/jlib/container/operation/ObservedRetain.java index b0650d1e..8c78e05c 100644 --- a/src/main/java/org/jlib/container/operation/ObservedRetain.java +++ b/src/main/java/org/jlib/container/operation/ObservedRetain.java @@ -60,5 +60,5 @@ public interface ObservedRetain { */ @SuppressWarnings("unchecked") void retain(Iterable items, Observer... observers) - throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException; + throws InvalidContainerArgumentException, InvalidContainerStateException, ObserverException; } diff --git a/src/main/java/org/jlib/container/operation/RemoveAll.java b/src/main/java/org/jlib/container/operation/RemoveAll.java index 40ef32ad..a20b97d7 100644 --- a/src/main/java/org/jlib/container/operation/RemoveAll.java +++ b/src/main/java/org/jlib/container/operation/RemoveAll.java @@ -30,5 +30,5 @@ public interface RemoveAll { * if an error occurs during the operation */ void removeAll() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/RemoveMultipleByValue.java b/src/main/java/org/jlib/container/operation/RemoveMultipleByValue.java index efe29577..536d19e0 100644 --- a/src/main/java/org/jlib/container/operation/RemoveMultipleByValue.java +++ b/src/main/java/org/jlib/container/operation/RemoveMultipleByValue.java @@ -29,8 +29,7 @@ * * @author Igor Akkerman */ -public interface RemoveMultipleByValue - { +public interface RemoveMultipleByValue { /** * Removes all Items from this object for which the specified {@link ContainsSingle}'s @@ -48,5 +47,5 @@ public interface RemoveMultipleByValue */ & ContainsSingle> /* */ void remove(ContainsIterable items) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/RemoveSingleByValue.java b/src/main/java/org/jlib/container/operation/RemoveSingleByValue.java index c41a9b12..098ee70f 100644 --- a/src/main/java/org/jlib/container/operation/RemoveSingleByValue.java +++ b/src/main/java/org/jlib/container/operation/RemoveSingleByValue.java @@ -45,5 +45,5 @@ public interface RemoveSingleByValue { * if an error occurs during the operation */ void remove(Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/RemoveSingleFromContainsItemByValue.java b/src/main/java/org/jlib/container/operation/RemoveSingleFromContainsItemByValue.java index 85c1c94b..4f5c7816 100644 --- a/src/main/java/org/jlib/container/operation/RemoveSingleFromContainsItemByValue.java +++ b/src/main/java/org/jlib/container/operation/RemoveSingleFromContainsItemByValue.java @@ -30,8 +30,8 @@ * @author Igor Akkerman */ public interface RemoveSingleFromContainsItemByValue -extends RemoveSingleByValue, - ContainsSingle { + extends RemoveSingleByValue, + ContainsSingle { /** * Removes all Items from this object for which the specified {@link ContainsSingle}'s @@ -49,5 +49,5 @@ public interface RemoveSingleFromContainsItemByValue */ @Override void remove(Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/Retain.java b/src/main/java/org/jlib/container/operation/Retain.java index 11b7b73a..cabbc44b 100644 --- a/src/main/java/org/jlib/container/operation/Retain.java +++ b/src/main/java/org/jlib/container/operation/Retain.java @@ -45,5 +45,5 @@ public interface Retain { * if an error occurs during the operation */ void retain(IterativeContainsAdapter items) - throws InvalidContainerArgumentException, InvalidContainerStateException; + throws InvalidContainerArgumentException, InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/SoleItemNotRemoveableException.java b/src/main/java/org/jlib/container/operation/SoleItemNotRemoveableException.java index 379dd179..e1d4dfa7 100644 --- a/src/main/java/org/jlib/container/operation/SoleItemNotRemoveableException.java +++ b/src/main/java/org/jlib/container/operation/SoleItemNotRemoveableException.java @@ -28,7 +28,7 @@ * @author Igor Akkerman */ public class SoleItemNotRemoveableException -extends InvalidContainerStateException { + extends InvalidContainerStateException { private static final long serialVersionUID = - 7467942886021869121L; diff --git a/src/main/java/org/jlib/container/operation/ToArray.java b/src/main/java/org/jlib/container/operation/ToArray.java index 19a32783..8716f7b2 100644 --- a/src/main/java/org/jlib/container/operation/ToArray.java +++ b/src/main/java/org/jlib/container/operation/ToArray.java @@ -33,5 +33,5 @@ public interface ToArray { * if an error occurs during the operation */ Item[] toArray() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/ToRandomAccessList.java b/src/main/java/org/jlib/container/operation/ToRandomAccessList.java index 618d07fe..1d7298c5 100644 --- a/src/main/java/org/jlib/container/operation/ToRandomAccessList.java +++ b/src/main/java/org/jlib/container/operation/ToRandomAccessList.java @@ -38,5 +38,5 @@ public interface ToRandomAccessList { * if an error occurs during the operation */ List toRandomAccessList() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/ToSequentialList.java b/src/main/java/org/jlib/container/operation/ToSequentialList.java index 3dd302a1..cc17a283 100644 --- a/src/main/java/org/jlib/container/operation/ToSequentialList.java +++ b/src/main/java/org/jlib/container/operation/ToSequentialList.java @@ -36,5 +36,5 @@ public interface ToSequentialList { * if an error occurs during the operation */ List toSequentialList() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/ToSet.java b/src/main/java/org/jlib/container/operation/ToSet.java index 6e959011..683304b5 100644 --- a/src/main/java/org/jlib/container/operation/ToSet.java +++ b/src/main/java/org/jlib/container/operation/ToSet.java @@ -26,5 +26,5 @@ public interface ToSet { Set toSet() - throws InvalidContainerStateException; + throws InvalidContainerStateException; } diff --git a/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapter.java b/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapter.java index 6ce6f152..6fba6fd7 100644 --- a/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapter.java +++ b/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapter.java @@ -26,8 +26,8 @@ import org.jlib.container.operation.ContainsSingle; public abstract class ContainsAdapter -implements Iterable, - ContainsSingle { + implements Iterable, + ContainsSingle { private final Iterable items; diff --git a/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapterUtility.java b/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapterUtility.java index b0df8841..122cd2e1 100644 --- a/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapterUtility.java +++ b/src/main/java/org/jlib/container/operation/containsadapter/ContainsAdapterUtility.java @@ -23,23 +23,24 @@ import java.util.Collection; -import org.jlib.array.ArrayUtility; - import org.jlib.container.operation.ContainsSingle; import org.jlib.container.operation.InvalidContainerArgumentException; import org.jlib.container.operation.InvalidContainerStateException; +import org.jlib.array.ArrayUtility; import static org.jlib.container.iterator.IterableUtility.singletonIterable; public final class ContainsAdapterUtility { + private ContainsAdapterUtility() {} + public static ContainsAdapter item(final Item suppliedItem) { return new ContainsAdapter(singletonIterable(suppliedItem)) { @Override public boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return suppliedItem.equals(item); } }; @@ -52,7 +53,7 @@ public boolean contains(final Item item) @Override public boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return items.contains(item); } }; @@ -69,7 +70,7 @@ public static ContainsAdapter allOf(final Collection items) { @Override public boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return items.contains(item); } }; @@ -79,6 +80,4 @@ public boolean contains(final Item item) public static ContainsAdapter allOf(final Item... items) { return new IterativeContainsAdapter<>(ArrayUtility.iterable(items)); } - - private ContainsAdapterUtility() {} } diff --git a/src/main/java/org/jlib/container/operation/containsadapter/IterativeContainsAdapter.java b/src/main/java/org/jlib/container/operation/containsadapter/IterativeContainsAdapter.java index 958e5e0d..e6c61c52 100644 --- a/src/main/java/org/jlib/container/operation/containsadapter/IterativeContainsAdapter.java +++ b/src/main/java/org/jlib/container/operation/containsadapter/IterativeContainsAdapter.java @@ -27,7 +27,7 @@ import org.jlib.iterator.IterableUtility; public class IterativeContainsAdapter -extends ContainsAdapter { + extends ContainsAdapter { public IterativeContainsAdapter(final Iterable items) { super(items); @@ -35,7 +35,7 @@ public IterativeContainsAdapter(final Iterable items) { @Override public final boolean contains(final Item item) - throws InvalidContainerArgumentException, InvalidContainerStateException { + throws InvalidContainerArgumentException, InvalidContainerStateException { return IterableUtility.contains(getItems(), item); } diff --git a/src/main/java/org/jlib/container/storage/AbstractLinearIndexStorage.java b/src/main/java/org/jlib/container/storage/AbstractLinearIndexStorage.java index 7f35263a..1751596b 100644 --- a/src/main/java/org/jlib/container/storage/AbstractLinearIndexStorage.java +++ b/src/main/java/org/jlib/container/storage/AbstractLinearIndexStorage.java @@ -22,20 +22,19 @@ package org.jlib.container.storage; import org.jlib.exception.UnexpectedStateException; - -import static org.jlib.message.MessageUtility.mfmessage; +import static org.jlib.message.Messages.mfmessage; public abstract class AbstractLinearIndexStorage -implements LinearIndexStorage { + implements LinearIndexStorage { protected AbstractLinearIndexStorage(final int initialCapacity) - throws InvalidStorageCapacityException { + throws InvalidStorageCapacityException { ensureCapacityValid("initialCapacity", initialCapacity); } @Override public Item get(final int index) - throws InvalidStorageIndexException { + throws InvalidStorageIndexException { ensureIndexValid("index", index); return safeGet(index); @@ -45,7 +44,7 @@ public Item get(final int index) @Override public void set(final int index, final Item item) - throws InvalidStorageIndexException { + throws InvalidStorageIndexException { ensureIndexValid("index", index); safeSet(index, item); @@ -62,7 +61,7 @@ public void ensureCapacityAndShiftItems(final int additionalCapacity, } private void ensureAdditionalCapacityValid(final int additionalCapacity) - throws InvalidAdditionalCapacityException { + throws InvalidAdditionalCapacityException { if (additionalCapacity < 0) throw new InvalidAdditionalCapacityException(this, additionalCapacity); } @@ -71,7 +70,7 @@ protected abstract void safeAddCapacityAndShiftItems(int capacity, IndexRangeOperationDescriptor... copyDescriptors); protected void ensureCapacityValid(final String capacityName, final int capacity) - throws InvalidStorageCapacityException { + throws InvalidStorageCapacityException { if (capacity < 0) throw new InvalidStorageCapacityException(this, capacityName, capacity); } @@ -82,7 +81,7 @@ protected void ensureIndexValid(final String indexName, final int index) { if (index > capacity() - 1) throw new InvalidStorageIndexException(this, mfmessage("{0} = {1} > {2} = capacity - 1", indexName, index, - capacity() - 1)); + capacity() - 1)); } protected void ensureSourceIndexRangeValid(final int beginIndex, final int endIndex) { @@ -90,8 +89,9 @@ protected void ensureSourceIndexRangeValid(final int beginIndex, final int endIn ensureIndexValid("sourceEndIndex", endIndex); if (endIndex < beginIndex) - throw new InvalidStorageIndexException(this, mfmessage("sourceEndIndex = {0} < {1} = sourceBeginIndex", endIndex, - beginIndex)); + throw new InvalidStorageIndexException(this, + mfmessage("sourceEndIndex = {0} < {1} = sourceBeginIndex", endIndex, + beginIndex)); } protected void ensureOperationDescriptorValid(final IndexRangeOperationDescriptor copyDescriptor) { diff --git a/src/main/java/org/jlib/container/storage/IndexRange.java b/src/main/java/org/jlib/container/storage/IndexRange.java index 4abb70d3..560b8681 100644 --- a/src/main/java/org/jlib/container/storage/IndexRange.java +++ b/src/main/java/org/jlib/container/storage/IndexRange.java @@ -33,8 +33,8 @@ * @author Igor Akkerman */ public class IndexRange -implements Cloneable, - Serializable { + implements Cloneable, + Serializable { private static final long serialVersionUID = - 7959127796333433937L; diff --git a/src/main/java/org/jlib/container/storage/IndexRangeOperationDescriptor.java b/src/main/java/org/jlib/container/storage/IndexRangeOperationDescriptor.java index a7b11d25..fe4ddb29 100644 --- a/src/main/java/org/jlib/container/storage/IndexRangeOperationDescriptor.java +++ b/src/main/java/org/jlib/container/storage/IndexRangeOperationDescriptor.java @@ -31,8 +31,8 @@ * @author Igor Akkerman */ public class IndexRangeOperationDescriptor -implements Cloneable, - Serializable { + implements Cloneable, + Serializable { private static final long serialVersionUID = - 750513726974596434L; diff --git a/src/main/java/org/jlib/container/storage/InvalidAdditionalCapacityException.java b/src/main/java/org/jlib/container/storage/InvalidAdditionalCapacityException.java index 2b638656..76a69067 100644 --- a/src/main/java/org/jlib/container/storage/InvalidAdditionalCapacityException.java +++ b/src/main/java/org/jlib/container/storage/InvalidAdditionalCapacityException.java @@ -21,10 +21,10 @@ package org.jlib.container.storage; -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; public class InvalidAdditionalCapacityException -extends InvalidStorageArgumentException { + extends InvalidStorageArgumentException { private static final long serialVersionUID = 8571768940498236393L; diff --git a/src/main/java/org/jlib/container/storage/InvalidStorageArgumentException.java b/src/main/java/org/jlib/container/storage/InvalidStorageArgumentException.java index 52a9cffb..3e6f5e46 100644 --- a/src/main/java/org/jlib/container/storage/InvalidStorageArgumentException.java +++ b/src/main/java/org/jlib/container/storage/InvalidStorageArgumentException.java @@ -31,7 +31,7 @@ * @author Igor Akkerman */ public abstract class InvalidStorageArgumentException -extends InvalidArgumentException { + extends InvalidArgumentException { private static final long serialVersionUID = - 1514836335986845986L; diff --git a/src/main/java/org/jlib/container/storage/InvalidStorageCapacityException.java b/src/main/java/org/jlib/container/storage/InvalidStorageCapacityException.java index dd1eb163..9a251e51 100644 --- a/src/main/java/org/jlib/container/storage/InvalidStorageCapacityException.java +++ b/src/main/java/org/jlib/container/storage/InvalidStorageCapacityException.java @@ -21,7 +21,7 @@ package org.jlib.container.storage; -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; /** * {@link InvalidStorageArgumentException} thrown when an invalid capacity of an {@link LinearIndexStorage} is @@ -30,7 +30,7 @@ * @author Igor Akkerman */ public class InvalidStorageCapacityException -extends InvalidStorageArgumentException { + extends InvalidStorageArgumentException { private static final long serialVersionUID = - 701812048814999842L; diff --git a/src/main/java/org/jlib/container/storage/InvalidStorageIndexException.java b/src/main/java/org/jlib/container/storage/InvalidStorageIndexException.java index 4d216654..d456618a 100644 --- a/src/main/java/org/jlib/container/storage/InvalidStorageIndexException.java +++ b/src/main/java/org/jlib/container/storage/InvalidStorageIndexException.java @@ -24,7 +24,7 @@ import org.jlib.message.Message; public class InvalidStorageIndexException -extends InvalidStorageArgumentException { + extends InvalidStorageArgumentException { private static final long serialVersionUID = 2164701656211361191L; diff --git a/src/main/java/org/jlib/container/storage/LinearIndexStorage.java b/src/main/java/org/jlib/container/storage/LinearIndexStorage.java index fff96bb7..3a50d7d4 100644 --- a/src/main/java/org/jlib/container/storage/LinearIndexStorage.java +++ b/src/main/java/org/jlib/container/storage/LinearIndexStorage.java @@ -45,7 +45,7 @@ * @author Igor Akkerman */ public interface LinearIndexStorage -extends Cloneable { + extends Cloneable { /** * Returns the current capacity, that is, the number of currently storable {@link Item}s without need of allocating @@ -67,7 +67,7 @@ public interface LinearIndexStorage * if {@code index} is out of the valid bounds of this {@link LinearIndexStorage} */ Item get(int index) - throws InvalidStorageIndexException; + throws InvalidStorageIndexException; /** * Replaces the {@link Item} stored at the specified index by the specified {@link Item}. @@ -82,7 +82,7 @@ Item get(int index) * if {@code index} is out of the valid bounds of this {@link LinearIndexStorage} */ void set(int index, Item newItem) - throws InvalidStorageIndexException; + throws InvalidStorageIndexException; /** *

@@ -112,7 +112,7 @@ void set(int index, Item newItem) * if an {@link IndexRangeOperationDescriptor} specifies a shift on an index outside the valid bounds */ void ensureCapacityAndShiftItems(int capacity, IndexRangeOperationDescriptor... shiftDescriptors) - throws InvalidStorageCapacityException, InvalidStorageIndexException; + throws InvalidStorageCapacityException, InvalidStorageIndexException; /** * Shifts the {@link Item}s ithin this {@link LinearIndexStorage}, as defined by the specified @@ -125,5 +125,5 @@ void ensureCapacityAndShiftItems(int capacity, IndexRangeOperationDescriptor... * if an {@link IndexRangeOperationDescriptor} specifies an index outside the valid bounds */ void shiftItems(IndexRangeOperationDescriptor... shiftDescriptors) - throws InvalidStorageIndexException; + throws InvalidStorageIndexException; } diff --git a/src/main/java/org/jlib/container/storage/array/ArrayStorage.java b/src/main/java/org/jlib/container/storage/array/ArrayStorage.java index 32bd7af6..e1d85d08 100644 --- a/src/main/java/org/jlib/container/storage/array/ArrayStorage.java +++ b/src/main/java/org/jlib/container/storage/array/ArrayStorage.java @@ -21,8 +21,6 @@ package org.jlib.container.storage.array; -import org.jlib.shared.Valid; - import org.jlib.container.storage.AbstractLinearIndexStorage; import org.jlib.container.storage.IndexRangeOperationDescriptor; import org.jlib.container.storage.InvalidStorageCapacityException; @@ -33,6 +31,7 @@ import static java.util.Arrays.copyOf; import static org.jlib.array.ArrayUtility.array; import static org.jlib.shared.NumericUtility.count; +import org.jlib.shared.Valid; /** * {@link LinearIndexStorage} based on an array. @@ -44,13 +43,13 @@ */ public class ArrayStorage -extends AbstractLinearIndexStorage { + extends AbstractLinearIndexStorage { /** array holding the {@link Item}s */ private Item[] delegateArray; public ArrayStorage(final int initialCapacity) - throws InvalidStorageCapacityException { + throws InvalidStorageCapacityException { super(initialCapacity); delegateArray = array(initialCapacity); @@ -83,7 +82,7 @@ protected void safeAddCapacityAndShiftItems(@Valid final int capacity, @Override public void shiftItems(final IndexRangeOperationDescriptor... shiftDescriptors) - throws IndexOutOfBoundsException { + throws IndexOutOfBoundsException { copyItemsTo(delegateArray, shiftDescriptors); } @@ -107,7 +106,7 @@ private void copyItemsTo(final Item[] targetArray, final IndexRangeOperationDesc */ protected void copyItems(final Item[] sourceArray, final Item[] targetArray, final IndexRangeOperationDescriptor copyDescriptor) - throws InvalidStorageIndexException { + throws InvalidStorageIndexException { ensureOperationDescriptorValid(copyDescriptor); 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 8f30d8cd..a45f9e9c 100644 --- a/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/AbstractCapacityStrategy.java @@ -27,10 +27,10 @@ import org.jlib.container.storage.LinearIndexStorage; import org.jlib.basefunctions.ApplicationObject; -import static org.jlib.message.MessageUtility.mfmessage; +import static org.jlib.message.Messages.mfmessage; public abstract class AbstractCapacityStrategy -extends ApplicationObject { + extends ApplicationObject { private final LinearIndexStorage storage; @@ -79,10 +79,10 @@ public void ensureCapacityValid(final int capacity) { protected void ensureIndexValid(final int index) { if (index < contentIndexRange.getMinimum()) throw new InvalidStorageIndexException(storage, mfmessage("index = {0} > {1} = firstItemIndex", index, - contentIndexRange.getMinimum())); + contentIndexRange.getMinimum())); if (index > contentIndexRange.getMaximum()) throw new InvalidStorageIndexException(storage, mfmessage("index = {0} < {1} = lastItemIndex", index, - contentIndexRange.getMaximum())); + contentIndexRange.getMaximum())); } } 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 dc410b8f..2b54e1fd 100644 --- a/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/AbstractSplitCapacityStrategy.java @@ -26,8 +26,8 @@ import org.jlib.container.storage.LinearIndexStorage; public abstract class AbstractSplitCapacityStrategy -extends AbstractCapacityStrategy -implements SplitCapacityStrategy { + extends AbstractCapacityStrategy + implements SplitCapacityStrategy { protected AbstractSplitCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); @@ -35,7 +35,7 @@ protected AbstractSplitCapacityStrategy(final LinearIndexStorage storage, fin @Override public void ensureSplitCapacity(final int splitIndex, final int splitCapacity) - throws InvalidStorageIndexException { + throws InvalidStorageIndexException { ensureIndexValid(splitIndex); ensureCapacityValid(splitCapacity); diff --git a/src/main/java/org/jlib/container/storage/capacity/CapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/CapacityStrategy.java index 5f241a3b..a9b7457f 100644 --- a/src/main/java/org/jlib/container/storage/capacity/CapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/CapacityStrategy.java @@ -22,9 +22,9 @@ package org.jlib.container.storage.capacity; public interface CapacityStrategy -extends InitialCapacityStrategy, - HeadCapacityStrategy, - TailCapacityStrategy, - SplitCapacityStrategy { + extends InitialCapacityStrategy, + HeadCapacityStrategy, + TailCapacityStrategy, + SplitCapacityStrategy { // Unifying interface } diff --git a/src/main/java/org/jlib/container/storage/capacity/ForwardingCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/ForwardingCapacityStrategy.java index 998e3ad3..0087eef8 100644 --- a/src/main/java/org/jlib/container/storage/capacity/ForwardingCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/ForwardingCapacityStrategy.java @@ -24,7 +24,7 @@ import org.jlib.container.storage.InvalidStorageIndexException; public class ForwardingCapacityStrategy -implements CapacityStrategy { + implements CapacityStrategy { private InitialCapacityStrategy delegateInitialCapacityStrategy; private HeadCapacityStrategy delegateHeadCapacityStrategy; @@ -38,19 +38,19 @@ public void initializeCapacity() { @Override public void ensureHeadCapacity(final int headCapacity) - throws InvalidCapacityException { + throws InvalidCapacityException { delegateHeadCapacityStrategy.ensureHeadCapacity(headCapacity); } @Override public void ensureSplitCapacity(final int splitIndex, final int splitCapacity) - throws InvalidStorageIndexException, InvalidCapacityException { + throws InvalidStorageIndexException, InvalidCapacityException { delegateSplitCapacityStrategy.ensureSplitCapacity(splitIndex, splitCapacity); } @Override public void ensureTailCapacity(final int tailCapacity) - throws InvalidCapacityException { + throws InvalidCapacityException { delegateTailCapacityStrategy.ensureTailCapacity(tailCapacity); } diff --git a/src/main/java/org/jlib/container/storage/capacity/HeadCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/HeadCapacityStrategy.java index 221a17d1..fd54e733 100644 --- a/src/main/java/org/jlib/container/storage/capacity/HeadCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/HeadCapacityStrategy.java @@ -41,5 +41,5 @@ public interface HeadCapacityStrategy { * if {@code headCapacity < 0} */ void ensureHeadCapacity(int headCapacity) - throws InvalidCapacityException; + throws InvalidCapacityException; } diff --git a/src/main/java/org/jlib/container/storage/capacity/InvalidCapacityException.java b/src/main/java/org/jlib/container/storage/capacity/InvalidCapacityException.java index 9ca71ca9..f345404c 100644 --- a/src/main/java/org/jlib/container/storage/capacity/InvalidCapacityException.java +++ b/src/main/java/org/jlib/container/storage/capacity/InvalidCapacityException.java @@ -21,13 +21,13 @@ package org.jlib.container.storage.capacity; -import org.jlib.container.storage.LinearIndexStorage; import org.jlib.container.storage.InvalidStorageArgumentException; +import org.jlib.container.storage.LinearIndexStorage; -import static org.jlib.message.MessageUtility.message; +import static org.jlib.message.Messages.message; public class InvalidCapacityException -extends InvalidStorageArgumentException { + extends InvalidStorageArgumentException { private static final long serialVersionUID = 2379753107475444861L; diff --git a/src/main/java/org/jlib/container/storage/capacity/SplitCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/SplitCapacityStrategy.java index e477c1f8..8cc5b362 100644 --- a/src/main/java/org/jlib/container/storage/capacity/SplitCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/SplitCapacityStrategy.java @@ -49,5 +49,5 @@ public interface SplitCapacityStrategy { * if {@code capacity < 0} */ void ensureSplitCapacity(int splitIndex, int splitCapacity) - throws InvalidCapacityException, InvalidStorageIndexException; + throws InvalidCapacityException, InvalidStorageIndexException; } diff --git a/src/main/java/org/jlib/container/storage/capacity/TailCapacityStrategy.java b/src/main/java/org/jlib/container/storage/capacity/TailCapacityStrategy.java index a72867fb..b7adb1fa 100644 --- a/src/main/java/org/jlib/container/storage/capacity/TailCapacityStrategy.java +++ b/src/main/java/org/jlib/container/storage/capacity/TailCapacityStrategy.java @@ -41,5 +41,5 @@ public interface TailCapacityStrategy { * if {@code headOrTailCapacity < 0} */ void ensureTailCapacity(int tailCapacity) - throws InvalidCapacityException; + throws InvalidCapacityException; } 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 f9e34997..30802860 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 @@ -21,11 +21,11 @@ package org.jlib.container.storage.capacity.minimal; -import org.jlib.container.storage.capacity.AbstractCapacityStrategy; -import org.jlib.container.storage.capacity.HeadCapacityStrategy; import org.jlib.container.storage.IndexRange; import org.jlib.container.storage.IndexRangeOperationDescriptor; import org.jlib.container.storage.LinearIndexStorage; +import org.jlib.container.storage.capacity.AbstractCapacityStrategy; +import org.jlib.container.storage.capacity.HeadCapacityStrategy; /** * {@link HeadCapacityStrategy} providing just as much head capacity as needed. @@ -44,8 +44,8 @@ * @author Igor Akkerman */ public class MinimalHeadCapacityStrategy -extends AbstractCapacityStrategy -implements HeadCapacityStrategy { + extends AbstractCapacityStrategy + implements HeadCapacityStrategy { 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 1ea64368..b1816d89 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 @@ -21,9 +21,9 @@ package org.jlib.container.storage.capacity.minimal; -import org.jlib.container.storage.capacity.AbstractCapacityStrategy; import org.jlib.container.storage.IndexRange; import org.jlib.container.storage.LinearIndexStorage; +import org.jlib.container.storage.capacity.AbstractCapacityStrategy; import org.jlib.container.storage.capacity.CapacityStrategy; import org.jlib.container.storage.capacity.HeadCapacityStrategy; import org.jlib.container.storage.capacity.InitialCapacityStrategy; @@ -45,8 +45,8 @@ * @author Igor Akkerman */ public class MinimalInitialCapacityStrategy -extends AbstractCapacityStrategy -implements InitialCapacityStrategy { + extends AbstractCapacityStrategy + implements InitialCapacityStrategy { 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 393fceae..5667955b 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 @@ -21,13 +21,13 @@ package org.jlib.container.storage.capacity.minimal; -import org.jlib.container.storage.capacity.AbstractSplitCapacityStrategy; import org.jlib.container.storage.IndexRange; import org.jlib.container.storage.IndexRangeOperationDescriptor; import org.jlib.container.storage.LinearIndexStorage; +import org.jlib.container.storage.capacity.AbstractSplitCapacityStrategy; public class MinimalSplitCapacityStrategy -extends AbstractSplitCapacityStrategy { + extends AbstractSplitCapacityStrategy { 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 d4291eae..44c13f71 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 @@ -21,13 +21,13 @@ package org.jlib.container.storage.capacity.minimal; +import org.jlib.container.storage.IndexRange; +import org.jlib.container.storage.IndexRangeOperationDescriptor; +import org.jlib.container.storage.LinearIndexStorage; import org.jlib.container.storage.capacity.AbstractCapacityStrategy; import org.jlib.container.storage.capacity.CapacityStrategy; import org.jlib.container.storage.capacity.HeadCapacityStrategy; import org.jlib.container.storage.capacity.TailCapacityStrategy; -import org.jlib.container.storage.IndexRange; -import org.jlib.container.storage.IndexRangeOperationDescriptor; -import org.jlib.container.storage.LinearIndexStorage; /** *

@@ -45,8 +45,8 @@ * @author Igor Akkerman */ public class MinimalTailCapacityStrategy -extends AbstractCapacityStrategy -implements TailCapacityStrategy { + extends AbstractCapacityStrategy + implements TailCapacityStrategy { public MinimalTailCapacityStrategy(final LinearIndexStorage storage, final IndexRange contentIndexRange) { super(storage, contentIndexRange); diff --git a/src/test/java/org/jlib/container/storage/array/ArrayStorageTest.java b/src/test/java/org/jlib/container/storage/array/ArrayStorageTest.java index b2ef8d93..b68f8d33 100644 --- a/src/test/java/org/jlib/container/storage/array/ArrayStorageTest.java +++ b/src/test/java/org/jlib/container/storage/array/ArrayStorageTest.java @@ -30,14 +30,14 @@ public class ArrayStorageTest { public void zeroCapacityStorageShouldReturnCorrectCapacity() - throws Exception { + throws Exception { final ArrayStorage storage = new ArrayStorage<>(0); assertThat(storage.capacity()).isEqualTo(0); } public void positiveCapacityStorageShouldReturnCorrectCapacity() - throws Exception { + throws Exception { final ArrayStorage storage = new ArrayStorage<>(5); assertThat(storage.capacity()).isEqualTo(5); @@ -45,25 +45,25 @@ public void positiveCapacityStorageShouldReturnCorrectCapacity() @Test(expected = InvalidStorageCapacityException.class) public void negativeCapacityStorageReadShouldThrowException() - throws Exception { + throws Exception { new ArrayStorage<>(- 1); } @Test(expected = InvalidStorageIndexException.class) public void zeroCapacityStorageReadShouldThrowException() - throws Exception { + throws Exception { new ArrayStorage(0).get(0); } @Test(expected = InvalidStorageIndexException.class) public void readNegativeIndexShouldThrowException() - throws Exception { + throws Exception { new ArrayStorage(5).get(- 1); } @Test public void getPreviouslySetItemShouldReturnCorrectItem() - throws Exception { + throws Exception { final ArrayStorage storage = new ArrayStorage<>(5); storage.set(3, "Test"); @@ -72,7 +72,7 @@ public void getPreviouslySetItemShouldReturnCorrectItem() @Test public void getReplacedItemShouldReturnCorrectItem() - throws Exception { + throws Exception { final ArrayStorage storage = new ArrayStorage<>(5); storage.set(3, "Test"); storage.set(3, "new"); @@ -83,28 +83,28 @@ public void getReplacedItemShouldReturnCorrectItem() @SuppressWarnings("EmptyMethod") @Test public void testShiftItems() - throws Exception { + throws Exception { // TODO: implement } @SuppressWarnings("EmptyMethod") @Test public void testCopyItems() - throws Exception { + throws Exception { // TODO: implement } @SuppressWarnings("EmptyMethod") @Test public void testGetCapacity() - throws Exception { + throws Exception { // TODO: implement } @SuppressWarnings("EmptyMethod") @Test public void testEnsureCapacityAndShiftItems() - throws Exception { + throws Exception { // TODO: implement } }