/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.facebook.presto.operator;

import com.facebook.presto.spi.Page;
import com.facebook.presto.spi.type.Type;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;

import java.util.List;

public interface Operator
{
    ListenableFuture<?> NOT_BLOCKED = Futures.immediateFuture(null);

    OperatorContext getOperatorContext();

    List<Type> getTypes();

    void finish();

    boolean isFinished();

    ListenableFuture<?> isBlocked();

    boolean needsInput();

    void addInput(Page page);

    Page getOutput();
}

@@ -956,174 +956,1069 @@
     
-List%3CType%3E getTypes();%0A%0A    void finish();%0A%0A    boolean isFinished();%0A%0A    ListenableFuture%3C?%3E isBlocked();%0A%0A    boolean needsInput();%0A%0A    void addInput(Page page);%0A
+/**%0A     * Gets the column types of pages produced by this operator.%0A     */%0A    List%3CType%3E getTypes();%0A%0A    /**%0A     * Notifies the operator that no more pages will be added and the%0A     * operator should finish processing and flush results.%0A     */%0A    void finish();%0A%0A    /**%0A     * Is this operator completely finished processing and no more%0A     * output pages will be produced.%0A     */%0A    boolean isFinished();%0A%0A    /**%0A     * Returns a future that will be completed when the operator becomes%0A     * unblocked.  If the operator is not blocked, this method should return%0A     * %7B@code NOT_BLOCKED%7D.%0A     */%0A    ListenableFuture%3C?%3E isBlocked();%0A%0A    /**%0A     * Returns true if and only if this operator can accept an input page.%0A     */%0A    boolean needsInput();%0A%0A    /**%0A     * Adds an input page to the operator.  This method will only be called if%0A     * %7B@code needsInput()%7D returns true.%0A     */%0A    void addInput(Page page);%0A%0A    /**%0A     * Gets an output page from the operator.  If no output data is currently%0A     * available, return null.%0A     */
 %0A   

Add documentation to Operator interface