Class PositionListBase<T,​P extends IPositionHolder<T,​P>>

  • Type Parameters:
    T - type of position
    P - type of position holder
    All Implemented Interfaces:
    IPositionListener, IPositionUpdater<T,​P>, IPreviewPositionListener, java.lang.Iterable<P>
    Direct Known Subclasses:
    PositionList

    public abstract class PositionListBase<T,​P extends IPositionHolder<T,​P>>
    extends java.lang.Object
    implements java.lang.Iterable<P>, IPositionUpdater<T,​P>
    Iterator for list positions allowing to iterate over current elements while inserting and deleting elements relative to current position

    elements inserted at current position or at current + 1 position will skipped in the iteration allowing adding new elements which will not be part of the iteration

    • Constructor Detail

      • PositionListBase

        public PositionListBase​(@NotNull
                                java.util.List<T> list,
                                @NotNull
                                PositionFactory<T,​P> factory)
    • Method Detail

      • getListeners

        @TestOnly
        public int getListeners()
      • getMaxListeners

        @TestOnly
        public int getMaxListeners()
      • getPreviewListeners

        @TestOnly
        public int getPreviewListeners()
      • iterator

        @NotNull
        public java.util.Iterator<P> iterator()
        Specified by:
        iterator in interface java.lang.Iterable<T>
      • reversedIterator

        @NotNull
        public java.util.Iterator<P> reversedIterator()
      • reversed

        @NotNull
        public java.lang.Iterable<P> reversed()
      • isEmpty

        public boolean isEmpty()
      • isNotEmpty

        public boolean isNotEmpty()
      • get

        public T get​(int index)
      • getOrNull

        public T getOrNull​(int index)
      • getOrNull

        public <S extends T> S getOrNull​(int index,
                                         java.lang.Class<S> elementClass)
      • openFrame

        public java.lang.Object openFrame()
      • getListParentId

        @NotNull
        public java.lang.String getListParentId()
      • closeFrame

        public void closeFrame​(java.lang.Object frameId)
      • getFirst

        public P getFirst()
      • getLast

        public P getLast()
      • getEnd

        public P getEnd()
      • inserted

        public void inserted​(int index,
                             int count)
        Description copied from interface: IPositionListener
        insert Notification
        Specified by:
        inserted in interface IPositionListener
        Parameters:
        index - at which insert was performed, list contents and size at this point are already updated
        count - of elements inserted
      • deleted

        public void deleted​(int index,
                            int count)
        Description copied from interface: IPositionListener
        delete Notification
        Specified by:
        deleted in interface IPositionListener
        Parameters:
        index - at which delete was performed, list contents and size at this point are already updated
        count - of elements deleted
      • deleting

        public void deleting​(int index,
                             int count)
        Description copied from interface: IPreviewPositionListener
        before delete Notification
        Specified by:
        deleting in interface IPreviewPositionListener
        Parameters:
        index - at which delete will be performed, list contents and size at this point have not changed
        count - of elements deleted
      • changing

        public java.lang.Object changing​(int index,
                                         java.lang.Object value)
        Description copied from interface: IPreviewPositionListener
        Before set Notification

        NOTE: the returned class should be the same or a subclass of original object's class

        Specified by:
        changing in interface IPreviewPositionListener
        Parameters:
        index - at which set is being performed, list contents and size at this point are not updated
        value - new value for the element
        Returns:
        value to use for setting the element
      • changed

        public void changed​(int index,
                            java.lang.Object oldValue,
                            java.lang.Object newValue)
        Description copied from interface: IPreviewPositionListener
        After set Notification

        NOTE: the returned class should be the same or a subclass of original object's class

        Specified by:
        changed in interface IPreviewPositionListener
        Parameters:
        index - at which set is being performed, list contents and size at this point are already updated
        oldValue - value at index before setting
        newValue - value at index before setting
      • set

        public T set​(int index,
                     T value)
      • remove

        public T remove​(int index)
      • remove

        public void remove​(int startIndex,
                           int endIndex)
      • add

        public boolean add​(T element)
      • add

        public boolean add​(int index,
                           T element)
      • addAll

        public boolean addAll​(@NotNull
                              java.util.Collection<? extends T> elements)
      • addAll

        public boolean addAll​(int index,
                              @NotNull
                              java.util.Collection<? extends T> elements)
      • size

        public int size()
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object