diff options
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/grouping/request/DebugWaitFunction.java')
-rw-r--r-- | container-search/src/main/java/com/yahoo/search/grouping/request/DebugWaitFunction.java | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/grouping/request/DebugWaitFunction.java b/container-search/src/main/java/com/yahoo/search/grouping/request/DebugWaitFunction.java new file mode 100644 index 00000000000..c2f26e6b3b0 --- /dev/null +++ b/container-search/src/main/java/com/yahoo/search/grouping/request/DebugWaitFunction.java @@ -0,0 +1,43 @@ +// 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; + +import java.util.Arrays; + +/** + * This class represents debug_wait function in a {@link GroupingExpression}. For each hit evaluated, + * it waits for the time specified as the second argument. The third argument specifies if the wait + * should be a busy-wait or not. The first argument is then evaluated. + * + * @author <a href="mailto:lulf@yahoo-inc.com">Ulf Lilleengen</a> + */ +public class DebugWaitFunction extends FunctionNode { + + /** + * Constructs a new instance of this class. + * + * @param arg1 The first compulsory argument, the expression to proxy. + * @param arg2 The second compulsory argument, must evaluate to a positive number. + * @param arg3 The third compulsory argument, specifying busy wait or not. + */ + public DebugWaitFunction(GroupingExpression arg1, DoubleValue arg2, BooleanValue arg3) { + super("debugwait", Arrays.asList(arg1, arg2, arg3)); + } + + /** + * Returns the time to wait when evaluating this function. + * + * @return the number of seconds to wait. + */ + public double getWaitTime() { + return ((DoubleValue)getArg(1)).getValue(); + } + + /** + * Returns whether or not the debug node should busy-wait. + * + * @return true if busy-wait, false if not. + */ + public boolean getBusyWait() { + return ((BooleanValue)getArg(2)).getValue(); + } +} |