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

io.sirix.index.art.EntrySet 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.AbstractSet;
import java.util.Iterator;
import java.util.Map;

class EntrySet extends AbstractSet> {
	private final AdaptiveRadixTree tree;

	EntrySet(AdaptiveRadixTree tree) {
		this.tree = tree;
	}

	@Override
	public Iterator> iterator() {
		return tree.entryIterator();
	}

	@Override
	public boolean contains(Object o) {
		if (!(o instanceof Map.Entry entry))
			return false;
		Object value = entry.getValue();
		LeafNode p = tree.getEntry(entry.getKey());
		return p != null && AdaptiveRadixTree.valEquals(p.getValue(), value);
	}

	@Override
	public boolean remove(Object o) {
		if (!(o instanceof Map.Entry entry))
			return false;
		Object value = entry.getValue();
		LeafNode p = tree.getEntry(entry.getKey());
		if (p != null && AdaptiveRadixTree.valEquals(p.getValue(), value)) {
			tree.deleteEntry(p);
			return true;
		}
		return false;
	}

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

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

	// TODO: implement Spliterator
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy