de.upb.hni.vmagic.util
Class ParentSetList<E extends VhdlElement>

java.lang.Object
  extended by de.upb.hni.vmagic.util.ForwardingList<E>
      extended by de.upb.hni.vmagic.util.ParentSetList<E>
Type Parameters:
E - the type of the list elements
All Implemented Interfaces:
java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>

public class ParentSetList<E extends VhdlElement>
extends ForwardingList<E>

Implementation of the List interfaces that sets the parent of the added items.


Method Summary
 boolean add(E e)
          Adds an element to this list.
 void add(int index, E element)
          Adds an element to a specific position in this list.
 boolean addAll(java.util.Collection<? extends E> c)
          Adds all elements of a collection to this list.
 boolean addAll(int index, java.util.Collection<? extends E> c)
          Adds all elements of a collection to a specific index in this list.
 void clear()
          Clears this list.
static
<E extends VhdlElement>
java.util.List<E>
create(DeclarativeRegion parent)
          Creates a new ParentSetList which uses an ArrayList for storage.
static
<E extends VhdlElement>
java.util.List<E>
create(DeclarativeRegion parent, java.util.List<E> list)
          Creates a new ParentSetList.
static
<E extends VhdlElement>
java.util.List<E>
createProxyList(java.util.List<E> list, VhdlElement parent)
          Creates a new proxy ParentSetList and initializes it from a given list.
static
<E extends VhdlElement>
java.util.List<E>
createProxyList(VhdlElement parent)
          Creates a new proxy ParentSetList which uses an ArrayList for storage.
 java.util.Iterator<E> iterator()
          Returns an iterator for this list.
 java.util.ListIterator<E> listIterator()
          Returns a list iterator for this list.
 java.util.ListIterator<E> listIterator(int index)
          Returns a list iterator with a start index.
 E remove(int index)
          Removes the element at a given index.
 boolean remove(java.lang.Object o)
          Removes an object from this list.
 boolean removeAll(java.util.Collection<?> c)
          Removes all elements in a collection from this list.
 boolean retainAll(java.util.Collection<?> c)
          Removes all elements that are not in the given collection from this list.
 E set(int index, E element)
          Sets the element at the given index.
 java.util.List<E> subList(int fromIndex, int toIndex)
          Returns a sub list of this list.
 
Methods inherited from class de.upb.hni.vmagic.util.ForwardingList
contains, containsAll, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.List
equals, hashCode
 

Method Detail

create

public static <E extends VhdlElement> java.util.List<E> create(DeclarativeRegion parent)
Creates a new ParentSetList which uses an ArrayList for storage.

Type Parameters:
E - the type of the list elements
Parameters:
parent - the parent declarative region
Returns:
the parent set list

create

public static <E extends VhdlElement> java.util.List<E> create(DeclarativeRegion parent,
                                                               java.util.List<E> list)
Creates a new ParentSetList.

Type Parameters:
E - the type of the list elements
Parameters:
list - the list used for element storage
parent - the parent declarative region
Returns:
the parent set list

createProxyList

public static <E extends VhdlElement> java.util.List<E> createProxyList(VhdlElement parent)
Creates a new proxy ParentSetList which uses an ArrayList for storage. A proxy ParentSetList is used for parents which aren't declarative regions (e.g. IfStatements).

Type Parameters:
E - the type of the list elements
Parameters:
parent - the parent
Returns:
the proxy list

createProxyList

public static <E extends VhdlElement> java.util.List<E> createProxyList(java.util.List<E> list,
                                                                        VhdlElement parent)
Creates a new proxy ParentSetList and initializes it from a given list. A proxy ParentSetList is used for parents which aren't declarative regions (e.g. IfStatements).

Type Parameters:
E - the type of the list elements
Parameters:
list - the list used for element storage
parent - the parent
Returns:
the proxy list

add

public boolean add(E e)
Description copied from class: ForwardingList
Adds an element to this list.

Specified by:
add in interface java.util.Collection<E extends VhdlElement>
Specified by:
add in interface java.util.List<E extends VhdlElement>
Overrides:
add in class ForwardingList<E extends VhdlElement>
Parameters:
e - the element
Returns:
true

add

public void add(int index,
                E element)
Description copied from class: ForwardingList
Adds an element to a specific position in this list.

Specified by:
add in interface java.util.List<E extends VhdlElement>
Overrides:
add in class ForwardingList<E extends VhdlElement>
Parameters:
index - the index
element - the element

addAll

