org.schwa.dr
Class Store<T extends Ann>

java.lang.Object
  extended by org.schwa.dr.Store<T>
All Implemented Interfaces:
Iterable<T>, Collection<T>, List<T>

public class Store<T extends Ann>
extends Object
implements List<T>

Implementation of docrep stores; ordered collections of annotation instances. This class wraps an ArrayList while providing some additional methods, such as create(java.lang.Class), and adding some additional docrep semantics to methods like add(T) and clear().

Author:
Tim Dawborn

Field Summary
protected  List<T> items
           
 
Constructor Summary
Store()
           
 
Method Summary
 void add(int index, T o)
          This method is unsupported but required by the List interface.
 boolean add(T obj)
          Adds a new Ann instance to the store, setting the drIndex attribute in the process.
 boolean addAll(Collection<? extends T> c)
           
 boolean addAll(int index, Collection<? extends T> c)
           
 void clear()
          Removes all annotation instances from the store, setting their drIndex values to null in the process.
 boolean contains(Object o)
           
 boolean containsAll(Collection<?> c)
           
 T create(Class<T> klass)
          Creates a new annotation instance, adds it to the store, and returns the instance.
 void create(Class<T> klass, int n)
          Creates n new annotation instances, adding them all to the store.
 boolean equals(Object o)
           
 T get(int index)
           
 int hashCode()
           
 int indexOf(Object o)
           
 boolean isEmpty()
           
 Iterator<T> iterator()
           
 int lastIndexOf(Object o)
           
 ListIterator<T> listIterator()
           
 ListIterator<T> listIterator(int index)
           
 T remove(int index)
          This method is unsupported but required by the List interface.
 boolean remove(Object o)
          This method is unsupported but required by the List interface.
 boolean removeAll(Collection<?> c)
          This method is unsupported but required by the List interface.
 boolean retainAll(Collection<?> c)
          This method is unsupported but required by the List interface.
 T set(int index, T o)
          This method is unsupported but required by the List interface.
 int size()
           
 List<T> subList(int fromIndex, int toIndex)
          This method is unsupported but required by the List interface.
 Object[] toArray()
           
<T> T[]
toArray(T[] a)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

items

protected final List<T extends Ann> items
Constructor Detail

Store

public Store()
Method Detail

add

public boolean add(T obj)
Adds a new Ann instance to the store, setting the drIndex attribute in the process.

Specified by:
add in interface Collection<T extends Ann>
Specified by:
add in interface List<T extends Ann>

add

public void add(int index,
                T o)
This method is unsupported but required by the List interface.

Specified by:
add in interface List<T extends Ann>
Throws:
UnsupportedOperationException

addAll

public boolean addAll(Collection<? extends T> c)
Specified by:
addAll in interface Collection<T extends Ann>
Specified by:
addAll in interface List<T extends Ann>
See Also:
add(Ann)

addAll

public boolean addAll(int index,
                      Collection<? extends T> c)
Specified by:
addAll in interface List<T extends Ann>
Throws:
UnsupportedOperationException
See Also:
add(int, Ann)

clear

public void clear()
Removes all annotation instances from the store, setting their drIndex values to null in the process.

Specified by:
clear in interface Collection<T extends Ann>
Specified by:
clear in interface List<T extends Ann>

contains

public boolean contains(Object o)
Specified by:
contains in interface Collection<T extends Ann>
Specified by:
contains in interface List<T extends Ann>

containsAll

public boolean containsAll(Collection<?> c)
Specified by:
containsAll in interface Collection<T extends Ann>
Specified by:
containsAll in interface List<T extends Ann>

create

public T create(Class<T> klass)
Creates a new annotation instance, adds it to the store, and returns the instance. This is simply a convenience method to save the user from creating and adding to the store separately.


create

public void create(Class<T> klass,
                   int n)
Creates n new annotation instances, adding them all to the store.

See Also:
create(Class)

equals

public boolean equals(Object o)
Specified by:
equals in interface Collection<T extends Ann>
Specified by:
equals in interface List<T extends Ann>
Overrides:
equals in class Object

get

public T get(int index)
Specified by:
get in interface List<T extends Ann>

hashCode

public int hashCode()
Specified by:
hashCode in interface Collection<T extends Ann>
Specified by:
hashCode in interface List<T extends Ann>
Overrides:
hashCode in class Object

indexOf

public int indexOf(Object o)
Specified by:
indexOf in interface List<T extends Ann>

isEmpty

public boolean isEmpty()
Specified by:
isEmpty in interface Collection<T extends Ann>
Specified by:
isEmpty in interface List<T extends Ann>

iterator

public Iterator<T> iterator()
Specified by:
iterator in interface Iterable<T extends Ann>
Specified by:
iterator in interface Collection<T extends Ann>
Specified by:
iterator in interface List<T extends Ann>

lastIndexOf

public int lastIndexOf(Object o)
Specified by:
lastIndexOf in interface List<T extends Ann>

listIterator

public ListIterator<T> listIterator()
Specified by:
listIterator in interface List<T extends Ann>

listIterator

public ListIterator<T> listIterator(int index)
Specified by:
listIterator in interface List<T extends Ann>

remove

public T remove(int index)
This method is unsupported but required by the List interface.

Specified by:
remove in interface List<T extends Ann>
Throws:
UnsupportedOperationException

remove

public boolean remove(Object o)
This method is unsupported but required by the List interface.

Specified by:
remove in interface Collection<T extends Ann>
Specified by:
remove in interface List<T extends Ann>
Throws:
UnsupportedOperationException

removeAll

public boolean removeAll(Collection<?> c)
This method is unsupported but required by the List interface.

Specified by:
removeAll in interface Collection<T extends Ann>
Specified by:
removeAll in interface List<T extends Ann>
Throws:
UnsupportedOperationException

retainAll

public boolean retainAll(Collection<?> c)
This method is unsupported but required by the List interface.

Specified by:
retainAll in interface Collection<T extends Ann>
Specified by:
retainAll in interface List<T extends Ann>
Throws:
UnsupportedOperationException

set

public T set(int index,
             T o)
This method is unsupported but required by the List interface.

Specified by:
set in interface List<T extends Ann>
Throws:
UnsupportedOperationException

size

public int size()
Specified by:
size in interface Collection<T extends Ann>
Specified by:
size in interface List<T extends Ann>

subList

public List<T> subList(int fromIndex,
                       int toIndex)
This method is unsupported but required by the List interface.

Specified by:
subList in interface List<T extends Ann>
Throws:
UnsupportedOperationException

toArray

public Object[] toArray()
Specified by:
toArray in interface Collection<T extends Ann>
Specified by:
toArray in interface List<T extends Ann>

toArray

public <T> T[] toArray(T[] a)
Specified by:
toArray in interface Collection<T extends Ann>
Specified by:
toArray in interface List<T extends Ann>


Copyright © 2014. All rights reserved.