Exemplo n.º 1
0
  @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;
  }
Exemplo n.º 2
0
 /**
  * Retrieve the number of edges within this graph
  *
  * @return
  */
 public int getEdgeCount() {
   return edges.size();
 }
Exemplo n.º 3
0
 public boolean containsEdge(Edge e) {
   return edges.contains(e);
 }
Exemplo n.º 4
0
 public boolean removeEdge(Edge e) {
   return edges.remove(e);
 }
Exemplo n.º 5
0
 public boolean addEdge(Edge e) {
   return this.containsNodes(e) && edges.add(e);
 }