1 19 20 package edu.umd.cs.findbugs.ba.npe; 21 22 import edu.umd.cs.findbugs.ba.Location; 23 import edu.umd.cs.findbugs.ba.vna.ValueNumber; 24 25 30 public class LocationWhereValueBecomesNull implements Comparable <LocationWhereValueBecomesNull> { 31 private Location location; 32 private ValueNumber valueNumber; 33 34 40 public LocationWhereValueBecomesNull(Location location, ValueNumber valueNumber) { 41 this.location = location; 42 this.valueNumber = valueNumber; 43 } 44 45 48 public Location getLocation() { 49 return location; 50 } 51 52 55 public ValueNumber getValueNumber() { 56 return valueNumber; 57 } 58 59 62 public int compareTo(LocationWhereValueBecomesNull o) { 63 int cmp = this.location.compareTo(o.location); 64 if (cmp != 0) { 65 return cmp; 66 } 67 cmp = this.valueNumber.compareTo(o.valueNumber); 68 return cmp; 69 } 70 71 74 @Override 75 public boolean equals(Object obj) { 76 if (obj == null || obj.getClass() != this.getClass()) { 77 return false; 78 } 79 LocationWhereValueBecomesNull other = (LocationWhereValueBecomesNull) obj; 80 return this.location.equals(other.location) 81 && this.valueNumber.equals(other.valueNumber); 82 } 83 84 87 @Override 88 public int hashCode() { 89 return location.hashCode() * 6563 + valueNumber.hashCode(); 90 } 91 92 @Override 93 public String toString() { 94 return valueNumber + " becomes null at " + location.getHandle().getPosition() +":" + location; 95 } 96 } 97 | Popular Tags |