net.sf.saffron.rex
Class RexKind

java.lang.Object
  |
  +--net.sf.saffron.util.EnumeratedValues.BasicValue
        |
        +--net.sf.saffron.rex.RexKind
All Implemented Interfaces:
EnumeratedValues.Value

public class RexKind
extends EnumeratedValues.BasicValue

Enumeration of some important types of row-expression.

The values are immutable, canonical constants, so you can use Kinds to find particular types of expressions quickly. To identity a call to a common operator such as '=', use RexNode.isA(net.sf.saffron.rex.RexKind):

exp.isA(RexKind.Equals)
To identify a category of expressions, you can use RexNode.isA(net.sf.saffron.rex.RexKind) with an aggregate RexKind. The following expression will return true for calls to '=' and '>=', but false for the constant '5', or a call to '+':
exp.isA(RexKind.Comparison)
To quickly choose between a number of options, use the ordinal property:
switch (exp.getKind().getOrdinal()) {
 case RexKind.Equals_ORDINAL:
     ...;
 case RexKind.NotEquals_ORDINAL:
     ...;
 default:
     throw exp.getKind().unexpected();
 }

Since:
Nov 24, 2003
Version:
$Id: $
Author:
jhyde

Field Summary
static RexKind And
          The logical "AND" operator.
static int AndORDINAL
           
static RexKind Arithmetic
          An arithmetic operator (Divide, Minus, MinusPrefix, Plus, Times).
static int ArithmeticORDINAL
           
static RexKind Comparison
          A comparison operator (Equals, GreaterThan, etc.).
static int ComparisonORDINAL
           
static RexKind Concat
          The string concatenation operator, "||".
static int ConcatORDINAL
           
static RexKind Divide
          The arithmetic division operator, "/".
static int DivideORDINAL
           
static EnumeratedValues enumeration
          Set of all RexKind instances.
static RexKind Equals
          The equals operator, "=".
static int EqualsORDINAL
           
static RexKind FieldAccess
          The arithmetic multiplication operator, "*".
static int FieldAccessORDINAL
           
static int GreaterEqualORDINAL
           
static RexKind GreaterThan
          The greater-than operator, ">".
static int GreaterThanORDINAL
           
static RexKind GreaterThanOrEqual
          The greater-than-or-equal operator, ">=".
static RexKind Identifier
          An identifier.
static int IdentifierORDINAL
           
static RexKind IsNull
          The IS NULL operator.
static int IsNullORDINAL
           
static RexKind LessThan
          The less-than operator, "<".
static int LessThanORDINAL
           
static RexKind LessThanOrEqual
          The less-than-or-equal operator, "<=".
static int LessThanOrEqualORDINAL
           
static RexKind Literal
          A literal.
static int LiteralORDINAL
           
static RexKind Logical
          A logical operator (And, Or, Not).
static int LogicalORDINAL
           
static RexKind Minus
          The arithmetic minus operator, "-".
static int MinusORDINAL
           
static RexKind MinusPrefix
          The unary minus operator, as in "-1".
static int MinusPrefixORDINAL
           
static RexKind Not
          The logical "NOT" operator.
static RexKind NotEquals
          The not-equals operator, "!=" or "<>".
static int NotEqualsORDINAL
           
static int NotORDINAL
           
static RexKind Or
          The logical "OR" operator.
static int OrORDINAL
           
static RexKind Other
          No operator in particular.
private  Set otherKinds
           
static int OtherORDINAL
           
static RexKind Plus
          The arithmetic plus operator, "+".
static int PlusORDINAL
           
static RexKind Row
          The row constructor operator.
static int RowORDINAL
           
static RexKind Substr
          The substring function.
static int SubstrORDINAL
           
static RexKind Times
          The arithmetic multiplication operator, "*".
static int TimesORDINAL
           
static RexKind Values
          The VALUES operator.
static int ValuesORDINAL
           
 
Fields inherited from class net.sf.saffron.util.EnumeratedValues.BasicValue
description_, name_, ordinal_
 
Constructor Summary
private RexKind(String name, int ordinal)
          Creates a kind.
private RexKind(String name, int ordinal, RexKind[] others)
          Creates a kind which includes other kinds.
 
Method Summary
static RexKind get(int ordinal)
          Looks up a kind from its ordinal.
static RexKind get(String name)
          Looks up a kind from its name.
 boolean includes(RexKind kind)
           
 
Methods inherited from class net.sf.saffron.util.EnumeratedValues.BasicValue
equals, getDescription, getName, getOrdinal, toString, unexpected
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

otherKinds

private Set otherKinds

OtherORDINAL

public static final int OtherORDINAL
See Also:
Constant Field Values

Other

public static final RexKind Other
No operator in particular. This is the default kind.


EqualsORDINAL

public static final int EqualsORDINAL
See Also:
Constant Field Values

Equals

