Class AbstractCollectionWrapper<T>

  • All Implemented Interfaces:
    Iterable<T>, Collection<T>

    public abstract class AbstractCollectionWrapper<T>
    extends Object
    implements Collection<T>
    Abstract list which is updating some properties when adding/removing elements.
    Since:
    11/02/13
    Version:
    $Id$
    Author:
    Marine Dumousseau (marine@ebi.ac.uk)
    • Constructor Detail

      • AbstractCollectionWrapper

        public AbstractCollectionWrapper​(Collection<T> list)

        Constructor for AbstractCollectionWrapper.

        Parameters:
        list - a Collection object.
    • Method Detail

      • size

        public int size()

        size

        Specified by:
        size in interface Collection<T>
        Returns:
        a int.
      • isEmpty

        public boolean isEmpty()

        isEmpty

        Specified by:
        isEmpty in interface Collection<T>
        Returns:
        a boolean.
      • toArray

        public <T> T[] toArray​(T[] a)

        toArray

        Specified by:
        toArray in interface Collection<T>
        Type Parameters:
        T - a T object.
        Parameters:
        a - an array of T objects.
        Returns:
        an array of T objects.
      • add

        public boolean add​(T xref)

        add

        Specified by:
        add in interface Collection<T>
        Parameters:
        xref - a T object.
        Returns:
        a boolean.
      • clear

        public void clear()

        clear

        Specified by:
        clear in interface Collection<T>
      • getWrappedList

        public Collection<T> getWrappedList()

        Getter for the field wrappedList.

        Returns:
        a Collection object.
      • needToPreProcessElementToAdd

        protected abstract boolean needToPreProcessElementToAdd​(T added)
        Method to know if an element to add needs some processing or being wrapped
        Parameters:
        added - : element that will be added to the collection
        Returns:
        true if we need to process/ wrap the element that will be added
      • processOrWrapElementToAdd

        protected abstract T processOrWrapElementToAdd​(T added)
        Method to process or wrap an element to be added to the list
        Parameters:
        added - : element that will be added to the collection
        Returns:
        the processed/wrapped element that will be added
      • processElementToRemove

        protected abstract void processElementToRemove​(Object o)

        processElementToRemove

        Parameters:
        o - a Object object.
      • needToPreProcessElementToRemove

        protected abstract boolean needToPreProcessElementToRemove​(Object o)

        needToPreProcessElementToRemove

        Parameters:
        o - a Object object.
        Returns:
        a boolean.