public boolean addAll(java.util.Collection<? extends E> c)
Description copied from class: ForwardingList
Adds all elements of a collection to this list.

Specified by:
addAll in interface java.util.Collection<E extends VhdlElement>
Specified by:
addAll in interface java.util.List<E extends VhdlElement>
Overrides:
addAll in class ForwardingList<E extends VhdlElement>
Parameters:
c - the collection
Returns:
true, if this list was changed

addAll

public boolean addAll(int index,
                      java.util.Collection<? extends E> c)
Description copied from class: ForwardingList
Adds all elements of a collection to a specific index in this list.

Specified by:
addAll in interface java.util.List<E extends VhdlElement>
Overrides:
addAll in class ForwardingList<E extends VhdlElement>
Parameters:
index - the index
c - the collection
Returns:
true, if this list was changed

remove

public boolean remove(java.lang.Object o)
Description copied from class: ForwardingList
Removes an object from this list.

Specified by:
remove in interface java.util.Collection<E extends VhdlElement>
Specified by:
remove in interface java.util.List<E extends VhdlElement>
Overrides:
remove in class ForwardingList<E extends VhdlElement>
Parameters:
o - the object
Returns:
true, if the object was removed

remove

public E remove(int index)
Description copied from class: ForwardingList
Removes the element at a given index.

Specified by:
remove in interface java.util.List<E extends VhdlElement>
Overrides:
remove in class ForwardingList<E extends VhdlElement>
Parameters:
index - the index
Returns:
the removed element

removeAll

public boolean removeAll(java.util.Collection<?> c)
Description copied from class: ForwardingList
Removes all elements in a collection from this list.

Specified by:
removeAll in interface java.util.Collection<E extends VhdlElement>
Specified by:
removeAll in interface java.util.List<E extends VhdlElement>
Overrides:
removeAll in class ForwardingList<E extends VhdlElement>
Parameters:
c - the collection
Returns:
true, if this list was changed

retainAll

public boolean retainAll(java.util.Collection<?> c)
Description copied from class: ForwardingList
Removes all elements that are not in the given collection from this list.

Specified by:
retainAll in interface java.util.Collection<E extends VhdlElement>
Specified by:
retainAll in interface java.util.List<E extends VhdlElement>
Overrides:
retainAll in class ForwardingList<E extends VhdlElement>
Parameters:
c - the collection
Returns:
true, if this list was changed

clear

public void clear()
Description copied from class: ForwardingList
Clears this list.

Specified by:
clear in interface java.util.Collection<E extends VhdlElement>
Specified by:
clear in interface java.util.List<E extends VhdlElement>
Overrides:
clear in class ForwardingList<E extends VhdlElement>

set

public E set(int index,
             E element)
Description copied from class: ForwardingList
Sets the element at the given index.

Specified by:
set in interface java.util.List<E extends VhdlElement>
Overrides:
set in class ForwardingList<E extends VhdlElement>
Parameters:
index - the index
element - the new element
Returns:
the old element

listIterator

public java.util.ListIterator<E> listIterator(int index)
Description copied from class: ForwardingList
Returns a list iterator with a start index.

Specified by:
listIterator in interface java.util.List<E extends VhdlElement>
Overrides:
listIterator in class ForwardingList<E extends VhdlElement>
Parameters:
index - the index
Returns:
the list iterator

listIterator

public java.util.ListIterator<E> listIterator()
Description copied from class: ForwardingList
Returns a list iterator for this list.

Specified by:
listIterator in interface java.util.List<E extends VhdlElement>
Overrides:
listIterator in class ForwardingList<E extends VhdlElement>
Returns:
the list iterator

iterator

public java.util.Iterator<E> iterator()
Description copied from class: ForwardingList
Returns an iterator for this list.

Specified by:
iterator in interface java.lang.Iterable<E extends VhdlElement>
Specified by:
iterator in interface java.util.Collection<E extends VhdlElement>
Specified by:
iterator in interface java.util.List<E extends VhdlElement>
Overrides:
iterator in class ForwardingList<E extends VhdlElement>
Returns:
the iterator

subList

public java.util.List<E> subList(int fromIndex,
                                 int toIndex)
Description copied from class: ForwardingList
Returns a sub list of this list.

Specified by:
subList in interface java.util.List<E extends VhdlElement>
Overrides:
subList in class ForwardingList<E extends VhdlElement>
Parameters:
fromIndex - the first index
toIndex - the last index
Returns:
the sub list