Пример #1
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public static org.eclipse.wst.xml.xpath2.api.ResultSequence fn_round_half_to_even(java.util.Collection args) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence fn_round_half_to_even(ICollection args)
        {
            if (args.Count > 2 || args.Count <= 1)
            {
                throw new DynamicError(TypeError.invalid_type(null));
            }

            IEnumerator argIt = args.GetEnumerator();

            argIt.MoveNext();
            ResultSequence rsArg1 = (ResultSequence)argIt.Current;

            argIt.MoveNext();
            ResultSequence rsPrecision = (ResultSequence)argIt.Current;

            NumericType nt = FnAbs.get_single_numeric_arg(rsArg1);

            // empty arg
            if (nt == null)
            {
                return(ResultBuffer.EMPTY);
            }

            NumericType ntPrecision = (NumericType)rsPrecision.first();

            return(nt.round_half_to_even(int.Parse(ntPrecision.StringValue)));
        }
Пример #2
0
        /// <summary>
        /// Round-Half-to-Even operation.
        /// </summary>
        /// <param name="arg">
        ///            Result from the expressions evaluation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of fn:round-half-to-even 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 fn_round_half_to_even(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence fn_round_half_to_even(ResultSequence arg)
        {
            NumericType nt = FnAbs.get_single_numeric_arg(arg);

            // empty arg
            if (nt == null)
            {
                return(ResultBuffer.EMPTY);
            }

            return(nt.round_half_to_even());
        }
Пример #3
0
        /// <summary>
        /// Round operation.
        /// </summary>
        /// <param name="arg">
        ///            Result from the expressions evaluation. </param>
        /// <exception cref="DynamicError">
        ///             Dynamic error. </exception>
        /// <returns> Result of fn:round 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 fn_round(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public static ResultSequence fn_round(ResultSequence arg)
        {
            // sanity chex
            NumericType nt = FnAbs.get_single_numeric_arg(arg);

            // empty arg
            if (nt == null)
            {
                return(ResultBuffer.EMPTY);
            }

            return(nt.round());
        }