Esempio n. 1
0
		// first selector == class name
		// check potential attributes
		/// <hide></hide>
		public static void buildShortClassTag(object cls, java.lang.StringBuilder @out)
		{
			if (cls == null)
			{
				@out.append("null");
			}
			else
			{
				string simpleName = cls.GetType().Name;
				if (simpleName == null || string.IsNullOrEmpty(simpleName))
				{
					simpleName = cls.GetType().FullName;
					int end = simpleName.LastIndexOf('.');
					if (end > 0)
					{
						simpleName = Sharpen.StringHelper.Substring(simpleName, end + 1);
					}
				}
				@out.append(simpleName);
				@out.append('{');
				@out.append(Sharpen.Util.IntToHexString(Sharpen.Util.IdentityHashCode(cls)));
			}
		}
Esempio n. 2
0
		/// <hide></hide>
		public virtual void toShortString(java.lang.StringBuilder sb)
		{
			float[] values = new float[9];
			getValues(values);
			sb.append('[');
			sb.append(values[0]);
			sb.append(", ");
			sb.append(values[1]);
			sb.append(", ");
			sb.append(values[2]);
			sb.append("][");
			sb.append(values[3]);
			sb.append(", ");
			sb.append(values[4]);
			sb.append(", ");
			sb.append(values[5]);
			sb.append("][");
			sb.append(values[6]);
			sb.append(", ");
			sb.append(values[7]);
			sb.append(", ");
			sb.append(values[8]);
			sb.append(']');
		}
Esempio n. 3
0
		private static void appendHex(java.lang.StringBuilder sb, byte b)
		{
			sb.append('%');
			sb.append(Sharpen.Util.ByteToHexString(b, true));
		}
		private static void appendEvent(java.lang.StringBuilder message, int index, android.view.InputEvent
			 @event, bool unhandled)
		{
			message.append(index).append(": sent at ").append(@event.getEventTimeNano());
			message.append(", ");
			if (unhandled)
			{
				message.append("(unhandled) ");
			}
			message.append(@event);
		}
Esempio n. 5
0
		/// <summary>
		/// Encodes
		/// <code>s</code>
		/// and appends the result to
		/// <code>builder</code>
		/// .
		/// </summary>
		/// <param name="isPartiallyEncoded">
		/// true to fix input that has already been
		/// partially or fully encoded. For example, input of "hello%20world" is
		/// unchanged with isPartiallyEncoded=true but would be double-escaped to
		/// "hello%2520world" otherwise.
		/// </param>
		private void appendEncoded(java.lang.StringBuilder builder, string s, java.nio.charset.Charset
			 charset, bool isPartiallyEncoded)
		{
			if (s == null)
			{
				throw new System.ArgumentNullException();
			}
			int escapeStart = -1;
			{
				for (int i = 0; i < s.Length; i++)
				{
					char c = s[i];
					if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c >= '0' && c <= '9') ||
						 isRetained(c) || (c == '%' && isPartiallyEncoded))
					{
						if (escapeStart != -1)
						{
							appendHex(builder, Sharpen.StringHelper.Substring(s, escapeStart, i), charset);
							escapeStart = -1;
						}
						if (c == '%' && isPartiallyEncoded)
						{
							// this is an encoded 3-character sequence like "%20"
							builder.append(java.lang.CharSequenceProxy.Wrap(s), i, i + 3);
							i += 2;
						}
						else
						{
							if (c == ' ')
							{
								builder.append('+');
							}
							else
							{
								builder.append(c);
							}
						}
					}
					else
					{
						if (escapeStart == -1)
						{
							escapeStart = i;
						}
					}
				}
			}
			if (escapeStart != -1)
			{
				appendHex(builder, Sharpen.StringHelper.Substring(s, escapeStart, s.Length), charset
					);
			}
		}
Esempio n. 6
0
		/// <summary>Internal helper method to append a given string to a given string buffer.
		/// 	</summary>
		/// <remarks>
		/// Internal helper method to append a given string to a given string buffer.
		/// If the string contains any references to groups, these are replaced by
		/// the corresponding group's contents.
		/// </remarks>
		/// <param name="buffer">the string buffer.</param>
		/// <param name="s">the string to append.</param>
		private void appendEvaluated(java.lang.StringBuffer buffer, string s)
		{
			bool escape = false;
			bool dollar = false;
			{
				for (int i = 0; i < s.Length; i++)
				{
					char c = s[i];
					if (c == '\\' && !escape)
					{
						escape = true;
					}
					else
					{
						if (c == '$' && !escape)
						{
							dollar = true;
						}
						else
						{
							if (c >= '0' && c <= '9' && dollar)
							{
								buffer.append(group(c - '0'));
								dollar = false;
							}
							else
							{
								buffer.append(c);
								dollar = false;
								escape = false;
							}
						}
					}
				}
			}
			// This seemingly stupid piece of code reproduces a JDK bug.
			if (escape)
			{
				throw Sharpen.Util.IndexOutOfRangeCtor(s.Length);
			}
		}
