All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.sirix.index.art.Values Maven / Gradle / Ivy

Go to download

SirixDB is a hybrid on-disk and in-memory document oriented, versioned database system. It has a lightweight buffer manager, stores everything in a huge persistent and durable tree and allows efficient reconstruction of every revision. Furthermore, SirixDB implements change tracking, diffing and supports time travel queries.

There is a newer version: 0.11.0
Show newest version
package io.sirix.index.art;

import java.util.AbstractCollection;
import java.util.Iterator;

// contains all stuff borrowed from TreeMap
// such methods/utilities should be taken out and made a library of their own
// so any implementation of NavigableMap can reuse it, while the implementation
// provides certain primitive methods (getEntry, successor, predecessor, etc)

class Values extends AbstractCollection {
	private final AdaptiveRadixTree m;

	Values(AdaptiveRadixTree m){
		this.m = m;
	}

	@Override
	public Iterator iterator() {
		return m.valueIterator();
	}

	@Override
	public int size() {
		return m.size();
	}

	@Override
	public boolean contains(Object o) {
		return m.containsValue(o);
	}

	@Override
	public boolean remove(Object o) {
		for (LeafNode e = m.getFirstEntry(); e != null; e = AdaptiveRadixTree.successor(e)) {
			if (AdaptiveRadixTree.valEquals(e.getValue(), o)) {
				m.deleteEntry(e);
				return true;
			}
		}
		return false;
	}

	@Override
	public void clear() {
		m.clear();
	}

	// TODO: implement Spliterator
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy