예제 #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
        private ResultSequence minusXSDayTimeDuration(Item at)
        {
            XSDuration val = (XSDuration)at;

            XSTime res = null;

            try
            {
                res = (XSTime)clone();
            }
            catch
            {
                return(null);
            }

            XMLGregorianCalendar xmlCal     = _datatypeFactory.newXMLGregorianCalendar((GregorianCalendar)calendar());
            Duration             dtduration = _datatypeFactory.newDuration(val.StringValue);

            xmlCal.add(dtduration.negate());
            res = new XSTime(xmlCal.toGregorianCalendar(), res.tz());

            return(ResultSequenceFactory.create_new(res));
        }