Skip to content

Commit

Permalink
Merge pull request #23 from TheRoddyWMS/FixBufferValueTests
Browse files Browse the repository at this point in the history
Add equals and hashCode to BufferValue
  • Loading branch information
vinjana committed Aug 20, 2018
2 parents 9d9ebeb + aad6905 commit d42c039
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion src/main/groovy/de/dkfz/roddy/tools/BufferValue.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package de.dkfz.roddy.tools
*/
public class BufferValue {

/**
/**
* The stored value aligned to KiloByte
*/
private Long alignedValue;
Expand Down Expand Up @@ -90,4 +90,23 @@ public class BufferValue {
return alignedValue
return alignedValue * baseUnit.multiplier / unit.multiplier as Long
}

boolean equals(o) {
if (this.is(o)) return true
if (getClass() != o.class) return false

BufferValue that = (BufferValue) o

if (alignedValue != that.alignedValue) return false
if (baseUnit != that.baseUnit) return false

return true
}

int hashCode() {
int result
result = (alignedValue != null ? alignedValue.hashCode() : 0)
result = 31 * result + (baseUnit != null ? baseUnit.hashCode() : 0)
return result
}
}

0 comments on commit d42c039

Please sign in to comment.