Skip to content

Commit

Permalink
Simplify Implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
KingOfSquares committed Dec 18, 2021
1 parent 1c0eb1c commit 6a7320c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 117 deletions.
14 changes: 10 additions & 4 deletions api/src/main/java/net/kyori/adventure/util/HSVLikeImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,9 @@ final class HSVLikeImpl implements HSVLike {
private final float v;

HSVLikeImpl(final float h, final float s, final float v) {
final RangeImpl range = new RangeImpl(0, 1);
range.requireInside(h, "h");
range.requireInside(s, "s");
range.requireInside(v, "v");
requireInsideRange(h, "h");
requireInsideRange(s, "s");
requireInsideRange(v, "v");
this.h = h;
this.s = s;
this.v = v;
Expand All @@ -57,6 +56,13 @@ public float v() {
return this.v;
}

private static void requireInsideRange(final float number, final String name) throws IllegalArgumentException {
if (!(0 <= number && number <= 1)) {
throw new IllegalArgumentException(
name + " (" + number + ")" + " is not inside the required range: [" + 0 + "," + 1 + "]");
}
}

@Override
public boolean equals(final @Nullable Object other) {
if (this == other) return true;
Expand Down
67 changes: 0 additions & 67 deletions api/src/main/java/net/kyori/adventure/util/Range.java

This file was deleted.

46 changes: 0 additions & 46 deletions api/src/main/java/net/kyori/adventure/util/RangeImpl.java

This file was deleted.

0 comments on commit 6a7320c

Please sign in to comment.