Example #1
0
        // comparisons
        /// <summary>
        /// Equality comparison on this and the supplied dates (taking timezones into
        /// account)
        /// </summary>
        /// <param name="arg">
        ///            XSDate representation of the date to compare to </param>
        /// <exception cref="DynamicError"> </exception>
        /// <returns> True if the two dates are represent the same exact point in time.
        ///         False otherwise. </returns>
//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)
        {
            XSDate   val     = (XSDate)NumericType.get_single_type((Item)arg, typeof(XSDate));
            Calendar thiscal = normalizeCalendar(calendar(), tz());
            Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());

            return(thiscal.Equals(thatcal));
        }
Example #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: private org.eclipse.wst.xml.xpath2.api.ResultSequence minusXSDate(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        private ResultSequence minusXSDate(ResultSequence arg)
        {
            XSDate   val        = (XSDate)NumericType.get_single_type(arg, typeof(XSDate));
            Duration dtduration = null;
            Calendar thisCal    = normalizeCalendar(calendar(), tz());
            Calendar thatCal    = normalizeCalendar(val.calendar(), val.tz());
            long     duration   = thisCal.getTimeInMillis()
                                  - thatCal.getTimeInMillis();

            dtduration = _datatypeFactory.newDuration(duration);
            return(ResultSequenceFactory.create_new(XSDayTimeDuration.parseDTDuration(dtduration.ToString())));
        }
Example #3
0
        private XSDate castDate(Item aat)
        {
            if (aat is XSDate)
            {
                XSDate date = (XSDate)aat;
                return(new XSDate(date.calendar(), date.tz()));
            }

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

            return(parse_date(aat.StringValue));
        }
Example #4
0
        private CalendarType castDateTime(AnyAtomicType aat)
        {
            if (aat is XSDate)
            {
                XSDate date = (XSDate)aat;
                return(new XSDateTime(date.calendar(), date.tz()));
            }

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

            return(parseDateTime(aat.StringValue));
        }
Example #5
0
        private ResultSequence minusXSDayTimeDuration(AnyType at)
        {
            XSDuration val = (XSDuration)at;

            try
            {
                XSDate res = (XSDate)clone();
                XMLGregorianCalendar xmlCal = _datatypeFactory
                                              .newXMLGregorianCalendar(
                    (GregorianCalendar)calendar());
                Duration dtduration = _datatypeFactory.newDuration(val.StringValue);
                xmlCal.add(dtduration.negate());
                res = new XSDate(xmlCal.toGregorianCalendar(), res.tz());
                return(ResultSequenceFactory.create_new(res));
            }
            catch
            {
            }
            return(null);
        }
Example #6
0
        private XSGDay castGDay(AnyAtomicType aat)
        {
            if (aat is XSGDay)
            {
                XSGDay gday = (XSGDay)aat;
                return(new XSGDay(gday.calendar(), gday.tz()));
            }

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

            if (aat is XSDateTime)
            {
                XSDateTime dateTime = (XSDateTime)aat;
                return(new XSGDay(dateTime.calendar(), dateTime.tz()));
            }
            return(parse_gDay(aat.StringValue));
        }
Example #7
0
        private XSGYear castGYear(AnyAtomicType aat)
        {
            if (aat is XSGYear)
            {
                XSGYear gy = (XSGYear)aat;
                return(new XSGYear(gy.calendar(), gy.tz()));
            }

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

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

            return(parse_gYear(aat.StringValue));
        }
Example #8
0
        private XSGYearMonth castGYearMonth(AnyAtomicType aat)
        {
            if (aat is XSGYearMonth)
            {
                XSGYearMonth gym = (XSGYearMonth)aat;
                return(new XSGYearMonth(gym.calendar(), gym.tz()));
            }

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

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

            return(parse_gYearMonth(aat.StringValue));
        }
Example #9
0
        private XSGMonthDay castGMonthDay(AnyAtomicType aat)
        {
            if (aat is XSGMonthDay)
            {
                XSGMonthDay gmd = (XSGMonthDay)aat;
                return(new XSGMonthDay(gmd.calendar(), gmd.tz()));
            }

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

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

            return(parse_gMonthDay(aat.StringValue));
        }