Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you 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 org.apache.pig.newplan;
 
 import java.util.Map;
 
 
 public abstract class Operator implements Serializable {
     protected SourceLocation location// The location of the operator in the original pig script.
     
     protected String name;
     protected OperatorPlan plan// plan that contains this operator
     protected transient Map<StringObjectannotations;
     protected transient final int hashPrime = 31;
 
     public Operator(String nOperatorPlan p) {
          = n;
          = p;
          = new HashMap<StringObject>();
          = new SourceLocation();
     }

    
Accept a visitor at this node in the graph.

Parameters:
v Visitor to accept.
Throws:
org.apache.pig.impl.logicalLayer.FrontendException
 
     public abstract void accept(PlanVisitor vthrows FrontendException;
 
     public String getName() {
         return ;
     }
     
     public SourceLocation getLocation() {
         return ;
     }
     
     public void setLocation(SourceLocation loc) {
          = loc;
     }
    
    
Get the plan associated with this operator.

Returns:
plan
 
     public OperatorPlan getPlan() {
         return ;
     }
    
    
Add an annotation to a node in the plan.

Parameters:
key string name of this annotation
val value, as an Object
 
     public void annotate(String keyObject val) {
         .put(keyval);
     }
    
    
Look to see if a node is annotated.

Parameters:
key string name of annotation to look for
Returns:
value of the annotation, as an Object, or null if the key is not present in the map.
 
     public Object getAnnotation(String key) {
         return .get(key);
     }

    
Remove an annotation

Parameters:
key the key of the annotation
Returns:
the original value of the annotation
 
     public Object removeAnnotation(String key) {
         return .remove(key);
     }
     
     public void setPlan(OperatorPlan p) {
          = p;
    }
    
    
This is like a shallow equals comparison. It returns true if two operators have equivalent properties even if they are different objects. Here properties mean equivalent plan and equivalent name.

Parameters:
operator
Returns:
true if two object have equivalent properties, else false
    public abstract boolean isEqual(Operator operatorthrows FrontendException;
New to GrepCode? Check out our FAQ X