- java.lang.Object
-
- swim.collections.STreeContext<T>
-
- swim.collections.STree<T>
-
public class STree<T> extends STreeContext<T> implements KeyedList<T>, Cloneable, Debug
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(int index, T newValue)voidadd(int index, T newValue, Object key)booleanadd(T newValue)booleanadd(T newValue, Object key)booleanaddAll(int index, Collection<? extends T> newValues)booleanaddAll(Collection<? extends T> newValues)STree<T>appended(T newValue)STree<T>appended(T newValue, Object key)voidclear()STree<T>clone()protected intcompare(Object x, Object y)booleancontains(Object value)booleancontainsAll(Collection<?> values)protected STree<T>copy(STreePage<T> root)<U> Output<U>debug(Output<U> output)Writes a developer readable, debug-formatted string representation of this object tooutput.voiddrop(int lower)static <T> STree<T>empty()Cursor<Map.Entry<Object,T>>entryIterator()booleanequals(Object other)Tget(int index)Tget(int index, Object key)Map.Entry<Object,T>getEntry(int index)Map.Entry<Object,T>getEntry(int index, Object key)inthashCode()protected Objectidentify(T value)intindexOf(Object value)STree<T>inserted(int index, T newValue)STree<T>inserted(int index, T newValue, Object key)booleanisEmpty()Cursor<T>iterator()Cursor<Object>keyIterator()intlastIndexOf(Object value)Cursor<T>listIterator()Cursor<T>listIterator(int index)protected intlookup(int start, Object key)voidmove(int fromIndex, int toIndex)voidmove(int fromIndex, int toIndex, Object key)static <T> STree<T>of(T... values)protected booleanpageShouldMerge(STreePage<T> page)protected booleanpageShouldSplit(STreePage<T> page)protected intpageSplitSize()Tremove(int index)Tremove(int index, Object key)booleanremove(Object value)booleanremoveAll(Collection<?> values)STree<T>removed(int index)STree<T>removed(int index, Object key)STree<T>removed(Object value)booleanretainAll(Collection<?> values)Cursor<Map.Entry<Object,T>>reverseEntryIterator()Cursor<T>reverseIterator()Cursor<Object>reverseKeyIterator()Tset(int index, T newValue)Tset(int index, T newValue, Object key)intsize()List<T>subList(int fromIndex, int toIndex)voidtake(int upper)Object[]toArray()<U> U[]toArray(U[] array)StringtoString()STree<T>updated(int index, T newValue)STree<T>updated(int index, T newValue, Object key)-
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.Collection
parallelStream, removeIf, stream, toArray
-
Methods inherited from interface java.util.List
replaceAll, sort, spliterator
-
-
-
-
Method Detail
-
isEmpty
public boolean isEmpty()
-
size
public int size()
-
contains
public boolean contains(Object value)
-
containsAll
public boolean containsAll(Collection<?> values)
- Specified by:
containsAllin interfaceCollection<T>- Specified by:
containsAllin interfaceList<T>
-
lastIndexOf
public int lastIndexOf(Object value)
- Specified by:
lastIndexOfin interfaceList<T>
-
add
public boolean add(T newValue)
-
addAll
public boolean addAll(Collection<? extends T> newValues)
-
addAll
public boolean addAll(int index, Collection<? extends T> newValues)
-
remove
public boolean remove(Object value)
-
removeAll
public boolean removeAll(Collection<?> values)
-
retainAll
public boolean retainAll(Collection<?> values)
-
move
public void move(int fromIndex, int toIndex, Object key)
-
drop
public void drop(int lower)
-
take
public void take(int upper)
-
clear
public void clear()
-
toArray
public Object[] toArray()
-
toArray
public <U> U[] toArray(U[] array)
-
listIterator
public Cursor<T> listIterator()
- Specified by:
listIteratorin interfaceList<T>
-
listIterator
public Cursor<T> listIterator(int index)
- Specified by:
listIteratorin interfaceList<T>
-
keyIterator
public Cursor<Object> keyIterator()
- Specified by:
keyIteratorin interfaceKeyedList<T>
-
entryIterator
public Cursor<Map.Entry<Object,T>> entryIterator()
- Specified by:
entryIteratorin interfaceKeyedList<T>
-
identify
protected Object identify(T value)
- Overrides:
identifyin classSTreeContext<T>
-
compare
protected int compare(Object x, Object y)
- Overrides:
comparein classSTreeContext<T>
-
pageSplitSize
protected int pageSplitSize()
- Overrides:
pageSplitSizein classSTreeContext<T>
-
pageShouldSplit
protected boolean pageShouldSplit(STreePage<T> page)
- Overrides:
pageShouldSplitin classSTreeContext<T>
-
pageShouldMerge
protected boolean pageShouldMerge(STreePage<T> page)
- Overrides:
pageShouldMergein classSTreeContext<T>
-
lookup
protected int lookup(int start, Object key)
-
equals
public boolean equals(Object other)
-
hashCode
public int hashCode()
-
debug
public <U> Output<U> debug(Output<U> output)
Description copied from interface:DebugWrites a developer readable, debug-formatted string representation of this object tooutput.
-
empty
public static <T> STree<T> empty()
-
of
public static <T> STree<T> of(T... values)
-
-