Exemple #1
0
        void UnaryExpr(out IExpressionNode node)
        {
            IExpressionNode child;
            UnaryOperator   operatorNode = null;

            if (la.kind == 23 || la.kind == 32 || la.kind == 33)
            {
                if (la.kind == 23)
                {
                    Get();
                    operatorNode = new Negation();
                }
                else if (la.kind == 32)
                {
                    Get();
                    operatorNode = new ToBoolean();
                }
                else
                {
                    Get();
                    operatorNode = new NegateToBoolean();
                }
            }
            Term(out child);
            if (operatorNode != null)
            {
                operatorNode.child = child;
            }
            node = (operatorNode != null) ? operatorNode : child;
        }
Exemple #2
0
 public double Evaluate(IDictionary <string, double> variables)
 {
     return(sequence.Aggregate(-1.0, (last, current) => (ToBoolean.Normalize(current.Evaluate(variables)) != last) ? 1 : -1));
 }