com.wewebu.expression.language
Class OwExprBinaryOperator

java.lang.Object
  extended by com.wewebu.expression.language.OwExprOperator
      extended by com.wewebu.expression.language.OwExprBinaryOperator
Direct Known Subclasses:
OwExprBooleanOperator, OwExprComparisonOperator, OwExprEqualityOperator, OwExprMinusOperator, OwExprMultiplicativeOperator, OwExprPlusOperator

public abstract class OwExprBinaryOperator
extends OwExprOperator

Binary operator class (egg. 1+2 , 'aaaa'+'b' , 1<2). A two operands operation implementation (left and right).
Index present in the parameters names usually denote left (index 1) or right (index 2) correlation.

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


Constructor Summary
OwExprBinaryOperator(String image_p, OwExprBinaryConversionTable conversionTable_p)
          Constructor
 
Method Summary
protected  OwExprValue binaryEvaluation(OwExprScope scope_p, OwExprValue v1_p, OwExprValue v2_p)
          Binary evaluation method to be called at evaluation time.
 OwExprBinaryExpressionType computeExpressionType(OwExprExpression operand1_p, OwExprExpression operand2_p)
          Computes the resulted expression type based on given operands and regresses sub-expression types accordingly
 OwExprType computeType(OwExprType type1_p, OwExprType type2_p)
          Type computation method.
 OwExprValue evaluate(OwExprBooleanValue v1_p, OwExprBooleanValue v2_p)
          BOOLEAN operator BOOLEAN operation evaluation
 OwExprValue evaluate(OwExprBooleanValue v1_p, OwExprNullValue v2_p)
          BOOLEAN operator NULL operation evaluation
 OwExprValue evaluate(OwExprBooleanValue v1_p, OwExprStringValue v2_p)
          BOOLEAN operator STRING operation evaluation
 OwExprValue evaluate(OwExprBooleanValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprDateValue v1_p, OwExprDateValue v2_p)
          DATE operator DATE operation evaluation
 OwExprValue evaluate(OwExprDateValue v1_p, OwExprNullValue v2_p)
          DATE operator NULL operation evaluation
 OwExprValue evaluate(OwExprDateValue v1_p, OwExprStringValue v2_p)
          DATE operator STRING operation evaluation
 OwExprValue evaluate(OwExprDateValue v1_p, OwExprTimeValue v2_p)
          DATE operator TIME operation evaluation
 OwExprValue evaluate(OwExprDateValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprNullValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprNumericValue v1_p, OwExprNullValue v2_p)
          NUMERIC operator NULL operation evaluation
 OwExprValue evaluate(OwExprNumericValue v1_p, OwExprNumericValue v2_p)
          NUMERIC operator NUMERIC operation evaluation
 OwExprValue evaluate(OwExprNumericValue v1_p, OwExprStringValue v2_p)
          NUMERIC operator STRING operation evaluation
 OwExprValue evaluate(OwExprNumericValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprScopeValue v1_p, OwExprNullValue v2_p)
          SCOPE operator NULL operation evaluation
 OwExprValue evaluate(OwExprScopeValue v1_p, OwExprScopeValue v2_p)
          SCOPE operator SCOPE operation evaluation
 OwExprValue evaluate(OwExprScopeValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprBooleanValue v2_p)
          STRING operator BOOLEAN operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprDateValue v2_p)
          STRING operator DATE operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprNullValue v2_p)
          STRING operator NULL operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprNumericValue v2_p)
          STRING operator NUMERIC operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprStringValue v2_p)
          STRING operator STRING operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprTimeValue v2_p)
          STRING operator TIME operation evaluation
 OwExprValue evaluate(OwExprStringValue v1_p, OwExprValue v2_p)
          Stage 2 evaluation by visiting entry point with concrete left operand type.
 OwExprValue evaluate(OwExprTimeValue v1_p, OwExprDateValue v2_p)
          TIME operator DATE operation evaluation
 OwExprValue evaluate(OwExprTimeValue v1_p, OwExprNullValue v2_p)
          TIME operator NULL operation evaluation
 OwExprValue evaluate(OwExprTimeValue v1_p, OwExprStringValue v2_p)
          TIME operator STRING operation evaluation
 OwExprValue evaluate(OwExprTimeValue v1_p, OwExprTimeValue v2_p)
          TIME operator TIME operation evaluation
 Set getRegressingTypes1(Set regressedTypes_p)
          Returns a set of compatible left side operand types ( OwExprTypes ) for a set of given operation result types set.
 Set getRegressingTypes2(Set regressedTypes_p)
          Returns a set of compatible right side operand types ( OwExprTypes ) for a set of given operation result types set.
 
Methods inherited from class com.wewebu.expression.language.OwExprOperator
toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OwExprBinaryOperator

public OwExprBinaryOperator(String image_p,
                            OwExprBinaryConversionTable conversionTable_p)
Constructor

Parameters:
image_p - String image of this operator (egg. "+","-" or "<=")
conversionTable_p - the conversion table m_conversionTable
Method Detail

binaryEvaluation

protected final OwExprValue binaryEvaluation(OwExprScope scope_p,
                                             OwExprValue v1_p,
                                             OwExprValue v2_p)
                                      throws OwExprEvaluationException
