org.opensaml.xml.util
Class ListView<ElementType extends XMLObject>

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<ElementType>
          extended by org.opensaml.xml.util.ListView<ElementType>
Type Parameters:
ElementType - the XMLObject type that this list operates on
All Implemented Interfaces:
Iterable<ElementType>, Collection<ElementType>, List<ElementType>

 class ListView<ElementType extends XMLObject>
extends AbstractList<ElementType>

A special list that works as a view of an IndexedXMLObjectChildrenList showing only the sublist associated with a given index. Operations performed on this sublist are reflected in the backing list. Index-based mutation operations are not supported.


Field Summary
private  IndexedXMLObjectChildrenList<ElementType> backingList
          List that backs this view.
private  QName index
          Index that points to the list, in the backing list, that this view operates on.
private  List<ElementType> indexList
          List, in the backing list, that the given index points to.
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ListView(IndexedXMLObjectChildrenList<ElementType> newBackingList, QName newIndex)
          Constructor.
 
Method Summary
 boolean add(ElementType o)
          
 void add(int newIndex, ElementType element)
          
 boolean addAll(Collection<? extends ElementType> c)
          
 boolean addAll(int index, Collection<? extends ElementType> c)
          
 void clear()
          
 boolean contains(Object element)
          Checks to see if the given element is contained in this list.
 boolean containsAll(Collection<?> c)
          
 ElementType get(int newIndex)
          
 int indexOf(Object o)
          
 boolean isEmpty()
          
 int lastIndexOf(Object o)
          
 ElementType remove(int newIndex)
          
 boolean remove(Object o)
          
 boolean removeAll(Collection<?> c)
          
 boolean retainAll(Collection<?> c)
          
 ElementType set(int newIndex, ElementType element)
          
 int size()
          
 Object[] toArray()
          
<T> T[]
toArray(T[] a)
          
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

backingList

private IndexedXMLObjectChildrenList<ElementType extends XMLObject> backingList
List that backs this view.


index

private QName index
Index that points to the list, in the backing list, that this view operates on.


indexList

private List<ElementType extends XMLObject> indexList
List, in the backing list, that the given index points to.

Constructor Detail

ListView

public ListView(IndexedXMLObjectChildrenList<ElementType> newBackingList,
                QName newIndex)
Constructor.

Parameters:
newBackingList - the list that backs this view
newIndex - the element schema type or name of the sublist this view operates on
Method Detail

add

public boolean add(ElementType o)

Specified by:
add in interface Collection<ElementType extends XMLObject>
Specified by:
add in interface List<ElementType extends XMLObject>
Overrides:
add in class AbstractList<ElementType extends XMLObject>

add

public void add(int newIndex,
                ElementType element)

Specified by:
add in interface List<ElementType extends XMLObject>
Overrides:
add in class AbstractList<ElementType extends XMLObject>

addAll

public boolean addAll(Collection<? extends ElementType> c)

Specified by:
addAll in interface Collection<ElementType extends XMLObject>
Specified by:
addAll in interface List<ElementType extends XMLObject>
Overrides:
addAll in class AbstractCollection<ElementType extends XMLObject>

addAll

public boolean addAll(int index,
                      Collection<? extends ElementType> c)

Specified by:
addAll in interface List<ElementType extends XMLObject>
Overrides:
addAll in class AbstractList<ElementType extends XMLObject>

clear

public void clear()

Specified by:
clear in interface Collection<ElementType extends XMLObject>
Specified by:
clear in interface List<ElementType extends XMLObject>
Overrides:
clear in class AbstractList<ElementType extends XMLObject>

contains

public boolean contains(Object element)
Checks to see if the given element is contained in this list.

Specified by:
contains in interface Collection<ElementType extends XMLObject>
Specified by:
contains in interface List<ElementType extends XMLObject>
Overrides:
contains in class AbstractCollection<ElementType extends XMLObject>
Parameters:
element - the element to check for
Returns:
true if the element is in this list, false if not

containsAll

public boolean containsAll(Collection<?> c)

Specified by:
containsAll in interface Collection<ElementType extends XMLObject>
Specified by:
containsAll in interface List<ElementType extends XMLObject>
Overrides:
containsAll in class AbstractCollection<ElementType extends XMLObject>

get

public ElementType get(int newIndex)

Specified by:
get in interface List<ElementType extends XMLObject>
Specified by:
get in class AbstractList<ElementType extends XMLObject>

indexOf

public int indexOf(Object o)

Specified by:
indexOf in interface List<ElementType extends XMLObject>
Overrides:
indexOf in class AbstractList<ElementType extends XMLObject>

isEmpty

public boolean isEmpty()

Specified by:
isEmpty in interface Collection<ElementType extends XMLObject>
Specified by:
isEmpty in interface List<ElementType extends XMLObject>
Overrides:
isEmpty in class AbstractCollection<ElementType extends XMLObject>

lastIndexOf

public int lastIndexOf(Object o)

Specified by:
lastIndexOf in interface List<ElementType extends XMLObject>
Overrides:
lastIndexOf in class AbstractList<ElementType extends XMLObject>

remove

public ElementType remove(int newIndex)

Specified by:
remove in interface List<ElementType extends XMLObject>
Overrides:
remove in class AbstractList<ElementType extends XMLObject>

remove

public boolean remove(Object o)

Specified by:
remove in interface Collection<ElementType extends XMLObject>
Specified by:
remove in interface List<ElementType extends XMLObject>
Overrides:
remove in class AbstractCollection<ElementType extends XMLObject>

removeAll

public boolean removeAll(Collection<?> c)

Specified by:
removeAll in interface Collection<ElementType extends XMLObject>
Specified by:
removeAll in interface List<ElementType extends XMLObject>
Overrides:
removeAll in class AbstractCollection<ElementType extends XMLObject>

retainAll

public boolean retainAll(Collection<?> c)

Specified by:
retainAll in interface Collection<ElementType extends XMLObject>
Specified by:
retainAll in interface List<ElementType extends XMLObject>
Overrides:
retainAll in class AbstractCollection<ElementType extends XMLObject>

set

public ElementType set(int newIndex,
                       ElementType element)

Specified by:
set in interface List<ElementType extends XMLObject>
Overrides:
set in class AbstractList<ElementType extends XMLObject>

size

public int size()

Specified by:
size in interface Collection<ElementType extends XMLObject>
Specified by:
size in interface List<ElementType extends XMLObject>
Specified by:
size in class AbstractCollection<ElementType extends XMLObject>

toArray

public Object[] toArray()

Specified by:
toArray in interface Collection<ElementType extends XMLObject>
Specified by:
toArray in interface List<ElementType extends XMLObject>
Overrides:
toArray in class AbstractCollection<ElementType extends XMLObject>

toArray

public <T> T[] toArray(T[] a)

Specified by:
toArray in interface Collection<ElementType extends XMLObject>
Specified by:
toArray in interface List<ElementType extends XMLObject>
Overrides:
toArray in class AbstractCollection<ElementType extends XMLObject>


Copyright © 1999-2012. All Rights Reserved.