示例#1
0
 public UnaryOperatorNode(XPath2Context context, UnaryOperator action, object node, XPath2ResultType resultType)
     : base(context)
 {
     _unaryOper  = action;
     _resultType = resultType;
     Add(node);
 }
示例#2
0
 public BinaryOperatorNode(XPath2Context context, BinaryOperator action, object node1, object node2, XPath2ResultType resultType)
     : base(context)
 {
     _binaryOper = action;
     _resultType = resultType;
     Add(node1);
     Add(node2);
 }
 public override XPath2ResultType GetReturnType(object[] dataPool)
 {
     if (_returnTypeDelegate != null)
     {
         XPath2ResultType resType1 = this[0].GetReturnType(dataPool);
         XPath2ResultType resType2 = this[1].GetReturnType(dataPool);
         return(_returnTypeDelegate(resType1, resType2));
     }
     return(base.GetReturnType(dataPool));
 }
示例#4
0
        public override XPath2ResultType GetReturnType(object[] dataPool)
        {
            XPath2ResultType res1 = this[1].GetReturnType(dataPool);
            XPath2ResultType res2 = this[2].GetReturnType(dataPool);

            if (res1 == res2)
            {
                return(res1);
            }
            return(XPath2ResultType.Any);
        }
 public static XPath2ResultType MultiplyResult(XPath2ResultType resType1, XPath2ResultType resType2)
 {
     if ((resType1 == XPath2ResultType.Duration && resType2 == XPath2ResultType.Number) ||
         (resType1 == XPath2ResultType.Number && resType2 == XPath2ResultType.Duration))
     {
         return(XPath2ResultType.Duration);
     }
     if (resType1 == XPath2ResultType.Number && resType2 == XPath2ResultType.Number)
     {
         return(XPath2ResultType.Number);
     }
     return(XPath2ResultType.Any);
 }
示例#6
0
        public void Add(string ns, string name, int arity, XPath2ResultType resultType, XPathFunctionDelegate action, bool overwriteExistingEntry = true)
        {
            var key = new FunctionDesc(name, ns, arity);

            if (_funcTable.ContainsKey(key) && overwriteExistingEntry)
            {
                _funcTable[key] = new XPathFunctionDef(name, action, resultType);
            }
            else
            {
                _funcTable.Add(key, new XPathFunctionDef(name, action, resultType));
            }
        }
示例#7
0
 public override XPath2ResultType GetReturnType(object[] dataPool)
 {
     if (_func.ResultType == XPath2ResultType.Any && Count > 0)
     {
         XPath2ResultType resType = this[0].GetItemType(dataPool);
         if (resType == XPath2ResultType.NodeSet)
         {
             return(XPath2ResultType.Any);
         }
         return(resType);
     }
     return(_func.ResultType);
 }
 public static XPath2ResultType DivisionResult(XPath2ResultType resType1, XPath2ResultType resType2)
 {
     if (resType1 == XPath2ResultType.Duration && resType2 == XPath2ResultType.Number)
     {
         return(XPath2ResultType.Duration);
     }
     if (resType1 == XPath2ResultType.Duration && resType2 == XPath2ResultType.Duration)
     {
         return(XPath2ResultType.Number);
     }
     if (resType1 == XPath2ResultType.Number && resType2 == XPath2ResultType.Number)
     {
         return(XPath2ResultType.Number);
     }
     return(XPath2ResultType.Any);
 }
示例#9
0
        internal override XPath2ResultType GetItemType(object[] dataPool)
        {
            XPath2ResultType resType = XPath2ResultType.Any;

            foreach (AbstractNode child in this)
            {
                if (!child.IsEmptySequence())
                {
                    XPath2ResultType itemType = child.GetItemType(dataPool);
                    if (itemType != resType)
                    {
                        if (resType != XPath2ResultType.Any)
                        {
                            return(XPath2ResultType.Any);
                        }
                        resType = itemType;
                    }
                }
            }
            return(resType);
        }
 public static XPath2ResultType SubstractionResult(XPath2ResultType resType1, XPath2ResultType resType2)
 {
     if (resType1 == XPath2ResultType.Number ||
         resType2 == XPath2ResultType.Number)
     {
         return(XPath2ResultType.Number);
     }
     if (resType1 == XPath2ResultType.DateTime)
     {
         if (resType2 == XPath2ResultType.DateTime)
         {
             return(XPath2ResultType.Duration);
         }
         if (resType2 == XPath2ResultType.Duration)
         {
             return(XPath2ResultType.DateTime);
         }
     }
     if (resType1 == XPath2ResultType.Duration && resType2 == XPath2ResultType.Duration)
     {
         return(XPath2ResultType.Duration);
     }
     return(XPath2ResultType.Any);
 }
示例#11
0
 public OrderedBinaryOperatorNode(XPath2Context context, BinaryOperator action, object node1, object node2,
                                  XPath2ResultType resultType)
     : base(context, action, node1, node2, resultType)
 {
 }
示例#12
0
 public AtomizedUnaryOperatorNode(XPath2Context context, UnaryOperator action, object node, XPath2ResultType resultType)
     : base(context, action, node, resultType)
 {
 }
示例#13
0
 public void Add(string ns, string name, XPath2ResultType resultType, XPathFunctionDelegate action, bool overwriteExistingEntry = true)
 {
     Add(ns, name, -1, resultType, action, overwriteExistingEntry);
 }
示例#14
0
 public XPathFunctionDef(string name, XPathFunctionDelegate _delegate, XPath2ResultType resultType)
 {
     Name       = name;
     Delegate   = _delegate;
     ResultType = resultType;
 }