コード例 #1
0
        /// <summary>
        /// Comparison between this and the supplied XSTime representation
        /// </summary>
        /// <param name="arg">
        ///            The XSTime to compare with </param>
        /// <returns> True if the supplied time represnts a point in time before that
        ///         represented by the time stored. False otherwise </returns>
        /// <exception cref="DynamicError"> </exception>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public boolean gt(AnyType arg, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public virtual bool gt(AnyType arg, DynamicContext context)
        {
            XSTime   val     = (XSTime)NumericType.get_single_type(arg, typeof(XSTime));
            Calendar thiscal = normalizeCalendar(calendar(), tz());
            Calendar thatcal = normalizeCalendar(val.calendar(), val.tz());

            return(thiscal.IsGreaterThan(thatcal));
        }
コード例 #2
0
        private ResultSequence minusXSTimeDuration(Item at)
        {
            XSTime   val        = (XSTime)at;
            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())));
        }
コード例 #3
0
        private CalendarType castTime(AnyAtomicType aat)
        {
            if (aat is XSTime)
            {
                XSTime time = (XSTime)aat;
                return(new XSTime(time.calendar(), time.tz()));
            }
            if (aat is XSDateTime)
            {
                XSDateTime dateTime = (XSDateTime)aat;
                return(new XSTime(dateTime.calendar(), dateTime.tz()));
            }

            return(parse_time(aat.StringValue));
        }
コード例 #4
0
        /// <summary>
        /// Mathematical addition between this time stored and the supplied time
        /// duration.
        /// </summary>
        /// <param name="arg">
        ///            A XDTDayTimeDuration representation of the duration of time to
        ///            add </param>
        /// <returns> A XSTime representing the result of this addition. </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 plus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public virtual ResultSequence plus(ResultSequence arg)
        {
            XSDuration val = (XSDuration)NumericType.get_single_type(arg, typeof(XSDayTimeDuration));

            try
            {
                double ms = val.time_value() * 1000.0;

                XSTime res = (XSTime)clone();

                res.calendar().add(Calendar.MILLISECOND, (int)ms);

                return(ResultSequenceFactory.create_new(res));
            }
            catch
            {
                Debug.Assert(false);
                return(null);
            }
        }