-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
183 additions
and
302 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
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
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,48 @@ | ||
package rules | ||
|
||
interface RuleRangeable<R> where R : RuleFamily, R : RuleRangeable<R> { | ||
/** | ||
* Checks if a rule is between 2 other rules | ||
* @param minRule The minimum rule | ||
* @param maxRule The maximum rule | ||
* @return Returns true if the rule is between the two rules, false otherwise | ||
*/ | ||
fun between(minRule: R, maxRule: R): Boolean | ||
|
||
/** | ||
* The range of rules in which the provided transitions will occur | ||
* @return Returns a pair of rules, the first is the minimum rule and the second is the maximum rule | ||
*/ | ||
fun ruleRange(transitionsToSatisfy: Iterable<List<Int>>): RuleRange<R> | ||
|
||
/** | ||
* Outputs a sequence containing all rules within the specified rule range | ||
* @param minRule The minimum rule of the rule range | ||
* @param maxRule The maximum rule of the rule range | ||
* @return Returns a sequence containing all rules within the specified rule range | ||
*/ | ||
fun enumerate(minRule: R, maxRule: R): Sequence<R> | ||
|
||
/** | ||
* Outputs an infinite sequence of random rules within the specified rule range | ||
* @param minRule The minimum rule of the rule range | ||
* @param maxRule The maximum rule of the rule range | ||
* @return Returns an infinite sequence of random rules | ||
*/ | ||
fun random(minRule: R, maxRule: R, seed: Int? = null): Sequence<R> | ||
|
||
/** | ||
* Computes the intersection between [ruleRange1] and [ruleRange2] | ||
* @param ruleRange1 One rule range to use in the intersection | ||
* @param ruleRange2 The other rule range to use in the intersection | ||
* @return A new rule range containining the rules in both [ruleRange1] and [ruleRange2]. Returns null if no intersection. | ||
*/ | ||
fun intersect(ruleRange1: RuleRange<R>, ruleRange2: RuleRange<R>): RuleRange<R>? | ||
|
||
/** | ||
* Outputs a sequence containing all rules within the specified rule range | ||
* @param maxRule The maximum rule of the rule range | ||
* @return Returns a sequence containing all rules within the specified rule range | ||
*/ | ||
operator fun rangeTo(maxRule: R): RuleRange<R> | ||
} |
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
Oops, something went wrong.