Esempio n. 7
0
		/// <summary>
		/// Appends the (unmatched) remainder of the input to the given
		/// <see cref="java.lang.StringBuffer">java.lang.StringBuffer</see>
		/// . The method can be used in conjunction with
		/// <see cref="find()">find()</see>
		/// and
		/// <see cref="appendReplacement(java.lang.StringBuffer, string)">appendReplacement(java.lang.StringBuffer, string)
		/// 	</see>
		/// to
		/// walk through the input and replace all matches of the
		/// <code>Pattern</code>
		/// with something else.
		/// </summary>
		/// <param name="buffer">
		/// the
		/// <code>StringBuffer</code>
		/// to append to.
		/// </param>
		/// <returns>
		/// the
		/// <code>StringBuffer</code>
		/// .
		/// </returns>
		/// <exception cref="System.InvalidOperationException">if no successful match has been made.
		/// 	</exception>
		public java.lang.StringBuffer appendTail(java.lang.StringBuffer buffer)
		{
			if (appendPos < _regionEnd)
			{
				buffer.append(Sharpen.StringHelper.Substring(input, appendPos, _regionEnd));
			}
			return buffer;
		}
Esempio n. 8
0
		/// <summary>
		/// Appends a literal part of the input plus a replacement for the current
		/// match to a given
		/// <see cref="java.lang.StringBuffer">java.lang.StringBuffer</see>
		/// . The literal part is exactly the
		/// part of the input between the previous match and the current match. The
		/// method can be used in conjunction with
		/// <see cref="find()">find()</see>
		/// and
		/// <see cref="appendTail(java.lang.StringBuffer)">appendTail(java.lang.StringBuffer)
		/// 	</see>
		/// to walk through the input and replace
		/// all occurrences of the
		/// <code>Pattern</code>
		/// with something else.
		/// </summary>
		/// <param name="buffer">
		/// the
		/// <code>StringBuffer</code>
		/// to append to.
		/// </param>
		/// <param name="replacement">the replacement text.</param>
		/// <returns>
		/// the
		/// <code>Matcher</code>
		/// itself.
		/// </returns>
		/// <exception cref="System.InvalidOperationException">if no successful match has been made.
		/// 	</exception>
		public java.util.regex.Matcher appendReplacement(java.lang.StringBuffer buffer, string
			 replacement)
		{
			buffer.append(Sharpen.StringHelper.Substring(input, appendPos, start()));
			appendEvaluated(buffer, replacement);
			appendPos = end();
			return this;
		}
Esempio n. 9
0
		/// <hide></hide>
		public virtual void toShortString(java.lang.StringBuilder sb)
		{
			sb.append("{alpha=");
			sb.append(mAlpha);
			sb.append(" matrix=");
			mMatrix.toShortString(sb);
			sb.append('}');
		}
Esempio n. 10
0
		private void appendLocalized(java.lang.StringBuilder result, long value, int width
			)
		{
			int paddingIndex = result.Length;
			char zeroDigit = localeData.zeroDigit;
			if (zeroDigit == '0')
			{
				result.append(value);
			}
			else
			{
				result.append(localizeDigits(java.lang.CharSequenceProxy.Wrap(System.Convert.ToString
					(value))));
			}
			int zeroCount = width - (result.Length - paddingIndex);
			if (zeroCount <= 0)
			{
				return;
			}
			if (zeroDigit == '0')
			{
				result.insert(paddingIndex, ZEROS, 0, zeroCount);
			}
			else
			{
				{
					for (int i = 0; i < zeroCount; ++i)
					{
						result.insert(paddingIndex, zeroDigit);
					}
				}
			}
		}
Esempio n. 11
0
		private java.lang.StringBuilder wrapParentheses(java.lang.StringBuilder result)
		{
			result.setCharAt(0, '(');
			// Replace the '-'.
			if (formatToken.flagZero)
			{
				formatToken.setWidth(formatToken.getWidth() - 1);
				result = (java.lang.StringBuilder)padding(result, 1);
				result.append(')');
			}
			else
			{
				result.append(')');
				result = (java.lang.StringBuilder)padding(result, 0);
			}
			return result;
		}
Esempio n. 12
0
		/// <hide>Just for debugging; not internationalized.</hide>
		public static void formatDuration(long duration, java.lang.StringBuilder builder)
		{
			lock (sFormatSync)
			{
				int len = formatDurationLocked(duration, 0);
				builder.append(sFormatStr, 0, len);
			}
		}