com.wewebu.expression.language
Class OwExprUnaryOperator

java.lang.Object
  extended by com.wewebu.expression.language.OwExprOperator
      extended by com.wewebu.expression.language.OwExprUnaryOperator
Direct Known Subclasses:
OwExprArithmeticUnaryOperator, OwExprUnaryNegateOperator

public abstract class OwExprUnaryOperator
extends OwExprOperator

Unary operator class (egg. !boolPropertz , -232.2 ). A single operand operation implementation.

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
OwExprUnaryOperator(String image_p, OwExprUnaryConversionTable conversionTable_p)
          Constructor
 
Method Summary
 OwExprUnaryExpressionType computeExpressionType(OwExprExpression operand_p)
          Computes the resulted expression type based on given operand and regresses sub-expression types accordingly
 OwExprType computeType(OwExprType type_p)
          Type computation method.
 OwExprValue evaluate(OwExprBooleanValue booleanValue_p)
          Evaluation by visiting with concrete single operand type.
 OwExprValue evaluate(OwExprNumericValue numericValue_p)
          Evaluation by visiting with concrete single operand type.
 OwExprValue evaluate(OwExprScope scope_p, OwExprExpression expression_p)
          Unary evaluation method to be called at evaluation time.
 Set getRegressingTypes(Set regressedTypes_p)
          Returns a set of compatible single 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

OwExprUnaryOperator

public OwExprUnaryOperator(String image_p,
                           OwExprUnaryConversionTable conversionTable_p)
Constructor

Parameters:
image_p - literal image (egg. "!" , "-")
conversionTable_p - conversion table to use
Method Detail

evaluate

public final OwExprValue evaluate(OwExprScope scope_p,
                                  OwExprExpression expression_p)
                           throws OwExprEvaluationException
Unary evaluation method to be called at evaluation time. This is the entry point in the operator evaluation visitor sequence.

Parameters:
scope_p - the scope this operation is evaluated on
expression_p - single operand
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 booleanValue_p)
                     throws OwExprEvaluationException
Evaluation by visiting with concrete single operand type.

Parameters:
booleanValue_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 numericValue_p)
                     throws OwExprEvaluationException
Evaluation by visiting with concrete single operand type.

Parameters:
numericValue_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)

computeType

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

Parameters:
type_p - single operand type
Returns:
the type of the value resulted if two operands of type1 and type2 were combined in this operation
Throws:
OwExprTypeMissmatchException

getRegressingTypes

public final Set getRegressingTypes(Set regressedTypes_p)
Returns a set of compatible single 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

computeExpressionType

public final OwExprUnaryExpressionType computeExpressionType(OwExprExpression operand_p)
                                                      throws OwExprTypeMissmatchException
Computes the resulted expression type based on given operand and regresses sub-expression types accordingly

Parameters:
operand_p - single OwExprExpression operand
Returns:
the resulted expression type as OwExprUnaryExpressionType
Throws:
OwExprTypeMissmatchException - if the operator evaluation cannot not be performed due to type incompatibility


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.