예제 #1
0
파일: Graph.java 프로젝트: nopanic/DNA
  @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;
  }
예제 #2
0
파일: Graph.java 프로젝트: nopanic/DNA
 /**
  * Retrieve the number of edges within this graph
  *
  * @return
  */
 public int getEdgeCount() {
   return edges.size();
 }
예제 #3
0
파일: Graph.java 프로젝트: nopanic/DNA
 public boolean containsEdge(Edge e) {
   return edges.contains(e);
 }
예제 #4
0
파일: Graph.java 프로젝트: nopanic/DNA
 public boolean removeEdge(Edge e) {
   return edges.remove(e);
 }
예제 #5
0
파일: Graph.java 프로젝트: nopanic/DNA
 public boolean addEdge(Edge e) {
   return this.containsNodes(e) && edges.add(e);
 }