public static final RexKind Equals
The equals operator, "=".


NotEqualsORDINAL

public static final int NotEqualsORDINAL
See Also:
Constant Field Values

NotEquals

public static final RexKind NotEquals
The not-equals operator, "!=" or "<>".


GreaterThanORDINAL

public static final int GreaterThanORDINAL
See Also:
Constant Field Values

GreaterThan

public static final RexKind GreaterThan
The greater-than operator, ">".


GreaterEqualORDINAL

public static final int GreaterEqualORDINAL
See Also:
Constant Field Values

GreaterThanOrEqual

public static final RexKind GreaterThanOrEqual
The greater-than-or-equal operator, ">=".


LessThanORDINAL

public static final int LessThanORDINAL
See Also:
Constant Field Values

LessThan

public static final RexKind LessThan
The less-than operator, "<".


LessThanOrEqualORDINAL

public static final int LessThanOrEqualORDINAL
See Also:
Constant Field Values

LessThanOrEqual

public static final RexKind LessThanOrEqual
The less-than-or-equal operator, "<=".


ComparisonORDINAL

public static final int ComparisonORDINAL
See Also:
Constant Field Values

Comparison

public static final RexKind Comparison
A comparison operator (Equals, GreaterThan, etc.). Comparisons are always a RexCall with 2 arguments.


AndORDINAL

public static final int AndORDINAL
See Also:
Constant Field Values

And

public static final RexKind And
The logical "AND" operator.


OrORDINAL

public static final int OrORDINAL
See Also:
Constant Field Values

Or

public static final RexKind Or
The logical "OR" operator.


NotORDINAL

public static final int NotORDINAL
See Also:
Constant Field Values

Not

public static final RexKind Not
The logical "NOT" operator.


LogicalORDINAL

public static final int LogicalORDINAL
See Also:
Constant Field Values

Logical

public static final RexKind Logical
A logical operator (And, Or, Not).


DivideORDINAL

public static final int DivideORDINAL
See Also:
Constant Field Values

Divide

public static final RexKind Divide
The arithmetic division operator, "/".


MinusORDINAL

public static final int MinusORDINAL
See Also:
Constant Field Values

Minus

public static final RexKind Minus
The arithmetic minus operator, "-".

See Also:
MinusPrefix

PlusORDINAL

public static final int PlusORDINAL
See Also:
Constant Field Values

Plus

public static final RexKind Plus
The arithmetic plus operator, "+".


MinusPrefixORDINAL

public static final int MinusPrefixORDINAL
See Also:
Constant Field Values

MinusPrefix

public static final RexKind MinusPrefix
The unary minus operator, as in "-1".

See Also:
Minus

TimesORDINAL

public static final int TimesORDINAL
See Also:
Constant Field Values

Times

public static final RexKind Times
The arithmetic multiplication operator, "*".


ArithmeticORDINAL

public static final int ArithmeticORDINAL
See Also:
Constant Field Values

Arithmetic

public static final RexKind Arithmetic
An arithmetic operator (Divide, Minus, MinusPrefix, Plus, Times).


FieldAccessORDINAL

public static final int FieldAccessORDINAL
See Also:
Constant Field Values

FieldAccess

public static final RexKind FieldAccess
The arithmetic multiplication operator, "*".


ConcatORDINAL

public static final int ConcatORDINAL
See Also:
Constant Field Values

Concat

public static final RexKind Concat
The string concatenation operator, "||".


SubstrORDINAL

public static final int SubstrORDINAL
See Also:
Constant Field Values

Substr

public static final RexKind Substr
The substring function.


RowORDINAL

public static final int RowORDINAL
See Also:
Constant Field Values

Row

public static final RexKind Row
The row constructor operator.


IsNullORDINAL

public static final int IsNullORDINAL
See Also:
Constant Field Values

IsNull

public static final RexKind IsNull
The IS NULL operator. (There is no "IS NOT NULL" operator.)


IdentifierORDINAL

public static final int IdentifierORDINAL
See Also:
Constant Field Values

Identifier

public static final RexKind Identifier
An identifier.


LiteralORDINAL

public static final int LiteralORDINAL
See Also:
Constant Field Values

Literal

public static final RexKind Literal
A literal.


ValuesORDINAL

public static final int ValuesORDINAL
See Also:
Constant Field Values

Values

public static final RexKind Values
The VALUES operator.


enumeration

public static final EnumeratedValues enumeration
Set of all RexKind instances.

Constructor Detail

RexKind

private RexKind(String name,
                int ordinal)
Creates a kind.


RexKind

private RexKind(String name,
                int ordinal,
                RexKind[] others)
Creates a kind which includes other kinds.

Method Detail

includes

public boolean includes(RexKind kind)

get

public static RexKind get(int ordinal)
Looks up a kind from its ordinal.


get

public static RexKind get(String name)
Looks up a kind from its name.


SourceForge.net_Logo