ConvertToBoolean() 공개 메소드

public ConvertToBoolean ( QilNode n ) : QilNode
n QilNode
리턴 QilNode
예제 #1
0
 //also used by XPathPatternBuilder
 public static QilNode PredicateToBoolean(QilNode predicate, XPathQilFactory f, IXPathEnvironment env)
 {
     // Prepocess predicate: if (predicate is number) then predicate := (position() == predicate)
     if (!f.IsAnyType(predicate))
     {
         if (predicate.XmlType.TypeCode == XmlTypeCode.Double)
         {
             predicate = f.Eq(env.GetPosition(), predicate);
         }
         else
         {
             predicate = f.ConvertToBoolean(predicate);
         }
     }
     else
     {
         QilIterator i;
         predicate = f.Loop(i = f.Let(predicate),
                            f.Conditional(f.IsType(i, T.Double),
                                          f.Eq(env.GetPosition(), f.TypeAssert(i, T.DoubleX)),
                                          f.ConvertToBoolean(i)
                                          )
                            );
     }
     return(predicate);
 }
예제 #2
0
 private QilNode LogicalOperator(XPathOperator op, QilNode left, QilNode right)
 {
     Debug.Assert(op == XPathOperator.Or || op == XPathOperator.And);
     left  = _f.ConvertToBoolean(left);
     right = _f.ConvertToBoolean(right);
     return(
         op == XPathOperator.Or ? _f.Or(left, right) :
         /*default*/ _f.And(left, right)
         );
 }