Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
package overflowdb;
import org.h2.mvstore.MVMap;
import overflowdb.storage.OdbStorage;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.LongStream;
public final class IndexManager {
private final Graph graph;
protected Map>> indexes = new ConcurrentHashMap<>();
protected Map dirtyFlags = new ConcurrentHashMap<>();
public IndexManager(Graph graph) {
this.graph = graph;
}
/**
* Create an index for specified node property.
* Whenever an element has the specified key mutated, the index is updated.
* When the index is created, all existing elements are indexed to ensure that they are captured by the index.
*/
public final void createNodePropertyIndex(final String propertyName) {
checkPropertyName(propertyName);
if (indexes.containsKey(propertyName))
return;
dirtyFlags.put(propertyName, true);
graph.nodes.iterator().forEachRemaining(node -> {
Object value = node.property(propertyName);
if (value != null) {
put(propertyName, value, (NodeRef) node);
}
});
}
public boolean isIndexed(final String propertyName) {
return indexes.containsKey(propertyName);
}
private void checkPropertyName(String propertyName) {
if (propertyName == null || propertyName.isEmpty())
throw new IllegalArgumentException("Illegal property name: " + propertyName);
}
private final void loadNodePropertyIndex(final String propertyName, Map