Class AbstractKFList<T>

  • All Implemented Interfaces:
    ej.kf.FeatureStateListener, java.lang.Iterable<T>, java.util.Collection<T>
    Direct Known Subclasses:
    KFList, KFList2

    public abstract class AbstractKFList<T>
    extends java.lang.Object
    implements java.util.Collection<T>, ej.kf.FeatureStateListener
    Implementation of a Collection with multi-context support.

    This class can only be embedded in Kernel code. It cannot be embedded into Feature code.

    This collection does not allow to pass null elements.

    The semantic is the following:

    • Each context has its dedicated list, acting as an ArrayList.
    • A Feature can add Feature or Kernel objects to its list.
    • The Kernel can only add Kernel objects to its list. However it has the full control and visibility on all the elements of the collection. For example, the call of the Collection.clear() method clears the whole collection. The call to Collection.iterator() method return an iterator on all objects of the collection...

    See Also:
    KFList, KFList2
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractKFList()  
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      boolean addAll​(java.util.Collection<? extends T> c)  
      boolean containsAll​(java.util.Collection<?> c)  
      boolean removeAll​(java.util.Collection<?> c)  
      protected abstract void removeAllElementsOwnedBy​(ej.kf.Feature feature)
      Removed all elements owned by the given Feature.
      boolean retainAll​(java.util.Collection<?> c)  
      void stateChanged​(ej.kf.Feature feature, ej.kf.Feature.State previousState)  
      java.lang.Object[] toArray()  
      <E> E[] toArray​(E[] a)  
      protected abstract void toArray​(java.util.ArrayList<T> allList)
      Add all the elements of the collection to the given ArrayList.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Collection

        add, clear, contains, equals, hashCode, isEmpty, iterator, parallelStream, remove, removeIf, size, spliterator, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
    • Constructor Detail

      • AbstractKFList

        public AbstractKFList()
    • Method Detail

      • stateChanged

        public final void stateChanged​(ej.kf.Feature feature,
                                       ej.kf.Feature.State previousState)
        Specified by:
        stateChanged in interface ej.kf.FeatureStateListener
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> c)
        Specified by:
        addAll in interface java.util.Collection<T>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<T>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<T>
      • retainAll

        public boolean retainAll​(java.util.Collection<?> c)
        Specified by:
        retainAll in interface java.util.Collection<T>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<T>
      • toArray

        public <E> E[] toArray​(E[] a)
        Specified by:
        toArray in interface java.util.Collection<T>
      • removeAllElementsOwnedBy

        protected abstract void removeAllElementsOwnedBy​(ej.kf.Feature feature)
        Removed all elements owned by the given Feature.
        Parameters:
        feature - the owner of the elements to be removed
      • toArray

        protected abstract void toArray​(java.util.ArrayList<T> allList)
        Add all the elements of the collection to the given ArrayList.
        Parameters:
        allList - the list where all elements are added.