private void remove(NodeBuilder index, String key, String value) { ApproximateCounter.adjustCountSync(index, -1); NodeBuilder builder = index.getChildNode(key); if (builder.exists()) { ApproximateCounter.adjustCountSync(builder, -1); // Collect all builders along the given path Deque<NodeBuilder> builders = newArrayDeque(); builders.addFirst(builder); // Descend to the correct location in the index tree for (String name : PathUtils.elements(value)) { builder = builder.getChildNode(name); builders.addFirst(builder); } // Drop the match value, if present if (builder.exists()) { builder.removeProperty("match"); } // Prune all index nodes that are no longer needed prune(index, builders, key); } }
private void remove(NodeBuilder index, String key, String value) { ApproximateCounter.adjustCountSync(index, -1); NodeBuilder builder = index.getChildNode(key); if (builder.exists()) { ApproximateCounter.adjustCountSync(builder, -1); // Collect all builders along the given path Deque<NodeBuilder> builders = newArrayDeque(); builders.addFirst(builder); // Descend to the correct location in the index tree for (String name : PathUtils.elements(value)) { builder = builder.getChildNode(name); builders.addFirst(builder); } // Drop the match value, if present if (builder.exists()) { builder.removeProperty("match"); } // Prune all index nodes that are no longer needed prune(index, builders, key); } }
private void remove(NodeBuilder index, String key, String value) { ApproximateCounter.adjustCountSync(index, -1); NodeBuilder builder = index.getChildNode(key); if (builder.exists()) { ApproximateCounter.adjustCountSync(builder, -1); // Collect all builders along the given path Deque<NodeBuilder> builders = newArrayDeque(); builders.addFirst(builder); // Descend to the correct location in the index tree for (String name : PathUtils.elements(value)) { builder = builder.getChildNode(name); builders.addFirst(builder); } // Drop the match value, if present if (builder.exists()) { builder.removeProperty("match"); } // Prune all index nodes that are no longer needed prune(index, builders, key); } }