com.vinculumtech.carrierwave.image.util
Class ImageArrayList

java.lang.Object
  extended byjava.util.AbstractCollection
      extended byjava.util.AbstractList
          extended bycom.vinculumtech.carrierwave.image.util.ImageArrayList
All Implemented Interfaces:
java.util.Collection, ImageContainer, java.util.List, java.io.Serializable

public class ImageArrayList
extends java.util.AbstractList
implements ImageContainer, java.io.Serializable

Version:
$Id: //depot/carrierwave/src/shared/com/vinculumtech/carrierwave/image/util/ImageArrayList.java#4 $
See Also:
Serialized Form

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
ImageArrayList(Image parent)
           
ImageArrayList(Image parent, java.util.List iconList)
           
ImageArrayList(Image parent, java.lang.String edge)
           
ImageArrayList(Image parent, java.lang.String edge, java.util.List iconList)
           
 
Method Summary
 void add(int index, java.lang.Object element)
          Inserts the specified element at the specified position in this list.
 boolean add(java.lang.Object object)
          Appends the specified element to the end of this list.
 boolean addAll(java.util.Collection c)
          Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator.
 boolean addAll(int index, java.util.Collection c)
          Inserts all of the elements in the specified Collection into this list, starting at the specified position.
 void clear()
          Removes all of the elements from this list.
 boolean contains(java.lang.Object elem)
          Returns true if this list contains the specified element.
 boolean containsAll(java.util.Collection c)
          Returns true if this collection contains all of the elements in the specified collection.
 java.lang.Object get(int index)
          Returns the element at the specified position in this list.
 java.lang.String getEdge()
           
 Icon getIcon(int index)
           
 java.util.List getIconList()
           
 java.lang.Object getIcons()
           
protected  ImageGraph getImageGraph()
           
 java.util.Collection getImages()
           
 java.util.Iterator imageIterator()
          Returns an Iterator over the owned Image instances.
 int indexOf(java.lang.Object elem)
          Searches for the first occurence of the given argument, testing for equality using the equals method.
 java.lang.Object remove(int index)
          Removes the element at the specified position in this list.
 boolean removeAll(java.util.Collection c)
          Removes from this collection all of its elements that are contained in the specified collection (optional operation).
 boolean retainAll(java.util.Collection c)
          Retains only the elements in this collection that are contained in the specified collection (optional operation).
 java.lang.Object set(int index, java.lang.Object element)
          Replaces the element at the specified position in this list with the specified element.
 int size()
          Returns the number of elements in this collection.
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, lastIndexOf, listIterator, listIterator, removeRange, subList
 
Methods inherited from class java.util.AbstractCollection
isEmpty, remove, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
isEmpty, remove, toArray, toArray
 

Constructor Detail

ImageArrayList

public ImageArrayList(Image parent,
                      java.util.List iconList)

ImageArrayList

public ImageArrayList(Image parent,
                      java.lang.String edge)

ImageArrayList

public ImageArrayList(Image parent,
                      java.lang.String edge,
                      java.util.List iconList)

ImageArrayList

public ImageArrayList(Image parent)
Method Detail

imageIterator

public java.util.Iterator imageIterator()
Returns an Iterator over the owned Image instances.

Returns:

getImageGraph

protected ImageGraph getImageGraph()

getEdge

public java.lang.String getEdge()
Specified by:
getEdge in interface ImageContainer

getImages

public java.util.Collection getImages()

getIconList

public java.util.List getIconList()

getIcons

public java.lang.Object getIcons()
Specified by:
getIcons in interface ImageContainer

contains

public boolean contains(java.lang.Object elem)
Returns true if this list contains the specified element.

Specified by:
contains in interface java.util.List
Parameters:
elem - element whose presence in this List is to be tested.

indexOf

public int indexOf(java.lang.Object elem)
Searches for the first occurence of the given argument, testing for equality using the equals method.

Specified by:
indexOf in interface java.util.List
Parameters:
elem - an object.
Returns:
the index of the first occurrence of the argument in this list; returns -1 if the object is not found.
See Also:
Object.equals(Object)

get

public java.lang.Object get(int index)
Returns the element at the specified position in this list.

Specified by:
get in interface java.util.List
Parameters:
index - index of element to return.
Returns:
the element at the specified position in this list.
Throws:
java.lang.IndexOutOfBoundsException - if index is out of range (index < 0 || index >= size()).

getIcon

public Icon getIcon(int index)

set

public java.lang.Object set(int index,
                            java.lang.Object element)
Replaces the element at the specified position in this list with the specified element.

