swim.collections.BTreePage Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of swim-collections Show documentation
Show all versions of swim-collections Show documentation
Immutable, structure sharing collections, including hash array mapped tries, finger tries, B-trees, and S-trees (sequence trees)
// Copyright 2015-2019 SWIM.AI inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package swim.collections;
import java.util.Map;
import swim.util.CombinerFunction;
import swim.util.Cursor;
import swim.util.OrderedMapCursor;
public abstract class BTreePage {
BTreePage() {
// stub
}
public abstract boolean isEmpty();
public abstract int size();
public abstract int arity();
public abstract U fold();
public abstract K minKey();
public abstract K maxKey();
public abstract boolean containsKey(Object key, BTreeContext tree);
public abstract boolean containsValue(Object value);
public abstract int indexOf(Object key, BTreeContext tree);
public abstract V get(Object key, BTreeContext tree);
public abstract Map.Entry getEntry(Object key, BTreeContext tree);
public abstract Map.Entry getIndex(int index);
public abstract Map.Entry firstEntry();
public abstract Map.Entry lastEntry();
public abstract Map.Entry nextEntry(K key, BTreeContext tree);
public abstract Map.Entry previousEntry(K key, BTreeContext tree);
public abstract BTreePage updated(K key, V newValue, BTreeContext tree);
public abstract BTreePage removed(Object key, BTreeContext tree);
public abstract BTreePage drop(int lower, BTreeContext tree);
public abstract BTreePage take(int upper, BTreeContext tree);
public abstract BTreePage balanced(BTreeContext tree);
public abstract BTreePage split(int index);
public abstract BTreePage splitLeft(int index);
public abstract BTreePage splitRight(int index);
public abstract BTreePage reduced(U identity, CombinerFunction super V, U> accumulator,
CombinerFunction combiner);
public Cursor keyIterator() {
return Cursor.keys(iterator());
}
public Cursor valueIterator() {
return Cursor.values(iterator());
}
public abstract OrderedMapCursor iterator();
public Cursor lastKeyIterator() {
return Cursor.keys(lastIterator());
}
public Cursor lastValueIterator() {
return Cursor.values(lastIterator());
}
public abstract OrderedMapCursor lastIterator();
public static BTreePage empty() {
return BTreeLeaf.empty();
}
}