Check-in [58be2b6ff9]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Bring in regionMatches to the supervisor.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 58be2b6ff98f5f3bcdb9082831ab9df84eb008d7
User & Date: stephanie.gawroriski 2020-01-19 15:46:15
Context
2020-01-19
15:54
Merge heads. check-in: 553fa6eb7c user: stephanie.gawroriski tags: trunk
15:46
Bring in regionMatches to the supervisor. check-in: 58be2b6ff9 user: stephanie.gawroriski tags: trunk
2020-01-18
20:09
Implement String.regionMatches(); Add method to ClassLoadingAdjustments to consider the current class; Make it so that classes within the same package are not deferred loaded. check-in: 4623e16026 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/klib/supervisor/java/lang/Character.java.

55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toLowerCase(char __c)
	{
		if (__c >= 'A' && __c <= 'Z')
			return __c + ('a' + (__c - 'A'));
		return __c;
	}
	
	/**
	 * Converts the specified character to lower case without considering
	 * locale.
	 *
................................................................................
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toUpperCase(char __c)
	{
		if (__c >= 'a' && __c <= 'z')
			return __c + ('A' + (__c - 'a'));
		return __c;
	}
}








|







 







|




55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
..
70
71
72
73
74
75
76
77
78
79
80
81
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toLowerCase(char __c)
	{
		if (__c >= 'A' && __c <= 'Z')
			return (char)(__c + ('a' + (__c - 'A')));
		return __c;
	}
	
	/**
	 * Converts the specified character to lower case without considering
	 * locale.
	 *
................................................................................
	 * @param __c The character to convert.
	 * @return The converted character.
	 * @since 2020/01/18
	 */
	public static char toUpperCase(char __c)
	{
		if (__c >= 'a' && __c <= 'z')
			return (char)(__c + ('A' + (__c - 'a')));
		return __c;
	}
}

Changes to runt/klib/supervisor/java/lang/String.java.

315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335





























336
337
338
339
340
341
342
	}
	
	/**
	 * Compares the given string regions to see if they match.
	 *
	 * @param __igncase Is case to be ignored?
	 * @param __toff The offset for this string.
	 * @param __o The other string to compare against.
	 * @param __ooff The offset of the target string.
	 * @param __len The number of characters to compare.
	 * @return If the region matches or not.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/01/18
	 */
	public boolean regionMatches(boolean __igncase, int __toff, String __o,
		int __ooff, int __len)
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();





























	}
	
	/**
	 * Returns a substring of this string starting at the given index.
	 *
	 * @param __s The index to start at.
	 * @return The sub-string for that index.







|
|





|
|

|


|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
	}
	
	/**
	 * Compares the given string regions to see if they match.
	 *
	 * @param __igncase Is case to be ignored?
	 * @param __toff The offset for this string.
	 * @param __b The other string to compare against.
	 * @param __boff The offset of the target string.
	 * @param __len The number of characters to compare.
	 * @return If the region matches or not.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/01/18
	 */
	public boolean regionMatches(boolean __igncase, int __toff, String __b,
		int __boff, int __len)
	{
		if (__b == null)
			throw new NullPointerException("NARG");
		
		// Automatically false
		if (__toff < 0 || __boff < 0 ||
			__toff + __len > this.length() || __boff + __len > __b.length())
			return false;
		
		// A quirk of the standard is that negative lengths are not an error
		// but are treated as matches
		if (__len < 0)
			return true;
		
		// Disregarding case
		if (__igncase)
			for (int i = 0; i < __len; i++, __toff++, __boff++)
			{
				char a = this.charAt(__toff),
					b = __b.charAt(__boff);
				
				if (Character.toLowerCase(a) != Character.toLowerCase(b) &&
					Character.toUpperCase(a) != Character.toUpperCase(b))
					return false;
			}
		
		// Regarding case
		else
			for (int i = 0; i < __len; i++, __toff++, __boff++)
				if (this.charAt(__toff) != __b.charAt(__boff))
					return false;
		
		// Matches
		return true;
	}
	
	/**
	 * Returns a substring of this string starting at the given index.
	 *
	 * @param __s The index to start at.
	 * @return The sub-string for that index.