Class 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.ArrayList
    An 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 SimplePropertyChangeSupport pcs
      The proerty change thrower.
      • Fields inherited from class java.util.AbstractList

        modCount
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanChangesArrayList()
      Create a new array list.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, java.lang.Object o)
      Inserts the specified element at the specified position in this list.
      boolean add​(java.lang.Object o)
      Appends the specified element to the end of this list.
      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.
      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.
      void addPropertyChangeListener​(PropertyChangeListener listener)
      Add a PropertyChangeListener to the listener list.
      boolean equals​(java.lang.Object o)
      Identity required for rete.
      java.lang.Object getList()
      Get the list of elements.
      int getSize()  
      int hashCode()
      Constant hashcode required for rete.
      void modified()
      Indicate that the list has changed.
      java.lang.Object remove​(int index)
      Removes the element at the specified position in this list.
      boolean remove​(java.lang.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.
      java.lang.Object set​(int index, java.lang.Object o)
      Replaces the element at the specified position in this list with the specified element.
      void setList​(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
      • Methods inherited from class java.util.AbstractCollection

        containsAll, toString
      • Methods inherited from class java.lang.Object

        finalize, getClass, notify, notifyAll, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        parallelStream, stream, toArray
      • Methods inherited from interface java.util.List

        containsAll
    • Constructor Detail

      • BeanChangesArrayList

        public BeanChangesArrayList()
        Create a new array list.
    • 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:
        set in interface java.util.List
        Overrides:
        set in class java.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:
        add in interface java.util.Collection
        Specified by:
        add in interface java.util.List
        Overrides:
        add in class java.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:
        add in interface java.util.List
        Overrides:
        add in class java.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:
        remove in interface java.util.List
        Overrides:
        remove in class java.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:
        remove in interface java.util.Collection
        Specified by:
        remove in interface java.util.List
        Overrides:
        remove in class java.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:
        addAll in interface java.util.Collection
        Specified by:
        addAll in interface java.util.List
        Overrides:
        addAll in class java.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:
        addAll in interface java.util.List
        Overrides:
        addAll in class java.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 range
        java.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:
        removeRange in class java.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:
        hashCode in interface java.util.Collection
        Specified by:
        hashCode in interface java.util.List
        Overrides:
        hashCode in class java.util.ArrayList
      • equals

        public boolean equals​(java.lang.Object o)
        Identity required for rete.
        Specified by:
        equals in interface java.util.Collection
        Specified by:
        equals in interface java.util.List
        Overrides:
        equals in class java.util.ArrayList