Specified by:
set in interface java.util.List
Parameters:
index - index of element to replace.
element - element to be stored at the specified position.
Returns:
the element previously at the specified position.
Throws:
java.lang.IndexOutOfBoundsException - if index out of range (index < 0 || index >= size()).

remove

public java.lang.Object remove(int index)
Removes the element at the specified position in this list. Shifts any subsequent elements to the left (subtracts one from their indices).

Specified by:
remove in interface java.util.List
Parameters:
index - the index of the element to removed.
Returns:
the element that was removed from the list.
Throws:
java.lang.IndexOutOfBoundsException - if index out of range (index < 0 || index >= size()).

clear

public void clear()
Removes all of the elements from this list. The list will be empty after this call returns.

Specified by:
clear in interface java.util.List

add

public boolean add(java.lang.Object object)
Appends the specified element to the end of this list.

Specified by:
add in interface java.util.List
Parameters:
object - element to be appended to this list.
Returns:
true (as per the general contract of Collection.add).

add

public void add(int index,
                java.lang.Object element)
Inserts the specified element at the specified position in this list. Shifts the element currently at that position (if any) and any subsequent elements to the right (adds one to their indices).

Specified by:
add in interface java.util.List
Parameters:
index - index at which the specified element is to be inserted.
element - element to be inserted.
Throws:
java.lang.IndexOutOfBoundsException - if index is out of range (index < 0 || index > size()).

addAll

public boolean addAll(java.util.Collection c)
Appends all of the elements in the specified Collection to the end of this list, in the order that they are returned by the specified Collection's Iterator. The behavior of this operation is undefined if the specified Collection is modified while the operation is in progress. (This implies that the behavior of this call is undefined if the specified Collection is this list, and this list is nonempty.)

Specified by:
addAll in interface java.util.List
Parameters:
c - the elements to be inserted into this list.
Throws:
java.lang.IndexOutOfBoundsException - if index out of range (index < 0 || index > size()).

addAll

public boolean addAll(int index,
                      java.util.Collection c)
Inserts all of the elements in the specified Collection into this list, starting at the specified position. Shifts the element currently at that position (if any) and any subsequent elements to the right (increases their indices). The new elements will appear in the list in the order that they are returned by the specified Collection's iterator.

Specified by:
addAll in interface java.util.List
Parameters:
index - index at which to insert first element from the specified collection.
c - elements to be inserted into this list.
Throws:
java.lang.IndexOutOfBoundsException - if index out of range (index < 0 || index > size()).

removeAll

public boolean removeAll(java.util.Collection c)
Removes from this collection all of its elements that are contained in the specified collection (optional operation).

This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's so contained, it's removed from this collection with the iterator's remove method.

Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

Specified by:
removeAll in interface java.util.List
Parameters:
c - elements to be removed from this collection.
Returns:
true if this collection changed as a result of the call.
Throws:
java.lang.UnsupportedOperationException - removeAll is not supported by this collection.
See Also:
AbstractCollection.remove(Object), contains(Object)

retainAll

public boolean retainAll(java.util.Collection c)
Retains only the elements in this collection that are contained in the specified collection (optional operation). In other words, removes from this collection all of its elements that are not contained in the specified collection.

This implementation iterates over this collection, checking each element returned by the iterator in turn to see if it's contained in the specified collection. If it's not so contained, it's removed from this collection with the iterator's remove method.

Note that this implementation will throw an UnsupportedOperationException if the iterator returned by the iterator method does not implement the remove method.

Specified by:
retainAll in interface java.util.List
Parameters:
c - elements to be retained in this collection.
Returns:
true if this collection changed as a result of the call.
Throws:
java.lang.UnsupportedOperationException - if the retainAll method is not supported by this collection.
See Also:
AbstractCollection.remove(Object), contains(Object)

containsAll

public boolean containsAll(java.util.Collection c)
Returns true if this collection contains all of the elements in the specified collection.

This implementation iterates over the specified collection, checking each element returned by the iterator in turn to see if it's contained in this collection. If all elements are so contained true is returned, otherwise false.

Specified by:
containsAll in interface java.util.List
Parameters:
c - collection to be checked for containment in this collection.
Returns:
true if this collection contains all of the elements in the specified collection.
See Also:
contains(Object)

size

public int size()
Returns the number of elements in this collection. If the collection contains more than Integer.MAX_VALUE elements, returns Integer.MAX_VALUE.

Specified by:
size in interface java.util.List
Returns:
the number of elements in this collection.


Copyright (C) 2002 Vinculum Technologies, Inc. All Rights Reserved.