Skip to content

Commit

Permalink
fixing hashcode, equals, and toString of bounds string
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanCheshire committed Jul 9, 2024
1 parent 56a0988 commit a5448d1
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,10 @@ public int hashCode() {
int ret = text.hashCode();
ret = 31 * ret + Double.hashCode(width);
ret = 31 * ret + Double.hashCode(height);
ret = 31 * ret + font.hashCode();
ret = 31 * ret + Double.hashCode(maxWidth);
ret = 31 * ret + Double.hashCode(maxHeight);
ret = 31 * ret + Integer.hashCode(linePadding);
return ret;
}

Expand All @@ -244,7 +248,11 @@ public String toString() {
return "BoundsString{"
+ "text=\"" + text + "\", "
+ "width=" + width + ", "
+ "height=" + height
+ "height=" + height + ", "
+ "font=" + font + ", "
+ "maxWidth=" + maxWidth + ", "
+ "maxHeight=" + maxHeight + ", "
+ "linePadding=" + linePadding
+ "}";
}

Expand All @@ -259,7 +267,11 @@ public boolean equals(Object o) {
BoundsString other = (BoundsString) o;
return text.equals(other.getText())
&& width == other.getWidth()
&& height == other.getHeight();
&& height == other.getHeight()
&& font.equals(other.font)
&& maxWidth == other.maxWidth
&& maxHeight == other.maxHeight
&& linePadding == other.linePadding;
}

/** A builder for constructing a BoundsString object. */
Expand Down

0 comments on commit a5448d1

Please sign in to comment.