public static ResultSequence newToOld(org.eclipse.wst.xml.xpath2.api.ResultSequence result)
        {
            if (result is ResultSequence)
            {
                return((ResultSequence)result);
            }

            ResultSequence rs = ResultSequenceFactory.create_new();

            for (int i = 0; i < result.size(); ++i)
            {
                rs.add((AnyType)result.item(i));
            }
            return(rs);
        }
Exemple #2
0
        protected internal static ResultSequence getResultSetForArityZero(EvaluationContext ec)
        {
            ResultSequence rs = ResultSequenceFactory.create_new();

            Item contextItem = ec.ContextItem;

            if (contextItem != null)
            {
                // if context item is defined, then that is the default argument
                // to fn:string function
                rs.add(new XSString(contextItem.StringValue));
            }
            else
            {
                throw DynamicError.contextUndefined();
            }
            return(rs);
        }
Exemple #3
0
        /// <summary>
        /// interate through range.
        /// </summary>
        /// <returns> tail </returns>
        public override IEnumerator <Item> iterator()
        {
            // XXX life is getting hard...
            if (_size != 0)
            {
                ResultSequence newtail = ResultSequenceFactory.create_new();

                for (; _start <= _end; _start++)
                {
                    newtail.add(new XSInteger(new System.Numerics.BigInteger(_start)));
                }

                newtail.concat(_tail);
                _tail.release();
                _tail = newtail;

                _size  = 0;
                _start = 0;
                _end   = 0;
            }

            return(_tail.iterator());
        }
Exemple #4
0
 /// <summary>
 /// item is an integer to add to the range.
 /// </summary>
 /// <param name="item">
 ///            is an integer. </param>
 public override void add(AnyType item)
 {
     _tail.add(item);
 }