Example #1
0
        /// <summary>
        /// Equality comparison between this and the supplied representation which
        /// must be of type xs:anyURI (or, by promotion of this, xs:string)
        /// </summary>
        /// <param name="arg">
        ///            The representation to compare with </param>
        /// <returns> True if the two representation are of the same String. False
        ///         otherwise </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public boolean eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public virtual bool eq(AnyType arg, DynamicContext dynamicContext)
        {
            if (arg is XSAnyURI || arg is XSString)
            {
                if (this.string_value().Equals(arg.string_value()))
                {
                    return(true);
                }
            }
            else
            {
                throw DynamicError.throw_type_error();
            }

            return(false);
        }
Example #2
0
        /// <summary>
        /// Less than comparison between this and the supplied representation which
        /// must be of type xs:anyURI (or, by promotion of this, xs:string)
        ///
        /// @since 1.1
        /// </summary>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public boolean lt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public virtual bool lt(AnyType arg, DynamicContext context)
        {
            if (!(arg is XSAnyURI || arg is XSString))
            {
                throw DynamicError.throw_type_error();
            }

            string anyURI       = this.string_value();
            string compareToURI = arg.string_value();

            if (anyURI.CompareTo(compareToURI) < 0)
            {
                return(true);
            }

            return(false);
        }
Example #3
0
        /// <summary>
        /// Evaluate the function using the arguments passed.
        /// </summary>
        /// <param name="args">
        ///            Result from the expressions evaluation. </param>
        /// <param name="sc">
        ///            Result of static context operation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of the fn:dateTime operation. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence adjustdateTime(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence adjustdateTime(ICollection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dynamicContext)
        {
            ICollection cargs = Function.convert_arguments(args, expectedArgs());

            // get args
            IEnumerator argiter = cargs.GetEnumerator();

            argiter.MoveNext();
            ResultSequence arg1 = (ResultSequence)argiter.Current;

            if (arg1 == null || arg1.empty())
            {
                return(ResultBuffer.EMPTY);
            }
            ResultSequence arg2 = null;

            if (argiter.MoveNext())
            {
//JAVA TO C# CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
                arg2 = (ResultSequence)argiter.Current;
            }
            XSDateTime        dateTime = (XSDateTime)arg1.item(0);
            XSDayTimeDuration timezone = null;

            if (arg2 != null && arg2.empty())
            {
                if (dateTime.timezoned())
                {
                    CalendarType localized = new XSDateTime(dateTime.calendar(), null);
                    return(localized);
                }
                else
                {
                    return(arg1);
                }
            }
            else if (arg2 == null)
            {
                CalendarType localized = new XSDateTime(dateTime.normalizeCalendar(dateTime.calendar(), dateTime.tz()), null);
                return(localized);
            }

            timezone = (XSDayTimeDuration)arg2.item(0);
            if (timezone.lt(minDuration, dynamicContext) || timezone.gt(maxDuration, dynamicContext))
            {
                throw DynamicError.invalidTimezone();
            }

            if (dateTime.tz() == null)
            {
                return(new XSDateTime(dateTime.calendar(), timezone));
            }

            XMLGregorianCalendar xmlCalendar = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar)dateTime.normalizeCalendar(dateTime.calendar(), dateTime.tz()));

            Duration duration = _datatypeFactory.newDuration(timezone.StringValue);

            xmlCalendar.add(duration);

            return(new XSDateTime(xmlCalendar.toGregorianCalendar(), timezone));
        }
Example #4
0
 public abstract bool eq(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context);