Class ContentListFacade<T extends Node>

  • All Implemented Interfaces:
    java.lang.Iterable<T>, java.util.Collection<T>, java.util.List<T>

    public class ContentListFacade<T extends Node>
    extends java.util.AbstractList<T>

    ContentListFacade represents a facade of the content of a Branch which is returned via calls to the Branch.content() method to allow users to modify the content of a Branch directly using the List interface. This list is backed by the branch such that changes to the list will be reflected in the branch and changes to the branch will be reflected in this list.

    • 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, T node)  
      boolean add​(T node)  
      boolean addAll​(int index, java.util.Collection<? extends T> collection)  
      boolean addAll​(java.util.Collection<? extends T> collection)  
      protected Node asNode​(java.lang.Object object)  
      void clear()  
      boolean contains​(java.lang.Object o)  
      boolean containsAll​(java.util.Collection<?> c)  
      T get​(int index)  
      protected java.util.List<T> getBackingList()  
      int indexOf​(java.lang.Object o)  
      boolean isEmpty()  
      int lastIndexOf​(java.lang.Object o)  
      T remove​(int index)  
      boolean remove​(java.lang.Object object)  
      boolean removeAll​(java.util.Collection<?> c)  
      T set​(int index, T node)  
      int size()  
      java.lang.Object[] toArray()  
      java.lang.Object[] toArray​(java.lang.Object[] a)  
      • Methods inherited from class java.util.AbstractList

        equals, hashCode, iterator, listIterator, listIterator, removeRange, subList
      • Methods inherited from class java.util.AbstractCollection

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

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

        parallelStream, removeIf, stream, toArray
      • Methods inherited from interface java.lang.Iterable

        forEach
      • Methods inherited from interface java.util.List

        replaceAll, retainAll, sort, spliterator
    • Constructor Detail

      • ContentListFacade

        public ContentListFacade​(AbstractBranch branch,
                                 java.util.List<T> branchContent)
    • Method Detail

      • add

        public boolean add​(T node)
        Specified by:
        add in interface java.util.Collection<T extends Node>
        Specified by:
        add in interface java.util.List<T extends Node>
        Overrides:
        add in class java.util.AbstractList<T extends Node>
      • add

        public void add​(int index,
                        T node)
        Specified by:
        add in interface java.util.List<T extends Node>
        Overrides:
        add in class java.util.AbstractList<T extends Node>
      • set

        public T set​(int index,
                     T node)
        Specified by:
        set in interface java.util.List<T extends Node>
        Overrides:
        set in class java.util.AbstractList<T extends Node>
      • remove

        public boolean remove​(java.lang.Object object)
        Specified by:
        remove in interface java.util.Collection<T extends Node>
        Specified by:
        remove in interface java.util.List<T extends Node>
        Overrides:
        remove in class java.util.AbstractCollection<T extends Node>
      • remove

        public T remove​(int index)
        Specified by:
        remove in interface java.util.List<T extends Node>
        Overrides:
        remove in class java.util.AbstractList<T extends Node>
      • addAll

        public boolean addAll​(java.util.Collection<? extends T> collection)
        Specified by:
        addAll in interface java.util.Collection<T extends Node>
        Specified by:
        addAll in interface java.util.List<T extends Node>
        Overrides:
        addAll in class java.util.AbstractCollection<T extends Node>
      • addAll

        public boolean addAll​(int index,
                              java.util.Collection<? extends T> collection)
        Specified by:
        addAll in interface java.util.List<T extends Node>
        Overrides:
        addAll in class java.util.AbstractList<T extends Node>
      • clear

        public void clear()
        Specified by:
        clear in interface java.util.Collection<T extends Node>
        Specified by:
        clear in interface java.util.List<T extends Node>
        Overrides:
        clear in class java.util.AbstractList<T extends Node>
      • removeAll

        public boolean removeAll​(java.util.Collection<?> c)
        Specified by:
        removeAll in interface java.util.Collection<T extends Node>
        Specified by:
        removeAll in interface java.util.List<T extends Node>
        Overrides:
        removeAll in class java.util.AbstractCollection<T extends Node>
      • size

        public int size()
        Specified by:
        size in interface java.util.Collection<T extends Node>
        Specified by:
        size in interface java.util.List<T extends Node>
        Specified by:
        size in class java.util.AbstractCollection<T extends Node>
      • isEmpty

        public boolean isEmpty()
        Specified by:
        isEmpty in interface java.util.Collection<T extends Node>
        Specified by:
        isEmpty in interface java.util.List<T extends Node>
        Overrides:
        isEmpty in class java.util.AbstractCollection<T extends Node>
      • contains

        public boolean contains​(java.lang.Object o)
        Specified by:
        contains in interface java.util.Collection<T extends Node>
        Specified by:
        contains in interface java.util.List<T extends Node>
        Overrides:
        contains in class java.util.AbstractCollection<T extends Node>
      • toArray

        public java.lang.Object[] toArray()
        Specified by:
        toArray in interface java.util.Collection<T extends Node>
        Specified by:
        toArray in interface java.util.List<T extends Node>
        Overrides:
        toArray in class java.util.AbstractCollection<T extends Node>
      • toArray

        public java.lang.Object[] toArray​(java.lang.Object[] a)
        Specified by:
        toArray in interface java.util.Collection<T extends Node>
        Specified by:
        toArray in interface java.util.List<T extends Node>
        Overrides:
        toArray in class java.util.AbstractCollection<T extends Node>
      • containsAll

        public boolean containsAll​(java.util.Collection<?> c)
        Specified by:
        containsAll in interface java.util.Collection<T extends Node>
        Specified by:
        containsAll in interface java.util.List<T extends Node>
        Overrides:
        containsAll in class java.util.AbstractCollection<T extends Node>
      • get

        public T get​(int index)
        Specified by:
        get in interface java.util.List<T extends Node>
        Specified by:
        get in class java.util.AbstractList<T extends Node>
      • indexOf

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

        public int lastIndexOf​(java.lang.Object o)
        Specified by:
        lastIndexOf in interface java.util.List<T extends Node>
        Overrides:
        lastIndexOf in class java.util.AbstractList<T extends Node>
      • asNode

        protected Node asNode​(java.lang.Object object)
      • getBackingList

        protected java.util.List<T> getBackingList()