00001 /* 00002 * Created on 05.03.2005 00003 * 00004 */ 00005 package org.dronus.graph; 00006 00011 public class Edge{ 00012 protected Node to,from; 00013 public String id, type; 00014 public float myspring; 00015 00016 public Edge(Node from, Node to, String id, String type) { 00017 this.from = from; 00018 this.to = to; 00019 this.id=id; 00020 this.type=type; 00021 } 00022 public Edge(Node from, Node to, String id, String type, float myspring) { 00023 this.from = from; 00024 this.to = to; 00025 this.id=id; 00026 this.type=type; 00027 this.myspring=myspring; 00028 } 00029 public Node getOtherEndpt(Node n) { 00030 if (to != n) return to; 00031 else return from; 00032 } 00033 public Node getFrom() { 00034 return from; 00035 } 00036 public Node getTo() { 00037 return to; 00038 } 00039 00040 public boolean equals(Object other) { 00041 return other instanceof Edge 00042 && ((Edge)other).from==from 00043 && ((Edge)other).to==to; 00044 } 00045 00046 public int hashCode() { 00047 return from.hashCode()^to.hashCode(); 00048 } 00049 }