com.wewebu.expression.language
Class OwExprExpressionType

java.lang.Object
  extended by com.wewebu.expression.language.OwExprExpressionType
Direct Known Subclasses:
OwExprBinaryExpressionType, OwExprConditionalExpressionType, OwExprUnaryExpressionType

public class OwExprExpressionType
extends Object

Compiled expression-type class.
Compiled expressions might result in multiple value types (see OwExprType) (the resulted type depends on the properties and function types which are discovered at evaluation time). Objects of OwExprExpressionType are a collection of possible value types - called inferred types - (see OwExprType) an expression might result in.
Expression types are produced during compilation time and they change (that is to say they are regressed) as sub expression or operands are parsed and added to the holding expression.
The expression types are regressed based on operator conversion tables and sub expression types.
Example:
1+a=c
In the above expression the operator = is applied to operands 1+a and c.
According to + conversion table 1+a can only result in {STRING,NUMERIC,TIME,DATE}.
According to the = conversion table this operator results in a BOOLEAN value always so the resulted expression-type will be a BOOLEAN.
The same conversion table the operands must be the same or at least one should be a STRING or NULL so the expression-type of 1+a and c should be {STRING,NUMERIC,TIME,DATE}.

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  Set m_inferringTypes
          Types that can be inferred from this expression type.
static OwExprExpressionType NOTYPE
           
 
Constructor Summary
OwExprExpressionType(Collection inferringTypes_p)
          Constructor
OwExprExpressionType(OwExprType type_p)
          Constructor
OwExprExpressionType(OwExprType[] inferringTypes_p)
          Constructor
 
Method Summary
 boolean canInfer(OwExprType type_p)
           
 boolean equals(Object obj_p)
           
 Set getInferringTypes()
           
 int hashCode()
           
static String printTypes(OwExprExpressionType[] types_p)
          Pretty printer of types
 void regressTo(OwExprExpressionType expressionType_p)
          Regresses (diminishes the possible types represented by this OwExprExpression ) this expression type to the types represented the argument expressionType_p
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTYPE

public static final OwExprExpressionType NOTYPE

m_inferringTypes

protected Set m_inferringTypes
Types that can be inferred from this expression type. The holding expression can result in any of this types.

Constructor Detail

OwExprExpressionType

public OwExprExpressionType(OwExprType type_p)
Constructor

Parameters:
type_p - the only inferred type

OwExprExpressionType

public OwExprExpressionType(OwExprType[] inferringTypes_p)
Constructor

Parameters:
inferringTypes_p - array of initially inferred types

OwExprExpressionType

public OwExprExpressionType(Collection inferringTypes_p)
Constructor

Parameters:
inferringTypes_p - collection of initially inferred types
Method Detail

printTypes

public static final String printTypes(OwExprExpressionType[] types_p)
Pretty printer of types

Parameters:
types_p -
Returns:
a pretty print String representation of the specified expression types

equals

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

hashCode

public int hashCode()
Overrides:
hashCode in class Object

regressTo

public void regressTo(OwExprExpressionType expressionType_p)
               throws OwExprTypeMissmatchException
Regresses (diminishes the possible types represented by this OwExprExpression ) this expression type to the types represented the argument expressionType_p

Parameters:
expressionType_p - types to regress this expression type to
Throws:
OwExprTypeMissmatchException - if the regression process fails (type incompatibility- the expressionType_p types can't be combined in a subset of the types represented by this expression type )

canInfer

public boolean canInfer(OwExprType type_p)
Parameters:
type_p -
Returns:
true if the holder expression of this expression type can result in value have the type_p type

toString

public String toString()
Overrides:
toString in class Object

getInferringTypes

public final Set getInferringTypes()
Returns:
the inferred types set


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.