/// <summary> /// Mathematical multiplication between this duration stored and the supplied /// duration of time (of type XSYearMonthDuration) /// </summary> /// <param name="arg"> /// The duration of time to multiply by </param> /// <returns> New XSYearMonthDuration representing the resulting duration /// after the multiplication </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 times(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual ResultSequence times(ResultSequence arg) { ResultSequence convertedRS = arg; if (arg.size() == 1) { Item argValue = arg.first(); if (argValue is XSDecimal) { convertedRS = ResultSequenceFactory.create_new(new XSDouble(argValue.StringValue)); } } XSDouble val = (XSDouble)NumericType.get_single_type(convertedRS, typeof(XSDouble)); if (val.nan()) { throw DynamicError.nan(); } if (val.infinite()) { throw DynamicError.overflowDateTime(); } int res = (int)Math.Round(monthValue() * val.double_value()); return(ResultSequenceFactory.create_new(new XSYearMonthDuration(res))); }
/// <summary> /// Doc 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:doc 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 doc(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.EvaluationContext ec) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence doc(ICollection args, EvaluationContext ec) { ICollection cargs = Function.convert_arguments(args, expected_args()); // get args IEnumerator argiter = cargs.GetEnumerator(); argiter.MoveNext(); ResultSequence arg1 = (ResultSequence)argiter.Current; if (arg1 == null || arg1.empty()) { return(ResultSequenceFactory.create_new()); } string uri = ((XSString)arg1.item(0)).value(); DynamicContext dc = ec.DynamicContext; var resolved = dc.resolveUri(uri); if (resolved == null) { throw DynamicError.invalid_doc(null); } Document doc = dc.getDocument(resolved); if (doc == null) { throw DynamicError.doc_not_found(null); } return(new DocType(doc, ec.StaticContext.TypeModel)); }
/// <summary> /// Mathematical subtraction operator between this XSInteger and the supplied /// ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a subtraction with </param> /// <returns> A XSInteger consisting of the result of the mathematical /// subtraction. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence minus(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSInteger val = (XSInteger)get_single_type(carg, typeof(XSInteger)); return(ResultSequenceFactory.create_new(new XSInteger(int_value() - val.int_value()))); }
/// <summary> /// Mathematical integer division operator between this XSDouble and the /// supplied ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform an integer division with </param> /// <returns> A XSInteger consisting of the result of the mathematical integer /// division. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence idiv(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence idiv(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSDouble val = (XSDouble)get_single_type(carg, typeof(XSDouble)); if (this.nan() || val.nan()) { throw DynamicError.numeric_overflow("Dividend or divisor is NaN"); } if (this.infinite()) { throw DynamicError.numeric_overflow("Dividend is infinite"); } if (val.zero()) { throw DynamicError.div_zero(null); } decimal result = new decimal((double_value() / val.double_value())); return(ResultSequenceFactory.create_new(new XSInteger(new BigInteger(result)))); }
/// <summary> /// Mathematical modulus operator between this XSFloat and the supplied /// ResultSequence. Due to no numeric type promotion or conversion, the /// ResultSequence must be of type XSFloat. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a modulus with </param> /// <returns> A XSFloat consisting of the result of the mathematical modulus. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence mod(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence mod(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSFloat val = (XSFloat)get_single_type(carg, typeof(XSFloat)); return(ResultSequenceFactory.create_new(new XSFloat(float_value() % val.float_value()))); }
/// <summary> /// Min operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <param name="dynamic"> /// Dynamic context </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:min 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 min(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence min(ICollection args, DynamicContext context) { ResultSequence arg = FnMax.get_arg(args, typeof(CmpLt)); if (arg.empty()) { return(ResultSequenceFactory.create_new()); } CmpLt max = null; TypePromoter tp = new ComparableTypePromoter(); tp.considerSequence(arg); for (var i = arg.iterator(); i.MoveNext();) { AnyAtomicType conv = tp.promote((AnyType)i.Current); if (conv != null) { if (conv is XSDouble && ((XSDouble)conv).nan() || conv is XSFloat && ((XSFloat)conv).nan()) { return(ResultSequenceFactory.create_new(tp.promote(new XSFloat(float.NaN)))); } if (max == null || ((CmpLt)conv).lt((AnyType)max, context)) { max = (CmpLt)conv; } } } return(ResultSequenceFactory.create_new((AnyType)max)); }
/// <summary> /// Deep-Equal expression operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <param name="context"> /// Dynamic context </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:deep-equal 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 deep_equal(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.EvaluationContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence deep_equal(ICollection args, EvaluationContext context) { // get args IEnumerator citer = args.GetEnumerator(); citer.MoveNext(); ResultSequence arg1 = (ResultSequence)citer.Current; citer.MoveNext(); ResultSequence arg2 = (ResultSequence)citer.Current; ResultSequence arg3 = null; string collationURI = context.StaticContext.CollationProvider.DefaultCollation; if (citer.MoveNext()) { arg3 = (ResultSequence)citer.Current; if (!(arg3 == null || arg3.empty())) { collationURI = arg3.first().StringValue; } } bool result = deep_equal(arg1, arg2, context, collationURI); return(ResultSequenceFactory.create_new(new XSBoolean(result))); }
/// <summary> /// Compare the arguments. /// </summary> /// <param name="args"> /// are compared (optional 3rd argument is the collation) </param> /// <param name="dynamicContext"> /// Current dynamic context </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> The result of the comparison of the arguments. </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 compare(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext context) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence compare(ICollection args, DynamicContext context) { ICollection cargs = Function.convert_arguments(args, expected_args()); IEnumerator argiter = cargs.GetEnumerator(); argiter.MoveNext(); ResultSequence arg1 = (ResultSequence)argiter.Current; argiter.MoveNext(); ResultSequence arg2 = (ResultSequence)argiter.Current; string collationUri = context.CollationProvider.DefaultCollation; if (argiter.MoveNext()) { ResultSequence collArg = (ResultSequence)argiter.Current; collationUri = collArg.first().StringValue; } XSString xstr1 = arg1.empty() ? null : (XSString)arg1.first(); XSString xstr2 = arg2.empty() ? null : (XSString)arg2.first(); System.Numerics.BigInteger result = compare_string(collationUri, xstr1, xstr2, context); if (result != null) { return(ResultSequenceFactory.create_new(new XSInteger(result))); } else { return(ResultSequenceFactory.create_new()); } }
/// <summary> /// Implicit-Timezone 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:implicit-timezone 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 implicit_timezone(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence implicit_timezone(ICollection args, DynamicContext dc) { Debug.Assert(args.Count == 0); AnyType res = new XSDayTimeDuration(dc.TimezoneOffset); return(ResultSequenceFactory.create_new(res)); }
/// <summary> /// Static-base-Uri operation. /// </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 fn:static-base-uri 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 static_base_uri(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.StaticContext sc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence static_base_uri(ICollection args, StaticContext sc) { Debug.Assert(args.Count == 0); Debug.Assert(sc != null); // make a copy prolly return(ResultSequenceFactory.create_new(new XSAnyURI(sc.BaseUri.ToString()))); }
/// <summary> /// Mathematical subtraction between this duration stored and the supplied /// duration of time (of type XSYearMonthDuration) /// </summary> /// <param name="arg"> /// The duration of time to subtract </param> /// <returns> New XSYearMonthDuration representing the resulting duration /// after the subtraction </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 minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual ResultSequence minus(ResultSequence arg) { XSYearMonthDuration val = (XSYearMonthDuration)NumericType.get_single_type(arg, typeof(XSYearMonthDuration)); int res = monthValue() - val.monthValue(); return(ResultSequenceFactory.create_new(new XSYearMonthDuration(res))); }
/// <summary> /// Mathematical subtraction between this duration stored and the supplied /// duration of time (of type XSDayTimeDuration) /// </summary> /// <param name="arg"> /// The duration of time to subtract </param> /// <returns> New XSDayTimeDuration representing the resulting duration after /// the subtraction </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 minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public virtual ResultSequence minus(ResultSequence arg) { XSDuration val = (XSDuration)NumericType.get_single_type(arg, typeof(XSDayTimeDuration)); double res = value() - val.value(); return(ResultSequenceFactory.create_new(new XSDayTimeDuration(res))); }
/// <summary> /// Mathematical modulus operator between this XSDouble and the supplied /// ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a modulus with </param> /// <returns> A XSDouble consisting of the result of the mathematical modulus. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence mod(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence mod(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSDouble val = (XSDouble)get_single_type(carg, typeof(XSDouble)); return(ResultSequenceFactory.create_new(new XSDouble(double_value() % val.double_value()))); }
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: protected org.eclipse.wst.xml.xpath2.api.Item convertArg(AnyType arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError protected internal virtual Item convertArg(AnyType arg) { ResultSequence rs = ResultSequenceFactory.create_new(arg); rs = constructor(rs); Item carg = rs.first(); return(carg); }
/// <summary> /// Mathematical multiplication operator between this XSDecimal and the /// supplied ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a multiplication with </param> /// <returns> A XSDecimal consisting of the result of the mathematical /// multiplication. </returns> public override ResultSequence times(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal)); decimal result = _value * val.Value; return(ResultSequenceFactory.create_new(new XSDecimal(result))); }
/// <summary> /// Current-Date 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-date 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_date(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence current_date(ICollection args, DynamicContext dc) { Debug.Assert(args.Count == 0); XSDayTimeDuration tz = new XSDayTimeDuration(dc.TimezoneOffset); AnyType res = new XSDate(dc.CurrentDateTime, tz); return(ResultSequenceFactory.create_new(res)); }
// voodoo 2 /// <summary> /// Actual equality operation for fs_eq_value. /// </summary> /// <param name="args"> /// input arguments. </param> /// <param name="type"> /// type of the arguments. </param> /// <param name="mname"> /// Method name for template simulation. </param> /// <param name="dynamicContext"> /// Dynamic error. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of the operation. </returns> public static ResultSequence do_cmp_value_op(ICollection args, Type type, string mname, DynamicContext context) { // sanity check args + convert em if (args.Count != 2) { DynamicError.throw_type_error(); } ICollection cargs = value_convert_args(args); if (cargs.Count == 0) { return(ResultBuffer.EMPTY); } // make sure arugments are comparable by equality IEnumerator argi = cargs.GetEnumerator(); argi.MoveNext(); Item arg = ((ResultSequence)argi.Current).first(); argi.MoveNext(); ResultSequence arg2 = (ResultSequence)argi.Current; if (arg2.size() != 1) { DynamicError.throw_type_error(); } if (!(type.IsInstanceOfType(arg))) { DynamicError.throw_type_error(); } try { Type[] margsdef = new Type[] { type }; Type[] margsdef2 = new Type[] { typeof(AnyType), typeof(DynamicContext) }; object[] margs3 = new object[] { mname, margsdef2 }; var v1 = typeof(GenericIComparer) .GetMethod("GetComparer"); var v2 = v1.MakeGenericMethod(margsdef); var method = (MethodBase)v2.Invoke(null, margs3); object[] margs = new object[] { arg2.first(), context }; object[] real_args = new object[] { arg, margs }; bool cmpres = (bool)method.Invoke(arg, margs); return(ResultSequenceFactory.create_new(new XSBoolean(cmpres))); } catch { Debug.Assert(false); throw new Exception("cannot compare using method " + mname); } }
/// <summary> /// Mathematical modulus operator between this XSInteger and the supplied /// ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a modulus with </param> /// <returns> A XSInteger consisting of the result of the mathematical modulus. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence mod(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence mod(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSInteger val = (XSInteger)get_single_type(carg, typeof(XSInteger)); System.Numerics.BigInteger result = ((long)int_value()) % (val.int_value()); return(ResultSequenceFactory.create_new(new XSInteger(result))); }
/// <summary> /// Current-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-time 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_time(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.DynamicContext dc) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence current_time(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 XSTime(dc.CurrentDateTime, tz); return(ResultSequenceFactory.create_new(res)); }
/// <summary> /// Position 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:position 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 position(java.util.Collection args, org.eclipse.wst.xml.xpath2.api.EvaluationContext ec) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence position(ICollection args, EvaluationContext ec) { Debug.Assert(args.Count == 0); if (ec.ContextItem == null) { throw DynamicError.contextUndefined(); } return(ResultSequenceFactory.create_new(new XSInteger(new System.Numerics.BigInteger(ec.ContextPosition)))); }
/// <summary> /// Evaluate arguments. /// </summary> /// <param name="args"> /// argument expressions. </param> /// <returns> Result of evaluation. </returns> public override ResultSequence evaluate(ICollection args, EvaluationContext ec) { // 1 argument only! Debug.Assert(args.Count >= min_arity() && args.Count <= max_arity()); var i = args.GetEnumerator(); i.MoveNext(); ResultSequence argument = (ResultSequence)i.Current; return(ResultSequenceFactory.create_new(fn_boolean(argument))); }
/// <summary> /// Mathematical modulus operator between this XSDecimal and the supplied /// ResultSequence. Due to no numeric type promotion or conversion, the /// ResultSequence must be of type XSDecimal. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a modulus with </param> /// <returns> A XSDecimal consisting of the result of the mathematical modulus. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence mod(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence mod(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); XSDecimal val = (XSDecimal)get_single_type(carg, typeof(XSDecimal)); // BigDecimal result = _value.remainder(val.getValue()); decimal result = remainder(_value, val.Value); return(ResultSequenceFactory.create_new(new XSDecimal(result))); }
/// <summary> /// set the start and end of the range result sequence /// </summary> /// <param name="start"> /// is the integer position of the start of range. </param> /// <param name="end"> /// is the integer position of the end of range. </param> public RangeResultSequence(int start, int end) { _size = (end - start) + 1; Debug.Assert(_size >= 0); _start = start; _end = end; _tail = ResultSequenceFactory.create_new(); }
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()))); }
/// <summary> /// Count operation. /// </summary> /// <param name="args"> /// Result from the expressions evaluation. </param> /// <exception cref="DynamicError"> /// Dynamic error. </exception> /// <returns> Result of fn:count 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 count(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public static ResultSequence count(ICollection args) { Debug.Assert(args.Count == 1); // get args IEnumerator citer = args.GetEnumerator(); citer.MoveNext(); ResultSequence arg = (ResultSequence)citer.Current; return(ResultSequenceFactory.create_new(new XSInteger(new System.Numerics.BigInteger(arg.size())))); }
//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()))); }
/// <summary> /// Mathematical subtraction operator between this XSFloat and the supplied /// ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform a subtraction with </param> /// <returns> A XSFloat consisting of the result of the mathematical /// subtraction. </returns> //JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET: //ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence minus(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError public override ResultSequence minus(ResultSequence arg) { ResultSequence carg = constructor(arg); Item at = get_single_arg(carg); if (!(at is XSFloat)) { DynamicError.throw_type_error(); } XSFloat val = (XSFloat)at; return(ResultSequenceFactory.create_new(new XSFloat(float_value() - val.float_value()))); }
// math /// <summary> /// Mathematical addition operator between this XSDouble and the supplied /// ResultSequence. /// </summary> /// <param name="arg"> /// The ResultSequence to perform an addition with </param> /// <returns> A XSDouble consisting of the result of the mathematical addition. </returns> //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 override ResultSequence plus(ResultSequence arg) { ResultSequence carg = convertResultSequence(arg); Item at = get_single_arg(carg); if (!(at is XSDouble)) { DynamicError.throw_type_error(); } XSDouble val = (XSDouble)at; return(ResultSequenceFactory.create_new(new XSDouble(double_value() + val.double_value()))); }
/// <summary> /// Not operation. /// </summary> /// <param name="arg"> /// Result from the expressions evaluation. </param> /// <returns> Result of fn:note operation. </returns> /// <exception cref="DynamicError"> </exception> public static ResultSequence fn_not(ResultSequence arg) { XSBoolean ret = FnBoolean.fn_boolean(arg); bool answer = false; if (ret.value() == false) { answer = true; } return(ResultSequenceFactory.create_new(new XSBoolean(answer))); }
/// <summary> /// Mathematical addition operator between this XSDate and a supplied result /// sequence (XDTYearMonthDuration and XDTDayTimeDuration are only valid /// ones). /// </summary> /// <param name="arg"> /// The supplied ResultSequence that is on the right of the minus /// operator. If arg is an XDTYearMonthDuration or an /// XDTDayTimeDuration the result will be a XSDate of the result /// of the current date minus the duration of time supplied. </param> /// <returns> New ResultSequence consisting of the result of the mathematical /// minus operation. </returns> //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) { if (arg.size() != 1) { DynamicError.throw_type_error(); } Item at = arg.first(); try { if (at is XSYearMonthDuration) { XSYearMonthDuration val = (XSYearMonthDuration)at; XSDate res = (XSDate)clone(); res.calendar().add(Calendar.MONTH, val.monthValue()); return(ResultSequenceFactory.create_new(res)); } else if (at is XSDayTimeDuration) { XSDayTimeDuration val = (XSDayTimeDuration)at; XSDate res = (XSDate)clone(); // We only need to add the Number of days dropping the rest. int days = val.days(); if (val.negative()) { days *= -1; } res.calendar().add(Calendar.DAY_OF_MONTH, days); res.calendar().add(Calendar.MILLISECOND, (int)(val.time_value() * 1000.0)); return(ResultSequenceFactory.create_new(res)); } else { DynamicError.throw_type_error(); return(null); // unreach } } catch { Debug.Assert(false); return(null); } }