Package jadex.bdi.testcases.beliefs
Class BeanChangesArrayList
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractList<E>
-
- java.util.ArrayList
-
- jadex.bdi.testcases.beliefs.BeanChangesArrayList
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Cloneable,java.lang.Iterable,java.util.Collection,java.util.List,java.util.RandomAccess
public class BeanChangesArrayList extends java.util.ArrayListAn array list with property change support. Throws events when the list changes.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected SimplePropertyChangeSupportpcsThe proerty change thrower.
-
Constructor Summary
Constructors Constructor Description BeanChangesArrayList()Create a new array list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, java.lang.Object o)Inserts the specified element at the specified position in this list.booleanadd(java.lang.Object o)Appends the specified element to the end of this list.booleanaddAll(int index, java.util.Collection collection)Inserts all of the elements in the specified Collection into this list, starting at the specified position.booleanaddAll(java.util.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.voidaddPropertyChangeListener(PropertyChangeListener listener)Add a PropertyChangeListener to the listener list.booleanequals(java.lang.Object o)Identity required for rete.java.lang.ObjectgetList()Get the list of elements.intgetSize()inthashCode()Constant hashcode required for rete.voidmodified()Indicate that the list has changed.java.lang.Objectremove(int index)Removes the element at the specified position in this list.booleanremove(java.lang.Object o)Removes a single instance of the specified element from this list, if it is present (optional operation).voidremovePropertyChangeListener(PropertyChangeListener listener)Remove a PropertyChangeListener from the listener list.voidremoveRange(int fromIndex, int toIndex)Removes from this List all of the elements whose index is between fromIndex, inclusive and toIndex, exclusive.java.lang.Objectset(int index, java.lang.Object o)Replaces the element at the specified position in this list with the specified element.voidsetList(java.lang.Object list)Set the list of elements.-
Methods inherited from class java.util.ArrayList
clear, clone, contains, ensureCapacity, forEach, get, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, removeAll, removeIf, replaceAll, retainAll, size, sort, spliterator, subList, toArray, toArray, trimToSize
-
-
-
-
Field Detail
-
pcs
protected SimplePropertyChangeSupport pcs
The proerty change thrower.
-
-
Method Detail
-
getSize
public int getSize()
-
set
public java.lang.Object set(int index, java.lang.Object o)Replaces the element at the specified position in this list with the specified element.- Specified by:
setin interfacejava.util.List- Overrides:
setin classjava.util.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:
java.lang.IndexOutOfBoundsException- if index out of range
-
add
public boolean add(java.lang.Object o)
Appends the specified element to the end of this list.- Specified by:
addin interfacejava.util.Collection- Specified by:
addin interfacejava.util.List- Overrides:
addin classjava.util.ArrayList- Parameters:
o- element to be appended to this list.- Returns:
-
add
public void add(int index, java.lang.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:
addin interfacejava.util.List- Overrides:
addin classjava.util.ArrayList- Parameters:
index- index at which the specified element is to be inserted.o- element to be inserted.- Throws:
java.lang.IndexOutOfBoundsException- if index is out of range
-
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:
removein interfacejava.util.List- Overrides:
removein classjava.util.ArrayList- 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
-
remove
public boolean remove(java.lang.Object o)
Removes a single instance of the specified element from this list, if it is present (optional operation). More formally, removes an element- Specified by:
removein interfacejava.util.Collection- Specified by:
removein interfacejava.util.List- Overrides:
removein classjava.util.ArrayList- Parameters:
o- element to be removed from this list, if present.- Returns:
-
addAll
public boolean addAll(java.util.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:
addAllin interfacejava.util.Collection- Specified by:
addAllin interfacejava.util.List- Overrides:
addAllin classjava.util.ArrayList- Parameters:
collection- the elements to be inserted into this list.- Returns:
-
- Throws:
java.lang.NullPointerException- if the specified collection is null.
-
addAll
public boolean addAll(int index, java.util.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:
addAllin interfacejava.util.List- Overrides:
addAllin classjava.util.ArrayList- Parameters:
index- index at which to insert first element from the specified collection.collection- elements to be inserted into this list.- Returns:
-
- Throws:
java.lang.IndexOutOfBoundsException- if index out of rangejava.lang.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- Overrides:
removeRangein classjava.util.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.
-
getList
public java.lang.Object getList()
Get the list of elements.
-
setList
public void setList(java.lang.Object list)
Set the list of elements.
-
hashCode
public int hashCode()
Constant hashcode required for rete.- Specified by:
hashCodein interfacejava.util.Collection- Specified by:
hashCodein interfacejava.util.List- Overrides:
hashCodein classjava.util.ArrayList
-
equals
public boolean equals(java.lang.Object o)
Identity required for rete.- Specified by:
equalsin interfacejava.util.Collection- Specified by:
equalsin interfacejava.util.List- Overrides:
equalsin classjava.util.ArrayList
-
-