Class STree<T>

java.lang.Object
swim.collections.STreeContext<T>
swim.collections.STree<T>
All Implemented Interfaces:
Cloneable, Iterable<T>, Collection<T>, List<T>, swim.codec.Debug, swim.util.KeyedList<T>

public class STree<T> extends STreeContext<T> implements swim.util.KeyedList<T>, Cloneable, swim.codec.Debug
  • Constructor Details

    • STree

      protected STree(STreePage<T> root)
    • STree

      public STree()
  • Method Details

    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Collection<T>
      Specified by:
      isEmpty in interface List<T>
    • size

      public int size()
      Specified by:
      size in interface Collection<T>
      Specified by:
      size in interface List<T>
    • contains

      public boolean contains(Object value)
      Specified by:
      contains in interface Collection<T>
      Specified by:
      contains in interface List<T>
    • containsAll

      public boolean containsAll(Collection<?> values)
      Specified by:
      containsAll in interface Collection<T>
      Specified by:
      containsAll in interface List<T>
    • indexOf

      public int indexOf(Object value)
      Specified by:
      indexOf in interface List<T>
    • lastIndexOf

      public int lastIndexOf(Object value)
      Specified by:
      lastIndexOf in interface List<T>
    • get

      public T get(int index)
      Specified by:
      get in interface List<T>
    • get

      public T get(int index, Object key)
      Specified by:
      get in interface swim.util.KeyedList<T>
    • getEntry

      public Map.Entry<Object,T> getEntry(int index)
      Specified by:
      getEntry in interface swim.util.KeyedList<T>
    • getEntry

      public Map.Entry<Object,T> getEntry(int index, Object key)
      Specified by:
      getEntry in interface swim.util.KeyedList<T>
    • set

      public T set(int index, T newValue)
      Specified by:
      set in interface List<T>
    • set

      public T set(int index, T newValue, Object key)
      Specified by:
      set in interface swim.util.KeyedList<T>
    • add

      public boolean add(T newValue)
      Specified by:
      add in interface Collection<T>
      Specified by:
      add in interface List<T>
    • add

      public boolean add(T newValue, Object key)
      Specified by:
      add in interface swim.util.KeyedList<T>
    • addAll

      public boolean addAll(Collection<? extends T> newValues)
      Specified by:
      addAll in interface Collection<T>
      Specified by:
      addAll in interface List<T>
    • add

      public void add(int index, T newValue)
      Specified by:
      add in interface List<T>
    • add

      public void add(int index, T newValue, Object key)
      Specified by:
      add in interface swim.util.KeyedList<T>
    • addAll

      public boolean addAll(int index, Collection<? extends T> newValues)
      Specified by:
      addAll in interface List<T>
    • remove

      public T remove(int index)
      Specified by:
      remove in interface List<T>
    • remove

      public T remove(int index, Object key)
      Specified by:
      remove in interface swim.util.KeyedList<T>
    • remove

      public boolean remove(Object value)
      Specified by:
      remove in interface Collection<T>
      Specified by:
      remove in interface List<T>
    • removeAll

      public boolean removeAll(Collection<?> values)
      Specified by:
      removeAll in interface Collection<T>
      Specified by:
      removeAll in interface List<T>
    • retainAll

      public boolean retainAll(Collection<?> values)
      Specified by:
      retainAll in interface Collection<T>
      Specified by:
      retainAll in interface List<T>
    • move

      public void move(int fromIndex, int toIndex)
      Specified by:
      move in interface swim.util.KeyedList<T>
    • move

      public void move(int fromIndex, int toIndex, Object key)
      Specified by:
      move in interface swim.util.KeyedList<T>
    • drop

      public void drop(int lower)
    • take

      public void take(int upper)
    • clear

      public void clear()
      Specified by:
      clear in interface Collection<T>
      Specified by:
      clear in interface List<T>
    • updated

      public STree<T> updated(int index, T newValue)
    • updated

      public STree<T> updated(int index, T newValue, Object key)
    • appended

      public STree<T> appended(T newValue)
    • appended

      public STree<T> appended(T newValue, Object key)
    • inserted

      public STree<T> inserted(int index, T newValue)
    • inserted

      public STree<T> inserted(int index, T newValue, Object key)
    • removed

      public STree<T> removed(int index)
    • removed

      public STree<T> removed(int index, Object key)
    • removed

      public STree<T> removed(Object value)
    • toArray

      public Object[] toArray()
      Specified by:
      toArray in interface Collection<T>
      Specified by:
      toArray in interface List<T>
    • toArray

      public <U> U[] toArray(U[] array)
      Specified by:
      toArray in interface Collection<T>
      Specified by:
      toArray in interface List<T>
    • iterator

      public swim.util.Cursor<T> iterator()
      Specified by:
      iterator in interface Collection<T>
      Specified by:
      iterator in interface Iterable<T>
      Specified by:
      iterator in interface List<T>
    • listIterator

      public swim.util.Cursor<T> listIterator()
      Specified by:
      listIterator in interface List<T>
    • listIterator

      public swim.util.Cursor<T> listIterator(int index)
      Specified by:
      listIterator in interface List<T>
    • keyIterator

      public swim.util.Cursor<Object> keyIterator()
      Specified by:
      keyIterator in interface swim.util.KeyedList<T>
    • entryIterator

      public swim.util.Cursor<Map.Entry<Object,T>> entryIterator()
      Specified by:
      entryIterator in interface swim.util.KeyedList<T>
    • reverseIterator

      public swim.util.Cursor<T> reverseIterator()
    • reverseKeyIterator

      public swim.util.Cursor<Object> reverseKeyIterator()
    • reverseEntryIterator

      public swim.util.Cursor<Map.Entry<Object,T>> reverseEntryIterator()
    • subList

      public List<T> subList(int fromIndex, int toIndex)
      Specified by:
      subList in interface List<T>
    • clone

      public STree<T> clone()
      Overrides:
      clone in class Object
    • copy

      protected STree<T> copy(STreePage<T> root)
    • identify

      protected Object identify(T value)
      Overrides:
      identify in class STreeContext<T>
    • compare

      protected int compare(Object x, Object y)
      Overrides:
      compare in class STreeContext<T>
    • pageSplitSize

      protected int pageSplitSize()
      Overrides:
      pageSplitSize in class STreeContext<T>
    • pageShouldSplit

      protected boolean pageShouldSplit(STreePage<T> page)
      Overrides:
      pageShouldSplit in class STreeContext<T>
    • pageShouldMerge

      protected boolean pageShouldMerge(STreePage<T> page)
      Overrides:
      pageShouldMerge in class STreeContext<T>
    • lookup

      protected int lookup(int start, Object key)
    • equals

      public boolean equals(Object other)
      Specified by:
      equals in interface Collection<T>
      Specified by:
      equals in interface List<T>
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Collection<T>
      Specified by:
      hashCode in interface List<T>
      Overrides:
      hashCode in class Object
    • debug

      public <U> swim.codec.Output<U> debug(swim.codec.Output<U> output)
      Specified by:
      debug in interface swim.codec.Debug
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • empty

      public static <T> STree<T> empty()
    • of

      public static <T> STree<T> of(T... values)