GraphViewImpl implements GraphView { public void fill() { if (nodeView) { if (nodeCount > 0) { nodeBitVector = new BitVector(graphStore.nodeStore.maxStoreId()); } nodeBitVector.not(); this.nodeCount = graphStore.nodeStore.size(); } if (edgeCount > 0) { edgeBitVector = new BitVector(graphStore.edgeStore.maxStoreId()); } edgeBitVector.not(); this.edgeCount = graphStore.edgeStore.size(); int typeLength = graphStore.edgeStore.longDictionary.length; this.typeCounts = new int[typeLength]; for (int i = 0; i < typeLength; i++) { int count = graphStore.edgeStore.longDictionary[i].size(); this.typeCounts[i] = count; } this.mutualEdgeTypeCounts = new int[graphStore.edgeStore.mutualEdgesTypeSize.length]; System.arraycopy(graphStore.edgeStore.mutualEdgesTypeSize, 0, this.mutualEdgeTypeCounts, 0, this.mutualEdgeTypeCounts.length); this.mutualEdgesCount = graphStore.edgeStore.mutualEdgesSize; if (edgeCount > 0) { incrementEdgeVersion(); } if (nodeCount > 0) { incrementNodeVersion(); } if (nodeView) { IndexStore<Node> nodeIndexStore = graphStore.nodeTable.store.indexStore; if (nodeIndexStore != null) { nodeIndexStore.indexView(directedDecorator); } TimeIndexStore nodeTimeIndexStore = graphStore.timeStore.nodeIndexStore; if (nodeTimeIndexStore != null) { nodeTimeIndexStore.indexView(directedDecorator); } } IndexStore<Edge> edgeIndexStore = graphStore.edgeTable.store.indexStore; if (edgeIndexStore != null) { edgeIndexStore.indexView(directedDecorator); } TimeIndexStore edgeTimeIndexStore = graphStore.timeStore.edgeIndexStore; if (edgeTimeIndexStore != null) { edgeTimeIndexStore.indexView(directedDecorator); } } GraphViewImpl(final GraphStore store, boolean nodes, boolean edges);  GraphViewImpl(final GraphViewImpl view, boolean nodes, boolean edges); boolean addNode(final Node node); boolean addAllNodes(final Collection<? extends Node> nodes); boolean addEdge(final Edge edge); boolean addAllEdges(final Collection<? extends Edge> edges); boolean removeNode(final Node node); boolean removeNodeAll(final Collection<? extends Node> nodes); boolean removeEdge(final Edge edge); boolean removeEdgeAll(final Collection<? extends Edge> edges); void clear(); void clearEdges(); void fill(); boolean containsNode(final NodeImpl node); boolean containsEdge(final EdgeImpl edge); void intersection(final GraphViewImpl otherView); void union(final GraphViewImpl otherView); void not(); void addEdgeInNodeView(EdgeImpl edge); int getNodeCount(); int getEdgeCount(); int getUndirectedEdgeCount(); int getEdgeCount(int type); int getUndirectedEdgeCount(int type); @Override GraphModelImpl getGraphModel(); @Override boolean isMainView(); @Override boolean isNodeView(); @Override boolean isEdgeView(); void setTimeInterval(Interval interval); @Override Interval getTimeInterval(); @Override boolean isDestroyed(); int deepHashCode(); boolean deepEquals(GraphViewImpl obj);  }
@Test public void testFill() { GraphStore graphStore = GraphGenerator.generateSmallMultiTypeGraphStore(); GraphViewStore store = graphStore.viewStore; GraphViewImpl view = store.createView(); DirectedSubgraph graph = store.getDirectedGraph(view); UndirectedSubgraph unGraph = store.getUndirectedGraph(view); view.fill(); Assert.assertEquals(view.getNodeCount(), graphStore.getNodeCount()); Assert.assertEquals(view.getEdgeCount(), graphStore.getEdgeCount()); for (Edge e : graphStore.getEdges()) { Assert.assertTrue(graph.contains(e)); } for (Node n : graphStore.getNodes()) { Assert.assertTrue(graph.contains(n)); } for (int i = 0; i < graphStore.edgeTypeStore.length; i++) { Assert.assertEquals(graph.getEdgeCount(i), graphStore.getEdgeCount(i)); } for (Edge e : graphStore.undirectedDecorator.getEdges()) { Assert.assertTrue(unGraph.contains(e)); } for (Node n : graphStore.undirectedDecorator.getNodes()) { Assert.assertTrue(unGraph.contains(n)); } for (int i = 0; i < graphStore.edgeTypeStore.length; i++) { Assert.assertEquals(unGraph.getEdgeCount(i), graphStore.undirectedDecorator.getEdgeCount(i)); } }