GraphStore implements DirectedGraph, DirectedSubgraph { @Override public boolean addNode(final Node node) { autoWriteLock(); try { return nodeStore.add(node); } finally { autoWriteUnlock(); } } GraphStore();  GraphStore(GraphModelImpl model); @Override boolean addNode(final Node node); @Override boolean addAllNodes(final Collection<? extends Node> nodes); @Override boolean addEdge(final Edge edge); @Override boolean addAllEdges(Collection<? extends Edge> edges); @Override NodeImpl getNode(final Object id); @Override boolean hasNode(final Object id); @Override EdgeImpl getEdge(final Object id); @Override boolean hasEdge(final Object id); @Override Edge getMutualEdge(Edge edge); @Override NodeIterable getNodes(); @Override EdgeIterable getEdges(); @Override EdgeIterable getSelfLoops(); @Override boolean removeNode(final Node node); @Override boolean removeEdge(final Edge edge); @Override boolean removeAllNodes(Collection<? extends Node> nodes); @Override boolean removeAllEdges(Collection<? extends Edge> edges); NodeStore getNodeStore(); EdgeStore getEdgeStore(); @Override boolean contains(final Node node); @Override boolean contains(final Edge edge); @Override Edge getEdge(final Node node1, final Node node2, final int type); @Override EdgeIterable getEdges(Node node1, Node node2, int type); @Override Edge getEdge(final Node node1, final Node node2); @Override EdgeIterable getEdges(Node node1, Node node2); @Override NodeIterable getNeighbors(final Node node); @Override NodeIterable getNeighbors(final Node node, final int type); @Override NodeIterable getPredecessors(final Node node); @Override NodeIterable getPredecessors(final Node node, final int type); @Override NodeIterable getSuccessors(final Node node); @Override NodeIterable getSuccessors(final Node node, final int type); @Override EdgeIterable getEdges(final Node node); @Override EdgeIterable getEdges(final Node node, final int type); @Override EdgeIterable getInEdges(final Node node); @Override EdgeIterable getInEdges(final Node node, final int type); @Override EdgeIterable getOutEdges(final Node node); @Override EdgeIterable getOutEdges(final Node node, final int type); @Override int getNodeCount(); @Override int getEdgeCount(); @Override int getEdgeCount(final int type); @Override Node getOpposite(final Node node, final Edge edge); @Override int getDegree(final Node node); int getUndirectedDegree(final Node node); @Override int getInDegree(final Node node); @Override int getOutDegree(final Node node); @Override boolean isSelfLoop(final Edge edge); @Override boolean isDirected(final Edge edge); @Override boolean isAdjacent(final Node node1, final Node node2); @Override boolean isAdjacent(final Node node1, final Node node2, final int type); @Override boolean isIncident(final Edge edge1, final Edge edge2); @Override boolean isIncident(final Node node, final Edge edge); @Override void clearEdges(final Node node); @Override void clearEdges(final Node node, final int type); @Override void clear(); @Override void clearEdges(); @Override GraphView getView(); @Override Object getAttribute(String key); @Override Object getAttribute(String key, double timestamp); @Override Object getAttribute(String key, Interval interval); @Override Set<String> getAttributeKeys(); @Override void setAttribute(String key, Object value); @Override void removeAttribute(String key); @Override void setAttribute(String key, Object value, double timestamp); @Override void setAttribute(String key, Object value, Interval interval); @Override void removeAttribute(String key, double timestamp); @Override void removeAttribute(String key, Interval interval); @Override void readLock(); @Override void readUnlock(); @Override void readUnlockAll(); @Override void writeLock(); @Override void writeUnlock(); @Override GraphModel getModel(); @Override boolean isDirected(); @Override boolean isUndirected(); @Override boolean isMixed(); @Override void union(Subgraph subGraph); @Override void intersection(Subgraph subGraph); @Override void fill(); @Override void not(); @Override Graph getRootGraph(); int deepHashCode(); boolean deepEquals(GraphStore obj);  }
@Test public void testAddNode() { GraphStore graphStore = new GraphStore(); NodeImpl[] nodes = GraphGenerator.generateNodeList(1); Assert.assertTrue(graphStore.addNode(nodes[0])); Assert.assertFalse(graphStore.addNode(nodes[0])); Assert.assertTrue(graphStore.contains(nodes[0])); }
@Test(expectedExceptions = ClassCastException.class) public void testAddNodeClass() { GraphStore graphStore = new GraphStore(); graphStore.addNode(new Node() { @Override public Object getId() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(String key) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(Column column) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(Column column, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(String key, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object[] getAttributes() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Set<String> getAttributeKeys() { throw new UnsupportedOperationException("Not supported yet."); } @Override public ColumnIterable getAttributeColumns() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(String key) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(Column column) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(String key, Object value) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(Column column, Object value) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void clearAttributes() { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(String key, Object value, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(Column column, Object value, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean addTimestamp(double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean removeTimestamp(double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public double[] getTimestamps() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float x() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float y() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float z() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float r() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float g() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float b() { throw new UnsupportedOperationException("Not supported yet."); } @Override public int getRGBA() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Color getColor() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float alpha() { throw new UnsupportedOperationException("Not supported yet."); } @Override public float size() { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setX(float x) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setY(float y) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setZ(float z) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setPosition(float x, float y) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setPosition(float x, float y, float z) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setR(float r) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setG(float g) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setB(float b) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAlpha(float a) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setColor(Color color) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setSize(float size) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean isFixed() { throw new UnsupportedOperationException("Not supported yet."); } @Override public <T extends LayoutData> T getLayoutData() { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setFixed(boolean fixed) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setLayoutData(LayoutData layoutData) { throw new UnsupportedOperationException("Not supported yet."); } @Override public TextProperties getTextProperties() { throw new UnsupportedOperationException("Not supported yet."); } @Override public String getLabel() { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setLabel(String label) { throw new UnsupportedOperationException("Not supported yet."); } @Override public int getStoreId() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(String key, GraphView view) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(Column column, GraphView view) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean hasTimestamp(double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(String key, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(Column column, double timestamp) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(String key, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object getAttribute(Column column, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(String key, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Object removeAttribute(Column column, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(String key, Object value, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public void setAttribute(Column column, Object value, Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean addInterval(Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean removeInterval(Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public boolean hasInterval(Interval interval) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Interval[] getIntervals() { throw new UnsupportedOperationException("Not supported yet."); } @Override public Iterable<Map.Entry> getAttributes(Column column) { throw new UnsupportedOperationException("Not supported yet."); } @Override public Table getTable() { throw new UnsupportedOperationException("Not supported yet."); } }); }