scan(operator.getOperand());
ASTNodeData operandNodeData = nodeDataStack.peek();
BinaryOperatorKind binOp;
XpathOperatorMapping xpathBinOpMap = xpathFactory.createBinOpMapping();
XpathNumberExpression xpathNumberOne = xpathFactory.createNumber();
xpathNumberOne.setNumber(1);
XpathBinaryOpExpression xpathBinOperation = xpathFactory.createBinaryOperation();
//XpathTypeMapping xpathTypeMap = xpathFactory.createTypeMapping();
//XpathExprType varXpathType = xpathTypeMap.getXpathExprType(operator.getType().getQualifiedName());
switch(operator.getKind()){
case NEG: break;
case NOT:
if (operandNodeData.xpathExpr != null){
XpathNotExpression xpathNotExpr = xpathFactory.createNotExpression();
xpathNotExpr.setExpr(operandNodeData.xpathExpr);
unaryOperatorContext.xpathExpr = xpathNotExpr;
unaryOperatorContext.variable = operandNodeData.variable;
}
break;
case POS: break;
case POSTDEC:
case POSTINC:
if (operator.getKind().equals(UnaryOperatorKind.PREDEC))
binOp = BinaryOperatorKind.MINUS;
else
binOp = BinaryOperatorKind.PLUS;
if (operandNodeData.variable != null && operandNodeData.xpathExpr != null){
// create temp variable
Variable tmpVar = createTempVariable(unaryOperatorContext.scopeStack,typeNodeData.xsdType);
// assign real variable value to temp variable
From from = BPELFactory.eINSTANCE.createFrom();
from.setVariable(operandNodeData.variable);
Query fromQuery = BPELFactory.eINSTANCE.createQuery();
fromQuery.setQueryLanguage(XPATH_NAMESPACE);
fromQuery.setValue(operandNodeData.xpathExpr.evaluate());
from.setQuery(fromQuery);
To to = BPELFactory.eINSTANCE.createTo();
to.setVariable(tmpVar);
Copy copy = BPELFactory.eINSTANCE.createCopy();
copy.setTo(to);
copy.setFrom(from);
Assign assign = BPELFactory.eINSTANCE.createAssign();
assign.getCopy().add(copy);
// add assignment activty to curr scope
operandNodeData.scopeStack.peek().addActivity(assign);
// increment real variable
try {
xpathBinOperation.setLeftSide(operandNodeData.xpathExpr);
xpathBinOperation.setOperator(xpathBinOpMap.getBinOp(binOp));
xpathBinOperation.setRightSide(xpathNumberOne);
from = BPELFactory.eINSTANCE.createFrom();
from.setVariable(operandNodeData.variable);
fromQuery = BPELFactory.eINSTANCE.createQuery();
fromQuery.setQueryLanguage(XPATH_NAMESPACE);
fromQuery.setValue(xpathBinOperation.evaluate());
from.setQuery(fromQuery);
to = BPELFactory.eINSTANCE.createTo();
to.setVariable(operandNodeData.variable);
copy = BPELFactory.eINSTANCE.createCopy();
copy.setTo(to);
copy.setFrom(from);
assign = BPELFactory.eINSTANCE.createAssign();
assign.getCopy().add(copy);
// add increment activity to curr scope
operandNodeData.scopeStack.peek().addActivity(assign);
// set variable reference = temp variable
operandNodeData.variable = tmpVar;
XpathVariableRefExpression xpathVarRef = xpathFactory.createVariableReference();
xpathVarRef.setVariableName(tmpVar.getName());
xpathVarRef.setType(typeNodeData.xsdTypeQName);
operandNodeData.xpathExpr = xpathVarRef;
} catch (Exception e) {}
}
break;
case PREDEC:
case PREINC:
if (operator.getKind().equals(UnaryOperatorKind.PREDEC))
binOp = BinaryOperatorKind.MINUS;
else
binOp = BinaryOperatorKind.PLUS;
if (operandNodeData.variable != null && operandNodeData.xpathExpr != null){
// increment variable
try {
xpathBinOperation.setLeftSide(operandNodeData.xpathExpr);
xpathBinOperation.setOperator(xpathBinOpMap.getBinOp(binOp));
xpathBinOperation.setRightSide(xpathNumberOne);
From from = BPELFactory.eINSTANCE.createFrom();
from.setVariable(operandNodeData.variable);
Query fromQuery = BPELFactory.eINSTANCE.createQuery();