@Test public void testClear() { ColumnStore<Node> columnStore = generateBasicNodeColumnStore(); IndexStore<Node> indexStore = columnStore.indexStore; IndexImpl<Node> mainIndex = indexStore.mainIndex; Column col = columnStore.getColumn("age"); NodeImpl n1 = new NodeImpl("0"); n1.setAttribute(col, 1); NodeImpl n2 = new NodeImpl("1"); n2.setAttribute(col, 5); indexStore.index(n1); indexStore.index(n2); indexStore.clear(); Assert.assertEquals(mainIndex.count(col, 1), 0); Assert.assertTrue(mainIndex.values(col).isEmpty()); }
public void clear(T element) { ElementImpl elementImpl = (ElementImpl) element; lock(); try { final int length = columnStore.length; final ColumnImpl[] cols = columnStore.columns; for (int i = 0; i < length; i++) { Column c = cols[i]; if (c != null && c.isIndexed() && elementImpl.attributes.length > c.getIndex()) { Object value = elementImpl.attributes[c.getIndex()]; mainIndex.remove(c, value, element); for (Entry<GraphView, IndexImpl<T>> entry : viewIndexes.entrySet()) { GraphViewImpl graphView = (GraphViewImpl) entry.getKey(); DirectedSubgraph graph = graphView.getDirectedGraph(); boolean inView = element instanceof Node ? graph.contains((Node) element) : graph .contains((Edge) element); if (inView) { entry.getValue().remove(c, value, element); } } } } } finally { unlock(); } }
IndexStore { public void clear(T element) { ElementImpl elementImpl = (ElementImpl) element; lock(); try { final int length = columnStore.length; final ColumnImpl[] cols = columnStore.columns; for (int i = 0; i < length; i++) { Column c = cols[i]; if (c != null && c.isIndexed() && elementImpl.attributes.length > c.getIndex()) { Object value = elementImpl.attributes[c.getIndex()]; mainIndex.remove(c, value, element); for (Entry<GraphView, IndexImpl<T>> entry : viewIndexes.entrySet()) { GraphViewImpl graphView = (GraphViewImpl) entry.getKey(); DirectedSubgraph graph = graphView.getDirectedGraph(); boolean inView = element instanceof Node ? graph.contains((Node) element) : graph .contains((Edge) element); if (inView) { entry.getValue().remove(c, value, element); } } } } } finally { unlock(); } } }
IndexStore { public void clear(T element) { ElementImpl elementImpl = (ElementImpl) element; lock(); try { final int length = columnStore.length; final ColumnImpl[] cols = columnStore.columns; for (int i = 0; i < length; i++) { Column c = cols[i]; if (c != null && c.isIndexed() && elementImpl.attributes.length > c.getIndex()) { Object value = elementImpl.attributes[c.getIndex()]; mainIndex.remove(c, value, element); for (Entry<GraphView, IndexImpl<T>> entry : viewIndexes.entrySet()) { GraphViewImpl graphView = (GraphViewImpl) entry.getKey(); DirectedSubgraph graph = graphView.getDirectedGraph(); boolean inView = element instanceof Node ? graph.contains((Node) element) : graph .contains((Edge) element); if (inView) { entry.getValue().remove(c, value, element); } } } } } finally { unlock(); } } IndexStore(ColumnStore<T> columnStore); }
IndexStore { public void clear(T element) { ElementImpl elementImpl = (ElementImpl) element; lock(); try { final int length = columnStore.length; final ColumnImpl[] cols = columnStore.columns; for (int i = 0; i < length; i++) { Column c = cols[i]; if (c != null && c.isIndexed() && elementImpl.attributes.length > c.getIndex()) { Object value = elementImpl.attributes[c.getIndex()]; mainIndex.remove(c, value, element); for (Entry<GraphView, IndexImpl<T>> entry : viewIndexes.entrySet()) { GraphViewImpl graphView = (GraphViewImpl) entry.getKey(); DirectedSubgraph graph = graphView.getDirectedGraph(); boolean inView = element instanceof Node ? graph.contains((Node) element) : graph .contains((Edge) element); if (inView) { entry.getValue().remove(c, value, element); } } } } } finally { unlock(); } } IndexStore(ColumnStore<T> columnStore); Object set(Column column, Object oldValue, Object value, T element); void clear(T element); void index(T element); void indexView(Graph graph); void indexInView(T element, GraphView view); void clearInView(T element, GraphView view); void clear(GraphView view); void clear(); }
IndexStore { public void clear(T element) { ElementImpl elementImpl = (ElementImpl) element; lock(); try { final int length = columnStore.length; final ColumnImpl[] cols = columnStore.columns; for (int i = 0; i < length; i++) { Column c = cols[i]; if (c != null && c.isIndexed() && elementImpl.attributes.length > c.getIndex()) { Object value = elementImpl.attributes[c.getIndex()]; mainIndex.remove(c, value, element); for (Entry<GraphView, IndexImpl<T>> entry : viewIndexes.entrySet()) { GraphViewImpl graphView = (GraphViewImpl) entry.getKey(); DirectedSubgraph graph = graphView.getDirectedGraph(); boolean inView = element instanceof Node ? graph.contains((Node) element) : graph .contains((Edge) element); if (inView) { entry.getValue().remove(c, value, element); } } } } } finally { unlock(); } } IndexStore(ColumnStore<T> columnStore); Object set(Column column, Object oldValue, Object value, T element); void clear(T element); void index(T element); void indexView(Graph graph); void indexInView(T element, GraphView view); void clearInView(T element, GraphView view); void clear(GraphView view); void clear();  }