// // The operand needs to use the number function // to covert to numbers internal NumericExpr(Operator.Op op, IQuery opnd1, IQuery opnd2) { if (opnd1.ReturnType() != XPathResultType.Number) { this.opnd1= new NumberFunctions(opnd1); } else { this.opnd1 = opnd1; } if (opnd2 != null && (opnd2.ReturnType() != XPathResultType.Number)) { this.opnd2= new NumberFunctions(opnd2); } else{ this.opnd2 = opnd2; } this.op= op; }
internal LogicalExpr(Operator.Op op, IQuery opnd1, IQuery opnd2){ this.opnd1= opnd1; this.opnd2= opnd2; this.op= op; }
// // Operator: Or, and, | // +, -, *, div, // >, >=, <, <=, =, != // private IQuery ProcessOperator(Operator root, IQuery qyInput) { IQuery ret = null; switch (root.OperatorType) { case Operator.Op.OR: ret = new OrExpr(ProcessNode(root.Operand1, null), ProcessNode(root.Operand2, null)); return ret; case Operator.Op.AND : ret = new AndExpr(ProcessNode(root.Operand1, null), ProcessNode(root.Operand2, null)); return ret; } switch (root.ReturnType) { case XPathResultType.Number: ret = new NumericExpr(root.OperatorType, ProcessNode(root.Operand1, null), ProcessNode(root.Operand2, null)); return ret; case XPathResultType.Boolean: ret = new LogicalExpr(root.OperatorType, ProcessNode(root.Operand1, null), ProcessNode(root.Operand2, null)); return ret; } return ret; }