com.wewebu.expression.language
Class OwExprLiteral

java.lang.Object
  extended by com.wewebu.expression.language.OwExprExpression
      extended by com.wewebu.expression.language.OwExprLiteral
All Implemented Interfaces:
OwExprPrimaryPrefix
Direct Known Subclasses:
OwExprBooleanLiteral, OwExprFloatingPointLiteral, OwExprIntegerLiteral, OwExprNullLiteral, OwExprStringLiteral

public abstract class OwExprLiteral
extends OwExprExpression
implements OwExprPrimaryPrefix

An expression representing a fixed value (egg. strings , numeric values so.)

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com

See Also:
OwExprParser, OwExprValue

Field Summary
protected  OwExprConstantSymbol m_symbol
           
 
Fields inherited from class com.wewebu.expression.language.OwExprExpression
m_errorTable, m_symbolTable, m_typeError
 
Constructor Summary
OwExprLiteral(String symbolName_p, OwExprValue value_p, OwExprType symbolType_p, OwExprSymbolTable symbolTable_p, OwExprErrorTable errorTable_p)
          Constructor
 
Method Summary
 OwExprValue evaluate(OwExprScope scope_p)
          Evaluates this expression on the OwExprScope (scope) provided as argument.
 OwExprExpression expression()
           
 OwExprValue getValue()
           
 OwExprFunctionSymbol regressToFunction()
          Forces this primary prefix symbol to a function.
 OwExprPropertySymbol regressToPorperty()
          Forces this primary prefix symbol to a property.
 OwExprSymbolScope regressToScope()
          Forces this primary prefix to a scope symbol.
protected static OwExprConstantSymbol symbolInstance(String image_p, OwExprSymbolTable symbolTable_p, OwExprErrorTable errorTable_p)
          Constant symbol single flyweight instance accessor.
 String toString()
           
 OwExprExpressionType type()
          Type check method.
 
Methods inherited from class com.wewebu.expression.language.OwExprExpression
errCount, evaluate, evaluate, getErrorTable, getSymbol, getSymbolTable, hasErrors, initType, symbolsVisibleInScopes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_symbol

protected OwExprConstantSymbol m_symbol
Constructor Detail

OwExprLiteral

public OwExprLiteral(String symbolName_p,
                     OwExprValue value_p,
                     OwExprType symbolType_p,
                     OwExprSymbolTable symbolTable_p,
                     OwExprErrorTable errorTable_p)
Constructor

Parameters:
symbolName_p - the name of the symbol this literal relays on
value_p - the value of this literal
symbolType_p - the type of the symbol
symbolTable_p - the global symbol table
errorTable_p - the global error table
Method Detail

symbolInstance

protected static final OwExprConstantSymbol symbolInstance(String image_p,
                                                           OwExprSymbolTable symbolTable_p,
                                                           OwExprErrorTable errorTable_p)
Constant symbol single flyweight instance accessor. If the symbol is not a constant symbol an error is added to the global error table.

Parameters:
image_p - the constant symbol image
symbolTable_p - the global symbol table
errorTable_p - the global error table
Returns:
a single symbol instance for the designated image_p or null if no such instance exists

type

public final OwExprExpressionType type()
                                throws OwExprTypeMissmatchException
Description copied from class: OwExprExpression
Type check method. If type errors are encountered during type computation the OwExprExpression.m_typeError should be set to true

Specified by:
type in class OwExprExpression
Returns:
the type of this symbol
Throws:
OwExprTypeMissmatchException

getValue

public final OwExprValue getValue()
Returns:
the value of this symbol

evaluate

public final OwExprValue evaluate(OwExprScope scope_p)
                           throws OwExprEvaluationException
Description copied from class: OwExprExpression
Evaluates this expression on the OwExprScope (scope) provided as argument.

Specified by:
evaluate in class OwExprExpression
Parameters:
scope_p -
Returns:
the value of this symbol
Throws:
OwExprEvaluationException

regressToPorperty

public final OwExprPropertySymbol regressToPorperty()
                                             throws OwExprTypeMissmatchException
Description copied from interface: OwExprPrimaryPrefix
Forces this primary prefix symbol to a property.

Specified by:
regressToPorperty in interface OwExprPrimaryPrefix
Returns:
N/A
Throws:
OwExprTypeMissmatchException - always

regressToFunction

public final OwExprFunctionSymbol regressToFunction()
                                             throws OwExprTypeMissmatchException
Description copied from interface: OwExprPrimaryPrefix
Forces this primary prefix symbol to a function.

Specified by:
regressToFunction in interface OwExprPrimaryPrefix
Returns:
N/A
Throws:
OwExprTypeMissmatchException - always

regressToScope

public OwExprSymbolScope regressToScope()
                                 throws OwExprTypeMissmatchException
Description copied from interface: OwExprPrimaryPrefix
Forces this primary prefix to a scope symbol.

Specified by:
regressToScope in interface OwExprPrimaryPrefix
Returns:
an OwExprSymbolScope based on this literals symbol
Throws:
OwExprTypeMissmatchException - if a type mismatch is detected during scope symbol creation

expression

public final OwExprExpression expression()
Specified by:
expression in interface OwExprPrimaryPrefix
Returns:
this literal

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.