@Override public boolean equals(Object obj) { Log.debug("Running equality check for graphs"); if (this == obj) { return true; } if (obj == null) { return false; } if (getClass() != obj.getClass()) { return false; } Graph other = (Graph) obj; if (gds == null) { if (other.gds != null) { return false; } } else if (!gds.equals(other.gds)) { return false; } if (timestamp != other.timestamp) { return false; } if (name == null) { if (other.name != null) { return false; } } else if (!name.equals(other.name)) { return false; } Log.debug("Basics equal, going for edges and nodes"); if (edges == null) { if (other.edges != null) { return false; } } else if (!this.edges.equals(other.edges)) { Log.debug("Edges not equal (type: " + edges.getClass() + ")"); return false; } if (nodes == null) { if (other.nodes != null) { return false; } } else if (!this.nodes.equals(other.nodes)) { Log.debug("Nodes not equal (type: " + nodes.getClass() + ")"); return false; } return true; }
/** * Retrieve the number of edges within this graph * * @return */ public int getEdgeCount() { return edges.size(); }
public boolean containsEdge(Edge e) { return edges.contains(e); }
public boolean removeEdge(Edge e) { return edges.remove(e); }
public boolean addEdge(Edge e) { return this.containsNodes(e) && edges.add(e); }