/// <summary> /// Current-Date-Time operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <param name="dc"> /// Result of dynamic context operation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:current-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 current_dateTime(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence current_dateTime(ICollection args, DynamicContext dc) { Debug.Assert(args.Count == 0); var d = dc.TimezoneOffset; XSDayTimeDuration tz = new XSDayTimeDuration(0, d.Hours, d.Minutes, 0.0, d.Sign == -1); AnyType res = new XSDateTime(dc.CurrentDateTime, tz); return(ResultSequenceFactory.create_new(res)); }
/// <summary> /// Seconds-from-dateTime operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:seconds-from-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 seconds_from_date_time(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence seconds_from_date_time(ICollection args) { ICollection cargs = Function.convert_arguments(args, expected_args()); var i = cargs.GetEnumerator(); i.MoveNext(); ResultSequence arg1 = (ResultSequence)i.Current; if (arg1.empty()) { return(ResultBuffer.EMPTY); } XSDateTime dt = (XSDateTime)arg1.first(); double res = dt.second(); return(new XSDecimal(new decimal(res))); }
/// <summary> /// Year-from-DateTime operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:year-from-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 year_from_date_time(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence year_from_date_time(ICollection args) { ICollection cargs = Function.convert_arguments(args, expected_args()); var i = cargs.GetEnumerator(); i.MoveNext(); ResultSequence arg1 = (ResultSequence)i.Current; if (arg1.empty()) { return(ResultBuffer.EMPTY); } XSDateTime dt = (XSDateTime)arg1.first(); int res = dt.year(); return(new XSInteger(new System.Numerics.BigInteger(res))); }
/// <summary> /// Timezone-from-DateTime operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:timezone-from-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 timezone_from_date_time(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence timezone_from_date_time(ICollection args) { ICollection cargs = Function.convert_arguments(args, expected_args()); var i = cargs.GetEnumerator(); i.MoveNext(); ResultSequence arg1 = (ResultSequence)i.Current; if (arg1 == null || arg1.empty()) { return(ResultBuffer.EMPTY); } XSDateTime dt = (XSDateTime)arg1.first(); if (dt.timezoned()) { return(dt.tz()); } return(ResultBuffer.EMPTY); }
/// <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)); }