Jadex 0.96-beta1

jadex.util.collection
Class BeanChangesArrayList

java.lang.Object
  extended by java.util.AbstractCollection
      extended by java.util.AbstractList
          extended by java.util.ArrayList
              extended by jadex.util.collection.BeanChangesArrayList
All Implemented Interfaces:
Serializable, Cloneable, Iterable, Collection, List, RandomAccess

public class BeanChangesArrayList
extends ArrayList

An array list with property change support. Throws events when the list changes.

See Also:
Serialized Form

Constructor Summary
BeanChangesArrayList()
          Create a new array list.
 
Method Summary
 void add(int index, Object o)
          Inserts the specified element at the specified position in this list.
 boolean add(Object o)
          Appends the specified element to the end of this list.
 boolean addAll(Collection collection)
          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, Collection collection)
          Inserts all of the elements in the specified Collection into this list, starting at the specified position.
 void addPropertyChangeListener(PropertyChangeListener listener)
          Add a PropertyChangeListener to the listener list.
 void modified()
          Indicate that the list has changed.
 Object remove(int index)
          Removes the element at the specified position in this list.
 boolean remove(Object o)
          Removes a single instance of the specified element from this list, if it is present (optional operation).
 void removePropertyChangeListener(PropertyChangeListener listener)
          Remove a PropertyChangeListener from the listener list.
 void removeRange(int fromIndex, int toIndex)
          Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.
 Object set(int index, Object o)
          Replaces the element at the specified position in this list with the specified element.
 
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, get, indexOf, isEmpty, lastIndexOf, size, toArray, toArray, trimToSize
 
Methods inherited from class java.util.AbstractList
equals, hashCode, iterator, listIterator, listIterator, subList
 
Methods inherited from class java.util.AbstractCollection
containsAll, removeAll, retainAll, toString
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
containsAll, equals, hashCode, iterator, listIterator, listIterator, removeAll, retainAll, subList
 

Constructor Detail

BeanChangesArrayList

public BeanChangesArrayList()
Create a new array list.

Method Detail

set

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

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

add

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

Specified by:
add in interface Collection
Specified by:
add in interface List
Overrides:
add in class ArrayList
Parameters:
o - element to be appended to this list.
Returns:
true (as per the general contract of Collection.add).

add

public void add(int index,
                Object o)
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 List
Overrides:
add in class ArrayList
Parameters:
index - index at which the specified element is to be inserted.
o - element to be inserted.
Throws:
IndexOutOfBoundsException - if index is out of range (index < 0 || index > size()).

remove

public 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 List
Overrides:
remove in class ArrayList
Parameters:
index - the index of the element to removed.
Returns:
the element that was removed from the list.
Throws:
IndexOutOfBoundsException - if index out of range (index < 0 || index >= size()).

remove

public boolean remove(Object o)
Removes a single instance of the specified element from this list, if it is present (optional operation). More formally, removes an element e such that (o==null ? e==null : o.equals(e)), if the list contains one or more such elements. Returns true if the list contained the specified element (or equivalently, if the list changed as a result of the call).

Specified by:
remove in interface Collection
Specified by:
remove in interface List
Overrides:
remove in class ArrayList
Parameters:
o - element to be removed from this list, if present.
Returns:
true if the list contained the specified element.

addAll

public boolean addAll(Collection collection)
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 Collection
Specified by:
addAll in interface List
Overrides:
addAll in class ArrayList
Parameters:
collection - the elements to be inserted into this list.
Returns:
true if this list changed as a result of the call.
Throws:
NullPointerException - if the specified collection is null.

addAll

public boolean addAll(int index,
                      Collection collection)
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 List
Overrides:
addAll in class ArrayList
Parameters:
index - index at which to insert first element from the specified collection.
collection - elements to be inserted into this list.
Returns:
true if this list changed as a result of the call.
Throws:
IndexOutOfBoundsException - if index out of range (index < 0 || index > size()).
NullPointerException - if the specified Collection is null.

removeRange

public void removeRange(int fromIndex,
                        int toIndex)
Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive. Shifts any succeeding elements to the left (reduces their index). This call shortens the list by (toIndex - fromIndex) elements. (If toIndex==fromIndex, this operation has no effect.)

Overrides:
removeRange in class ArrayList
Parameters:
fromIndex - index of first element to be removed.
toIndex - index after last element to be removed.

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Add a PropertyChangeListener to the listener list. The listener is registered for all properties.

Parameters:
listener - The PropertyChangeListener to be added.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Remove a PropertyChangeListener from the listener list. This removes a PropertyChangeListener that was registered for all properties.

Parameters:
listener - The PropertyChangeListener to be removed.

modified

public void modified()
Indicate that the list has changed. Provoke a bean change event.


Jadex 0.96-beta1

Submit a bug or feature
For further API reference and developer documentation, see the Jadex User Guide and the Jadex Tutorial. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, and working code examples.

Copyright (C) 2002-2007 Lars Braubach, Alexander Pokahr - University of Hamburg. Use is subject to license terms.