1 19 20 package edu.umd.cs.findbugs.ba.obl; 21 22 34 public class State { 35 private ObligationSet obligationSet; 36 private Path path; 37 38 private State() { 39 } 40 41 public State(int maxObligationTypes, ObligationFactory factory) { 42 this.obligationSet = new ObligationSet(maxObligationTypes, factory); 43 this.path = new Path(); 44 } 45 46 49 public ObligationSet getObligationSet() { 50 return obligationSet; 51 } 52 53 56 public Path getPath() { 57 return path; 58 } 59 60 public State duplicate() { 61 State dup = new State(); 62 dup.obligationSet = this.obligationSet.duplicate(); 63 dup.path = this.path.duplicate(); 64 65 return dup; 66 } 67 68 @Override 69 public boolean equals(Object o) { 70 if (o == null || o.getClass() != this.getClass()) 71 return false; 72 State other = (State) o; 73 return this.obligationSet.equals(other.obligationSet) 74 || this.path.equals(other.path); 75 } 76 77 @Override 78 public int hashCode() { 79 return obligationSet.hashCode() + (1009 * path.hashCode()); 80 } 81 82 @Override 83 public String toString() { 84 StringBuffer buf = new StringBuffer (); 85 buf.append("["); 86 buf.append(obligationSet.toString()); 87 buf.append(","); 88 buf.append(path.toString()); 89 buf.append("]"); 90 return buf.toString(); 91 } 92 } 93 94 | Popular Tags |