Add missing @Override markers

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/collections/trunk@966315 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2010-07-21 17:03:58 +00:00
parent da5a378c4f
commit c9e19ce6cd
6 changed files with 65 additions and 0 deletions

View File

@ -148,14 +148,17 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
return normalMap.containsKey(key);
}
@Override
public boolean equals(Object obj) {
return normalMap.equals(obj);
}
@Override
public int hashCode() {
return normalMap.hashCode();
}
@Override
public String toString() {
return normalMap.toString();
}
@ -337,6 +340,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
this.parent = parent;
}
@Override
public boolean removeAll(Collection<?> coll) {
if (parent.isEmpty() || coll.isEmpty()) {
return false;
@ -352,6 +356,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
return modified;
}
@Override
public boolean retainAll(Collection<?> coll) {
if (parent.isEmpty()) {
return false;
@ -371,6 +376,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
return modified;
}
@Override
public void clear() {
parent.clear();
}
@ -395,14 +401,17 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
super(parent.normalMap.keySet(), (AbstractDualBidiMap<K, Object>) parent);
}
@Override
public Iterator<K> iterator() {
return parent.createKeySetIterator(super.iterator());
}
@Override
public boolean contains(Object key) {
return parent.normalMap.containsKey(key);
}
@Override
public boolean remove(Object key) {
if (parent.normalMap.containsKey(key)) {
Object value = parent.normalMap.remove(key);
@ -437,12 +446,14 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
this.parent = parent;
}
@Override
public K next() {
lastKey = super.next();
canRemove = true;
return lastKey;
}
@Override
public void remove() {
if (canRemove == false) {
throw new IllegalStateException("Iterator remove() can only be called once after next()");
@ -474,14 +485,17 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
super(parent.normalMap.values(), (AbstractDualBidiMap<Object, V>) parent);
}
@Override
public Iterator<V> iterator() {
return parent.createValuesIterator(super.iterator());
}
@Override
public boolean contains(Object value) {
return parent.reverseMap.containsKey(value);
}
@Override
public boolean remove(Object value) {
if (parent.reverseMap.containsKey(value)) {
Object key = parent.reverseMap.remove(value);
@ -517,12 +531,14 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
this.parent = (AbstractDualBidiMap<Object, V>) parent;
}
@Override
public V next() {
lastValue = super.next();
canRemove = true;
return lastValue;
}
@Override
public void remove() {
if (canRemove == false) {
throw new IllegalStateException("Iterator remove() can only be called once after next()");
@ -552,10 +568,12 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
super(parent.normalMap.entrySet(), parent);
}
@Override
public Iterator<Map.Entry<K, V>> iterator() {
return parent.createEntrySetIterator(super.iterator());
}
@Override
public boolean remove(Object obj) {
if (obj instanceof Map.Entry == false) {
return false;
@ -598,12 +616,14 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
this.parent = parent;
}
@Override
public Map.Entry<K, V> next() {
last = new MapEntry<K, V>(super.next(), parent);
canRemove = true;
return last;
}
@Override
public void remove() {
if (canRemove == false) {
throw new IllegalStateException("Iterator remove() can only be called once after next()");
@ -635,6 +655,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
this.parent = parent;
}
@Override
public V setValue(V value) {
K key = MapEntry.this.getKey();
if (parent.reverseMap.containsKey(value) &&
@ -727,6 +748,7 @@ public abstract class AbstractDualBidiMap<K, V> implements BidiMap<K, V> {
canRemove = false;
}
@Override
public String toString() {
if (last != null) {
return "MapIterator[" + getKey() + "=" + getValue() + "]";

View File

@ -55,11 +55,13 @@ public abstract class AbstractOrderedBidiMapDecorator<K, V>
*
* @return the decorated map
*/
@Override
protected OrderedBidiMap<K, V> decorated() {
return (OrderedBidiMap<K, V>) super.decorated();
}
//-----------------------------------------------------------------------
@Override
public OrderedMapIterator<K, V> mapIterator() {
return decorated().mapIterator();
}

View File

@ -84,6 +84,7 @@ public class DualHashBidiMap<K, V> extends AbstractDualBidiMap<K, V> implements
* @param inverseBidiMap the inverse BidiMap
* @return new bidi map
*/
@Override
protected BidiMap<V, K> createBidiMap(Map<V, K> normalMap, Map<K, V> reverseMap, BidiMap<K, V> inverseBidiMap) {
return new DualHashBidiMap<V, K>(normalMap, reverseMap, inverseBidiMap);
}

View File

@ -90,6 +90,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* The equivalent of a default constructor called
* by any constructor and by <code>readObject</code>.
*/
@Override
protected void init() {
super.init();
cursors = new ArrayList<WeakReference<Cursor<E>>>();
@ -105,6 +106,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
*
* @return a new iterator that does <b>not</b> support concurrent modification
*/
@Override
public Iterator<E> iterator() {
return super.listIterator(0);
}
@ -124,6 +126,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
*
* @return a new cursor iterator
*/
@Override
public ListIterator<E> listIterator() {
return cursor(0);
}
@ -144,6 +147,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* @param fromIndex the index to start from
* @return a new cursor iterator
*/
@Override
public ListIterator<E> listIterator(int fromIndex) {
return cursor(fromIndex);
}
@ -217,6 +221,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* @param node node to update
* @param value new value of the node
*/
@Override
protected void updateNode(Node<E> node, E value) {
super.updateNode(node, value);
broadcastNodeChanged(node);
@ -229,6 +234,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* @param insertBeforeNode node to insert before
* @throws NullPointerException if either node is null
*/
@Override
protected void addNode(Node<E> nodeToInsert, Node<E> insertBeforeNode) {
super.addNode(nodeToInsert, insertBeforeNode);
broadcastNodeInserted(nodeToInsert);
@ -240,6 +246,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* @param node the node to remove
* @throws NullPointerException if <code>node</code> is null
*/
@Override
protected void removeNode(Node<E> node) {
super.removeNode(node);
broadcastNodeRemoved(node);
@ -248,6 +255,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
/**
* Removes all nodes by iteration.
*/
@Override
protected void removeAllNodes() {
if (size() > 0) {
// superclass implementation would break all the iterators
@ -381,6 +389,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
* @param subList the sublist to get an iterator for
* @param fromIndex the index to start from, relative to the sublist
*/
@Override
protected ListIterator<E> createSubListListIterator(LinkedSubList<E> subList, int fromIndex) {
SubCursor<E> cursor = new SubCursor<E>(subList, fromIndex);
registerCursor(cursor);
@ -421,6 +430,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
*
* @throws IllegalStateException if there is no item to remove
*/
@Override
public void remove() {
// overridden, as the nodeRemoved() method updates the iterator
// state in the parent.removeNode() call below
@ -442,6 +452,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
*
* @param obj the object to add
*/
@Override
public void add(E obj) {
// overridden, as the nodeInserted() method updates the iterator state
super.add(obj);
@ -460,6 +471,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
*
* @return the next index
*/
@Override
public int nextIndex() {
if (nextIndexValid == false) {
if (next == parent.header) {
@ -533,6 +545,7 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
/**
* Override superclass modCount check, and replace it with our valid flag.
*/
@Override
protected void checkModCount() {
if (!valid) {
throw new ConcurrentModificationException("Cursor closed");
@ -576,24 +589,29 @@ public class CursorableLinkedList<E> extends AbstractLinkedList<E> implements Se
this.sub = sub;
}
@Override
public boolean hasNext() {
return (nextIndex() < sub.size);
}
@Override
public boolean hasPrevious() {
return (previousIndex() >= 0);
}
@Override
public int nextIndex() {
return (super.nextIndex() - sub.offset);
}
@Override
public void add(E obj) {
super.add(obj);
sub.expectedModCount = parent.modCount;
sub.size++;
}
@Override
public void remove() {
super.remove();
sub.expectedModCount = parent.modCount;

View File

@ -68,70 +68,87 @@ public class FixedSizeList<E>
}
//-----------------------------------------------------------------------
@Override
public boolean add(E object) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public void add(int index, E object) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public boolean addAll(Collection<? extends E> coll) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public boolean addAll(int index, Collection<? extends E> coll) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public void clear() {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public E get(int index) {
return decorated().get(index);
}
@Override
public int indexOf(Object object) {
return decorated().indexOf(object);
}
@Override
public Iterator<E> iterator() {
return UnmodifiableIterator.decorate(decorated().iterator());
}
@Override
public int lastIndexOf(Object object) {
return decorated().lastIndexOf(object);
}
@Override
public ListIterator<E> listIterator() {
return new FixedSizeListIterator(decorated().listIterator(0));
}
@Override
public ListIterator<E> listIterator(int index) {
return new FixedSizeListIterator(decorated().listIterator(index));
}
@Override
public E remove(int index) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public boolean remove(Object object) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public boolean removeAll(Collection<?> coll) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public boolean retainAll(Collection<?> coll) {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public E set(int index, E object) {
return decorated().set(index, object);
}
@Override
public List<E> subList(int fromIndex, int toIndex) {
List<E> sub = decorated().subList(fromIndex, toIndex);
return new FixedSizeList<E>(sub);
@ -144,9 +161,11 @@ public class FixedSizeList<E>
protected FixedSizeListIterator(ListIterator<E> iterator) {
super(iterator);
}
@Override
public void remove() {
throw new UnsupportedOperationException("List is fixed size");
}
@Override
public void add(Object object) {
throw new UnsupportedOperationException("List is fixed size");
}

View File

@ -85,6 +85,7 @@ public class PredicatedList<E> extends PredicatedCollection<E> implements List<E
*
* @return the decorated list
*/
@Override
protected List<E> decorated() {
return (List<E>) super.decorated();
}
@ -146,11 +147,13 @@ public class PredicatedList<E> extends PredicatedCollection<E> implements List<E
super(iterator);
}
@Override
public void add(E object) {
validate(object);
iterator.add(object);
}
@Override
public void set(E object) {
validate(object);
iterator.set(object);