mondrian.olap
Class Literal

java.lang.Object
  extended by mondrian.olap.QueryPart
      extended by mondrian.olap.ExpBase
          extended by mondrian.olap.Literal
All Implemented Interfaces:
Exp, Walkable

public class Literal
extends ExpBase

Represents a constant value, such as a string or number, in a parse tree.

Symbols, such as the ASC keyword in Order([Store].Members, [Measures].[Unit Sales], ASC), are also represented as Literals.

Author:
jhyde
 

Field Summary
 int category
           
static Literal doubleNegativeOne
           
static Literal doubleOne
           
static Literal doubleZero
           
static Literal emptyString
           
static Literal negativeOne
           
static Literal nullValue
           
static Literal one
           
static Literal zero
           
 
Method Summary
 Calc accept(ExpCompiler compiler)
          Converts this expression into an a tree of expressions which can be efficiently evaluated.
 Object accept(MdxVisitor visitor)
          Accepts a visitor to this Exp.
 Exp accept(Validator validator)
          Validates this expression.
 Literal clone()
           
static Literal create(Double d)
          Creates a numeric literal.
static Literal create(Integer i)
          Creates an integer literal.
static Literal createString(String s)
          Creates a string literal.
static Literal createSymbol(String s)
          Creates a symbol.
 int getCategory()
          Returns the Category of the expression.
 int getIntValue()
           
 Type getType()
          Returns the type of this expression.
 Object getValue()
           
 void unparse(PrintWriter pw)
          Writes a string representation of this parse tree node to the given writer.
 
Methods inherited from class mondrian.olap.ExpBase
cloneArray, getTypes, unparseList
 
Methods inherited from class mondrian.olap.QueryPart
getChildren
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

category

public final int category

nullValue

public static final Literal nullValue

emptyString

public static final Literal emptyString

zero

public static final Literal zero

one

public static final Literal one

negativeOne

public static final Literal negativeOne

doubleZero

public static final Literal doubleZero

doubleOne

public static final Literal doubleOne

doubleNegativeOne

public static final Literal doubleNegativeOne
Method Detail

createString

public static Literal createString(String s)
Creates a string literal.

See Also:
createSymbol(java.lang.String)

createSymbol

public static Literal createSymbol(String s)
Creates a symbol.

See Also:
createString(java.lang.String)

create

public static Literal create(Double d)
Creates a numeric literal.


create

public static Literal create(Integer i)
Creates an integer literal.


clone

public Literal clone()
Specified by:
clone in interface Exp
Specified by:
clone in class ExpBase

unparse

public void unparse(PrintWriter pw)
Description copied from class: QueryPart
Writes a string representation of this parse tree node to the given writer.

Specified by:
unparse in interface Exp
Overrides:
unparse in class QueryPart
Parameters:
pw - writer

getCategory

public int getCategory()
Description copied from interface: Exp
Returns the Category of the expression.


getType

public Type getType()
Description copied from interface: Exp
Returns the type of this expression. Never null.


accept

public Exp accept(Validator validator)
Description copied from interface: Exp
Validates this expression. The validator acts in the role of 'visitor' (see Gang of Four 'visitor pattern'), and an expression in the role of 'visitee'.

Parameters:
validator - Validator contains validation context
Returns:
The validated expression; often but not always the same as this expression

accept

public Calc accept(ExpCompiler compiler)
Description copied from interface: Exp
Converts this expression into an a tree of expressions which can be efficiently evaluated.

Specified by:
accept in interface Exp
Overrides:
accept in class ExpBase
Returns:
A compiled expression

accept

public Object accept(MdxVisitor visitor)
Description copied from interface: Exp
Accepts a visitor to this Exp. The implementation should generally dispatches to the MdxVisitor.visit(mondrian.olap.Query) method appropriate to the type of expression.

Parameters:
visitor - Visitor

getValue

public Object getValue()

getIntValue

public int getIntValue()

SourceForge.net_Logo