Package sc.db

Class DBList<E extends IDBObject>

  • All Implemented Interfaces:
    java.io.Serializable, java.lang.Cloneable, java.lang.Iterable<E>, java.util.Collection<E>, java.util.List<E>, java.util.RandomAccess, IChangeable

    public class DBList<E extends IDBObject>
    extends java.util.ArrayList<E>
    implements IChangeable
    This acts like a java.util.ArrayList but is usable with data binding and persistence It does a 'copy on write' to manage a separate per-transaction view of each list that's being modified, and allows the underlying list to be updated when the transaction is committed. TODO: need to add more ArrayList methods to reflect the current transaction state to support them with lists that have been modified by not yet committed.
    See Also:
    Serialized Form
    • Field Summary

      • Fields inherited from class java.util.AbstractList

        modCount
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(int index, E element)  
      boolean add​(E value)  
      boolean addAll​(int index, java.util.Collection<? extends E> c)  
      boolean addAll​(java.util.Collection<? extends E> c)  
      void clear()  
      void forEach​(java.util.function.Consumer<? super E> action)  
      E get​(int index)  
      int indexOf​(java.lang.Object o)  
      boolean isEmpty()  
      java.util.Iterator<E> iterator()  
      int lastIndexOf​(java.lang.Object o)  
      E remove​(int index)  
      boolean remove​(java.lang.Object o)  
      boolean removeAll​(java.util.Collection<?> c)  
      void replaceAll​(java.util.function.UnaryOperator<E> operator)  
      E ret​(int index)
      Just like get but returns null if the element is out of range
      boolean retainAll​(java.util.Collection<?> c)  
      E set​(int index, E element)  
      void setRefId​(int ix, java.lang.Object refId)  
      int size()  
      void sort​(java.util.Comparator<? super E> c)  
      java.util.List<E> subList​(int from, int to)  
      java.lang.Object[] toArray()  
      void updateToList​(java.util.List<E> newList)  
      • Methods inherited from class java.util.ArrayList

        clone, contains, ensureCapacity, equals, hashCode, listIterator, listIterator, removeIf, removeRange, spliterator, 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
    • Method Detail

      • add

        public boolean add​(E value)
        Specified by:
        add in interface java.util.Collection<E extends IDBObject>
        Specified by:
        add in interface java.util.List<E extends IDBObject>
        Overrides:
        add in class java.util.ArrayList<E extends IDBObject>
      • remove

        public boolean remove​(java.lang.Object o)
        Specified by:
        remove in interface java.util.Collection<E extends IDBObject>
        Specified by:
        remove in interface java.util.List<E extends IDBObject>
        Overrides:
        remove in class java.util.ArrayList<E extends IDBObject>
      • addAll

        public boolean addAll​(java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.Collection<E extends IDBObject>
        Specified by:
        addAll in interface java.util.List<E extends IDBObject>
        Overrides:
        addAll in class java.util.ArrayList<E extends IDBObject>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends E> c)
        Specified by:
        addAll in interface java.util.List<E extends IDBObject>
        Overrides:
        addAll in class java.util.ArrayList<E extends IDBObject>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<E extends IDBObject>
        Specified by:
        removeAll in interface java.util.List<E extends IDBObject>
        Overrides:
        removeAll in class java.util.ArrayList<E extends IDBObject>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<E extends IDBObject>
        Specified by:
        retainAll in interface java.util.List<E extends IDBObject>
        Overrides:
        retainAll in class java.util.ArrayList<E extends IDBObject>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<E extends IDBObject>
        Specified by:
        clear in interface java.util.List<E extends IDBObject>
        Overrides:
        clear in class java.util.ArrayList<E extends IDBObject>
      • set

        public E set​(int index,
                     E element)
        Specified by:
        set in interface java.util.List<E extends IDBObject>
        Overrides:
        set in class java.util.ArrayList<E extends IDBObject>
      • add

        public void add​(int index,
                        E element)
        Specified by:
        add in interface java.util.List<E extends IDBObject>
        Overrides:
        add in class java.util.ArrayList<E extends IDBObject>
      • remove

        public E remove​(int index)
        Specified by:
        remove in interface java.util.List<E extends IDBObject>
        Overrides:
        remove in class java.util.ArrayList<E extends IDBObject>
      • ret

        public E ret​(int index)
        Just like get but returns null if the element is out of range
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<E extends IDBObject>
        Specified by:
        size in interface java.util.List<E extends IDBObject>
        Overrides:
        size in class java.util.ArrayList<E extends IDBObject>
      • get

        public E get​(int index)
        Specified by:
        get in interface java.util.List<E extends IDBObject>
        Overrides:
        get in class java.util.ArrayList<E extends IDBObject>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<E extends IDBObject>
        Specified by:
        isEmpty in interface java.util.List<E extends IDBObject>
        Overrides:
        isEmpty in class java.util.ArrayList<E extends IDBObject>
      • indexOf

        public int indexOf​(java.lang.Object o)
        Specified by:
        indexOf in interface java.util.List<E extends IDBObject>
        Overrides:
        indexOf in class java.util.ArrayList<E extends IDBObject>
      • lastIndexOf

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<E extends IDBObject>
        Overrides:
        lastIndexOf in class java.util.ArrayList<E extends IDBObject>
      • updateToList

        public void updateToList​(java.util.List<E> newList)
      • setRefId

        public void setRefId​(int ix,
                             java.lang.Object refId)
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<E extends IDBObject>
        Specified by:
        toArray in interface java.util.List<E extends IDBObject>
        Overrides:
        toArray in class java.util.ArrayList<E extends IDBObject>
      • iterator

        public java.util.Iterator<E> iterator()
        Specified by:
        iterator in interface java.util.Collection<E extends IDBObject>
        Specified by:
        iterator in interface java.lang.Iterable<E extends IDBObject>
        Specified by:
        iterator in interface java.util.List<E extends IDBObject>
        Overrides:
        iterator in class java.util.ArrayList<E extends IDBObject>
      • subList

        public java.util.List<E> subList​(int from,
                                         int to)
        Specified by:
        subList in interface java.util.List<E extends IDBObject>
        Overrides:
        subList in class java.util.ArrayList<E extends IDBObject>
      • forEach

        public void forEach​(java.util.function.Consumer<? super E> action)
        Specified by:
        forEach in interface java.lang.Iterable<E extends IDBObject>
        Overrides:
        forEach in class java.util.ArrayList<E extends IDBObject>
      • sort

        public void sort​(java.util.Comparator<? super E> c)
        Specified by:
        sort in interface java.util.List<E extends IDBObject>
        Overrides:
        sort in class java.util.ArrayList<E extends IDBObject>
      • replaceAll

        public void replaceAll​(java.util.function.UnaryOperator<E> operator)
        Specified by:
        replaceAll in interface java.util.List<E extends IDBObject>
        Overrides:
        replaceAll in class java.util.ArrayList<E extends IDBObject>