コード例 #1
0
ファイル: XSDateTime.cs プロジェクト: kaby76/AntlrTreeEditing
        /// <summary>
        /// Creates a new result sequence consisting of the retrievable date and time
        /// value in the supplied result sequence
        /// </summary>
        /// <param name="arg">
        ///            The result sequence from which to extract the date and time
        ///            value. </param>
        /// <exception cref="DynamicError"> </exception>
        /// <returns> A new result sequence consisting of the date and time value
        ///         supplied. </returns>
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in .NET:
//ORIGINAL LINE: public org.eclipse.wst.xml.xpath2.api.ResultSequence constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat = (AnyAtomicType)arg.first();

            if (aat is NumericType || aat is XSDuration || aat is XSTime || isGDataType(aat) || aat is XSBoolean || aat is XSBase64Binary || aat is XSHexBinary || aat is XSAnyURI)
            {
                throw DynamicError.invalidType();
            }

            if (!isCastable(aat))
            {
                throw DynamicError.cant_cast(null);
            }

            CalendarType dt = castDateTime(aat);

            if (dt == null)
            {
                throw DynamicError.cant_cast(null);
            }

            return(dt);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new ResultSequence consisting of the extractable time from the
        /// supplied ResultSequence
        /// </summary>
        /// <param name="arg">
        ///            The ResultSequence from which to extract the time </param>
        /// <returns> New ResultSequence consisting of the supplied time </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 constructor(org.eclipse.wst.xml.xpath2.api.ResultSequence arg) throws org.eclipse.wst.xml.xpath2.processor.DynamicError
        public override ResultSequence constructor(ResultSequence arg)
        {
            if (arg.empty())
            {
                return(ResultBuffer.EMPTY);
            }

            AnyAtomicType aat = (AnyAtomicType)arg.first();

            if (!isCastable(aat))
            {
                throw DynamicError.invalidType();
            }

            CalendarType t = castTime(aat);

            if (t == null)
            {
                throw DynamicError.cant_cast(null);
            }

            return(t);
        }