Beispiel #1
0
        /** Construct a compound token. */
        private Token gramToken(Token first, Token second)
        {
            buffer.setLength(0);
#pragma warning disable 612
            buffer.append(first.termText());
#pragma warning restore 612
            buffer.append(SEPARATOR);
#pragma warning disable 612
            buffer.append(second.termText());
#pragma warning restore 612
            Token result = new Token(buffer.toString(), first.startOffset(), second
                                     .endOffset(), "gram");
            result.setPositionIncrement(0);
            return(result);
        }
Beispiel #2
0
 private void updateText(long now)
 {
     lock (this)
     {
         long seconds = now - mBase;
         seconds /= 1000;
         string text = android.text.format.DateUtils.formatElapsedTime(mRecycle, seconds);
         if (mFormat != null)
         {
             System.Globalization.CultureInfo loc = System.Globalization.CultureInfo.CurrentCulture;
             if (mFormatter == null || !loc.Equals(mFormatterLocale))
             {
                 mFormatterLocale = loc;
                 mFormatter       = new java.util.Formatter(mFormatBuilder, loc);
             }
             mFormatBuilder.setLength(0);
             mFormatterArgs[0] = text;
             try
             {
                 mFormatter.format(mFormat, mFormatterArgs);
                 text = mFormatBuilder.ToString();
             }
             catch (java.util.IllegalFormatException)
             {
                 if (!mLogged)
                 {
                     android.util.Log.w(TAG, "Illegal format string: " + mFormat);
                     mLogged = true;
                 }
             }
         }
         setText(java.lang.CharSequenceProxy.Wrap(text));
     }
 }
Beispiel #3
0
        /// <summary>
        /// Returns the ASCII characters up to but not including the next "\r\n", or
        /// "\n".
        /// </summary>
        /// <remarks>
        /// Returns the ASCII characters up to but not including the next "\r\n", or
        /// "\n".
        /// </remarks>
        /// <exception cref="java.io.EOFException">
        /// if the stream is exhausted before the next newline
        /// character.
        /// </exception>
        /// <exception cref="System.IO.IOException"></exception>
        public static string readAsciiLine(java.io.InputStream @in)
        {
            // TODO: support UTF-8 here instead
            java.lang.StringBuilder result = new java.lang.StringBuilder(80);
            while (true)
            {
                int c = @in.read();
                if (c == -1)
                {
                    throw new java.io.EOFException();
                }
                else
                {
                    if (c == '\n')
                    {
                        break;
                    }
                }
                result.append((char)c);
            }
            int length = result.Length;

            if (length > 0 && result[length - 1] == '\r')
            {
                result.setLength(length - 1);
            }
            return(result.ToString());
        }
Beispiel #4
0
 /// <summary>Return a string representation of the rectangle in a compact form.</summary>
 /// <remarks>Return a string representation of the rectangle in a compact form.</remarks>
 /// <hide></hide>
 public string toShortString(java.lang.StringBuilder sb)
 {
     sb.setLength(0);
     sb.append('[');
     sb.append(left);
     sb.append(',');
     sb.append(top);
     sb.append("][");
     sb.append(right);
     sb.append(',');
     sb.append(bottom);
     sb.append(']');
     return(sb.ToString());
 }
 public StringBuilder Clear()
 {
     sb.setLength(0);
     return(this);
 }
Beispiel #6
0
		/// <summary>
		/// Returns the ASCII characters up to but not including the next "\r\n", or
		/// "\n".
		/// </summary>
		/// <remarks>
		/// Returns the ASCII characters up to but not including the next "\r\n", or
		/// "\n".
		/// </remarks>
		/// <exception cref="java.io.EOFException">
		/// if the stream is exhausted before the next newline
		/// character.
		/// </exception>
		/// <exception cref="System.IO.IOException"></exception>
		public static string readAsciiLine(java.io.InputStream @in)
		{
			// TODO: support UTF-8 here instead
			java.lang.StringBuilder result = new java.lang.StringBuilder(80);
			while (true)
			{
				int c = @in.read();
				if (c == -1)
				{
					throw new java.io.EOFException();
				}
				else
				{
					if (c == '\n')
					{
						break;
					}
				}
				result.append((char)c);
			}
			int length = result.Length;
			if (length > 0 && result[length - 1] == '\r')
			{
				result.setLength(length - 1);
			}
			return result.ToString();
		}