From b4fc6dd01988fa51000ec9cd775a59fc419ed54e Mon Sep 17 00:00:00 2001 From: Riccardo Azzolini Date: Mon, 12 Aug 2019 12:55:24 +0200 Subject: [PATCH] Improve PatternRule documentation --- .../warppi/math/rules/dsl/PatternRule.java | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/PatternRule.java b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/PatternRule.java index 08a94045..af9a09c9 100644 --- a/core/src/main/java/it/cavallium/warppi/math/rules/dsl/PatternRule.java +++ b/core/src/main/java/it/cavallium/warppi/math/rules/dsl/PatternRule.java @@ -21,6 +21,16 @@ public class PatternRule implements Rule { private final Pattern target; private final List replacements; + /** + * Constructs a PatternRule with the given name, type and Patterns. + * + * @param ruleName the name of the rule. + * @param ruleType the type of the rule. + * @param target the Pattern used to match functions and capture sub-functions. + * @param replacements the list of Patterns used to construct replacement functions. + * All sub-functions which are referenced within these Patterns must be captured + * by target. + */ public PatternRule( final String ruleName, final RuleType ruleType, @@ -33,6 +43,16 @@ public class PatternRule implements Rule { this.replacements = replacements; } + /** + * Constructs a PatternRule with the given name, type and Patterns. + * + * @param ruleName the name of the rule. + * @param ruleType the type of the rule. + * @param target the Pattern used to match functions and capture sub-functions. + * @param replacements the Patterns used to construct replacement functions. + * All sub-functions which are referenced within these Patterns must be captured + * by target. + */ public PatternRule( final String ruleName, final RuleType ruleType, @@ -52,10 +72,16 @@ public class PatternRule implements Rule { return ruleType; } + /** + * @return the Pattern used to match functions and capture sub-functions. + */ public Pattern getTarget() { return target; } + /** + * @return the list of Patterns used to construct replacement functions. + */ public List getReplacements() { return replacements; }