Exemplo n.º 1
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the extractable gMonth in the
        /// supplied ResultSequence
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which the gMonth is to be extracted </param>
        /// <returns> New ResultSequence consisting of the supplied month </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat = (AnyAtomicType)arg.first();

            if (aat is NumericType || aat is XSDuration || aat is XSTime || isGDataType(aat) || aat is XSBoolean || aat is XSBase64Binary || aat is XSHexBinary || aat is XSAnyURI)
            {
                throw DynamicError.invalidType();
            }

            if (!isCastable(aat))
            {
                throw DynamicError.cant_cast(null);
            }

            XSGMonth val = castGMonth(aat);

            if (val == null)
            {
                throw DynamicError.cant_cast(null);
            }

            return(val);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Equality comparison between this and the supplied representation. This
        /// representation must be of type XSGMonth
        /// </summary>
        /// <param name="arg">
        ///            The XSGMonth to compare with </param>
        /// <returns> True if the two representations are of the same month. 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)
        {
            XSGMonth val     = (XSGMonth)NumericType.get_single_type(arg, typeof(XSGMonth));
            Calendar thiscal = normalizeCalendar(calendar(), tz());
            Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());

            return(thiscal.Equals(thatcal));
        }
Exemplo n.º 3
0
        private XSGMonth castGMonth(AnyAtomicType aat)
        {
            if (aat is XSGMonth)
            {
                XSGMonth gm = (XSGMonth)aat;
                return(new XSGMonth(gm.calendar(), gm.tz()));
            }

            if (aat is XSDate)
            {
                XSDate date = (XSDate)aat;
                return(new XSGMonth(date.calendar(), date.tz()));
            }

            if (aat is XSDateTime)
            {
                XSDateTime dateTime = (XSDateTime)aat;
                return(new XSGMonth(dateTime.calendar(), dateTime.tz()));
            }

            return(parse_gMonth(aat.StringValue));
        }