1 19 20 package edu.umd.cs.findbugs.detect; 21 22 23 import edu.umd.cs.findbugs.ba.Location; 24 25 31 public class StreamEscape implements Comparable <StreamEscape> { 32 public final Stream source; 33 public final Location target; 34 35 42 public StreamEscape(Stream source, Location target) { 43 this.source = source; 44 this.target = target; 45 } 46 47 public int compareTo(StreamEscape other) { 48 int cmp = source.compareTo(other.source); 49 if (cmp != 0) return cmp; 50 return target.compareTo(other.target); 51 } 52 53 public int hashCode() { 54 return source.hashCode() + 7*target.hashCode(); 55 } 56 @Override 57 public boolean equals(Object o) { 58 if (!(o instanceof StreamEscape)) return false; 59 StreamEscape other = (StreamEscape) o; 60 return source.equals(other.source) && target.equals(other.target); 61 } 62 @Override 63 public String toString() { 64 return source + " to " + target; 65 } 66 } 67 68 | Popular Tags |