| 1 19 20 25 26 package soot.jimple.toolkits.annotation.arraycheck; 27 28 class WeightedDirectedEdge { 29 Object from, to; 30 int weight; 31 public WeightedDirectedEdge(Object from, Object to, int weight) 32 { 33 this.from = from; 34 this.to = to; 35 this.weight = weight; 36 } 37 38 public int hashCode() 39 { 40 return from.hashCode()+to.hashCode()+weight; 41 } 42 43 public boolean equals(Object other) 44 { 45 if (other instanceof WeightedDirectedEdge) 46 { 47 WeightedDirectedEdge another = (WeightedDirectedEdge)other; 48 return ( (this.from == another.from) 49 &&(this.to == another.to) 50 &&(this.weight==another.weight) ); 51 } 52 return false; 53 } 54 55 public String toString() 56 { 57 return from+"->"+to+"="+weight; 58 } 59 } 60 | Popular Tags |