Binary evaluation method to be called at evaluation time. This is the entry point in the operator evaluation visitor sequence (stage 1 accept method is called on the left side operand)

Parameters:
scope_p - the scope this operation is evaluated on
v1_p - left side operand (1)
v2_p - right side operand (2)
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprBooleanValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprNumericValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprDateValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprScopeValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprNullValue v1_p,
                            OwExprValue v2_p)
                     throws OwExprEvaluationException
Stage 2 evaluation by visiting entry point with concrete left operand type.

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
STRING operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprNumericValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
NUMERIC operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprBooleanValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
BOOLEAN operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprDateValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
DATE operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprTimeValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
TIME operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprBooleanValue v1_p,
                            OwExprBooleanValue v2_p)
                     throws OwExprEvaluationException
BOOLEAN operator BOOLEAN operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprBooleanValue v1_p,
                            OwExprStringValue v2_p)
                     throws OwExprEvaluationException
BOOLEAN operator STRING operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprNumericValue v1_p,
                            OwExprNumericValue v2_p)
                     throws OwExprEvaluationException
NUMERIC operator NUMERIC operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprNumericValue v1_p,
                            OwExprStringValue v2_p)
                     throws OwExprEvaluationException
NUMERIC operator STRING operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprNumericValue v2_p)
                     throws OwExprEvaluationException
STRING operator NUMERIC operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprStringValue v2_p)
                     throws OwExprEvaluationException
STRING operator STRING operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprBooleanValue v2_p)
                     throws OwExprEvaluationException
STRING operator BOOLEAN operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprDateValue v2_p)
                     throws OwExprEvaluationException
STRING operator DATE operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprStringValue v1_p,
                            OwExprTimeValue v2_p)
                     throws OwExprEvaluationException
STRING operator TIME operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprDateValue v1_p,
                            OwExprDateValue v2_p)
                     throws OwExprEvaluationException
DATE operator DATE operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprDateValue v1_p,
                            OwExprTimeValue v2_p)
                     throws OwExprEvaluationException
DATE operator TIME operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprDateValue v1_p,
                            OwExprStringValue v2_p)
                     throws OwExprEvaluationException
DATE operator STRING operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprTimeValue v1_p,
                            OwExprTimeValue v2_p)
                     throws OwExprEvaluationException
TIME operator TIME operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprTimeValue v1_p,
                            OwExprDateValue v2_p)
                     throws OwExprEvaluationException
TIME operator DATE operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprTimeValue v1_p,
                            OwExprStringValue v2_p)
                     throws OwExprEvaluationException
TIME operator STRING operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprScopeValue v1_p,
                            OwExprNullValue v2_p)
                     throws OwExprEvaluationException
SCOPE operator NULL operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)

evaluate

public OwExprValue evaluate(OwExprScopeValue v1_p,
                            OwExprScopeValue v2_p)
                     throws OwExprEvaluationException
SCOPE operator SCOPE operation evaluation

Parameters:
v1_p -
v2_p -
Returns:
the resulted value as OwExprValue according to the conversion rules
Throws:
OwExprEvaluationException - if the operation fails for any reason (unsupported operand types , incompatible operands, unimplemented operation or operation failure at evaluation time)
Since:
version 1.1.0 and AWD 3.1.0.0

computeType

public final OwExprType computeType(OwExprType type1_p,
                                    OwExprType type2_p)
                             throws OwExprTypeMissmatchException
Type computation method. Delegates type computation to inner conversion table : m_conversionTable

Parameters:
type1_p - left operand type
type2_p - right operand type
Returns:
the type of the value resulted if two operands of type1 and type2 were combined in this operation
Throws:
OwExprTypeMissmatchException

computeExpressionType

public final OwExprBinaryExpressionType computeExpressionType(OwExprExpression operand1_p,
                                                              OwExprExpression operand2_p)
                                                       throws OwExprTypeMissmatchException
Computes the resulted expression type based on given operands and regresses sub-expression types accordingly

Parameters:
operand1_p - the left side OwExprExpression operand
operand2_p - the right side OwExprExpression operand
Returns:
the resulted expression type as OwExprBinaryExpressionType
Throws:
OwExprTypeMissmatchException - if the operator evaluation cannot not be performed due to type incompatibility (type incompatibility resulted from the operator itself or due to the regression process)

getRegressingTypes1

public final Set getRegressingTypes1(Set regressedTypes_p)
Returns a set of compatible left side operand types ( OwExprTypes ) for a set of given operation result types set. The returned type set is a subset of all left side operand types that can result invalid types (different from OwExprType.NOTYPE ) for this operator.

Parameters:
regressedTypes_p - the operation result types set
Returns:
a set of compatible left side operand OwExprTypes

getRegressingTypes2

public final Set getRegressingTypes2(Set regressedTypes_p)
Returns a set of compatible right side operand types ( OwExprTypes ) for a set of given operation result types set. The returned type set is a subset of all right side operand types that can result invalid types (different from OwExprType.NOTYPE ) for this operator.

Parameters:
regressedTypes_p - the operation result types set
Returns:
a set of compatible right side operand OwExprTypes


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.