Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * 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 java.util.List;
 
 import static com.google.common.base.Preconditions.checkNotNull;
 import static com.google.common.base.Preconditions.checkState;
 
 public class ValuesOperator
         implements Operator
 {
     public static class ValuesOperatorFactory
             implements OperatorFactory
     {
         private final int operatorId;
         private final List<Typetypes;
         private final List<Pagepages;
         private boolean closed;
 
         public ValuesOperatorFactory(int operatorIdList<TypetypesList<Pagepages)
         {
             this. = operatorId;
             this. = ImmutableList.copyOf(checkNotNull(types"types is null"));
             this. = ImmutableList.copyOf(checkNotNull(pages"pages is null"));
         }
 
         @Override
         public List<TypegetTypes()
         {
             return ;
         }
 
         @Override
         public Operator createOperator(DriverContext driverContext)
         {
             checkState(!"Factory is already closed");
             OperatorContext operatorContext = driverContext.addOperatorContext(ValuesOperator.class.getSimpleName());
             return new ValuesOperator(operatorContext);
         }
 
         @Override
         public void close()
         {
              = true;
         }
     }
 
     private final OperatorContext operatorContext;
     private final ImmutableList<Typetypes;
     private final Iterator<Pagepages;
 
     public ValuesOperator(OperatorContext operatorContextList<TypetypesList<Pagepages)
     {
         this. = checkNotNull(operatorContext"operatorContext is null");
         this. = ImmutableList.copyOf(checkNotNull(types"types is null"));
 
         checkNotNull(pages"pages is null");
 
         this. = ImmutableList.copyOf(pages).iterator();
     }
 
     @Override
     {
         return ;
     }
 
     @Override
     public List<TypegetTypes()
     {
         return ;
     }
 
     @Override
     public void finish()
     {
         Iterators.size();
     }
 
     @Override
     public boolean isFinished()
    {
        return !.hasNext();
    }
    @Override
    public boolean needsInput()
    {
        return false;
    }
    @Override
    public void addInput(Page page)
    {
        throw new UnsupportedOperationException();
    }
    @Override
    public Page getOutput()
    {
        if (!.hasNext()) {
            return null;
        }
        Page page = .next();
        if (page != null) {
        }
        return page;
    }
New to GrepCode? Check out our FAQ X