diff options
author | Jon Bratseth <bratseth@gmail.com> | 2022-01-20 12:36:34 +0100 |
---|---|---|
committer | Jon Bratseth <bratseth@gmail.com> | 2022-01-20 12:36:34 +0100 |
commit | c13776e481b5ad866c2cbec033dae91ef7a61d42 (patch) | |
tree | bc2b30c844d8a9797ee913f886af0de996560cab /container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java | |
parent | 593c35f1aed64636249fc4ed9e9dc6a1e30fa6ac (diff) |
Cleanup
Diffstat (limited to 'container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java b/container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java index 97cbfac0b2d..500c68cf4bd 100644 --- a/container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java +++ b/container-search/src/main/java/com/yahoo/prelude/query/EquivItem.java @@ -83,11 +83,16 @@ public class EquivItem extends CompositeTaggableItem { super.adding(item); Validator.ensure("Could not add an item of type " + item.getItemType() + ": Equiv can only have word, wordAlternatives, int, exact, or phrase as children", - item.getItemType() == ItemType.WORD || - item.getItemType() == ItemType.WORD_ALTERNATIVES || - item.getItemType() == ItemType.INT || - item.getItemType() == ItemType.EXACT || - item.getItemType() == ItemType.PHRASE); + acceptsChildrenOfType(item.getItemType())); + } + + /** Returns true if this accepts child items of the given type */ + public static boolean acceptsChildrenOfType(ItemType itemType) { + return itemType == ItemType.WORD || + itemType == ItemType.WORD_ALTERNATIVES || + itemType == ItemType.INT || + itemType == ItemType.EXACT || + itemType == ItemType.PHRASE; } } |