test/java/time/tck/java/time/MockSimplePeriod.java

Print this page




 159     @Override
 160     public boolean equals(Object obj) {
 161         if (this == obj) {
 162            return true;
 163         }
 164         if (obj instanceof MockSimplePeriod) {
 165             MockSimplePeriod other = (MockSimplePeriod) obj;
 166             return this.amount == other.amount &&
 167                     this.unit.equals(other.unit);
 168         }
 169         return false;
 170     }
 171 
 172     @Override
 173     public int hashCode() {
 174         return unit.hashCode() ^ (int) (amount ^ (amount >>> 32));
 175     }
 176 
 177     @Override
 178     public String toString() {
 179         return amount + " " + unit.getName();
 180     }
 181 
 182 }


 159     @Override
 160     public boolean equals(Object obj) {
 161         if (this == obj) {
 162            return true;
 163         }
 164         if (obj instanceof MockSimplePeriod) {
 165             MockSimplePeriod other = (MockSimplePeriod) obj;
 166             return this.amount == other.amount &&
 167                     this.unit.equals(other.unit);
 168         }
 169         return false;
 170     }
 171 
 172     @Override
 173     public int hashCode() {
 174         return unit.hashCode() ^ (int) (amount ^ (amount >>> 32));
 175     }
 176 
 177     @Override
 178     public String toString() {
 179         return amount + " " + unit;
 180     }
 181 
 182 }