aboutsummaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/grouping/request/EachOperation.java
blob: 2ea7d932a032cc7787f094b452ed085407a03f23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.grouping.request;

import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * 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 Simon Thoresen Hult
 * @author bratseth
 */
public class EachOperation extends GroupingOperation {

    /**
     * Constructs a new instance of this class.
     */
    public EachOperation() {
        super("each", null);
    }

    private EachOperation(GroupingOperation parentOfCopy,
                          String image,
                          String label,
                          List<GroupingExpression> orderBy,
                          List<GroupingExpression> outputs,
                          List<GroupingOperation> children,
                          Map<String, GroupingExpression> aliases,
                          Set<String> hints,
                          GroupingExpression groupBy,
                          String where,
                          boolean forceSinglePass,
                          double accuracy,
                          int precision,
                          int level,
                          int max) {
        super(parentOfCopy, image, label, orderBy, outputs, children, aliases, hints, groupBy, where, forceSinglePass, accuracy, precision, level, max);
    }

    @Override
    public EachOperation copy(GroupingOperation parentOfCopy) {
        return new EachOperation(parentOfCopy,
                                 getImage(),
                                 getLabel(),
                                 getOrderBy(),
                                 getOutputs(),
                                 getChildren(),
                                 getAliases(),
                                 getHints(),
                                 getGroupBy(),
                                 getWhere(),
                                 getForceSinglePass(),
                                 getAccuracy(),
                                 getPrecision(),
                                 getLevel(),
                                 getMax());
    }

    @Override
    public void resolveLevel(int level) {
        if (level == 0) {
            throw new IllegalArgumentException("Operation '" + this + "' can not operate on " + getLevelDesc(level) + ".");
        }
        super.resolveLevel(level - 1);
    }
}