org.eigenbase.rex
Class RexLocalRef

java.lang.Object
  extended by org.eigenbase.rex.RexNode
      extended by org.eigenbase.rex.RexVariable
          extended by org.eigenbase.rex.RexSlot
              extended by org.eigenbase.rex.RexLocalRef

public class RexLocalRef
extends RexSlot

Local variable.

Identity is based upon type and index. We want multiple references to the same slot in the same context to be equal. A side effect is that references to slots in different contexts which happen to have the same index and type will be considered equal; this is not desired, but not too damaging, because of the immutability.

Variables are immutable.

Since:
Oct 25, 2005
Version:
$Id: //open/dev/farrago/src/org/eigenbase/rex/RexLocalRef.java#10 $
Author:
jhyde

Field Summary
private static String[] names
           
 
Fields inherited from class org.eigenbase.rex.RexSlot
index
 
Fields inherited from class org.eigenbase.rex.RexVariable
name, type
 
Fields inherited from class org.eigenbase.rex.RexNode
digest, EMPTY_ARRAY
 
Constructor Summary
RexLocalRef(int index, RelDataType type)
          Creates a local variable.
 
Method Summary
<R> R
accept(RexVisitor<R> visitor)
          Accepts a visitor, dispatching to the right overloaded visitXxx method.
 RexLocalRef clone()
           
private static String createName(int index)
           
 boolean equals(Object obj)
           
 int hashCode()
           
 
Methods inherited from class org.eigenbase.rex.RexSlot
getIndex, makeArray
 
Methods inherited from class org.eigenbase.rex.RexVariable
getName, getType
 
Methods inherited from class org.eigenbase.rex.RexNode
getKind, isA, isAlwaysTrue, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

names

private static final String[] names
Constructor Detail

RexLocalRef

public RexLocalRef(int index,
                   RelDataType type)
Creates a local variable.

Parameters:
index - Index of the field in the underlying rowtype
type - Type of the column
"Precondition:"
type != null, index >= 0
Method Detail

clone

public RexLocalRef clone()
Specified by:
clone in class RexNode

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

accept

public <R> R accept(RexVisitor<R> visitor)
Description copied from class: RexNode
Accepts a visitor, dispatching to the right overloaded visitXxx method.

Also see RexProgram.apply(RexVisitor, RexNode[], RexNode), which applies a visitor to several expressions simultaneously.

Specified by:
accept in class RexNode

createName

private static String createName(int index)