-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add support for custom item comparisons * Bump version * Mmmm eclipse is eating rocks * Apply changes from PR review * Add changelog file * Rename Comparisons.Predicate -> Comparisons.EqualityPredicate and extend BiPredicate
- Loading branch information
Showing
10 changed files
with
251 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
* Add support for custom item comparisons |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/client/java/io/github/mattidragon/tlaapi/api/plugin/Comparisons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package io.github.mattidragon.tlaapi.api.plugin; | ||
|
||
import io.github.mattidragon.tlaapi.api.recipe.TlaStackComparison; | ||
|
||
public interface Comparisons<T> { | ||
/** | ||
* Adds a default comparison method for a stack for its key. | ||
* @param item The key for the object to compare. | ||
* @param comparison The comparison and hash function | ||
*/ | ||
void register(T key, TlaStackComparison comparison); | ||
|
||
/** | ||
* Adds a default comparison method for a stack for its key. | ||
* @param keys The keys for the object to compare. | ||
* @param comparison The comparison and hash function | ||
*/ | ||
default void register(TlaStackComparison comparison, @SuppressWarnings("unchecked") T... keys) { | ||
for (T key : keys) { | ||
register(key, comparison); | ||
} | ||
} | ||
|
||
/** | ||
* Adds a default comparison method for a stack for its key. | ||
* @param keys The keys for the object to compare. | ||
* @param comparison The comparison and hash function | ||
*/ | ||
default void register(TlaStackComparison comparison, Iterable<T> keys) { | ||
for (T key : keys) { | ||
register(key, comparison); | ||
} | ||
} | ||
} |
Oops, something went wrong.