diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java b/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java new file mode 100644 index 00000000000..12f6df1f497 --- /dev/null +++ b/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java @@ -0,0 +1,26 @@ +// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. +package com.yahoo.search.grouping.request; + +/** + * This is a grouping operation that processes each element of the input list separately, as opposed to {@link + * AllOperation} which processes that list as a whole. + * + * @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a> + */ +public class EachOperation extends GroupingOperation { + + /** + * Constructs a new instance of this class. + */ + public EachOperation() { + super("each"); + } + + @Override + public void resolveLevel(int level) { + if (level == 0) { + throw new IllegalArgumentException("Operation '" + this + "' can not operate on " + getLevelDesc(level) + "."); + } + super.resolveLevel(level - 1); + } +} |