示例#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);
 }