diff options
author | Jon Bratseth <bratseth@gmail.com> | 2021-03-26 07:56:44 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2021-03-26 07:56:44 +0100 |
commit | 830958254079b56705a207bc47f4f013fa10868c (patch) | |
tree | 8060d238fcb9161f81b926a48feb13bdd6676d21 /container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java | |
parent | 140cba216e27a5acbc2b28c93aa995f64d88e1b2 (diff) |
Cleanup: No functional changes
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java index d4593a5dbb9..e1bb8ff102d 100644 --- a/container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java +++ b/container-search/src/main/java/com/yahoo/prelude/semantics/rule/ReferenceTermProduction.java @@ -48,7 +48,7 @@ public class ReferenceTermProduction extends TermProduction { * @param label the label of the produced term * @param reference the label of the condition this should take it's value from */ - public ReferenceTermProduction(String label,String reference) { + public ReferenceTermProduction(String label, String reference) { super(label); setReference(reference); } @@ -60,15 +60,15 @@ public class ReferenceTermProduction extends TermProduction { * @param reference the label of the condition this should take it's value from * @param termType the type of term to produce */ - public ReferenceTermProduction(String label,String reference, TermType termType) { - super(label,termType); + public ReferenceTermProduction(String label, String reference, TermType termType) { + super(label, termType); setReference(reference); } /** The label of the condition this should take its value from, never null */ public void setReference(String reference) { Validator.ensureNotNull("reference name of a produced reference term",reference); - this.reference =reference; + this.reference = reference; } /** Returns the label of the condition this should take its value from, never null */ @@ -78,29 +78,29 @@ public class ReferenceTermProduction extends TermProduction { matchReferences.add(reference); } - public void produce(RuleEvaluation e,int offset) { - ReferencedMatches referencedMatches=e.getReferencedMatches(reference); - if (referencedMatches==null) + public void produce(RuleEvaluation e, int offset) { + ReferencedMatches referencedMatches = e.getReferencedMatches(reference); + if (referencedMatches == null) throw new EvaluationException("Referred match '" + reference + "' not found"); if (replacing) { - replaceMatches(e,referencedMatches); + replaceMatches(e, referencedMatches); } else { - addMatches(e,referencedMatches); + addMatches(e, referencedMatches); } } - public void replaceMatches(RuleEvaluation e,ReferencedMatches referencedMatches) { - Item referencedItem=referencedMatches.toItem(getLabel()); - if (referencedItem==null) return; + public void replaceMatches(RuleEvaluation e, ReferencedMatches referencedMatches) { + Item referencedItem = referencedMatches.toItem(getLabel()); + if (referencedItem == null) return; e.removeMatches(referencedMatches); - insertMatch(e, referencedMatches.matchIterator().next(),referencedItem,0); + insertMatch(e, referencedMatches.matchIterator().next(), referencedItem, 0); } - private void addMatches(RuleEvaluation e,ReferencedMatches referencedMatches) { - Item referencedItem=referencedMatches.toItem(getLabel()); - if (referencedItem==null) return; - e.addItem(referencedItem,getTermType()); + private void addMatches(RuleEvaluation e, ReferencedMatches referencedMatches) { + Item referencedItem = referencedMatches.toItem(getLabel()); + if (referencedItem == null) return; + e.addItem(referencedItem, getTermType()); } public String toInnerTermString() { |