com.wewebu.expression.language
Class OwExprSymbol

java.lang.Object
  extended by com.wewebu.expression.language.OwExprSymbol
Direct Known Subclasses:
OwExprAnonymousSymbol, OwExprConstantSymbol, OwExprFunctionSymbol, OwExprPropertySymbol

public abstract class OwExprSymbol
extends Object

Expression symbols are identifiers and constants alike (no separate constant table is used).
Expression symbols should implement custom behavior according to their semantics:
functions , properties ,constants or runtime-anonymous symbol Symbols are organized in a tree structure with multiple roots (the top level symbols).

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


Field Summary
protected  OwExprSymbol m_parent
          Parent symbol- null if this is a top level symbol
 
Constructor Summary
OwExprSymbol(OwExprSymbol parent_p, String name_p, OwExprExpressionType type_p)
           
OwExprSymbol(OwExprSymbol parent_p, String name_p, OwExprType type_p)
          Constructor
OwExprSymbol(OwExprSymbol parent_p, String name_p, OwExprType[] types_p)
          Constructor
 
Method Summary
 OwExprSymbol addAnonymousSymbol(String name_p, OwExprExpressionType type_p)
          Adds a property sub-symbol to this symbol.
 OwExprFunctionSymbol addFunctionSymbol(String name_p, OwExprType[] types_p)
          Adds a function sub-symbol to this symbol.
 OwExprPropertySymbol addPropertySymbol(String name_p, OwExprType[] types_p)
          Adds a property sub-symbol to this symbol.
 String getName()
           
 OwExprSymbol getSymbol(String name_p)
           
 String getSymbolFQN()
           
 OwExprSymbolTable getSymbolTable()
           
 OwExprExpressionType getType()
           
 String issueRuntimeSymbolName()
           
abstract  boolean matches(OwExprScope scope_p)
          A match method used to check the validity of symbols for certain scopes.
Can be used to discover symbol and related expressions validity before evaluation.
protected  void toPrettyPrintString(StringBuffer sb_p, StringBuffer tabs_p)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_parent

protected OwExprSymbol m_parent
Parent symbol- null if this is a top level symbol

Constructor Detail

OwExprSymbol

public OwExprSymbol(OwExprSymbol parent_p,
                    String name_p,
                    OwExprType type_p)
Constructor

Parameters:
parent_p - parent symbol
name_p - symbol literal name
type_p - symbol type

OwExprSymbol

public OwExprSymbol(OwExprSymbol parent_p,
                    String name_p,
                    OwExprType[] types_p)
Constructor

Parameters:
parent_p - parent symbol
name_p - symbol literal name
types_p - symbol types

OwExprSymbol

public OwExprSymbol(OwExprSymbol parent_p,
                    String name_p,
                    OwExprExpressionType type_p)
Parameters:
parent_p - parent symbol
name_p - symbol literal name
type_p - symbol expression types
Method Detail

addPropertySymbol

public final OwExprPropertySymbol addPropertySymbol(String name_p,
                                                    OwExprType[] types_p)
                                             throws OwExprTypeMissmatchException
Adds a property sub-symbol to this symbol.

Parameters:
name_p - the property symbol name
types_p - the property types
Returns:
the newly added symbol
Throws:
OwExprTypeMissmatchException - if symbol is already added and the type of the new symbol doesn't match the existing symbol

addAnonymousSymbol

public final OwExprSymbol addAnonymousSymbol(String name_p,
                                             OwExprExpressionType type_p)
                                      throws OwExprTypeMissmatchException
Adds a property sub-symbol to this symbol.

Parameters:
name_p - the property symbol name
type_p - the property expression type
Returns:
the newly added symbol
Throws:
OwExprTypeMissmatchException - if symbol is already added and the type of the new symbol doesn't match the existing symbol

addFunctionSymbol

public final OwExprFunctionSymbol addFunctionSymbol(String name_p,
                                                    OwExprType[] types_p)
                                             throws OwExprTypeMissmatchException
Adds a function sub-symbol to this symbol.

Parameters:
name_p - the property symbol name
types_p - the property types
Returns:
the newly added symbol
Throws:
OwExprTypeMissmatchException - if symbol is already added and the type of the new symbol doesn't match the existing symbol

issueRuntimeSymbolName

public final String issueRuntimeSymbolName()
Returns:
a new, unique , runtime sub-symbol name for this symbol

getName

public final String getName()
Returns:
the name of this symbol

getType

public final OwExprExpressionType getType()
Returns:
the type of this symbol

getSymbol

public final OwExprSymbol getSymbol(String name_p)
Parameters:
name_p -
Returns:
a sub-symbol with the given name

getSymbolTable

public final OwExprSymbolTable getSymbolTable()
Returns:
the sub symbols table

toPrettyPrintString

protected void toPrettyPrintString(StringBuffer sb_p,
                                   StringBuffer tabs_p)

getSymbolFQN

public String getSymbolFQN()
Returns:
String representation of the fully qualified symbol name (egg. object.peer.name)

matches

public abstract boolean matches(OwExprScope scope_p)
                         throws OwExprEvaluationException
A match method used to check the validity of symbols for certain scopes.
Can be used to discover symbol and related expressions validity before evaluation.

Parameters:
scope_p - a scope to search the symbol on
Returns:
true if this symbol is valid for the given scope
Throws:
OwExprEvaluationException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.