cascading.operation

## Interface Operation<Context>

- All Superinterfaces:
    DeclaresResults
  All Known Subinterfaces:
    Aggregator<Context>, Assertion<PC>, Buffer<Context>, Filter<Context>, Function<Context>, GroupAssertion<C>, PlannedOperation<Context>, ValueAssertion<C>
  All Known Implementing Classes:
    AggregateBy.CompositeFunction, And, AssertEquals, AssertEqualsAll, AssertGroupBase, AssertGroupSizeEquals, AssertGroupSizeLessThan, AssertGroupSizeMoreThan, AssertMatches, AssertMatchesAll, AssertNotEquals, AssertNotNull, AssertNull, AssertSizeEquals, AssertSizeLessThan, AssertSizeMoreThan, Average, AverageBy.AverageFinal, BaseAssertion, BaseOperation, Count, Counter, DateFormatter, DateOperation, DateParser, Debug, ExtentBase, ExtremaValueBase, FieldFormatter, FieldJoiner, FilterNotNull, FilterNull, First, FirstNBuffer, Identity, Insert, Last, Limit, Logic, MaxValue, MinValue, NoOp, Not, Or, RegexFilter, RegexGenerator, RegexMatcher, RegexOperation, RegexParser, RegexReplace, RegexSplitGenerator, RegexSplitter, Sample, SetValue, Status, Sum, UnGroup, Unique.FilterPartialDuplicates, Xor

      public interface Operation<Context>
      extends DeclaresResults

  Interface Operation is the base interface for all functions applied to `Tuple` streams.

  Specifically `Function`, `Filter`, `Aggregator`, `Buffer`, and `Assertion`.

  Use `BaseOperation` for a convenient way to create new Operation types.
  See Also:
    `BaseOperation`, `Function`, `Filter`, `Aggregator`, `Buffer`, `Assertion`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static int` | `ANY` Field ANY denotes that a given Operation will take any number of argument values

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `cleanup(FlowProcess flowProcess, OperationCall<Context> operationCall)` The cleanup method is called immediately after the current Operation instance is taken out of play processing Tuples.
    `void` | `flush(FlowProcess flowProcess, OperationCall<Context> operationCall)` The flush method is called when an Operation that is caching values must empty the cache.
    `Fields` | `getFieldDeclaration()` Returns the fields created by this Operation instance.
    `int` | `getNumArgs()` The minimum number of arguments this Operation expects from the calling `Each` or `Every` Operator.
    `boolean` | `isSafe()` Returns `true` if this Operation instance can safely execute on the same 'record' multiple times, `false` otherwise.
    `void` | `prepare(FlowProcess flowProcess, OperationCall<Context> operationCall)` The prepare method is called immediately before the current Operation instance is put into play processing Tuples.

- - ### Field Detail

    - #### ANY

          static final int ANY

      Field ANY denotes that a given Operation will take any number of argument values
      See Also:
        Constant Field Values

  - ### Method Detail

    - #### prepare

          void prepare(FlowProcess flowProcess,
                     OperationCall<Context> operationCall)

      The prepare method is called immediately before the current Operation instance is put into play processing Tuples. This method should initialize any resources that can be shutdown or released in the `cleanup(cascading.flow.FlowProcess, OperationCall)` method.

      Any resources created should be stored in the `Context`, not as instance fields on the class.

      This method may be called more than once during the life of this instance. But it will never be called multiple times without a cleanup invocation immediately before subsequent invocations.

      If the Flow this Operation instance belongs will execute on a remote cluster, this method will be called cluster side, not client side.
      Parameters:
        `flowProcess` -
        `operationCall` -

    - #### flush

          void flush(FlowProcess flowProcess,
                   OperationCall<Context> operationCall)

      The flush method is called when an Operation that is caching values must empty the cache. It is called before `cleanup(cascading.flow.FlowProcess, OperationCall)` is invoked.

      It is safe to cast the `OperationCall` to a `FunctionCall`, or equivalent, and get its `FunctionCall.getOutputCollector()`.
      Parameters:
        `flowProcess` -
        `operationCall` -

    - #### cleanup

          void cleanup(FlowProcess flowProcess,
                     OperationCall<Context> operationCall)

      The cleanup method is called immediately after the current Operation instance is taken out of play processing Tuples. This method should shutdown any resources created or initialized during the `prepare(cascading.flow.FlowProcess, OperationCall)` method.

      This method may be called more than once during the life of this instance. But it will never be called multiple times without a prepare invocation before.

      If the Flow this Operation instance belongs will execute on a remote cluster, this method will be called cluster side, not client side.
      Parameters:
        `flowProcess` -
        `operationCall` -

    - #### getFieldDeclaration

          Fields getFieldDeclaration()

      Returns the fields created by this Operation instance. If this instance is a `Filter`, it should always return `Fields.ALL`.
      Specified by:
        `getFieldDeclaration` in interface `DeclaresResults`
      Returns:
        a Fields instance

    - #### getNumArgs

          int getNumArgs()

      The minimum number of arguments this Operation expects from the calling `Each` or `Every` Operator.

      Operations should be willing to receive more arguments than expected, but should ignore them if they are unused, instead of failing.
      Returns:
        an int

    - #### isSafe

          boolean isSafe()

      Returns `true` if this Operation instance can safely execute on the same 'record' multiple times, `false` otherwise.

      That is, this Operation is safe if it has no side-effects, or if it does, they are idempotent.

      If seeing the same 'record' more than once can cause errors (internally or externally), this method must return `false`.
      Returns:
        a boolean

Copyright © 2007-2015 Concurrent, Inc. All Rights Reserved.