id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
32,900 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java | DateFormatSymbols.initializeData | protected void initializeData(ULocale desiredLocale, String type)
{
String key = desiredLocale.getBaseName() + '+' + type;
String ns = desiredLocale.getKeywordValue("numbers");
if (ns != null && ns.length() > 0) {
key += '+' + ns;
}
DateFormatSymbols dfs = DFSCACHE.getInstance(key, desiredLocale);
initializeData(dfs);
} | java | protected void initializeData(ULocale desiredLocale, String type)
{
String key = desiredLocale.getBaseName() + '+' + type;
String ns = desiredLocale.getKeywordValue("numbers");
if (ns != null && ns.length() > 0) {
key += '+' + ns;
}
DateFormatSymbols dfs = DFSCACHE.getInstance(key, desiredLocale);
initializeData(dfs);
} | [
"protected",
"void",
"initializeData",
"(",
"ULocale",
"desiredLocale",
",",
"String",
"type",
")",
"{",
"String",
"key",
"=",
"desiredLocale",
".",
"getBaseName",
"(",
")",
"+",
"'",
"'",
"+",
"type",
";",
"String",
"ns",
"=",
"desiredLocale",
".",
"getKe... | We may need to deescalate this API to @internal. | [
"We",
"may",
"need",
"to",
"deescalate",
"this",
"API",
"to"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1499-L1508 |
32,901 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java | DateFormatSymbols.initializeData | void initializeData(DateFormatSymbols dfs) {
this.eras = dfs.eras;
this.eraNames = dfs.eraNames;
this.narrowEras = dfs.narrowEras;
this.months = dfs.months;
this.shortMonths = dfs.shortMonths;
this.narrowMonths = dfs.narrowMonths;
this.standaloneMonths = dfs.standaloneMonths;
this.standaloneShortMonths = dfs.standaloneShortMonths;
this.standaloneNarrowMonths = dfs.standaloneNarrowMonths;
this.weekdays = dfs.weekdays;
this.shortWeekdays = dfs.shortWeekdays;
this.shorterWeekdays = dfs.shorterWeekdays;
this.narrowWeekdays = dfs.narrowWeekdays;
this.standaloneWeekdays = dfs.standaloneWeekdays;
this.standaloneShortWeekdays = dfs.standaloneShortWeekdays;
this.standaloneShorterWeekdays = dfs.standaloneShorterWeekdays;
this.standaloneNarrowWeekdays = dfs.standaloneNarrowWeekdays;
this.ampms = dfs.ampms;
this.ampmsNarrow = dfs.ampmsNarrow;
this.timeSeparator = dfs.timeSeparator;
this.shortQuarters = dfs.shortQuarters;
this.quarters = dfs.quarters;
this.standaloneShortQuarters = dfs.standaloneShortQuarters;
this.standaloneQuarters = dfs.standaloneQuarters;
this.leapMonthPatterns = dfs.leapMonthPatterns;
this.shortYearNames = dfs.shortYearNames;
this.shortZodiacNames = dfs.shortZodiacNames;
this.abbreviatedDayPeriods = dfs.abbreviatedDayPeriods;
this.wideDayPeriods = dfs.wideDayPeriods;
this.narrowDayPeriods = dfs.narrowDayPeriods;
this.standaloneAbbreviatedDayPeriods = dfs.standaloneAbbreviatedDayPeriods;
this.standaloneWideDayPeriods = dfs.standaloneWideDayPeriods;
this.standaloneNarrowDayPeriods = dfs.standaloneNarrowDayPeriods;
this.zoneStrings = dfs.zoneStrings; // always null at initialization time for now
this.localPatternChars = dfs.localPatternChars;
this.capitalization = dfs.capitalization;
this.actualLocale = dfs.actualLocale;
this.validLocale = dfs.validLocale;
this.requestedLocale = dfs.requestedLocale;
} | java | void initializeData(DateFormatSymbols dfs) {
this.eras = dfs.eras;
this.eraNames = dfs.eraNames;
this.narrowEras = dfs.narrowEras;
this.months = dfs.months;
this.shortMonths = dfs.shortMonths;
this.narrowMonths = dfs.narrowMonths;
this.standaloneMonths = dfs.standaloneMonths;
this.standaloneShortMonths = dfs.standaloneShortMonths;
this.standaloneNarrowMonths = dfs.standaloneNarrowMonths;
this.weekdays = dfs.weekdays;
this.shortWeekdays = dfs.shortWeekdays;
this.shorterWeekdays = dfs.shorterWeekdays;
this.narrowWeekdays = dfs.narrowWeekdays;
this.standaloneWeekdays = dfs.standaloneWeekdays;
this.standaloneShortWeekdays = dfs.standaloneShortWeekdays;
this.standaloneShorterWeekdays = dfs.standaloneShorterWeekdays;
this.standaloneNarrowWeekdays = dfs.standaloneNarrowWeekdays;
this.ampms = dfs.ampms;
this.ampmsNarrow = dfs.ampmsNarrow;
this.timeSeparator = dfs.timeSeparator;
this.shortQuarters = dfs.shortQuarters;
this.quarters = dfs.quarters;
this.standaloneShortQuarters = dfs.standaloneShortQuarters;
this.standaloneQuarters = dfs.standaloneQuarters;
this.leapMonthPatterns = dfs.leapMonthPatterns;
this.shortYearNames = dfs.shortYearNames;
this.shortZodiacNames = dfs.shortZodiacNames;
this.abbreviatedDayPeriods = dfs.abbreviatedDayPeriods;
this.wideDayPeriods = dfs.wideDayPeriods;
this.narrowDayPeriods = dfs.narrowDayPeriods;
this.standaloneAbbreviatedDayPeriods = dfs.standaloneAbbreviatedDayPeriods;
this.standaloneWideDayPeriods = dfs.standaloneWideDayPeriods;
this.standaloneNarrowDayPeriods = dfs.standaloneNarrowDayPeriods;
this.zoneStrings = dfs.zoneStrings; // always null at initialization time for now
this.localPatternChars = dfs.localPatternChars;
this.capitalization = dfs.capitalization;
this.actualLocale = dfs.actualLocale;
this.validLocale = dfs.validLocale;
this.requestedLocale = dfs.requestedLocale;
} | [
"void",
"initializeData",
"(",
"DateFormatSymbols",
"dfs",
")",
"{",
"this",
".",
"eras",
"=",
"dfs",
".",
"eras",
";",
"this",
".",
"eraNames",
"=",
"dfs",
".",
"eraNames",
";",
"this",
".",
"narrowEras",
"=",
"dfs",
".",
"narrowEras",
";",
"this",
".... | Initializes format symbols using another instance.
TODO Clean up initialization methods for subclasses | [
"Initializes",
"format",
"symbols",
"using",
"another",
"instance",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L1515-L1558 |
32,902 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java | DateFormatSymbols.loadDayPeriodStrings | private String[] loadDayPeriodStrings(Map<String, String> resourceMap) {
String strings[] = new String[DAY_PERIOD_KEYS.length];
if (resourceMap != null) {
for (int i = 0; i < DAY_PERIOD_KEYS.length; ++i) {
strings[i] = resourceMap.get(DAY_PERIOD_KEYS[i]); // Null if string doesn't exist.
}
}
return strings;
} | java | private String[] loadDayPeriodStrings(Map<String, String> resourceMap) {
String strings[] = new String[DAY_PERIOD_KEYS.length];
if (resourceMap != null) {
for (int i = 0; i < DAY_PERIOD_KEYS.length; ++i) {
strings[i] = resourceMap.get(DAY_PERIOD_KEYS[i]); // Null if string doesn't exist.
}
}
return strings;
} | [
"private",
"String",
"[",
"]",
"loadDayPeriodStrings",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"resourceMap",
")",
"{",
"String",
"strings",
"[",
"]",
"=",
"new",
"String",
"[",
"DAY_PERIOD_KEYS",
".",
"length",
"]",
";",
"if",
"(",
"resourceMap",
... | Loads localized names for day periods in the requested format.
@param resourceMap Contains the dayPeriod resource to load | [
"Loads",
"localized",
"names",
"for",
"day",
"periods",
"in",
"the",
"requested",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L2069-L2077 |
32,903 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java | DateFormatSymbols.setLocale | final void setLocale(ULocale valid, ULocale actual) {
// Change the following to an assertion later
if ((valid == null) != (actual == null)) {
///CLOVER:OFF
throw new IllegalArgumentException();
///CLOVER:ON
}
// Another check we could do is that the actual locale is at
// the same level or less specific than the valid locale.
this.validLocale = valid;
this.actualLocale = actual;
} | java | final void setLocale(ULocale valid, ULocale actual) {
// Change the following to an assertion later
if ((valid == null) != (actual == null)) {
///CLOVER:OFF
throw new IllegalArgumentException();
///CLOVER:ON
}
// Another check we could do is that the actual locale is at
// the same level or less specific than the valid locale.
this.validLocale = valid;
this.actualLocale = actual;
} | [
"final",
"void",
"setLocale",
"(",
"ULocale",
"valid",
",",
"ULocale",
"actual",
")",
"{",
"// Change the following to an assertion later",
"if",
"(",
"(",
"valid",
"==",
"null",
")",
"!=",
"(",
"actual",
"==",
"null",
")",
")",
"{",
"///CLOVER:OFF",
"throw",
... | Sets information about the locales that were used to create this
object. If the object was not constructed from locale data,
both arguments should be set to null. Otherwise, neither
should be null. The actual locale must be at the same level or
less specific than the valid locale. This method is intended
for use by factories or other entities that create objects of
this class.
@param valid the most specific locale containing any resource
data, or null
@param actual the locale containing data used to construct this
object, or null
@see android.icu.util.ULocale
@see android.icu.util.ULocale#VALID_LOCALE
@see android.icu.util.ULocale#ACTUAL_LOCALE | [
"Sets",
"information",
"about",
"the",
"locales",
"that",
"were",
"used",
"to",
"create",
"this",
"object",
".",
"If",
"the",
"object",
"was",
"not",
"constructed",
"from",
"locale",
"data",
"both",
"arguments",
"should",
"be",
"set",
"to",
"null",
".",
"O... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormatSymbols.java#L2437-L2448 |
32,904 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.checkVariableRange | private void checkVariableRange(int ch, String rule, int start) {
if (ch >= curData.variablesBase && ch < variableLimit) {
syntaxError("Variable range character in rule", rule, start);
}
} | java | private void checkVariableRange(int ch, String rule, int start) {
if (ch >= curData.variablesBase && ch < variableLimit) {
syntaxError("Variable range character in rule", rule, start);
}
} | [
"private",
"void",
"checkVariableRange",
"(",
"int",
"ch",
",",
"String",
"rule",
",",
"int",
"start",
")",
"{",
"if",
"(",
"ch",
">=",
"curData",
".",
"variablesBase",
"&&",
"ch",
"<",
"variableLimit",
")",
"{",
"syntaxError",
"(",
"\"Variable range charact... | Assert that the given character is NOT within the variable range.
If it is, signal an error. This is neccesary to ensure that the
variable range does not overlap characters used in a rule. | [
"Assert",
"that",
"the",
"given",
"character",
"is",
"NOT",
"within",
"the",
"variable",
"range",
".",
"If",
"it",
"is",
"signal",
"an",
"error",
".",
"This",
"is",
"neccesary",
"to",
"ensure",
"that",
"the",
"variable",
"range",
"does",
"not",
"overlap",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1332-L1336 |
32,905 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.resemblesPragma | static boolean resemblesPragma(String rule, int pos, int limit) {
// Must start with /use\s/i
return Utility.parsePattern(rule, pos, limit, "use ", null) >= 0;
} | java | static boolean resemblesPragma(String rule, int pos, int limit) {
// Must start with /use\s/i
return Utility.parsePattern(rule, pos, limit, "use ", null) >= 0;
} | [
"static",
"boolean",
"resemblesPragma",
"(",
"String",
"rule",
",",
"int",
"pos",
",",
"int",
"limit",
")",
"{",
"// Must start with /use\\s/i",
"return",
"Utility",
".",
"parsePattern",
"(",
"rule",
",",
"pos",
",",
"limit",
",",
"\"use \"",
",",
"null",
")... | Return true if the given rule looks like a pragma.
@param pos offset to the first non-whitespace character
of the rule.
@param limit pointer past the last character of the rule. | [
"Return",
"true",
"if",
"the",
"given",
"rule",
"looks",
"like",
"a",
"pragma",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1372-L1375 |
32,906 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.syntaxError | static final void syntaxError(String msg, String rule, int start) {
int end = ruleEnd(rule, start, rule.length());
throw new IllegalIcuArgumentException(msg + " in \"" +
Utility.escape(rule.substring(start, end)) + '"');
} | java | static final void syntaxError(String msg, String rule, int start) {
int end = ruleEnd(rule, start, rule.length());
throw new IllegalIcuArgumentException(msg + " in \"" +
Utility.escape(rule.substring(start, end)) + '"');
} | [
"static",
"final",
"void",
"syntaxError",
"(",
"String",
"msg",
",",
"String",
"rule",
",",
"int",
"start",
")",
"{",
"int",
"end",
"=",
"ruleEnd",
"(",
"rule",
",",
"start",
",",
"rule",
".",
"length",
"(",
")",
")",
";",
"throw",
"new",
"IllegalIcu... | Throw an exception indicating a syntax error. Search the rule string
for the probable end of the rule. Of course, if the error is that
the end of rule marker is missing, then the rule end will not be found.
In any case the rule start will be correctly reported.
@param msg error description
@param rule pattern string
@param start position of first character of current rule | [
"Throw",
"an",
"exception",
"indicating",
"a",
"syntax",
"error",
".",
"Search",
"the",
"rule",
"string",
"for",
"the",
"probable",
"end",
"of",
"the",
"rule",
".",
"Of",
"course",
"if",
"the",
"error",
"is",
"that",
"the",
"end",
"of",
"rule",
"marker",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1435-L1439 |
32,907 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.parseSet | private final char parseSet(String rule, ParsePosition pos) {
UnicodeSet set = new UnicodeSet(rule, pos, parseData);
if (variableNext >= variableLimit) {
throw new RuntimeException("Private use variables exhausted");
}
set.compact();
return generateStandInFor(set);
} | java | private final char parseSet(String rule, ParsePosition pos) {
UnicodeSet set = new UnicodeSet(rule, pos, parseData);
if (variableNext >= variableLimit) {
throw new RuntimeException("Private use variables exhausted");
}
set.compact();
return generateStandInFor(set);
} | [
"private",
"final",
"char",
"parseSet",
"(",
"String",
"rule",
",",
"ParsePosition",
"pos",
")",
"{",
"UnicodeSet",
"set",
"=",
"new",
"UnicodeSet",
"(",
"rule",
",",
"pos",
",",
"parseData",
")",
";",
"if",
"(",
"variableNext",
">=",
"variableLimit",
")",... | Parse a UnicodeSet out, store it, and return the stand-in character
used to represent it. | [
"Parse",
"a",
"UnicodeSet",
"out",
"store",
"it",
"and",
"return",
"the",
"stand",
"-",
"in",
"character",
"used",
"to",
"represent",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1453-L1460 |
32,908 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.generateStandInFor | char generateStandInFor(Object obj) {
// assert(obj != null);
// Look up previous stand-in, if any. This is a short list
// (typical n is 0, 1, or 2); linear search is optimal.
for (int i=0; i<variablesVector.size(); ++i) {
if (variablesVector.get(i) == obj) { // [sic] pointer comparison
return (char) (curData.variablesBase + i);
}
}
if (variableNext >= variableLimit) {
throw new RuntimeException("Variable range exhausted");
}
variablesVector.add(obj);
return variableNext++;
} | java | char generateStandInFor(Object obj) {
// assert(obj != null);
// Look up previous stand-in, if any. This is a short list
// (typical n is 0, 1, or 2); linear search is optimal.
for (int i=0; i<variablesVector.size(); ++i) {
if (variablesVector.get(i) == obj) { // [sic] pointer comparison
return (char) (curData.variablesBase + i);
}
}
if (variableNext >= variableLimit) {
throw new RuntimeException("Variable range exhausted");
}
variablesVector.add(obj);
return variableNext++;
} | [
"char",
"generateStandInFor",
"(",
"Object",
"obj",
")",
"{",
"// assert(obj != null);",
"// Look up previous stand-in, if any. This is a short list",
"// (typical n is 0, 1, or 2); linear search is optimal.",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"variablesVector",... | Generate and return a stand-in for a new UnicodeMatcher or UnicodeReplacer.
Store the object. | [
"Generate",
"and",
"return",
"a",
"stand",
"-",
"in",
"for",
"a",
"new",
"UnicodeMatcher",
"or",
"UnicodeReplacer",
".",
"Store",
"the",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1466-L1482 |
32,909 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java | TransliteratorParser.appendVariableDef | private void appendVariableDef(String name, StringBuffer buf) {
char[] ch = variableNames.get(name);
if (ch == null) {
// We allow one undefined variable so that variable definition
// statements work. For the first undefined variable we return
// the special placeholder variableLimit-1, and save the variable
// name.
if (undefinedVariableName == null) {
undefinedVariableName = name;
if (variableNext >= variableLimit) {
throw new RuntimeException("Private use variables exhausted");
}
buf.append(--variableLimit);
} else {
throw new IllegalIcuArgumentException("Undefined variable $"
+ name);
}
} else {
buf.append(ch);
}
} | java | private void appendVariableDef(String name, StringBuffer buf) {
char[] ch = variableNames.get(name);
if (ch == null) {
// We allow one undefined variable so that variable definition
// statements work. For the first undefined variable we return
// the special placeholder variableLimit-1, and save the variable
// name.
if (undefinedVariableName == null) {
undefinedVariableName = name;
if (variableNext >= variableLimit) {
throw new RuntimeException("Private use variables exhausted");
}
buf.append(--variableLimit);
} else {
throw new IllegalIcuArgumentException("Undefined variable $"
+ name);
}
} else {
buf.append(ch);
}
} | [
"private",
"void",
"appendVariableDef",
"(",
"String",
"name",
",",
"StringBuffer",
"buf",
")",
"{",
"char",
"[",
"]",
"ch",
"=",
"variableNames",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"ch",
"==",
"null",
")",
"{",
"// We allow one undefined variab... | Append the value of the given variable name to the given
StringBuffer.
@exception IllegalIcuArgumentException if the name is unknown. | [
"Append",
"the",
"value",
"of",
"the",
"given",
"variable",
"name",
"to",
"the",
"given",
"StringBuffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorParser.java#L1542-L1562 |
32,910 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/security/auth/callback/PasswordCallback.java | PasswordCallback.clearPassword | public void clearPassword() {
if (inputPassword != null) {
for (int i = 0; i < inputPassword.length; i++)
inputPassword[i] = ' ';
}
} | java | public void clearPassword() {
if (inputPassword != null) {
for (int i = 0; i < inputPassword.length; i++)
inputPassword[i] = ' ';
}
} | [
"public",
"void",
"clearPassword",
"(",
")",
"{",
"if",
"(",
"inputPassword",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"inputPassword",
".",
"length",
";",
"i",
"++",
")",
"inputPassword",
"[",
"i",
"]",
"=",
"'",
... | Clear the retrieved password. | [
"Clear",
"the",
"retrieved",
"password",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/security/auth/callback/PasswordCallback.java#L136-L141 |
32,911 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/ServerSocketChannelImpl.java | ServerSocketChannelImpl.translateReadyOps | public boolean translateReadyOps(int ops, int initialOps,
SelectionKeyImpl sk) {
int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
int oldOps = sk.nioReadyOps();
int newOps = initialOps;
if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return false;
}
if ((ops & (PollArrayWrapper.POLLERR
| PollArrayWrapper.POLLHUP)) != 0) {
newOps = intOps;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
}
if (((ops & PollArrayWrapper.POLLIN) != 0) &&
((intOps & SelectionKey.OP_ACCEPT) != 0))
newOps |= SelectionKey.OP_ACCEPT;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
} | java | public boolean translateReadyOps(int ops, int initialOps,
SelectionKeyImpl sk) {
int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes
int oldOps = sk.nioReadyOps();
int newOps = initialOps;
if ((ops & PollArrayWrapper.POLLNVAL) != 0) {
// This should only happen if this channel is pre-closed while a
// selection operation is in progress
// ## Throw an error if this channel has not been pre-closed
return false;
}
if ((ops & (PollArrayWrapper.POLLERR
| PollArrayWrapper.POLLHUP)) != 0) {
newOps = intOps;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
}
if (((ops & PollArrayWrapper.POLLIN) != 0) &&
((intOps & SelectionKey.OP_ACCEPT) != 0))
newOps |= SelectionKey.OP_ACCEPT;
sk.nioReadyOps(newOps);
return (newOps & ~oldOps) != 0;
} | [
"public",
"boolean",
"translateReadyOps",
"(",
"int",
"ops",
",",
"int",
"initialOps",
",",
"SelectionKeyImpl",
"sk",
")",
"{",
"int",
"intOps",
"=",
"sk",
".",
"nioInterestOps",
"(",
")",
";",
"// Do this just once, it synchronizes",
"int",
"oldOps",
"=",
"sk",... | Translates native poll revent set into a ready operation set | [
"Translates",
"native",
"poll",
"revent",
"set",
"into",
"a",
"ready",
"operation",
"set"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/ServerSocketChannelImpl.java#L308-L334 |
32,912 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getKeywordValues | public static final String[] getKeywordValues(String baseName, String keyword) {
Set<String> keywords = new HashSet<String>();
ULocale locales[] = getAvailEntry(baseName, ICU_DATA_CLASS_LOADER).getULocaleList();
int i;
for (i = 0; i < locales.length; i++) {
try {
UResourceBundle b = UResourceBundle.getBundleInstance(baseName, locales[i]);
// downcast to ICUResourceBundle?
ICUResourceBundle irb = (ICUResourceBundle) (b.getObject(keyword));
Enumeration<String> e = irb.getKeys();
while (e.hasMoreElements()) {
String s = e.nextElement();
if (!DEFAULT_TAG.equals(s) && !s.startsWith("private-")) {
// don't add 'default' items, nor unlisted types
keywords.add(s);
}
}
} catch (Throwable t) {
//System.err.println("Error in - " + new Integer(i).toString()
// + " - " + t.toString());
// ignore the err - just skip that resource
}
}
return keywords.toArray(new String[0]);
} | java | public static final String[] getKeywordValues(String baseName, String keyword) {
Set<String> keywords = new HashSet<String>();
ULocale locales[] = getAvailEntry(baseName, ICU_DATA_CLASS_LOADER).getULocaleList();
int i;
for (i = 0; i < locales.length; i++) {
try {
UResourceBundle b = UResourceBundle.getBundleInstance(baseName, locales[i]);
// downcast to ICUResourceBundle?
ICUResourceBundle irb = (ICUResourceBundle) (b.getObject(keyword));
Enumeration<String> e = irb.getKeys();
while (e.hasMoreElements()) {
String s = e.nextElement();
if (!DEFAULT_TAG.equals(s) && !s.startsWith("private-")) {
// don't add 'default' items, nor unlisted types
keywords.add(s);
}
}
} catch (Throwable t) {
//System.err.println("Error in - " + new Integer(i).toString()
// + " - " + t.toString());
// ignore the err - just skip that resource
}
}
return keywords.toArray(new String[0]);
} | [
"public",
"static",
"final",
"String",
"[",
"]",
"getKeywordValues",
"(",
"String",
"baseName",
",",
"String",
"keyword",
")",
"{",
"Set",
"<",
"String",
">",
"keywords",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"ULocale",
"locales",
"["... | Given a tree path and keyword, return a string enumeration of all possible values for that keyword.
@param baseName resource specifier
@param keyword a particular keyword to consider, must match a top level resource name
within the tree. (i.e. "collations")
@hide draft / provisional / internal are hidden on Android | [
"Given",
"a",
"tree",
"path",
"and",
"keyword",
"return",
"a",
"string",
"enumeration",
"of",
"all",
"possible",
"values",
"for",
"that",
"keyword",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L254-L279 |
32,913 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getStringWithFallback | public String getStringWithFallback(String path) throws MissingResourceException {
// Optimized form of getWithFallback(path).getString();
ICUResourceBundle actualBundle = this;
String result = findStringWithFallback(path, actualBundle, null);
if (result == null) {
throw new MissingResourceException(
"Can't find resource for bundle "
+ this.getClass().getName() + ", key " + getType(),
path, getKey());
}
if (result.equals(NO_INHERITANCE_MARKER)) {
throw new MissingResourceException("Encountered NO_INHERITANCE_MARKER", path, getKey());
}
return result;
} | java | public String getStringWithFallback(String path) throws MissingResourceException {
// Optimized form of getWithFallback(path).getString();
ICUResourceBundle actualBundle = this;
String result = findStringWithFallback(path, actualBundle, null);
if (result == null) {
throw new MissingResourceException(
"Can't find resource for bundle "
+ this.getClass().getName() + ", key " + getType(),
path, getKey());
}
if (result.equals(NO_INHERITANCE_MARKER)) {
throw new MissingResourceException("Encountered NO_INHERITANCE_MARKER", path, getKey());
}
return result;
} | [
"public",
"String",
"getStringWithFallback",
"(",
"String",
"path",
")",
"throws",
"MissingResourceException",
"{",
"// Optimized form of getWithFallback(path).getString();",
"ICUResourceBundle",
"actualBundle",
"=",
"this",
";",
"String",
"result",
"=",
"findStringWithFallback... | will throw type mismatch exception if the resource is not a string | [
"will",
"throw",
"type",
"mismatch",
"exception",
"if",
"the",
"resource",
"is",
"not",
"a",
"string"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L353-L369 |
32,914 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getAvailableLocaleNameSet | public static Set<String> getAvailableLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getLocaleNameSet();
} | java | public static Set<String> getAvailableLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getLocaleNameSet();
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getAvailableLocaleNameSet",
"(",
"String",
"bundlePrefix",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getAvailEntry",
"(",
"bundlePrefix",
",",
"loader",
")",
".",
"getLocaleNameSet",
"(",
")",
";",
"}"
] | Return a set of the locale names supported by a collection of resource
bundles.
@param bundlePrefix the prefix of the resource bundles to use. | [
"Return",
"a",
"set",
"of",
"the",
"locale",
"names",
"supported",
"by",
"a",
"collection",
"of",
"resource",
"bundles",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L441-L443 |
32,915 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getFullLocaleNameSet | public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet();
} | java | public static Set<String> getFullLocaleNameSet(String bundlePrefix, ClassLoader loader) {
return getAvailEntry(bundlePrefix, loader).getFullLocaleNameSet();
} | [
"public",
"static",
"Set",
"<",
"String",
">",
"getFullLocaleNameSet",
"(",
"String",
"bundlePrefix",
",",
"ClassLoader",
"loader",
")",
"{",
"return",
"getAvailEntry",
"(",
"bundlePrefix",
",",
"loader",
")",
".",
"getFullLocaleNameSet",
"(",
")",
";",
"}"
] | Return a set of all the locale names supported by a collection of
resource bundles.
@param bundlePrefix the prefix of the resource bundles to use. | [
"Return",
"a",
"set",
"of",
"all",
"the",
"locale",
"names",
"supported",
"by",
"a",
"collection",
"of",
"resource",
"bundles",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L459-L461 |
32,916 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.addLocaleIDsFromIndexBundle | private static final void addLocaleIDsFromIndexBundle(String baseName,
ClassLoader root, Set<String> locales) {
ICUResourceBundle bundle;
try {
bundle = (ICUResourceBundle) UResourceBundle.instantiateBundle(baseName, ICU_RESOURCE_INDEX, root, true);
bundle = (ICUResourceBundle) bundle.get(INSTALLED_LOCALES);
} catch (MissingResourceException e) {
if (DEBUG) {
System.out.println("couldn't find " + baseName + '/' + ICU_RESOURCE_INDEX + ".res");
Thread.dumpStack();
}
return;
}
UResourceBundleIterator iter = bundle.getIterator();
iter.reset();
while (iter.hasNext()) {
String locstr = iter.next(). getKey();
locales.add(locstr);
}
} | java | private static final void addLocaleIDsFromIndexBundle(String baseName,
ClassLoader root, Set<String> locales) {
ICUResourceBundle bundle;
try {
bundle = (ICUResourceBundle) UResourceBundle.instantiateBundle(baseName, ICU_RESOURCE_INDEX, root, true);
bundle = (ICUResourceBundle) bundle.get(INSTALLED_LOCALES);
} catch (MissingResourceException e) {
if (DEBUG) {
System.out.println("couldn't find " + baseName + '/' + ICU_RESOURCE_INDEX + ".res");
Thread.dumpStack();
}
return;
}
UResourceBundleIterator iter = bundle.getIterator();
iter.reset();
while (iter.hasNext()) {
String locstr = iter.next(). getKey();
locales.add(locstr);
}
} | [
"private",
"static",
"final",
"void",
"addLocaleIDsFromIndexBundle",
"(",
"String",
"baseName",
",",
"ClassLoader",
"root",
",",
"Set",
"<",
"String",
">",
"locales",
")",
"{",
"ICUResourceBundle",
"bundle",
";",
"try",
"{",
"bundle",
"=",
"(",
"ICUResourceBundl... | and returns the data in a different form. | [
"and",
"returns",
"the",
"data",
"in",
"a",
"different",
"form",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L577-L596 |
32,917 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.getResPathKeys | private void getResPathKeys(String[] keys, int depth) {
ICUResourceBundle b = this;
while (depth > 0) {
keys[--depth] = b.key;
b = b.container;
assert (depth == 0) == (b.container == null);
}
} | java | private void getResPathKeys(String[] keys, int depth) {
ICUResourceBundle b = this;
while (depth > 0) {
keys[--depth] = b.key;
b = b.container;
assert (depth == 0) == (b.container == null);
}
} | [
"private",
"void",
"getResPathKeys",
"(",
"String",
"[",
"]",
"keys",
",",
"int",
"depth",
")",
"{",
"ICUResourceBundle",
"b",
"=",
"this",
";",
"while",
"(",
"depth",
">",
"0",
")",
"{",
"keys",
"[",
"--",
"depth",
"]",
"=",
"b",
".",
"key",
";",
... | Fills some of the keys array with the keys on the path to this resource object.
Writes the top-level key into index 0 and increments from there.
@param keys
@param depth must be {@link #getResDepth()} | [
"Fills",
"some",
"of",
"the",
"keys",
"array",
"with",
"the",
"keys",
"on",
"the",
"path",
"to",
"this",
"resource",
"object",
".",
"Writes",
"the",
"top",
"-",
"level",
"key",
"into",
"index",
"0",
"and",
"increments",
"from",
"there",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L976-L983 |
32,918 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java | ICUResourceBundle.createBundle | public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) {
ICUResourceBundleReader reader = ICUResourceBundleReader.getReader(baseName, localeID, root);
if (reader == null) {
// could not open the .res file
return null;
}
return getBundle(reader, baseName, localeID, root);
} | java | public static ICUResourceBundle createBundle(String baseName, String localeID, ClassLoader root) {
ICUResourceBundleReader reader = ICUResourceBundleReader.getReader(baseName, localeID, root);
if (reader == null) {
// could not open the .res file
return null;
}
return getBundle(reader, baseName, localeID, root);
} | [
"public",
"static",
"ICUResourceBundle",
"createBundle",
"(",
"String",
"baseName",
",",
"String",
"localeID",
",",
"ClassLoader",
"root",
")",
"{",
"ICUResourceBundleReader",
"reader",
"=",
"ICUResourceBundleReader",
".",
"getReader",
"(",
"baseName",
",",
"localeID"... | Create a bundle using a reader.
@param baseName The name for the bundle.
@param localeID The locale identification.
@param root The ClassLoader object root.
@return the new bundle | [
"Create",
"a",
"bundle",
"using",
"a",
"reader",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundle.java#L1283-L1290 |
32,919 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java | CanonicalIterator.reset | public void reset() {
done = false;
for (int i = 0; i < current.length; ++i) {
current[i] = 0;
}
} | java | public void reset() {
done = false;
for (int i = 0; i < current.length; ++i) {
current[i] = 0;
}
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"done",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"current",
".",
"length",
";",
"++",
"i",
")",
"{",
"current",
"[",
"i",
"]",
"=",
"0",
";",
"}",
"}"
] | Resets the iterator so that one can start again from the beginning. | [
"Resets",
"the",
"iterator",
"so",
"that",
"one",
"can",
"start",
"again",
"from",
"the",
"beginning",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java#L70-L75 |
32,920 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java | CanonicalIterator.setSource | public void setSource(String newSource) {
source = nfd.normalize(newSource);
done = false;
// catch degenerate case
if (newSource.length() == 0) {
pieces = new String[1][];
current = new int[1];
pieces[0] = new String[]{""};
return;
}
// find the segments
List<String> segmentList = new ArrayList<String>();
int cp;
int start = 0;
// i should be the end of the first code point
// break up the string into segements
int i = UTF16.findOffsetFromCodePoint(source, 1);
for (; i < source.length(); i += Character.charCount(cp)) {
cp = source.codePointAt(i);
if (nfcImpl.isCanonSegmentStarter(cp)) {
segmentList.add(source.substring(start, i)); // add up to i
start = i;
}
}
segmentList.add(source.substring(start, i)); // add last one
// allocate the arrays, and find the strings that are CE to each segment
pieces = new String[segmentList.size()][];
current = new int[segmentList.size()];
for (i = 0; i < pieces.length; ++i) {
if (PROGRESS) System.out.println("SEGMENT");
pieces[i] = getEquivalents(segmentList.get(i));
}
} | java | public void setSource(String newSource) {
source = nfd.normalize(newSource);
done = false;
// catch degenerate case
if (newSource.length() == 0) {
pieces = new String[1][];
current = new int[1];
pieces[0] = new String[]{""};
return;
}
// find the segments
List<String> segmentList = new ArrayList<String>();
int cp;
int start = 0;
// i should be the end of the first code point
// break up the string into segements
int i = UTF16.findOffsetFromCodePoint(source, 1);
for (; i < source.length(); i += Character.charCount(cp)) {
cp = source.codePointAt(i);
if (nfcImpl.isCanonSegmentStarter(cp)) {
segmentList.add(source.substring(start, i)); // add up to i
start = i;
}
}
segmentList.add(source.substring(start, i)); // add last one
// allocate the arrays, and find the strings that are CE to each segment
pieces = new String[segmentList.size()][];
current = new int[segmentList.size()];
for (i = 0; i < pieces.length; ++i) {
if (PROGRESS) System.out.println("SEGMENT");
pieces[i] = getEquivalents(segmentList.get(i));
}
} | [
"public",
"void",
"setSource",
"(",
"String",
"newSource",
")",
"{",
"source",
"=",
"nfd",
".",
"normalize",
"(",
"newSource",
")",
";",
"done",
"=",
"false",
";",
"// catch degenerate case",
"if",
"(",
"newSource",
".",
"length",
"(",
")",
"==",
"0",
")... | Set a new source for this iterator. Allows object reuse.
@param newSource the source string to iterate against. This allows the same iterator to be used
while changing the source string, saving object creation. | [
"Set",
"a",
"new",
"source",
"for",
"this",
"iterator",
".",
"Allows",
"object",
"reuse",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java#L113-L151 |
32,921 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java | CanonicalIterator.getEquivalents | private String[] getEquivalents(String segment) {
Set<String> result = new HashSet<String>();
Set<String> basic = getEquivalents2(segment);
Set<String> permutations = new HashSet<String>();
// now get all the permutations
// add only the ones that are canonically equivalent
// TODO: optimize by not permuting any class zero.
Iterator<String> it = basic.iterator();
while (it.hasNext()) {
String item = it.next();
permutations.clear();
permute(item, SKIP_ZEROS, permutations);
Iterator<String> it2 = permutations.iterator();
while (it2.hasNext()) {
String possible = it2.next();
/*
String attempt = Normalizer.normalize(possible, Normalizer.DECOMP, 0);
if (attempt.equals(segment)) {
*/
if (Normalizer.compare(possible, segment,0)==0) {
if (PROGRESS) System.out.println("Adding Permutation: " + Utility.hex(possible));
result.add(possible);
} else {
if (PROGRESS) System.out.println("-Skipping Permutation: " + Utility.hex(possible));
}
}
}
// convert into a String[] to clean up storage
String[] finalResult = new String[result.size()];
result.toArray(finalResult);
return finalResult;
} | java | private String[] getEquivalents(String segment) {
Set<String> result = new HashSet<String>();
Set<String> basic = getEquivalents2(segment);
Set<String> permutations = new HashSet<String>();
// now get all the permutations
// add only the ones that are canonically equivalent
// TODO: optimize by not permuting any class zero.
Iterator<String> it = basic.iterator();
while (it.hasNext()) {
String item = it.next();
permutations.clear();
permute(item, SKIP_ZEROS, permutations);
Iterator<String> it2 = permutations.iterator();
while (it2.hasNext()) {
String possible = it2.next();
/*
String attempt = Normalizer.normalize(possible, Normalizer.DECOMP, 0);
if (attempt.equals(segment)) {
*/
if (Normalizer.compare(possible, segment,0)==0) {
if (PROGRESS) System.out.println("Adding Permutation: " + Utility.hex(possible));
result.add(possible);
} else {
if (PROGRESS) System.out.println("-Skipping Permutation: " + Utility.hex(possible));
}
}
}
// convert into a String[] to clean up storage
String[] finalResult = new String[result.size()];
result.toArray(finalResult);
return finalResult;
} | [
"private",
"String",
"[",
"]",
"getEquivalents",
"(",
"String",
"segment",
")",
"{",
"Set",
"<",
"String",
">",
"result",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"Set",
"<",
"String",
">",
"basic",
"=",
"getEquivalents2",
"(",
"segmen... | we have a segment, in NFD. Find all the strings that are canonically equivalent to it. | [
"we",
"have",
"a",
"segment",
"in",
"NFD",
".",
"Find",
"all",
"the",
"strings",
"that",
"are",
"canonically",
"equivalent",
"to",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CanonicalIterator.java#L246-L282 |
32,922 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/JapaneseCalendar.java | JapaneseCalendar.handleGetLimit | @SuppressWarnings("fallthrough")
protected int handleGetLimit(int field, int limitType) {
switch (field) {
case ERA:
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return 0;
}
return CURRENT_ERA;
case YEAR:
{
switch (limitType) {
case MINIMUM:
case GREATEST_MINIMUM:
return 1;
case LEAST_MAXIMUM:
return 1;
case MAXIMUM:
return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
}
//Fall through to the default if not handled above
}
default:
return super.handleGetLimit(field, limitType);
}
} | java | @SuppressWarnings("fallthrough")
protected int handleGetLimit(int field, int limitType) {
switch (field) {
case ERA:
if (limitType == MINIMUM || limitType == GREATEST_MINIMUM) {
return 0;
}
return CURRENT_ERA;
case YEAR:
{
switch (limitType) {
case MINIMUM:
case GREATEST_MINIMUM:
return 1;
case LEAST_MAXIMUM:
return 1;
case MAXIMUM:
return super.handleGetLimit(field, MAXIMUM) - ERAS[CURRENT_ERA*3];
}
//Fall through to the default if not handled above
}
default:
return super.handleGetLimit(field, limitType);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"protected",
"int",
"handleGetLimit",
"(",
"int",
"field",
",",
"int",
"limitType",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"ERA",
":",
"if",
"(",
"limitType",
"==",
"MINIMUM",
"||",
"limitT... | Override GregorianCalendar. We should really handle YEAR_WOY and
EXTENDED_YEAR here too to implement the 1..5000000 range, but it's
not critical. | [
"Override",
"GregorianCalendar",
".",
"We",
"should",
"really",
"handle",
"YEAR_WOY",
"and",
"EXTENDED_YEAR",
"here",
"too",
"to",
"implement",
"the",
"1",
"..",
"5000000",
"range",
"but",
"it",
"s",
"not",
"critical",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/JapaneseCalendar.java#L587-L611 |
32,923 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/Providers.java | Providers.getSunProvider | public static Provider getSunProvider() {
try {
Class<?> clazz = Class.forName(jarVerificationProviders[0]);
return (Provider)clazz.newInstance();
} catch (Exception e) {
try {
Class<?> clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
return (Provider)clazz.newInstance();
} catch (Exception ee) {
throw new RuntimeException("Sun provider not found", e);
}
}
} | java | public static Provider getSunProvider() {
try {
Class<?> clazz = Class.forName(jarVerificationProviders[0]);
return (Provider)clazz.newInstance();
} catch (Exception e) {
try {
Class<?> clazz = Class.forName(BACKUP_PROVIDER_CLASSNAME);
return (Provider)clazz.newInstance();
} catch (Exception ee) {
throw new RuntimeException("Sun provider not found", e);
}
}
} | [
"public",
"static",
"Provider",
"getSunProvider",
"(",
")",
"{",
"try",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"jarVerificationProviders",
"[",
"0",
"]",
")",
";",
"return",
"(",
"Provider",
")",
"clazz",
".",
"newInstan... | sun.security.util.ManifestEntryVerifier and java.security.SecureRandom. | [
"sun",
".",
"security",
".",
"util",
".",
"ManifestEntryVerifier",
"and",
"java",
".",
"security",
".",
"SecureRandom",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/Providers.java#L104-L116 |
32,924 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/Providers.java | Providers.getProviderList | public static ProviderList getProviderList() {
ProviderList list = getThreadProviderList();
if (list == null) {
list = getSystemProviderList();
}
return list;
} | java | public static ProviderList getProviderList() {
ProviderList list = getThreadProviderList();
if (list == null) {
list = getSystemProviderList();
}
return list;
} | [
"public",
"static",
"ProviderList",
"getProviderList",
"(",
")",
"{",
"ProviderList",
"list",
"=",
"getThreadProviderList",
"(",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"getSystemProviderList",
"(",
")",
";",
"}",
"return",
"list",
... | Return the current ProviderList. If the thread-local list is set,
it is returned. Otherwise, the system wide list is returned. | [
"Return",
"the",
"current",
"ProviderList",
".",
"If",
"the",
"thread",
"-",
"local",
"list",
"is",
"set",
"it",
"is",
"returned",
".",
"Otherwise",
"the",
"system",
"wide",
"list",
"is",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/jca/Providers.java#L143-L149 |
32,925 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/WriterToUTF8Buffered.java | WriterToUTF8Buffered.write | public void write(final int c) throws IOException
{
/* If we are close to the end of the buffer then flush it.
* Remember the buffer can hold a few more bytes than BYTES_MAX
*/
if (count >= BYTES_MAX)
flushBuffer();
if (c < 0x80)
{
m_outputBytes[count++] = (byte) (c);
}
else if (c < 0x800)
{
m_outputBytes[count++] = (byte) (0xc0 + (c >> 6));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
else if (c < 0x10000)
{
m_outputBytes[count++] = (byte) (0xe0 + (c >> 12));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
else
{
m_outputBytes[count++] = (byte) (0xf0 + (c >> 18));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 12) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
} | java | public void write(final int c) throws IOException
{
/* If we are close to the end of the buffer then flush it.
* Remember the buffer can hold a few more bytes than BYTES_MAX
*/
if (count >= BYTES_MAX)
flushBuffer();
if (c < 0x80)
{
m_outputBytes[count++] = (byte) (c);
}
else if (c < 0x800)
{
m_outputBytes[count++] = (byte) (0xc0 + (c >> 6));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
else if (c < 0x10000)
{
m_outputBytes[count++] = (byte) (0xe0 + (c >> 12));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
else
{
m_outputBytes[count++] = (byte) (0xf0 + (c >> 18));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 12) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + ((c >> 6) & 0x3f));
m_outputBytes[count++] = (byte) (0x80 + (c & 0x3f));
}
} | [
"public",
"void",
"write",
"(",
"final",
"int",
"c",
")",
"throws",
"IOException",
"{",
"/* If we are close to the end of the buffer then flush it.\n * Remember the buffer can hold a few more bytes than BYTES_MAX\n */",
"if",
"(",
"count",
">=",
"BYTES_MAX",
")",
"flushBu... | Write a single character. The character to be written is contained in
the 16 low-order bits of the given integer value; the 16 high-order bits
are ignored.
<p> Subclasses that intend to support efficient single-character output
should override this method.
@param c int specifying a character to be written.
@exception IOException If an I/O error occurs | [
"Write",
"a",
"single",
"character",
".",
"The",
"character",
"to",
"be",
"written",
"is",
"contained",
"in",
"the",
"16",
"low",
"-",
"order",
"bits",
"of",
"the",
"given",
"integer",
"value",
";",
"the",
"16",
"high",
"-",
"order",
"bits",
"are",
"ig... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/WriterToUTF8Buffered.java#L132-L164 |
32,926 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java | LocPathIterator.readObject | private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException, javax.xml.transform.TransformerException
{
try
{
stream.defaultReadObject();
m_clones = new IteratorPool(this);
}
catch (ClassNotFoundException cnfe)
{
throw new javax.xml.transform.TransformerException(cnfe);
}
} | java | private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException, javax.xml.transform.TransformerException
{
try
{
stream.defaultReadObject();
m_clones = new IteratorPool(this);
}
catch (ClassNotFoundException cnfe)
{
throw new javax.xml.transform.TransformerException(cnfe);
}
} | [
"private",
"void",
"readObject",
"(",
"java",
".",
"io",
".",
"ObjectInputStream",
"stream",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"try",
"{",
"stream",
".",
"def... | Read the object from a serialization stream.
@param stream Input stream to read from
@throws java.io.IOException
@throws javax.xml.transform.TransformerException | [
"Read",
"the",
"object",
"from",
"a",
"serialization",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java#L135-L147 |
32,927 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java | LocPathIterator.execute | public XObject execute(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
XNodeSet iter = new XNodeSet((LocPathIterator)m_clones.getInstance());
iter.setRoot(xctxt.getCurrentNode(), xctxt);
return iter;
} | java | public XObject execute(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
XNodeSet iter = new XNodeSet((LocPathIterator)m_clones.getInstance());
iter.setRoot(xctxt.getCurrentNode(), xctxt);
return iter;
} | [
"public",
"XObject",
"execute",
"(",
"XPathContext",
"xctxt",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"XNodeSet",
"iter",
"=",
"new",
"XNodeSet",
"(",
"(",
"LocPathIterator",
")",
"m_clones",
".",
"getInstance",
... | Execute this iterator, meaning create a clone that can
store state, and initialize it for fast execution from
the current runtime state. When this is called, no actual
query from the current context node is performed.
@param xctxt The XPath execution context.
@return An XNodeSet reference that holds this iterator.
@throws javax.xml.transform.TransformerException | [
"Execute",
"this",
"iterator",
"meaning",
"create",
"a",
"clone",
"that",
"can",
"store",
"state",
"and",
"initialize",
"it",
"for",
"fast",
"execution",
"from",
"the",
"current",
"runtime",
"state",
".",
"When",
"this",
"is",
"called",
"no",
"actual",
"quer... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java#L206-L215 |
32,928 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java | LocPathIterator.asNode | public int asNode(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
DTMIterator iter = (DTMIterator)m_clones.getInstance();
int current = xctxt.getCurrentNode();
iter.setRoot(current, xctxt);
int next = iter.nextNode();
// m_clones.freeInstance(iter);
iter.detach();
return next;
} | java | public int asNode(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
DTMIterator iter = (DTMIterator)m_clones.getInstance();
int current = xctxt.getCurrentNode();
iter.setRoot(current, xctxt);
int next = iter.nextNode();
// m_clones.freeInstance(iter);
iter.detach();
return next;
} | [
"public",
"int",
"asNode",
"(",
"XPathContext",
"xctxt",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"DTMIterator",
"iter",
"=",
"(",
"DTMIterator",
")",
"m_clones",
".",
"getInstance",
"(",
")",
";",
"int",
"curre... | Return the first node out of the nodeset, if this expression is
a nodeset expression. This is the default implementation for
nodesets. Derived classes should try and override this and return a
value without having to do a clone operation.
@param xctxt The XPath runtime context.
@return the first node out of the nodeset, or DTM.NULL. | [
"Return",
"the",
"first",
"node",
"out",
"of",
"the",
"nodeset",
"if",
"this",
"expression",
"is",
"a",
"nodeset",
"expression",
".",
"This",
"is",
"the",
"default",
"implementation",
"for",
"nodesets",
".",
"Derived",
"classes",
"should",
"try",
"and",
"ove... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java#L293-L306 |
32,929 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java | LocPathIterator.runTo | public void runTo(int index)
{
if (m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
return;
int n;
if (-1 == index)
{
while (DTM.NULL != (n = nextNode()));
}
else
{
while (DTM.NULL != (n = nextNode()))
{
if (getCurrentPos() >= index)
break;
}
}
} | java | public void runTo(int index)
{
if (m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
return;
int n;
if (-1 == index)
{
while (DTM.NULL != (n = nextNode()));
}
else
{
while (DTM.NULL != (n = nextNode()))
{
if (getCurrentPos() >= index)
break;
}
}
} | [
"public",
"void",
"runTo",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"m_foundLast",
"||",
"(",
"(",
"index",
">=",
"0",
")",
"&&",
"(",
"index",
"<=",
"getCurrentPos",
"(",
")",
")",
")",
")",
"return",
";",
"int",
"n",
";",
"if",
"(",
"-",
"1"... | If an index is requested, NodeSetDTM will call this method
to run the iterator to the index. By default this sets
m_next to the index. If the index argument is -1, this
signals that the iterator should be run to the end.
@param index The index to run to, or -1 if the iterator
should run to the end. | [
"If",
"an",
"index",
"is",
"requested",
"NodeSetDTM",
"will",
"call",
"this",
"method",
"to",
"run",
"the",
"iterator",
"to",
"the",
"index",
".",
"By",
"default",
"this",
"sets",
"m_next",
"to",
"the",
"index",
".",
"If",
"the",
"index",
"argument",
"is... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/LocPathIterator.java#L796-L816 |
32,930 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/DefaultMethodShimGenerator.java | DefaultMethodShimGenerator.getOverrideSignature | private String getOverrideSignature(ExecutablePair method) {
StringBuilder sb = new StringBuilder(ElementUtil.getName(method.element()));
sb.append('(');
for (TypeMirror pType : method.type().getParameterTypes()) {
sb.append(typeUtil.getSignatureName(pType));
}
sb.append(')');
return sb.toString();
} | java | private String getOverrideSignature(ExecutablePair method) {
StringBuilder sb = new StringBuilder(ElementUtil.getName(method.element()));
sb.append('(');
for (TypeMirror pType : method.type().getParameterTypes()) {
sb.append(typeUtil.getSignatureName(pType));
}
sb.append(')');
return sb.toString();
} | [
"private",
"String",
"getOverrideSignature",
"(",
"ExecutablePair",
"method",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"ElementUtil",
".",
"getName",
"(",
"method",
".",
"element",
"(",
")",
")",
")",
";",
"sb",
".",
"append",
"(",
... | otherwise. Used as a key to group inherited methods together. | [
"otherwise",
".",
"Used",
"as",
"a",
"key",
"to",
"group",
"inherited",
"methods",
"together",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DefaultMethodShimGenerator.java#L244-L252 |
32,931 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Enum.java | Enum.compareTo | public final int compareTo(E o) {
Enum<?> other = (Enum<?>)o;
Enum<E> self = this;
if (self.getClass() != other.getClass() && // optimization
self.getDeclaringClass() != other.getDeclaringClass())
throw new ClassCastException();
return self.ordinal - other.ordinal;
} | java | public final int compareTo(E o) {
Enum<?> other = (Enum<?>)o;
Enum<E> self = this;
if (self.getClass() != other.getClass() && // optimization
self.getDeclaringClass() != other.getDeclaringClass())
throw new ClassCastException();
return self.ordinal - other.ordinal;
} | [
"public",
"final",
"int",
"compareTo",
"(",
"E",
"o",
")",
"{",
"Enum",
"<",
"?",
">",
"other",
"=",
"(",
"Enum",
"<",
"?",
">",
")",
"o",
";",
"Enum",
"<",
"E",
">",
"self",
"=",
"this",
";",
"if",
"(",
"self",
".",
"getClass",
"(",
")",
"... | Compares this enum with the specified object for order. Returns a
negative integer, zero, or a positive integer as this object is less
than, equal to, or greater than the specified object.
Enum constants are only comparable to other enum constants of the
same enum type. The natural order implemented by this
method is the order in which the constants are declared. | [
"Compares",
"this",
"enum",
"with",
"the",
"specified",
"object",
"for",
"order",
".",
"Returns",
"a",
"negative",
"integer",
"zero",
"or",
"a",
"positive",
"integer",
"as",
"this",
"object",
"is",
"less",
"than",
"equal",
"to",
"or",
"greater",
"than",
"t... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Enum.java#L192-L199 |
32,932 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Enum.java | Enum.getSharedConstants | @SuppressWarnings("unchecked") // the cache always returns the type matching enumType
public static <T extends Enum<T>> T[] getSharedConstants(Class<T> enumType) {
return (T[]) sharedConstantsCache.get(enumType);
} | java | @SuppressWarnings("unchecked") // the cache always returns the type matching enumType
public static <T extends Enum<T>> T[] getSharedConstants(Class<T> enumType) {
return (T[]) sharedConstantsCache.get(enumType);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"// the cache always returns the type matching enumType",
"public",
"static",
"<",
"T",
"extends",
"Enum",
"<",
"T",
">",
">",
"T",
"[",
"]",
"getSharedConstants",
"(",
"Class",
"<",
"T",
">",
"enumType",
")",
... | Returns a shared, mutable array containing the constants of this enum. It
is an error to modify the returned array.
@hide | [
"Returns",
"a",
"shared",
"mutable",
"array",
"containing",
"the",
"constants",
"of",
"this",
"enum",
".",
"It",
"is",
"an",
"error",
"to",
"modify",
"the",
"returned",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Enum.java#L299-L302 |
32,933 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.subStream | public DerInputStream subStream(int len, boolean do_skip)
throws IOException {
DerInputBuffer newbuf = buffer.dup();
newbuf.truncate(len);
if (do_skip) {
buffer.skip(len);
}
return new DerInputStream(newbuf);
} | java | public DerInputStream subStream(int len, boolean do_skip)
throws IOException {
DerInputBuffer newbuf = buffer.dup();
newbuf.truncate(len);
if (do_skip) {
buffer.skip(len);
}
return new DerInputStream(newbuf);
} | [
"public",
"DerInputStream",
"subStream",
"(",
"int",
"len",
",",
"boolean",
"do_skip",
")",
"throws",
"IOException",
"{",
"DerInputBuffer",
"newbuf",
"=",
"buffer",
".",
"dup",
"(",
")",
";",
"newbuf",
".",
"truncate",
"(",
"len",
")",
";",
"if",
"(",
"d... | Creates a new DER input stream from part of this input stream.
@param len how long a chunk of the current input stream to use,
starting at the current position.
@param do_skip true if the existing data in the input stream should
be skipped. If this value is false, the next data read
on this stream and the newly created stream will be the
same. | [
"Creates",
"a",
"new",
"DER",
"input",
"stream",
"from",
"part",
"of",
"this",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L132-L141 |
32,934 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getInteger | public int getInteger() throws IOException {
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getInteger(getLength(buffer));
} | java | public int getInteger() throws IOException {
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getInteger(getLength(buffer));
} | [
"public",
"int",
"getInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_Integer",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DER input, Integer tag error\"",
")",
";",
"}",
"return"... | Get an integer from the input stream as an integer.
@return the integer held in this DER input stream. | [
"Get",
"an",
"integer",
"from",
"the",
"input",
"stream",
"as",
"an",
"integer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L166-L171 |
32,935 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getBigInteger | public BigInteger getBigInteger() throws IOException {
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getBigInteger(getLength(buffer), false);
} | java | public BigInteger getBigInteger() throws IOException {
if (buffer.read() != DerValue.tag_Integer) {
throw new IOException("DER input, Integer tag error");
}
return buffer.getBigInteger(getLength(buffer), false);
} | [
"public",
"BigInteger",
"getBigInteger",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_Integer",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DER input, Integer tag error\"",
")",
";",
"}",
... | Get a integer from the input stream as a BigInteger object.
@return the integer held in this DER input stream. | [
"Get",
"a",
"integer",
"from",
"the",
"input",
"stream",
"as",
"a",
"BigInteger",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L178-L183 |
32,936 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getEnumerated | public int getEnumerated() throws IOException {
if (buffer.read() != DerValue.tag_Enumerated) {
throw new IOException("DER input, Enumerated tag error");
}
return buffer.getInteger(getLength(buffer));
} | java | public int getEnumerated() throws IOException {
if (buffer.read() != DerValue.tag_Enumerated) {
throw new IOException("DER input, Enumerated tag error");
}
return buffer.getInteger(getLength(buffer));
} | [
"public",
"int",
"getEnumerated",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_Enumerated",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"DER input, Enumerated tag error\"",
")",
";",
"}",
... | Get an enumerated from the input stream.
@return the integer held in this DER input stream. | [
"Get",
"an",
"enumerated",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L204-L209 |
32,937 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getUnalignedBitString | public BitArray getUnalignedBitString() throws IOException {
if (buffer.read() != DerValue.tag_BitString)
throw new IOException("DER input not a bit string");
int length = getLength(buffer) - 1;
/*
* First byte = number of excess bits in the last octet of the
* representation.
*/
int validBits = length*8 - buffer.read();
byte[] repn = new byte[length];
if ((length != 0) && (buffer.read(repn) != length))
throw new IOException("short read of DER bit string");
return new BitArray(validBits, repn);
} | java | public BitArray getUnalignedBitString() throws IOException {
if (buffer.read() != DerValue.tag_BitString)
throw new IOException("DER input not a bit string");
int length = getLength(buffer) - 1;
/*
* First byte = number of excess bits in the last octet of the
* representation.
*/
int validBits = length*8 - buffer.read();
byte[] repn = new byte[length];
if ((length != 0) && (buffer.read(repn) != length))
throw new IOException("short read of DER bit string");
return new BitArray(validBits, repn);
} | [
"public",
"BitArray",
"getUnalignedBitString",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_BitString",
")",
"throw",
"new",
"IOException",
"(",
"\"DER input not a bit string\"",
")",
";",
"int",... | Get a bit string from the input stream. The bit string need
not be byte-aligned. | [
"Get",
"a",
"bit",
"string",
"from",
"the",
"input",
"stream",
".",
"The",
"bit",
"string",
"need",
"not",
"be",
"byte",
"-",
"aligned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L226-L243 |
32,938 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getOctetString | public byte[] getOctetString() throws IOException {
if (buffer.read() != DerValue.tag_OctetString)
throw new IOException("DER input not an octet string");
int length = getLength(buffer);
byte[] retval = new byte[length];
if ((length != 0) && (buffer.read(retval) != length))
throw new IOException("short read of DER octet string");
return retval;
} | java | public byte[] getOctetString() throws IOException {
if (buffer.read() != DerValue.tag_OctetString)
throw new IOException("DER input not an octet string");
int length = getLength(buffer);
byte[] retval = new byte[length];
if ((length != 0) && (buffer.read(retval) != length))
throw new IOException("short read of DER octet string");
return retval;
} | [
"public",
"byte",
"[",
"]",
"getOctetString",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_OctetString",
")",
"throw",
"new",
"IOException",
"(",
"\"DER input not an octet string\"",
")",
";",
... | Returns an ASN.1 OCTET STRING from the input stream. | [
"Returns",
"an",
"ASN",
".",
"1",
"OCTET",
"STRING",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L248-L258 |
32,939 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getBytes | public void getBytes(byte[] val) throws IOException {
if ((val.length != 0) && (buffer.read(val) != val.length)) {
throw new IOException("short read of DER octet string");
}
} | java | public void getBytes(byte[] val) throws IOException {
if ((val.length != 0) && (buffer.read(val) != val.length)) {
throw new IOException("short read of DER octet string");
}
} | [
"public",
"void",
"getBytes",
"(",
"byte",
"[",
"]",
"val",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"val",
".",
"length",
"!=",
"0",
")",
"&&",
"(",
"buffer",
".",
"read",
"(",
"val",
")",
"!=",
"val",
".",
"length",
")",
")",
"{",
"... | Returns the asked number of bytes from the input stream. | [
"Returns",
"the",
"asked",
"number",
"of",
"bytes",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L263-L267 |
32,940 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getSequence | public DerValue[] getSequence(int startLen,
boolean originalEncodedFormRetained) throws IOException {
tag = (byte)buffer.read();
if (tag != DerValue.tag_Sequence)
throw new IOException("Sequence tag error");
return readVector(startLen, originalEncodedFormRetained);
} | java | public DerValue[] getSequence(int startLen,
boolean originalEncodedFormRetained) throws IOException {
tag = (byte)buffer.read();
if (tag != DerValue.tag_Sequence)
throw new IOException("Sequence tag error");
return readVector(startLen, originalEncodedFormRetained);
} | [
"public",
"DerValue",
"[",
"]",
"getSequence",
"(",
"int",
"startLen",
",",
"boolean",
"originalEncodedFormRetained",
")",
"throws",
"IOException",
"{",
"tag",
"=",
"(",
"byte",
")",
"buffer",
".",
"read",
"(",
")",
";",
"if",
"(",
"tag",
"!=",
"DerValue",... | Return a sequence of encoded entities. ASN.1 sequences are
ordered, and they are often used, like a "struct" in C or C++,
to group data values. They may have optional or context
specific values.
@param startLen guess about how long the sequence will be
(used to initialize an auto-growing data structure)
@return array of the values in the sequence | [
"Return",
"a",
"sequence",
"of",
"encoded",
"entities",
".",
"ASN",
".",
"1",
"sequences",
"are",
"ordered",
"and",
"they",
"are",
"often",
"used",
"like",
"a",
"struct",
"in",
"C",
"or",
"C",
"++",
"to",
"group",
"data",
"values",
".",
"They",
"may",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L294-L300 |
32,941 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.readString | private String readString(byte stringTag, String stringName,
String enc) throws IOException {
if (buffer.read() != stringTag)
throw new IOException("DER input not a " +
stringName + " string");
int length = getLength(buffer);
byte[] retval = new byte[length];
if ((length != 0) && (buffer.read(retval) != length))
throw new IOException("short read of DER " +
stringName + " string");
return new String(retval, enc);
} | java | private String readString(byte stringTag, String stringName,
String enc) throws IOException {
if (buffer.read() != stringTag)
throw new IOException("DER input not a " +
stringName + " string");
int length = getLength(buffer);
byte[] retval = new byte[length];
if ((length != 0) && (buffer.read(retval) != length))
throw new IOException("short read of DER " +
stringName + " string");
return new String(retval, enc);
} | [
"private",
"String",
"readString",
"(",
"byte",
"stringTag",
",",
"String",
"stringName",
",",
"String",
"enc",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"stringTag",
")",
"throw",
"new",
"IOException",
"(",
"\"DE... | Private helper routine to read an encoded string from the input
stream.
@param stringTag the tag for the type of string to read
@param stringName a name to display in error messages
@param enc the encoder to use to interpret the data. Should
correspond to the stringTag above. | [
"Private",
"helper",
"routine",
"to",
"read",
"an",
"encoded",
"string",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L514-L528 |
32,942 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getUTCTime | public Date getUTCTime() throws IOException {
if (buffer.read() != DerValue.tag_UtcTime)
throw new IOException("DER input, UTCtime tag invalid ");
return buffer.getUTCTime(getLength(buffer));
} | java | public Date getUTCTime() throws IOException {
if (buffer.read() != DerValue.tag_UtcTime)
throw new IOException("DER input, UTCtime tag invalid ");
return buffer.getUTCTime(getLength(buffer));
} | [
"public",
"Date",
"getUTCTime",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_UtcTime",
")",
"throw",
"new",
"IOException",
"(",
"\"DER input, UTCtime tag invalid \"",
")",
";",
"return",
"buffe... | Get a UTC encoded time value from the input stream. | [
"Get",
"a",
"UTC",
"encoded",
"time",
"value",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L533-L537 |
32,943 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java | DerInputStream.getGeneralizedTime | public Date getGeneralizedTime() throws IOException {
if (buffer.read() != DerValue.tag_GeneralizedTime)
throw new IOException("DER input, GeneralizedTime tag invalid ");
return buffer.getGeneralizedTime(getLength(buffer));
} | java | public Date getGeneralizedTime() throws IOException {
if (buffer.read() != DerValue.tag_GeneralizedTime)
throw new IOException("DER input, GeneralizedTime tag invalid ");
return buffer.getGeneralizedTime(getLength(buffer));
} | [
"public",
"Date",
"getGeneralizedTime",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"read",
"(",
")",
"!=",
"DerValue",
".",
"tag_GeneralizedTime",
")",
"throw",
"new",
"IOException",
"(",
"\"DER input, GeneralizedTime tag invalid \"",
")",
"... | Get a Generalized encoded time value from the input stream. | [
"Get",
"a",
"Generalized",
"encoded",
"time",
"value",
"from",
"the",
"input",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/DerInputStream.java#L542-L546 |
32,944 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRuleParser.java | CollationRuleParser.getReorderCode | public static int getReorderCode(String word) {
for(int i = 0; i < gSpecialReorderCodes.length; ++i) {
if(word.equalsIgnoreCase(gSpecialReorderCodes[i])) {
return Collator.ReorderCodes.FIRST + i;
}
}
try {
int script = UCharacter.getPropertyValueEnum(UProperty.SCRIPT, word);
if(script >= 0) {
return script;
}
} catch (IllegalIcuArgumentException e) {
// fall through
}
if(word.equalsIgnoreCase("others")) {
return Collator.ReorderCodes.OTHERS; // same as Zzzz = USCRIPT_UNKNOWN
}
return -1;
} | java | public static int getReorderCode(String word) {
for(int i = 0; i < gSpecialReorderCodes.length; ++i) {
if(word.equalsIgnoreCase(gSpecialReorderCodes[i])) {
return Collator.ReorderCodes.FIRST + i;
}
}
try {
int script = UCharacter.getPropertyValueEnum(UProperty.SCRIPT, word);
if(script >= 0) {
return script;
}
} catch (IllegalIcuArgumentException e) {
// fall through
}
if(word.equalsIgnoreCase("others")) {
return Collator.ReorderCodes.OTHERS; // same as Zzzz = USCRIPT_UNKNOWN
}
return -1;
} | [
"public",
"static",
"int",
"getReorderCode",
"(",
"String",
"word",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"gSpecialReorderCodes",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"word",
".",
"equalsIgnoreCase",
"(",
"gSpecialRe... | Gets a script or reorder code from its string representation.
@return the script/reorder code, or
-1 if not recognized | [
"Gets",
"a",
"script",
"or",
"reorder",
"code",
"from",
"its",
"string",
"representation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRuleParser.java#L746-L764 |
32,945 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java | JavadocConverter.convertJavadoc | static Javadoc convertJavadoc(
TreePath path, String source, JavacEnvironment env, boolean reportWarnings) {
DocTrees docTrees = DocTrees.instance(env.task());
DocCommentTree docComment = docTrees.getDocCommentTree(path);
if (docComment == null) {
return null; // Declaration does not have a javadoc comment.
}
JavadocConverter converter =
new JavadocConverter(
env.treeUtilities().getElement(path),
docComment,
source,
docTrees,
path.getCompilationUnit(),
reportWarnings);
Javadoc result = new Javadoc();
// First tag is the description.
TagElement newTag = new TagElement().setTagKind(TagElement.TagKind.DESCRIPTION);
converter.scan(docComment.getFirstSentence(), newTag);
converter.scan(docComment.getBody(), newTag);
if (!newTag.getFragments().isEmpty()) {
List<TreeNode> fragments = newTag.getFragments();
int start = fragments.get(0).getStartPosition();
TreeNode lastFragment = fragments.get(fragments.size() - 1);
int end = start + lastFragment.getLength();
converter.setPos(newTag, start, end);
result.addTag(newTag);
}
for (DocTree tag : docComment.getBlockTags()) {
if (tag.getKind() != DocTree.Kind.ERRONEOUS) {
newTag = new TagElement();
converter.scan(tag, newTag);
result.addTag(newTag);
}
}
return result;
} | java | static Javadoc convertJavadoc(
TreePath path, String source, JavacEnvironment env, boolean reportWarnings) {
DocTrees docTrees = DocTrees.instance(env.task());
DocCommentTree docComment = docTrees.getDocCommentTree(path);
if (docComment == null) {
return null; // Declaration does not have a javadoc comment.
}
JavadocConverter converter =
new JavadocConverter(
env.treeUtilities().getElement(path),
docComment,
source,
docTrees,
path.getCompilationUnit(),
reportWarnings);
Javadoc result = new Javadoc();
// First tag is the description.
TagElement newTag = new TagElement().setTagKind(TagElement.TagKind.DESCRIPTION);
converter.scan(docComment.getFirstSentence(), newTag);
converter.scan(docComment.getBody(), newTag);
if (!newTag.getFragments().isEmpty()) {
List<TreeNode> fragments = newTag.getFragments();
int start = fragments.get(0).getStartPosition();
TreeNode lastFragment = fragments.get(fragments.size() - 1);
int end = start + lastFragment.getLength();
converter.setPos(newTag, start, end);
result.addTag(newTag);
}
for (DocTree tag : docComment.getBlockTags()) {
if (tag.getKind() != DocTree.Kind.ERRONEOUS) {
newTag = new TagElement();
converter.scan(tag, newTag);
result.addTag(newTag);
}
}
return result;
} | [
"static",
"Javadoc",
"convertJavadoc",
"(",
"TreePath",
"path",
",",
"String",
"source",
",",
"JavacEnvironment",
"env",
",",
"boolean",
"reportWarnings",
")",
"{",
"DocTrees",
"docTrees",
"=",
"DocTrees",
".",
"instance",
"(",
"env",
".",
"task",
"(",
")",
... | Returns an AST node for the javadoc comment of a specified class, method, or field element. | [
"Returns",
"an",
"AST",
"node",
"for",
"the",
"javadoc",
"comment",
"of",
"a",
"specified",
"class",
"method",
"or",
"field",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java#L80-L117 |
32,946 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java | JavadocConverter.setTagValues | private TagElement setTagValues(TagElement tag, TagKind tagKind, DocTree javadocNode,
DocTree body) {
tag.setTagKind(tagKind);
setPos(javadocNode, tag);
scan(body, tag);
return tag;
} | java | private TagElement setTagValues(TagElement tag, TagKind tagKind, DocTree javadocNode,
DocTree body) {
tag.setTagKind(tagKind);
setPos(javadocNode, tag);
scan(body, tag);
return tag;
} | [
"private",
"TagElement",
"setTagValues",
"(",
"TagElement",
"tag",
",",
"TagKind",
"tagKind",
",",
"DocTree",
"javadocNode",
",",
"DocTree",
"body",
")",
"{",
"tag",
".",
"setTagKind",
"(",
"tagKind",
")",
";",
"setPos",
"(",
"javadocNode",
",",
"tag",
")",
... | Updates a tag element with values from the javadoc node. | [
"Updates",
"a",
"tag",
"element",
"with",
"values",
"from",
"the",
"javadoc",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java#L310-L316 |
32,947 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java | JavadocConverter.setPos | private TreeNode setPos(DocTree node, TreeNode newNode) {
int pos = pos(node);
return newNode.setPosition(new SourcePosition(pos, length(node), lineNumber(pos)));
} | java | private TreeNode setPos(DocTree node, TreeNode newNode) {
int pos = pos(node);
return newNode.setPosition(new SourcePosition(pos, length(node), lineNumber(pos)));
} | [
"private",
"TreeNode",
"setPos",
"(",
"DocTree",
"node",
",",
"TreeNode",
"newNode",
")",
"{",
"int",
"pos",
"=",
"pos",
"(",
"node",
")",
";",
"return",
"newNode",
".",
"setPosition",
"(",
"new",
"SourcePosition",
"(",
"pos",
",",
"length",
"(",
"node",... | Set a TreeNode's position using the original DocTree. | [
"Set",
"a",
"TreeNode",
"s",
"position",
"using",
"the",
"original",
"DocTree",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java#L329-L332 |
32,948 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java | JavadocConverter.setPos | private TreeNode setPos(TreeNode newNode, int pos, int endPos) {
return newNode.setPosition(new SourcePosition(pos, endPos - pos, lineNumber(pos)));
} | java | private TreeNode setPos(TreeNode newNode, int pos, int endPos) {
return newNode.setPosition(new SourcePosition(pos, endPos - pos, lineNumber(pos)));
} | [
"private",
"TreeNode",
"setPos",
"(",
"TreeNode",
"newNode",
",",
"int",
"pos",
",",
"int",
"endPos",
")",
"{",
"return",
"newNode",
".",
"setPosition",
"(",
"new",
"SourcePosition",
"(",
"pos",
",",
"endPos",
"-",
"pos",
",",
"lineNumber",
"(",
"pos",
"... | Set a TreeNode's position using begin and end source offsets. Its line number
is unchanged. | [
"Set",
"a",
"TreeNode",
"s",
"position",
"using",
"begin",
"and",
"end",
"source",
"offsets",
".",
"Its",
"line",
"number",
"is",
"unchanged",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavadocConverter.java#L338-L340 |
32,949 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.transliterate | public final int transliterate(Replaceable text, int start, int limit) {
if (start < 0 ||
limit < start ||
text.length() < limit) {
return -1;
}
Position pos = new Position(start, limit, start);
filteredTransliterate(text, pos, false, true);
return pos.limit;
} | java | public final int transliterate(Replaceable text, int start, int limit) {
if (start < 0 ||
limit < start ||
text.length() < limit) {
return -1;
}
Position pos = new Position(start, limit, start);
filteredTransliterate(text, pos, false, true);
return pos.limit;
} | [
"public",
"final",
"int",
"transliterate",
"(",
"Replaceable",
"text",
",",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"if",
"(",
"start",
"<",
"0",
"||",
"limit",
"<",
"start",
"||",
"text",
".",
"length",
"(",
")",
"<",
"limit",
")",
"{",
"re... | Transliterates a segment of a string, with optional filtering.
@param text the string to be transliterated
@param start the beginning index, inclusive; <code>0 <= start
<= limit</code>.
@param limit the ending index, exclusive; <code>start <= limit
<= text.length()</code>.
@return The new limit index. The text previously occupying <code>[start,
limit)</code> has been transliterated, possibly to a string of a different
length, at <code>[start, </code><em>new-limit</em><code>)</code>, where
<em>new-limit</em> is the return value. If the input offsets are out of bounds,
the returned value is -1 and the input string remains unchanged. | [
"Transliterates",
"a",
"segment",
"of",
"a",
"string",
"with",
"optional",
"filtering",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L513-L523 |
32,950 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.transliterate | public final String transliterate(String text) {
ReplaceableString result = new ReplaceableString(text);
transliterate(result);
return result.toString();
} | java | public final String transliterate(String text) {
ReplaceableString result = new ReplaceableString(text);
transliterate(result);
return result.toString();
} | [
"public",
"final",
"String",
"transliterate",
"(",
"String",
"text",
")",
"{",
"ReplaceableString",
"result",
"=",
"new",
"ReplaceableString",
"(",
"text",
")",
";",
"transliterate",
"(",
"result",
")",
";",
"return",
"result",
".",
"toString",
"(",
")",
";"... | Transliterate an entire string and returns the result. Convenience method.
@param text the string to be transliterated
@return The transliterated text | [
"Transliterate",
"an",
"entire",
"string",
"and",
"returns",
"the",
"result",
".",
"Convenience",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L539-L543 |
32,951 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.filteredTransliterate | public void filteredTransliterate(Replaceable text,
Position index,
boolean incremental) {
filteredTransliterate(text, index, incremental, false);
} | java | public void filteredTransliterate(Replaceable text,
Position index,
boolean incremental) {
filteredTransliterate(text, index, incremental, false);
} | [
"public",
"void",
"filteredTransliterate",
"(",
"Replaceable",
"text",
",",
"Position",
"index",
",",
"boolean",
"incremental",
")",
"{",
"filteredTransliterate",
"(",
"text",
",",
"index",
",",
"incremental",
",",
"false",
")",
";",
"}"
] | Transliterate a substring of text, as specified by index, taking filters
into account. This method is for subclasses that need to delegate to
another transliterator, such as CompoundTransliterator.
@param text the text to be transliterated
@param index the position indices
@param incremental if TRUE, then assume more characters may be inserted
at index.limit, and postpone processing to accomodate future incoming
characters | [
"Transliterate",
"a",
"substring",
"of",
"text",
"as",
"specified",
"by",
"index",
"taking",
"filters",
"into",
"account",
".",
"This",
"method",
"is",
"for",
"subclasses",
"that",
"need",
"to",
"delegate",
"to",
"another",
"transliterator",
"such",
"as",
"Com... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1094-L1098 |
32,952 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.getBasicInstance | static Transliterator getBasicInstance(String id, String canonID) {
StringBuffer s = new StringBuffer();
Transliterator t = registry.get(id, s);
if (s.length() != 0) {
// assert(t==0);
// Instantiate an alias
t = getInstance(s.toString(), FORWARD);
}
if (t != null && canonID != null) {
t.setID(canonID);
}
return t;
} | java | static Transliterator getBasicInstance(String id, String canonID) {
StringBuffer s = new StringBuffer();
Transliterator t = registry.get(id, s);
if (s.length() != 0) {
// assert(t==0);
// Instantiate an alias
t = getInstance(s.toString(), FORWARD);
}
if (t != null && canonID != null) {
t.setID(canonID);
}
return t;
} | [
"static",
"Transliterator",
"getBasicInstance",
"(",
"String",
"id",
",",
"String",
"canonID",
")",
"{",
"StringBuffer",
"s",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"Transliterator",
"t",
"=",
"registry",
".",
"get",
"(",
"id",
",",
"s",
")",
";",
"i... | Create a transliterator from a basic ID. This is an ID
containing only the forward direction source, target, and
variant.
@param id a basic ID of the form S-T or S-T/V.
@param canonID canonical ID to apply to the result, or
null to leave the ID unchanged
@return a newly created Transliterator or null if the ID is
invalid. | [
"Create",
"a",
"transliterator",
"from",
"a",
"basic",
"ID",
".",
"This",
"is",
"an",
"ID",
"containing",
"only",
"the",
"forward",
"direction",
"source",
"target",
"and",
"variant",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1357-L1369 |
32,953 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.registerFactory | public static void registerFactory(String ID, Factory factory) {
registry.put(ID, factory, true);
} | java | public static void registerFactory(String ID, Factory factory) {
registry.put(ID, factory, true);
} | [
"public",
"static",
"void",
"registerFactory",
"(",
"String",
"ID",
",",
"Factory",
"factory",
")",
"{",
"registry",
".",
"put",
"(",
"ID",
",",
"factory",
",",
"true",
")",
";",
"}"
] | Register a factory object with the given ID. The factory
method should return a new instance of the given transliterator.
<p>Because ICU may choose to cache Transliterator objects internally, this must
be called at application startup, prior to any calls to
Transliterator.getInstance to avoid undefined behavior.
@param ID the ID of this transliterator
@param factory the factory object | [
"Register",
"a",
"factory",
"object",
"with",
"the",
"given",
"ID",
".",
"The",
"factory",
"method",
"should",
"return",
"a",
"new",
"instance",
"of",
"the",
"given",
"transliterator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1689-L1691 |
32,954 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.registerInstance | static void registerInstance(Transliterator trans, boolean visible) {
registry.put(trans.getID(), trans, visible);
} | java | static void registerInstance(Transliterator trans, boolean visible) {
registry.put(trans.getID(), trans, visible);
} | [
"static",
"void",
"registerInstance",
"(",
"Transliterator",
"trans",
",",
"boolean",
"visible",
")",
"{",
"registry",
".",
"put",
"(",
"trans",
".",
"getID",
"(",
")",
",",
"trans",
",",
"visible",
")",
";",
"}"
] | Register a Transliterator object.
<p>Because ICU may choose to cache Transliterator objects internally, this must
be called at application startup, prior to any calls to
Transliterator.getInstance to avoid undefined behavior.
@param trans the Transliterator object | [
"Register",
"a",
"Transliterator",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1715-L1717 |
32,955 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.registerAlias | public static void registerAlias(String aliasID, String realID) {
registry.put(aliasID, realID, true);
} | java | public static void registerAlias(String aliasID, String realID) {
registry.put(aliasID, realID, true);
} | [
"public",
"static",
"void",
"registerAlias",
"(",
"String",
"aliasID",
",",
"String",
"realID",
")",
"{",
"registry",
".",
"put",
"(",
"aliasID",
",",
"realID",
",",
"true",
")",
";",
"}"
] | Register an ID as an alias of another ID. Instantiating
alias ID produces the same result as instantiating the original ID.
This is generally used to create short aliases of compound IDs.
<p>Because ICU may choose to cache Transliterator objects internally, this must
be called at application startup, prior to any calls to
Transliterator.getInstance to avoid undefined behavior.
@param aliasID The new ID being registered.
@param realID The existing ID that the new ID should be an alias of. | [
"Register",
"an",
"ID",
"as",
"an",
"alias",
"of",
"another",
"ID",
".",
"Instantiating",
"alias",
"ID",
"produces",
"the",
"same",
"result",
"as",
"instantiating",
"the",
"original",
"ID",
".",
"This",
"is",
"generally",
"used",
"to",
"create",
"short",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1731-L1733 |
32,956 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.unregister | public static void unregister(String ID) {
displayNameCache.remove(new CaseInsensitiveString(ID));
registry.remove(ID);
} | java | public static void unregister(String ID) {
displayNameCache.remove(new CaseInsensitiveString(ID));
registry.remove(ID);
} | [
"public",
"static",
"void",
"unregister",
"(",
"String",
"ID",
")",
"{",
"displayNameCache",
".",
"remove",
"(",
"new",
"CaseInsensitiveString",
"(",
"ID",
")",
")",
";",
"registry",
".",
"remove",
"(",
"ID",
")",
";",
"}"
] | Unregisters a transliterator or class. This may be either
a system transliterator or a user transliterator or class.
@param ID the ID of the transliterator or class
@see #registerClass | [
"Unregisters",
"a",
"transliterator",
"or",
"class",
".",
"This",
"may",
"be",
"either",
"a",
"system",
"transliterator",
"or",
"a",
"user",
"transliterator",
"or",
"class",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1780-L1783 |
32,957 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java | Transliterator.getAvailableVariants | public static final Enumeration<String> getAvailableVariants(String source,
String target) {
return registry.getAvailableVariants(source, target);
} | java | public static final Enumeration<String> getAvailableVariants(String source,
String target) {
return registry.getAvailableVariants(source, target);
} | [
"public",
"static",
"final",
"Enumeration",
"<",
"String",
">",
"getAvailableVariants",
"(",
"String",
"source",
",",
"String",
"target",
")",
"{",
"return",
"registry",
".",
"getAvailableVariants",
"(",
"source",
",",
"target",
")",
";",
"}"
] | Returns an enumeration over the variant names of registered
transliterators having a given source name and target name. | [
"Returns",
"an",
"enumeration",
"over",
"the",
"variant",
"names",
"of",
"registered",
"transliterators",
"having",
"a",
"given",
"source",
"name",
"and",
"target",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Transliterator.java#L1824-L1827 |
32,958 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getFrozenInstance | @Deprecated
public static DateTimePatternGenerator getFrozenInstance(ULocale uLocale) {
String localeKey = uLocale.toString();
DateTimePatternGenerator result = DTPNG_CACHE.get(localeKey);
if (result != null) {
return result;
}
result = new DateTimePatternGenerator();
result.initData(uLocale);
// freeze and cache
result.freeze();
DTPNG_CACHE.put(localeKey, result);
return result;
} | java | @Deprecated
public static DateTimePatternGenerator getFrozenInstance(ULocale uLocale) {
String localeKey = uLocale.toString();
DateTimePatternGenerator result = DTPNG_CACHE.get(localeKey);
if (result != null) {
return result;
}
result = new DateTimePatternGenerator();
result.initData(uLocale);
// freeze and cache
result.freeze();
DTPNG_CACHE.put(localeKey, result);
return result;
} | [
"@",
"Deprecated",
"public",
"static",
"DateTimePatternGenerator",
"getFrozenInstance",
"(",
"ULocale",
"uLocale",
")",
"{",
"String",
"localeKey",
"=",
"uLocale",
".",
"toString",
"(",
")",
";",
"DateTimePatternGenerator",
"result",
"=",
"DTPNG_CACHE",
".",
"get",
... | Construct a frozen instance of DateTimePatternGenerator for a
given locale. This method returns a cached frozen instance of
DateTimePatternGenerator, so less expensive than the regular
factory method.
@param uLocale The locale to pass.
@return A frozen DateTimePatternGenerator.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Construct",
"a",
"frozen",
"instance",
"of",
"DateTimePatternGenerator",
"for",
"a",
"given",
"locale",
".",
"This",
"method",
"returns",
"a",
"cached",
"frozen",
"instance",
"of",
"DateTimePatternGenerator",
"so",
"less",
"expensive",
"than",
"the",
"regular",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L114-L129 |
32,959 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getSkeletonAllowingDuplicates | @Deprecated
public String getSkeletonAllowingDuplicates(String pattern) {
synchronized (this) { // synchronized since a getter must be thread-safe
current.set(pattern, fp, true);
return current.toString();
}
} | java | @Deprecated
public String getSkeletonAllowingDuplicates(String pattern) {
synchronized (this) { // synchronized since a getter must be thread-safe
current.set(pattern, fp, true);
return current.toString();
}
} | [
"@",
"Deprecated",
"public",
"String",
"getSkeletonAllowingDuplicates",
"(",
"String",
"pattern",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// synchronized since a getter must be thread-safe",
"current",
".",
"set",
"(",
"pattern",
",",
"fp",
",",
"true",
")... | Same as getSkeleton, but allows duplicates
@param pattern Input pattern, such as "dd/MMM"
@return skeleton, such as "MMMdd"
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Same",
"as",
"getSkeleton",
"but",
"allows",
"duplicates"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L730-L736 |
32,960 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getCanonicalSkeletonAllowingDuplicates | @Deprecated
public String getCanonicalSkeletonAllowingDuplicates(String pattern) {
synchronized (this) { // synchronized since a getter must be thread-safe
current.set(pattern, fp, true);
return current.toCanonicalString();
}
} | java | @Deprecated
public String getCanonicalSkeletonAllowingDuplicates(String pattern) {
synchronized (this) { // synchronized since a getter must be thread-safe
current.set(pattern, fp, true);
return current.toCanonicalString();
}
} | [
"@",
"Deprecated",
"public",
"String",
"getCanonicalSkeletonAllowingDuplicates",
"(",
"String",
"pattern",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// synchronized since a getter must be thread-safe",
"current",
".",
"set",
"(",
"pattern",
",",
"fp",
",",
"tr... | Same as getSkeleton, but allows duplicates
and returns a string using canonical pattern chars
@param pattern Input pattern, such as "ccc, d LLL"
@return skeleton, such as "MMMEd"
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Same",
"as",
"getSkeleton",
"but",
"allows",
"duplicates",
"and",
"returns",
"a",
"string",
"using",
"canonical",
"pattern",
"chars"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L748-L754 |
32,961 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getRedundants | @Deprecated
public Collection<String> getRedundants(Collection<String> output) {
synchronized (this) { // synchronized since a getter must be thread-safe
if (output == null) {
output = new LinkedHashSet<String>();
}
for (DateTimeMatcher cur : skeleton2pattern.keySet()) {
PatternWithSkeletonFlag patternWithSkelFlag = skeleton2pattern.get(cur);
String pattern = patternWithSkelFlag.pattern;
if (CANONICAL_SET.contains(pattern)) {
continue;
}
String trial = getBestPattern(cur.toString(), cur, MATCH_NO_OPTIONS);
if (trial.equals(pattern)) {
output.add(pattern);
}
}
///CLOVER:OFF
//The following would never be called since the parameter is false
//Eclipse stated the following is "dead code"
/*if (false) { // ordered
DateTimePatternGenerator results = new DateTimePatternGenerator();
PatternInfo pinfo = new PatternInfo();
for (DateTimeMatcher cur : skeleton2pattern.keySet()) {
String pattern = skeleton2pattern.get(cur);
if (CANONICAL_SET.contains(pattern)) {
continue;
}
//skipMatcher = current;
String trial = results.getBestPattern(cur.toString());
if (trial.equals(pattern)) {
output.add(pattern);
} else {
results.addPattern(pattern, false, pinfo);
}
}
}*/
///CLOVER:ON
return output;
}
} | java | @Deprecated
public Collection<String> getRedundants(Collection<String> output) {
synchronized (this) { // synchronized since a getter must be thread-safe
if (output == null) {
output = new LinkedHashSet<String>();
}
for (DateTimeMatcher cur : skeleton2pattern.keySet()) {
PatternWithSkeletonFlag patternWithSkelFlag = skeleton2pattern.get(cur);
String pattern = patternWithSkelFlag.pattern;
if (CANONICAL_SET.contains(pattern)) {
continue;
}
String trial = getBestPattern(cur.toString(), cur, MATCH_NO_OPTIONS);
if (trial.equals(pattern)) {
output.add(pattern);
}
}
///CLOVER:OFF
//The following would never be called since the parameter is false
//Eclipse stated the following is "dead code"
/*if (false) { // ordered
DateTimePatternGenerator results = new DateTimePatternGenerator();
PatternInfo pinfo = new PatternInfo();
for (DateTimeMatcher cur : skeleton2pattern.keySet()) {
String pattern = skeleton2pattern.get(cur);
if (CANONICAL_SET.contains(pattern)) {
continue;
}
//skipMatcher = current;
String trial = results.getBestPattern(cur.toString());
if (trial.equals(pattern)) {
output.add(pattern);
} else {
results.addPattern(pattern, false, pinfo);
}
}
}*/
///CLOVER:ON
return output;
}
} | [
"@",
"Deprecated",
"public",
"Collection",
"<",
"String",
">",
"getRedundants",
"(",
"Collection",
"<",
"String",
">",
"output",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"// synchronized since a getter must be thread-safe",
"if",
"(",
"output",
"==",
"null... | Redundant patterns are those which if removed, make no difference in the
resulting getBestPattern values. This method returns a list of them, to
help check the consistency of the patterns used to build this generator.
@param output stores the redundant patterns that are removed. To get these
in internal order, supply a LinkedHashSet. If null, a
collection is allocated.
@return the collection with added elements.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Redundant",
"patterns",
"are",
"those",
"which",
"if",
"removed",
"make",
"no",
"difference",
"in",
"the",
"resulting",
"getBestPattern",
"values",
".",
"This",
"method",
"returns",
"a",
"list",
"of",
"them",
"to",
"help",
"check",
"the",
"consistency",
"of",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L916-L956 |
32,962 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.isSingleField | @Deprecated
public static boolean isSingleField(String skeleton) {
char first = skeleton.charAt(0);
for (int i = 1; i < skeleton.length(); ++i) {
if (skeleton.charAt(i) != first) return false;
}
return true;
} | java | @Deprecated
public static boolean isSingleField(String skeleton) {
char first = skeleton.charAt(0);
for (int i = 1; i < skeleton.length(); ++i) {
if (skeleton.charAt(i) != first) return false;
}
return true;
} | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"isSingleField",
"(",
"String",
"skeleton",
")",
"{",
"char",
"first",
"=",
"skeleton",
".",
"charAt",
"(",
"0",
")",
";",
"for",
"(",
"int",
"i",
"=",
"1",
";",
"i",
"<",
"skeleton",
".",
"length",
"... | Determines whether a skeleton contains a single field
@param skeleton The skeleton to determine if it contains a single field.
@return true or not
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Determines",
"whether",
"a",
"skeleton",
"contains",
"a",
"single",
"field"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L1142-L1149 |
32,963 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getBestAppending | private String getBestAppending(DateTimeMatcher source, int missingFields, DistanceInfo distInfo, DateTimeMatcher skipMatcher, EnumSet<DTPGflags> flags, int options) {
String resultPattern = null;
if (missingFields != 0) {
PatternWithMatcher resultPatternWithMatcher = getBestRaw(source, missingFields, distInfo, skipMatcher);
resultPattern = adjustFieldTypes(resultPatternWithMatcher, source, flags, options);
while (distInfo.missingFieldMask != 0) { // precondition: EVERY single field must work!
// special hack for SSS. If we are missing SSS, and we had ss but found it, replace the s field according to the
// number separator
if ((distInfo.missingFieldMask & SECOND_AND_FRACTIONAL_MASK) == FRACTIONAL_MASK
&& (missingFields & SECOND_AND_FRACTIONAL_MASK) == SECOND_AND_FRACTIONAL_MASK) {
resultPatternWithMatcher.pattern = resultPattern;
flags = EnumSet.copyOf(flags);
flags.add(DTPGflags.FIX_FRACTIONAL_SECONDS);
resultPattern = adjustFieldTypes(resultPatternWithMatcher, source, flags, options);
distInfo.missingFieldMask &= ~FRACTIONAL_MASK; // remove bit
continue;
}
int startingMask = distInfo.missingFieldMask;
PatternWithMatcher tempWithMatcher = getBestRaw(source, distInfo.missingFieldMask, distInfo, skipMatcher);
String temp = adjustFieldTypes(tempWithMatcher, source, flags, options);
int foundMask = startingMask & ~distInfo.missingFieldMask;
int topField = getTopBitNumber(foundMask);
resultPattern = SimpleFormatterImpl.formatRawPattern(
getAppendFormat(topField), 2, 3, resultPattern, temp, getAppendName(topField));
}
}
return resultPattern;
} | java | private String getBestAppending(DateTimeMatcher source, int missingFields, DistanceInfo distInfo, DateTimeMatcher skipMatcher, EnumSet<DTPGflags> flags, int options) {
String resultPattern = null;
if (missingFields != 0) {
PatternWithMatcher resultPatternWithMatcher = getBestRaw(source, missingFields, distInfo, skipMatcher);
resultPattern = adjustFieldTypes(resultPatternWithMatcher, source, flags, options);
while (distInfo.missingFieldMask != 0) { // precondition: EVERY single field must work!
// special hack for SSS. If we are missing SSS, and we had ss but found it, replace the s field according to the
// number separator
if ((distInfo.missingFieldMask & SECOND_AND_FRACTIONAL_MASK) == FRACTIONAL_MASK
&& (missingFields & SECOND_AND_FRACTIONAL_MASK) == SECOND_AND_FRACTIONAL_MASK) {
resultPatternWithMatcher.pattern = resultPattern;
flags = EnumSet.copyOf(flags);
flags.add(DTPGflags.FIX_FRACTIONAL_SECONDS);
resultPattern = adjustFieldTypes(resultPatternWithMatcher, source, flags, options);
distInfo.missingFieldMask &= ~FRACTIONAL_MASK; // remove bit
continue;
}
int startingMask = distInfo.missingFieldMask;
PatternWithMatcher tempWithMatcher = getBestRaw(source, distInfo.missingFieldMask, distInfo, skipMatcher);
String temp = adjustFieldTypes(tempWithMatcher, source, flags, options);
int foundMask = startingMask & ~distInfo.missingFieldMask;
int topField = getTopBitNumber(foundMask);
resultPattern = SimpleFormatterImpl.formatRawPattern(
getAppendFormat(topField), 2, 3, resultPattern, temp, getAppendName(topField));
}
}
return resultPattern;
} | [
"private",
"String",
"getBestAppending",
"(",
"DateTimeMatcher",
"source",
",",
"int",
"missingFields",
",",
"DistanceInfo",
"distInfo",
",",
"DateTimeMatcher",
"skipMatcher",
",",
"EnumSet",
"<",
"DTPGflags",
">",
"flags",
",",
"int",
"options",
")",
"{",
"String... | We only get called here if we failed to find an exact skeleton. We have broken it into date + time, and look for the pieces.
If we fail to find a complete skeleton, we compose in a loop until we have all the fields. | [
"We",
"only",
"get",
"called",
"here",
"if",
"we",
"failed",
"to",
"find",
"an",
"exact",
"skeleton",
".",
"We",
"have",
"broken",
"it",
"into",
"date",
"+",
"time",
"and",
"look",
"for",
"the",
"pieces",
".",
"If",
"we",
"fail",
"to",
"find",
"a",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L1761-L1791 |
32,964 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java | DateTimePatternGenerator.getCanonicalIndex | private static int getCanonicalIndex(String s, boolean strict) {
int len = s.length();
if (len == 0) {
return -1;
}
int ch = s.charAt(0);
// verify that all are the same character
for (int i = 1; i < len; ++i) {
if (s.charAt(i) != ch) {
return -1;
}
}
int bestRow = -1;
for (int i = 0; i < types.length; ++i) {
int[] row = types[i];
if (row[0] != ch) continue;
bestRow = i;
if (row[3] > len) continue;
if (row[row.length-1] < len) continue;
return i;
}
return strict ? -1 : bestRow;
} | java | private static int getCanonicalIndex(String s, boolean strict) {
int len = s.length();
if (len == 0) {
return -1;
}
int ch = s.charAt(0);
// verify that all are the same character
for (int i = 1; i < len; ++i) {
if (s.charAt(i) != ch) {
return -1;
}
}
int bestRow = -1;
for (int i = 0; i < types.length; ++i) {
int[] row = types[i];
if (row[0] != ch) continue;
bestRow = i;
if (row[3] > len) continue;
if (row[row.length-1] < len) continue;
return i;
}
return strict ? -1 : bestRow;
} | [
"private",
"static",
"int",
"getCanonicalIndex",
"(",
"String",
"s",
",",
"boolean",
"strict",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"==",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"int",
"ch",
"=",
... | Get the canonical index, or return -1 if illegal.
@param s
@param strict TODO | [
"Get",
"the",
"canonical",
"index",
"or",
"return",
"-",
"1",
"if",
"illegal",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateTimePatternGenerator.java#L2085-L2107 |
32,965 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java | JavacParser.filterJavaFileObject | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | java | private static JavaFileObject filterJavaFileObject(JavaFileObject fobj) {
String path = fobj.getName();
if (path.endsWith("module-info.java")) {
String pkgName = null;
try {
pkgName = moduleName(fobj.getCharContent(true).toString());
String source = "package " + pkgName + ";";
return new MemoryFileObject(path, JavaFileObject.Kind.SOURCE, source);
} catch (IOException e) {
// Fall-through
}
}
return fobj;
} | [
"private",
"static",
"JavaFileObject",
"filterJavaFileObject",
"(",
"JavaFileObject",
"fobj",
")",
"{",
"String",
"path",
"=",
"fobj",
".",
"getName",
"(",
")",
";",
"if",
"(",
"path",
".",
"endsWith",
"(",
"\"module-info.java\"",
")",
")",
"{",
"String",
"p... | To allow Java 9 libraries like GSON to be transpiled using -source 1.8, stub out
the module-info source. This creates an empty .o file, like package-info.java
files without annotations. Skipping the file isn't feasible because of build tool
output file expectations. | [
"To",
"allow",
"Java",
"9",
"libraries",
"like",
"GSON",
"to",
"be",
"transpiled",
"using",
"-",
"source",
"1",
".",
"8",
"stub",
"out",
"the",
"module",
"-",
"info",
"source",
".",
"This",
"creates",
"an",
"empty",
".",
"o",
"file",
"like",
"package",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L220-L233 |
32,966 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java | JavacParser.createEnvironment | private JavacEnvironment createEnvironment(String path, String source) throws IOException {
List<JavaFileObject> inputFiles = new ArrayList<>();
inputFiles.add(filterJavaFileObject(MemoryFileObject.createJavaFile(path, source)));
return createEnvironment(Collections.emptyList(), inputFiles, false);
} | java | private JavacEnvironment createEnvironment(String path, String source) throws IOException {
List<JavaFileObject> inputFiles = new ArrayList<>();
inputFiles.add(filterJavaFileObject(MemoryFileObject.createJavaFile(path, source)));
return createEnvironment(Collections.emptyList(), inputFiles, false);
} | [
"private",
"JavacEnvironment",
"createEnvironment",
"(",
"String",
"path",
",",
"String",
"source",
")",
"throws",
"IOException",
"{",
"List",
"<",
"JavaFileObject",
">",
"inputFiles",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"inputFiles",
".",
"add",
"("... | Creates a javac environment from a memory source. | [
"Creates",
"a",
"javac",
"environment",
"from",
"a",
"memory",
"source",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L245-L249 |
32,967 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java | JavacParser.packageName | @VisibleForTesting
static String packageName(String source) {
try (StringReader r = new StringReader(source)) {
StreamTokenizer tokenizer = new StreamTokenizer(r);
tokenizer.slashSlashComments(true);
tokenizer.slashStarComments(true);
StringBuilder sb = new StringBuilder();
boolean inName = false;
while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) {
if (inName) {
switch (tokenizer.ttype) {
case ';':
return sb.length() > 0 ? sb.toString() : null;
case '.':
sb.append('.');
break;
case StreamTokenizer.TT_WORD:
sb.append(tokenizer.sval);
break;
default:
inName = false; // Invalid package statement pattern.
break;
}
} else if (tokenizer.ttype == StreamTokenizer.TT_WORD && tokenizer.sval.equals("package")) {
inName = true;
}
}
return null; // Package statement not found.
} catch (IOException e) {
throw new AssertionError("Exception reading string: " + e);
}
} | java | @VisibleForTesting
static String packageName(String source) {
try (StringReader r = new StringReader(source)) {
StreamTokenizer tokenizer = new StreamTokenizer(r);
tokenizer.slashSlashComments(true);
tokenizer.slashStarComments(true);
StringBuilder sb = new StringBuilder();
boolean inName = false;
while (tokenizer.nextToken() != StreamTokenizer.TT_EOF) {
if (inName) {
switch (tokenizer.ttype) {
case ';':
return sb.length() > 0 ? sb.toString() : null;
case '.':
sb.append('.');
break;
case StreamTokenizer.TT_WORD:
sb.append(tokenizer.sval);
break;
default:
inName = false; // Invalid package statement pattern.
break;
}
} else if (tokenizer.ttype == StreamTokenizer.TT_WORD && tokenizer.sval.equals("package")) {
inName = true;
}
}
return null; // Package statement not found.
} catch (IOException e) {
throw new AssertionError("Exception reading string: " + e);
}
} | [
"@",
"VisibleForTesting",
"static",
"String",
"packageName",
"(",
"String",
"source",
")",
"{",
"try",
"(",
"StringReader",
"r",
"=",
"new",
"StringReader",
"(",
"source",
")",
")",
"{",
"StreamTokenizer",
"tokenizer",
"=",
"new",
"StreamTokenizer",
"(",
"r",
... | Extract the name of a Java source's package, or null if not found. This method is only used
before javac parsing to determine the main type name. | [
"Extract",
"the",
"name",
"of",
"a",
"Java",
"source",
"s",
"package",
"or",
"null",
"if",
"not",
"found",
".",
"This",
"method",
"is",
"only",
"used",
"before",
"javac",
"parsing",
"to",
"determine",
"the",
"main",
"type",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/JavacParser.java#L353-L384 |
32,968 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPoint.java | DistributionPoint.encode | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tagged = new DerOutputStream();
// NOTE: only one of pointNames and pointRDN can be set
if ((fullName != null) || (relativeName != null)) {
DerOutputStream distributionPoint = new DerOutputStream();
if (fullName != null) {
DerOutputStream derOut = new DerOutputStream();
fullName.encode(derOut);
distributionPoint.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME),
derOut);
} else if (relativeName != null) {
DerOutputStream derOut = new DerOutputStream();
relativeName.encode(derOut);
distributionPoint.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REL_NAME),
derOut);
}
tagged.write(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_DIST_PT),
distributionPoint);
}
if (reasonFlags != null) {
DerOutputStream reasons = new DerOutputStream();
BitArray rf = new BitArray(reasonFlags);
reasons.putTruncatedUnalignedBitString(rf);
tagged.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_REASONS),
reasons);
}
if (crlIssuer != null) {
DerOutputStream issuer = new DerOutputStream();
crlIssuer.encode(issuer);
tagged.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_ISSUER),
issuer);
}
out.write(DerValue.tag_Sequence, tagged);
} | java | public void encode(DerOutputStream out) throws IOException {
DerOutputStream tagged = new DerOutputStream();
// NOTE: only one of pointNames and pointRDN can be set
if ((fullName != null) || (relativeName != null)) {
DerOutputStream distributionPoint = new DerOutputStream();
if (fullName != null) {
DerOutputStream derOut = new DerOutputStream();
fullName.encode(derOut);
distributionPoint.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME),
derOut);
} else if (relativeName != null) {
DerOutputStream derOut = new DerOutputStream();
relativeName.encode(derOut);
distributionPoint.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_REL_NAME),
derOut);
}
tagged.write(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_DIST_PT),
distributionPoint);
}
if (reasonFlags != null) {
DerOutputStream reasons = new DerOutputStream();
BitArray rf = new BitArray(reasonFlags);
reasons.putTruncatedUnalignedBitString(rf);
tagged.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, false, TAG_REASONS),
reasons);
}
if (crlIssuer != null) {
DerOutputStream issuer = new DerOutputStream();
crlIssuer.encode(issuer);
tagged.writeImplicit(
DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_ISSUER),
issuer);
}
out.write(DerValue.tag_Sequence, tagged);
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerOutputStream",
"tagged",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"// NOTE: only one of pointNames and pointRDN can be set",
"if",
"(",
"(",
"fullName",
"!=",
"null"... | Write the DistributionPoint value to the DerOutputStream.
@param out the DerOutputStream to write the extension to.
@exception IOException on error. | [
"Write",
"the",
"DistributionPoint",
"value",
"to",
"the",
"DerOutputStream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPoint.java#L280-L319 |
32,969 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPoint.java | DistributionPoint.reasonToString | private static String reasonToString(int reason) {
if ((reason > 0) && (reason < REASON_STRINGS.length)) {
return REASON_STRINGS[reason];
}
return "Unknown reason " + reason;
} | java | private static String reasonToString(int reason) {
if ((reason > 0) && (reason < REASON_STRINGS.length)) {
return REASON_STRINGS[reason];
}
return "Unknown reason " + reason;
} | [
"private",
"static",
"String",
"reasonToString",
"(",
"int",
"reason",
")",
"{",
"if",
"(",
"(",
"reason",
">",
"0",
")",
"&&",
"(",
"reason",
"<",
"REASON_STRINGS",
".",
"length",
")",
")",
"{",
"return",
"REASON_STRINGS",
"[",
"reason",
"]",
";",
"}"... | Return a string representation for reasonFlag bit 'reason'. | [
"Return",
"a",
"string",
"representation",
"for",
"reasonFlag",
"bit",
"reason",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPoint.java#L371-L376 |
32,970 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExsltFunction.java | ElemExsltFunction.compose | public void compose(StylesheetRoot sroot) throws TransformerException
{
super.compose(sroot);
// Register the function namespace (if not already registered).
String namespace = getName().getNamespace();
String handlerClass = sroot.getExtensionHandlerClass();
Object[] args ={namespace, sroot};
ExtensionNamespaceSupport extNsSpt =
new ExtensionNamespaceSupport(namespace, handlerClass, args);
sroot.getExtensionNamespacesManager().registerExtension(extNsSpt);
// Make sure there is a handler for the EXSLT functions namespace
// -- for isElementAvailable().
if (!(namespace.equals(Constants.S_EXSLT_FUNCTIONS_URL)))
{
namespace = Constants.S_EXSLT_FUNCTIONS_URL;
args = new Object[]{namespace, sroot};
extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args);
sroot.getExtensionNamespacesManager().registerExtension(extNsSpt);
}
} | java | public void compose(StylesheetRoot sroot) throws TransformerException
{
super.compose(sroot);
// Register the function namespace (if not already registered).
String namespace = getName().getNamespace();
String handlerClass = sroot.getExtensionHandlerClass();
Object[] args ={namespace, sroot};
ExtensionNamespaceSupport extNsSpt =
new ExtensionNamespaceSupport(namespace, handlerClass, args);
sroot.getExtensionNamespacesManager().registerExtension(extNsSpt);
// Make sure there is a handler for the EXSLT functions namespace
// -- for isElementAvailable().
if (!(namespace.equals(Constants.S_EXSLT_FUNCTIONS_URL)))
{
namespace = Constants.S_EXSLT_FUNCTIONS_URL;
args = new Object[]{namespace, sroot};
extNsSpt = new ExtensionNamespaceSupport(namespace, handlerClass, args);
sroot.getExtensionNamespacesManager().registerExtension(extNsSpt);
}
} | [
"public",
"void",
"compose",
"(",
"StylesheetRoot",
"sroot",
")",
"throws",
"TransformerException",
"{",
"super",
".",
"compose",
"(",
"sroot",
")",
";",
"// Register the function namespace (if not already registered).",
"String",
"namespace",
"=",
"getName",
"(",
")",
... | Called after everything else has been
recomposed, and allows the function to set remaining
values that may be based on some other property that
depends on recomposition. | [
"Called",
"after",
"everything",
"else",
"has",
"been",
"recomposed",
"and",
"allows",
"the",
"function",
"to",
"set",
"remaining",
"values",
"that",
"may",
"be",
"based",
"on",
"some",
"other",
"property",
"that",
"depends",
"on",
"recomposition",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExsltFunction.java#L124-L144 |
32,971 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.getContextKey | private static int getContextKey(char c) {
if (c < contexts[ctCache]) {
while (ctCache > 0 && c < contexts[ctCache]) --ctCache;
} else if (c >= contexts[ctCache + 1]) {
while (ctCache < ctCacheLimit && c >= contexts[ctCache + 1]) ++ctCache;
}
// if we're not in a known range, then return EUROPEAN as the range key
return (ctCache & 0x1) == 0 ? (ctCache / 2) : EUROPEAN_KEY;
} | java | private static int getContextKey(char c) {
if (c < contexts[ctCache]) {
while (ctCache > 0 && c < contexts[ctCache]) --ctCache;
} else if (c >= contexts[ctCache + 1]) {
while (ctCache < ctCacheLimit && c >= contexts[ctCache + 1]) ++ctCache;
}
// if we're not in a known range, then return EUROPEAN as the range key
return (ctCache & 0x1) == 0 ? (ctCache / 2) : EUROPEAN_KEY;
} | [
"private",
"static",
"int",
"getContextKey",
"(",
"char",
"c",
")",
"{",
"if",
"(",
"c",
"<",
"contexts",
"[",
"ctCache",
"]",
")",
"{",
"while",
"(",
"ctCache",
">",
"0",
"&&",
"c",
"<",
"contexts",
"[",
"ctCache",
"]",
")",
"--",
"ctCache",
";",
... | warning, synchronize access to this as it modifies state | [
"warning",
"synchronize",
"access",
"to",
"this",
"as",
"it",
"modifies",
"state"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L552-L561 |
32,972 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.shape | public void shape(char[] text, int start, int count) {
checkParams(text, start, count);
if (isContextual()) {
if (rangeSet == null) {
shapeContextually(text, start, count, key);
} else {
shapeContextually(text, start, count, shapingRange);
}
} else {
shapeNonContextually(text, start, count);
}
} | java | public void shape(char[] text, int start, int count) {
checkParams(text, start, count);
if (isContextual()) {
if (rangeSet == null) {
shapeContextually(text, start, count, key);
} else {
shapeContextually(text, start, count, shapingRange);
}
} else {
shapeNonContextually(text, start, count);
}
} | [
"public",
"void",
"shape",
"(",
"char",
"[",
"]",
"text",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"checkParams",
"(",
"text",
",",
"start",
",",
"count",
")",
";",
"if",
"(",
"isContextual",
"(",
")",
")",
"{",
"if",
"(",
"rangeSet",
... | Converts the digits in the text that occur between start and
start + count.
@param text an array of characters to convert
@param start the index into <code>text</code> to start
converting
@param count the number of characters in <code>text</code>
to convert
@throws IndexOutOfBoundsException if start or start + count is
out of bounds
@throws NullPointerException if text is null | [
"Converts",
"the",
"digits",
"in",
"the",
"text",
"that",
"occur",
"between",
"start",
"and",
"start",
"+",
"count",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1100-L1111 |
32,973 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.shape | public void shape(char[] text, int start, int count, int context) {
checkParams(text, start, count);
if (isContextual()) {
int ctxKey = getKeyFromMask(context);
if (rangeSet == null) {
shapeContextually(text, start, count, ctxKey);
} else {
shapeContextually(text, start, count, Range.values()[ctxKey]);
}
} else {
shapeNonContextually(text, start, count);
}
} | java | public void shape(char[] text, int start, int count, int context) {
checkParams(text, start, count);
if (isContextual()) {
int ctxKey = getKeyFromMask(context);
if (rangeSet == null) {
shapeContextually(text, start, count, ctxKey);
} else {
shapeContextually(text, start, count, Range.values()[ctxKey]);
}
} else {
shapeNonContextually(text, start, count);
}
} | [
"public",
"void",
"shape",
"(",
"char",
"[",
"]",
"text",
",",
"int",
"start",
",",
"int",
"count",
",",
"int",
"context",
")",
"{",
"checkParams",
"(",
"text",
",",
"start",
",",
"count",
")",
";",
"if",
"(",
"isContextual",
"(",
")",
")",
"{",
... | Converts the digits in the text that occur between start and
start + count, using the provided context.
Context is ignored if the shaper is not a contextual shaper.
@param text an array of characters
@param start the index into <code>text</code> to start
converting
@param count the number of characters in <code>text</code>
to convert
@param context the context to which to convert the
characters, such as <code>NumericShaper.EUROPEAN</code>
@throws IndexOutOfBoundsException if start or start + count is
out of bounds
@throws NullPointerException if text is null
@throws IllegalArgumentException if this is a contextual shaper
and the specified <code>context</code> is not a single valid
range. | [
"Converts",
"the",
"digits",
"in",
"the",
"text",
"that",
"occur",
"between",
"start",
"and",
"start",
"+",
"count",
"using",
"the",
"provided",
"context",
".",
"Context",
"is",
"ignored",
"if",
"the",
"shaper",
"is",
"not",
"a",
"contextual",
"shaper",
".... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1131-L1143 |
32,974 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.shapeNonContextually | private void shapeNonContextually(char[] text, int start, int count) {
int base;
char minDigit = '0';
if (shapingRange != null) {
base = shapingRange.getDigitBase();
minDigit += shapingRange.getNumericBase();
} else {
base = bases[key];
if (key == ETHIOPIC_KEY) {
minDigit++; // Ethiopic doesn't use decimal zero
}
}
for (int i = start, e = start + count; i < e; ++i) {
char c = text[i];
if (c >= minDigit && c <= '\u0039') {
text[i] = (char)(c + base);
}
}
} | java | private void shapeNonContextually(char[] text, int start, int count) {
int base;
char minDigit = '0';
if (shapingRange != null) {
base = shapingRange.getDigitBase();
minDigit += shapingRange.getNumericBase();
} else {
base = bases[key];
if (key == ETHIOPIC_KEY) {
minDigit++; // Ethiopic doesn't use decimal zero
}
}
for (int i = start, e = start + count; i < e; ++i) {
char c = text[i];
if (c >= minDigit && c <= '\u0039') {
text[i] = (char)(c + base);
}
}
} | [
"private",
"void",
"shapeNonContextually",
"(",
"char",
"[",
"]",
"text",
",",
"int",
"start",
",",
"int",
"count",
")",
"{",
"int",
"base",
";",
"char",
"minDigit",
"=",
"'",
"'",
";",
"if",
"(",
"shapingRange",
"!=",
"null",
")",
"{",
"base",
"=",
... | Perform non-contextual shaping. | [
"Perform",
"non",
"-",
"contextual",
"shaping",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1244-L1262 |
32,975 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.shapeContextually | private synchronized void shapeContextually(char[] text, int start, int count, int ctxKey) {
// if we don't support this context, then don't shape
if ((mask & (1<<ctxKey)) == 0) {
ctxKey = EUROPEAN_KEY;
}
int lastkey = ctxKey;
int base = bases[ctxKey];
char minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0'; // Ethiopic doesn't use decimal zero
synchronized (NumericShaper.class) {
for (int i = start, e = start + count; i < e; ++i) {
char c = text[i];
if (c >= minDigit && c <= '\u0039') {
text[i] = (char)(c + base);
}
if (isStrongDirectional(c)) {
int newkey = getContextKey(c);
if (newkey != lastkey) {
lastkey = newkey;
ctxKey = newkey;
if (((mask & EASTERN_ARABIC) != 0) &&
(ctxKey == ARABIC_KEY ||
ctxKey == EASTERN_ARABIC_KEY)) {
ctxKey = EASTERN_ARABIC_KEY;
} else if (((mask & ARABIC) != 0) &&
(ctxKey == ARABIC_KEY ||
ctxKey == EASTERN_ARABIC_KEY)) {
ctxKey = ARABIC_KEY;
} else if ((mask & (1<<ctxKey)) == 0) {
ctxKey = EUROPEAN_KEY;
}
base = bases[ctxKey];
minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0'; // Ethiopic doesn't use decimal zero
}
}
}
}
} | java | private synchronized void shapeContextually(char[] text, int start, int count, int ctxKey) {
// if we don't support this context, then don't shape
if ((mask & (1<<ctxKey)) == 0) {
ctxKey = EUROPEAN_KEY;
}
int lastkey = ctxKey;
int base = bases[ctxKey];
char minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0'; // Ethiopic doesn't use decimal zero
synchronized (NumericShaper.class) {
for (int i = start, e = start + count; i < e; ++i) {
char c = text[i];
if (c >= minDigit && c <= '\u0039') {
text[i] = (char)(c + base);
}
if (isStrongDirectional(c)) {
int newkey = getContextKey(c);
if (newkey != lastkey) {
lastkey = newkey;
ctxKey = newkey;
if (((mask & EASTERN_ARABIC) != 0) &&
(ctxKey == ARABIC_KEY ||
ctxKey == EASTERN_ARABIC_KEY)) {
ctxKey = EASTERN_ARABIC_KEY;
} else if (((mask & ARABIC) != 0) &&
(ctxKey == ARABIC_KEY ||
ctxKey == EASTERN_ARABIC_KEY)) {
ctxKey = ARABIC_KEY;
} else if ((mask & (1<<ctxKey)) == 0) {
ctxKey = EUROPEAN_KEY;
}
base = bases[ctxKey];
minDigit = ctxKey == ETHIOPIC_KEY ? '1' : '0'; // Ethiopic doesn't use decimal zero
}
}
}
}
} | [
"private",
"synchronized",
"void",
"shapeContextually",
"(",
"char",
"[",
"]",
"text",
",",
"int",
"start",
",",
"int",
"count",
",",
"int",
"ctxKey",
")",
"{",
"// if we don't support this context, then don't shape",
"if",
"(",
"(",
"mask",
"&",
"(",
"1",
"<<... | Perform contextual shaping.
Synchronized to protect caches used in getContextKey. | [
"Perform",
"contextual",
"shaping",
".",
"Synchronized",
"to",
"protect",
"caches",
"used",
"in",
"getContextKey",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1268-L1311 |
32,976 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java | NumericShaper.search | private static int search(int value, int[] array, int start, int length)
{
int power = 1 << getHighBit(length);
int extra = length - power;
int probe = power;
int index = start;
if (value >= array[index + extra]) {
index += extra;
}
while (probe > 1) {
probe >>= 1;
if (value >= array[index + probe]) {
index += probe;
}
}
return index;
} | java | private static int search(int value, int[] array, int start, int length)
{
int power = 1 << getHighBit(length);
int extra = length - power;
int probe = power;
int index = start;
if (value >= array[index + extra]) {
index += extra;
}
while (probe > 1) {
probe >>= 1;
if (value >= array[index + probe]) {
index += probe;
}
}
return index;
} | [
"private",
"static",
"int",
"search",
"(",
"int",
"value",
",",
"int",
"[",
"]",
"array",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"int",
"power",
"=",
"1",
"<<",
"getHighBit",
"(",
"length",
")",
";",
"int",
"extra",
"=",
"length",
"-"... | fast binary search over subrange of array. | [
"fast",
"binary",
"search",
"over",
"subrange",
"of",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/NumericShaper.java#L1481-L1501 |
32,977 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RBBISymbolTable.java | RBBISymbolTable.lookupMatcher | public UnicodeMatcher lookupMatcher(int ch) {
UnicodeSet retVal = null;
if (ch == 0xffff) {
retVal = fCachedSetLookup;
fCachedSetLookup = null;
}
return retVal;
} | java | public UnicodeMatcher lookupMatcher(int ch) {
UnicodeSet retVal = null;
if (ch == 0xffff) {
retVal = fCachedSetLookup;
fCachedSetLookup = null;
}
return retVal;
} | [
"public",
"UnicodeMatcher",
"lookupMatcher",
"(",
"int",
"ch",
")",
"{",
"UnicodeSet",
"retVal",
"=",
"null",
";",
"if",
"(",
"ch",
"==",
"0xffff",
")",
"{",
"retVal",
"=",
"fCachedSetLookup",
";",
"fCachedSetLookup",
"=",
"null",
";",
"}",
"return",
"retV... | and we just need to remember what set to return between these two calls. | [
"and",
"we",
"just",
"need",
"to",
"remember",
"what",
"set",
"to",
"return",
"between",
"these",
"two",
"calls",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RBBISymbolTable.java#L101-L108 |
32,978 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/CertificateFactory.java | CertificateFactory.getInstance | public static final CertificateFactory getInstance(String type)
throws CertificateException {
try {
Instance instance = GetInstance.getInstance("CertificateFactory",
CertificateFactorySpi.class, type);
return new CertificateFactory((CertificateFactorySpi)instance.impl,
instance.provider, type);
} catch (NoSuchAlgorithmException e) {
throw new CertificateException(type + " not found", e);
}
} | java | public static final CertificateFactory getInstance(String type)
throws CertificateException {
try {
Instance instance = GetInstance.getInstance("CertificateFactory",
CertificateFactorySpi.class, type);
return new CertificateFactory((CertificateFactorySpi)instance.impl,
instance.provider, type);
} catch (NoSuchAlgorithmException e) {
throw new CertificateException(type + " not found", e);
}
} | [
"public",
"static",
"final",
"CertificateFactory",
"getInstance",
"(",
"String",
"type",
")",
"throws",
"CertificateException",
"{",
"try",
"{",
"Instance",
"instance",
"=",
"GetInstance",
".",
"getInstance",
"(",
"\"CertificateFactory\"",
",",
"CertificateFactorySpi",
... | Returns a certificate factory object that implements the
specified certificate type.
<p> This method traverses the list of registered security Providers,
starting with the most preferred Provider.
A new CertificateFactory object encapsulating the
CertificateFactorySpi implementation from the first
Provider that supports the specified type is returned.
<p> Note that the list of registered providers may be retrieved via
the {@link Security#getProviders() Security.getProviders()} method.
@param type the name of the requested certificate type.
See the CertificateFactory section in the <a href=
"{@docRoot}openjdk-redirect.html?v=8&path=/technotes/guides/security/StandardNames.html#CertificateFactory">
Java Cryptography Architecture Standard Algorithm Name Documentation</a>
for information about standard certificate types.
@return a certificate factory object for the specified type.
@exception CertificateException if no Provider supports a
CertificateFactorySpi implementation for the
specified type.
@see java.security.Provider | [
"Returns",
"a",
"certificate",
"factory",
"object",
"that",
"implements",
"the",
"specified",
"certificate",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/CertificateFactory.java#L203-L213 |
32,979 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java | TaskQueue.add | void add(TimerTask task) {
// Grow backing store if necessary
if (size + 1 == queue.length)
queue = Arrays.copyOf(queue, 2*queue.length);
queue[++size] = task;
fixUp(size);
} | java | void add(TimerTask task) {
// Grow backing store if necessary
if (size + 1 == queue.length)
queue = Arrays.copyOf(queue, 2*queue.length);
queue[++size] = task;
fixUp(size);
} | [
"void",
"add",
"(",
"TimerTask",
"task",
")",
"{",
"// Grow backing store if necessary",
"if",
"(",
"size",
"+",
"1",
"==",
"queue",
".",
"length",
")",
"queue",
"=",
"Arrays",
".",
"copyOf",
"(",
"queue",
",",
"2",
"*",
"queue",
".",
"length",
")",
";... | Adds a new task to the priority queue. | [
"Adds",
"a",
"new",
"task",
"to",
"the",
"priority",
"queue",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java#L598-L605 |
32,980 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java | TaskQueue.quickRemove | void quickRemove(int i) {
assert i <= size;
queue[i] = queue[size];
queue[size--] = null; // Drop extra ref to prevent memory leak
} | java | void quickRemove(int i) {
assert i <= size;
queue[i] = queue[size];
queue[size--] = null; // Drop extra ref to prevent memory leak
} | [
"void",
"quickRemove",
"(",
"int",
"i",
")",
"{",
"assert",
"i",
"<=",
"size",
";",
"queue",
"[",
"i",
"]",
"=",
"queue",
"[",
"size",
"]",
";",
"queue",
"[",
"size",
"--",
"]",
"=",
"null",
";",
"// Drop extra ref to prevent memory leak",
"}"
] | Removes the ith element from queue without regard for maintaining
the heap invariant. Recall that queue is one-based, so
1 <= i <= size. | [
"Removes",
"the",
"ith",
"element",
"from",
"queue",
"without",
"regard",
"for",
"maintaining",
"the",
"heap",
"invariant",
".",
"Recall",
"that",
"queue",
"is",
"one",
"-",
"based",
"so",
"1",
"<",
"=",
"i",
"<",
"=",
"size",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Timer.java#L638-L643 |
32,981 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.setID | public void setID(String ID) {
if (ID == null) {
throw new NullPointerException();
}
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen TimeZone instance.");
}
this.ID = ID;
} | java | public void setID(String ID) {
if (ID == null) {
throw new NullPointerException();
}
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify a frozen TimeZone instance.");
}
this.ID = ID;
} | [
"public",
"void",
"setID",
"(",
"String",
"ID",
")",
"{",
"if",
"(",
"ID",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"... | Sets the time zone ID. This does not change any other data in
the time zone object.
@param ID the new time zone ID. | [
"Sets",
"the",
"time",
"zone",
"ID",
".",
"This",
"does",
"not",
"change",
"any",
"other",
"data",
"in",
"the",
"time",
"zone",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L355-L363 |
32,982 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getDisplayName | public final String getDisplayName(Locale locale) {
return _getDisplayName(LONG_GENERIC, false, ULocale.forLocale(locale));
} | java | public final String getDisplayName(Locale locale) {
return _getDisplayName(LONG_GENERIC, false, ULocale.forLocale(locale));
} | [
"public",
"final",
"String",
"getDisplayName",
"(",
"Locale",
"locale",
")",
"{",
"return",
"_getDisplayName",
"(",
"LONG_GENERIC",
",",
"false",
",",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
")",
";",
"}"
] | Returns a name of this time zone suitable for presentation to the user
in the specified locale.
This method returns the long generic name.
If the display name is not available for the locale,
a fallback based on the country, city, or time zone id will be used.
@param locale the locale in which to supply the display name.
@return the human-readable name of this time zone in the given locale
or in the default locale if the given locale is not recognized. | [
"Returns",
"a",
"name",
"of",
"this",
"time",
"zone",
"suitable",
"for",
"presentation",
"to",
"the",
"user",
"in",
"the",
"specified",
"locale",
".",
"This",
"method",
"returns",
"the",
"long",
"generic",
"name",
".",
"If",
"the",
"display",
"name",
"is",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L388-L390 |
32,983 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.getFrozenICUTimeZone | static BasicTimeZone getFrozenICUTimeZone(String id, boolean trySystem) {
BasicTimeZone result = null;
if (trySystem) {
result = ZoneMeta.getSystemTimeZone(id);
}
if (result == null) {
result = ZoneMeta.getCustomTimeZone(id);
}
return result;
} | java | static BasicTimeZone getFrozenICUTimeZone(String id, boolean trySystem) {
BasicTimeZone result = null;
if (trySystem) {
result = ZoneMeta.getSystemTimeZone(id);
}
if (result == null) {
result = ZoneMeta.getCustomTimeZone(id);
}
return result;
} | [
"static",
"BasicTimeZone",
"getFrozenICUTimeZone",
"(",
"String",
"id",
",",
"boolean",
"trySystem",
")",
"{",
"BasicTimeZone",
"result",
"=",
"null",
";",
"if",
"(",
"trySystem",
")",
"{",
"result",
"=",
"ZoneMeta",
".",
"getSystemTimeZone",
"(",
"id",
")",
... | Returns a frozen ICU type TimeZone object given a time zone ID.
@param id the time zone ID
@param trySystem if true tries the system time zones first otherwise skip to the
custom time zones.
@return the frozen ICU TimeZone or null if one could not be created. | [
"Returns",
"a",
"frozen",
"ICU",
"type",
"TimeZone",
"object",
"given",
"a",
"time",
"zone",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L708-L717 |
32,984 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java | TimeZone.hasSameRules | public boolean hasSameRules(TimeZone other) {
return other != null &&
getRawOffset() == other.getRawOffset() &&
useDaylightTime() == other.useDaylightTime();
} | java | public boolean hasSameRules(TimeZone other) {
return other != null &&
getRawOffset() == other.getRawOffset() &&
useDaylightTime() == other.useDaylightTime();
} | [
"public",
"boolean",
"hasSameRules",
"(",
"TimeZone",
"other",
")",
"{",
"return",
"other",
"!=",
"null",
"&&",
"getRawOffset",
"(",
")",
"==",
"other",
".",
"getRawOffset",
"(",
")",
"&&",
"useDaylightTime",
"(",
")",
"==",
"other",
".",
"useDaylightTime",
... | Returns true if this zone has the same rule and offset as another zone.
That is, if this zone differs only in ID, if at all. Returns false
if the other zone is null.
@param other the <code>TimeZone</code> object to be compared with
@return true if the other zone is not null and is the same as this one,
with the possible exception of the ID | [
"Returns",
"true",
"if",
"this",
"zone",
"has",
"the",
"same",
"rule",
"and",
"offset",
"as",
"another",
"zone",
".",
"That",
"is",
"if",
"this",
"zone",
"differs",
"only",
"in",
"ID",
"if",
"at",
"all",
".",
"Returns",
"false",
"if",
"the",
"other",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/TimeZone.java#L952-L956 |
32,985 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/AdaptableX509CertSelector.java | AdaptableX509CertSelector.parseAuthorityKeyIdentifierExtension | void parseAuthorityKeyIdentifierExtension(
AuthorityKeyIdentifierExtension akidext) throws IOException {
if (akidext != null) {
KeyIdentifier akid = (KeyIdentifier)akidext.get(
AuthorityKeyIdentifierExtension.KEY_ID);
if (akid != null) {
// Do not override the previous setting for initial selection.
if (isSKIDSensitive || getSubjectKeyIdentifier() == null) {
DerOutputStream derout = new DerOutputStream();
derout.putOctetString(akid.getIdentifier());
super.setSubjectKeyIdentifier(derout.toByteArray());
isSKIDSensitive = true;
}
}
SerialNumber asn = (SerialNumber)akidext.get(
AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
if (asn != null) {
// Do not override the previous setting for initial selection.
if (isSNSensitive || getSerialNumber() == null) {
super.setSerialNumber(asn.getNumber());
isSNSensitive = true;
}
}
// the subject criterion should be set by the caller.
}
} | java | void parseAuthorityKeyIdentifierExtension(
AuthorityKeyIdentifierExtension akidext) throws IOException {
if (akidext != null) {
KeyIdentifier akid = (KeyIdentifier)akidext.get(
AuthorityKeyIdentifierExtension.KEY_ID);
if (akid != null) {
// Do not override the previous setting for initial selection.
if (isSKIDSensitive || getSubjectKeyIdentifier() == null) {
DerOutputStream derout = new DerOutputStream();
derout.putOctetString(akid.getIdentifier());
super.setSubjectKeyIdentifier(derout.toByteArray());
isSKIDSensitive = true;
}
}
SerialNumber asn = (SerialNumber)akidext.get(
AuthorityKeyIdentifierExtension.SERIAL_NUMBER);
if (asn != null) {
// Do not override the previous setting for initial selection.
if (isSNSensitive || getSerialNumber() == null) {
super.setSerialNumber(asn.getNumber());
isSNSensitive = true;
}
}
// the subject criterion should be set by the caller.
}
} | [
"void",
"parseAuthorityKeyIdentifierExtension",
"(",
"AuthorityKeyIdentifierExtension",
"akidext",
")",
"throws",
"IOException",
"{",
"if",
"(",
"akidext",
"!=",
"null",
")",
"{",
"KeyIdentifier",
"akid",
"=",
"(",
"KeyIdentifier",
")",
"akidext",
".",
"get",
"(",
... | Parse the authority key identifier extension.
If the keyIdentifier field of the extension is non-null, set the
subjectKeyIdentifier criterion. If the authorityCertSerialNumber
field is non-null, set the serialNumber criterion.
Note that we will not set the subject criterion according to the
authorityCertIssuer field of the extension. The caller MUST set
the subject criterion before call match().
@param akidext the authorityKeyIdentifier extension | [
"Parse",
"the",
"authority",
"key",
"identifier",
"extension",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/AdaptableX509CertSelector.java#L101-L129 |
32,986 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java | InetAddress.getHostName | public String getHostName() {
if (holder().getHostName() == null) {
holder().hostName = InetAddress.getHostFromNameService(this);
}
return holder().getHostName();
} | java | public String getHostName() {
if (holder().getHostName() == null) {
holder().hostName = InetAddress.getHostFromNameService(this);
}
return holder().getHostName();
} | [
"public",
"String",
"getHostName",
"(",
")",
"{",
"if",
"(",
"holder",
"(",
")",
".",
"getHostName",
"(",
")",
"==",
"null",
")",
"{",
"holder",
"(",
")",
".",
"hostName",
"=",
"InetAddress",
".",
"getHostFromNameService",
"(",
"this",
")",
";",
"}",
... | Gets the host name for this IP address.
<p>If this InetAddress was created with a host name,
this host name will be remembered and returned;
otherwise, a reverse name lookup will be performed
and the result will be returned based on the system
configured name lookup service. If a lookup of the name service
is required, call
{@link #getCanonicalHostName() getCanonicalHostName}.
<p>If there is a security manager, its
<code>checkConnect</code> method is first called
with the hostname and <code>-1</code>
as its arguments to see if the operation is allowed.
If the operation is not allowed, it will return
the textual representation of the IP address.
@return the host name for this IP address, or if the operation
is not allowed by the security check, the textual
representation of the IP address.
@see InetAddress#getCanonicalHostName
@see SecurityManager#checkConnect | [
"Gets",
"the",
"host",
"name",
"for",
"this",
"IP",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java#L481-L486 |
32,987 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java | InetAddress.getHostFromNameService | private static String getHostFromNameService(InetAddress addr) {
String host = null;
try {
// first lookup the hostname
host = nameService.getHostByAddr(addr.getAddress());
/* now get all the IP addresses for this hostname,
* and make sure one of them matches the original IP
* address. We do this to try and prevent spoofing.
*/
InetAddress[] arr = nameService.lookupAllHostAddr(host, NETID_UNSET);
boolean ok = false;
if (arr != null) {
for(int i = 0; !ok && i < arr.length; i++) {
ok = addr.equals(arr[i]);
}
}
//XXX: if it looks a spoof just return the address?
if (!ok) {
host = addr.getHostAddress();
return host;
}
} catch (UnknownHostException e) {
host = addr.getHostAddress();
}
return host;
} | java | private static String getHostFromNameService(InetAddress addr) {
String host = null;
try {
// first lookup the hostname
host = nameService.getHostByAddr(addr.getAddress());
/* now get all the IP addresses for this hostname,
* and make sure one of them matches the original IP
* address. We do this to try and prevent spoofing.
*/
InetAddress[] arr = nameService.lookupAllHostAddr(host, NETID_UNSET);
boolean ok = false;
if (arr != null) {
for(int i = 0; !ok && i < arr.length; i++) {
ok = addr.equals(arr[i]);
}
}
//XXX: if it looks a spoof just return the address?
if (!ok) {
host = addr.getHostAddress();
return host;
}
} catch (UnknownHostException e) {
host = addr.getHostAddress();
}
return host;
} | [
"private",
"static",
"String",
"getHostFromNameService",
"(",
"InetAddress",
"addr",
")",
"{",
"String",
"host",
"=",
"null",
";",
"try",
"{",
"// first lookup the hostname",
"host",
"=",
"nameService",
".",
"getHostByAddr",
"(",
"addr",
".",
"getAddress",
"(",
... | Returns the hostname for this address.
<p>If there is a security manager, this method first
calls its <code>checkConnect</code> method
with the hostname and <code>-1</code>
as its arguments to see if the calling code is allowed to know
the hostname for this IP address, i.e., to connect to the host.
If the operation is not allowed, it will return
the textual representation of the IP address.
@return the host name for this IP address, or if the operation
is not allowed by the security check, the textual
representation of the IP address.
@see SecurityManager#checkConnect | [
"Returns",
"the",
"hostname",
"for",
"this",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java#L533-L562 |
32,988 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java | InetAddress.getByAddress | public static InetAddress getByAddress(String host, byte[] addr, int scopeId)
throws UnknownHostException {
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
if (addr.length == Inet4Address.INADDRSZ) {
return new Inet4Address(host, addr);
} else if (addr.length == Inet6Address.INADDRSZ) {
byte[] newAddr
= IPAddressUtil.convertFromIPv4MappedAddress(addr);
if (newAddr != null) {
return new Inet4Address(host, newAddr);
} else {
return new Inet6Address(host, addr, scopeId);
}
}
}
throw new UnknownHostException("addr is of illegal length");
} | java | public static InetAddress getByAddress(String host, byte[] addr, int scopeId)
throws UnknownHostException {
if (host != null && host.length() > 0 && host.charAt(0) == '[') {
if (host.charAt(host.length()-1) == ']') {
host = host.substring(1, host.length() -1);
}
}
if (addr != null) {
if (addr.length == Inet4Address.INADDRSZ) {
return new Inet4Address(host, addr);
} else if (addr.length == Inet6Address.INADDRSZ) {
byte[] newAddr
= IPAddressUtil.convertFromIPv4MappedAddress(addr);
if (newAddr != null) {
return new Inet4Address(host, newAddr);
} else {
return new Inet6Address(host, addr, scopeId);
}
}
}
throw new UnknownHostException("addr is of illegal length");
} | [
"public",
"static",
"InetAddress",
"getByAddress",
"(",
"String",
"host",
",",
"byte",
"[",
"]",
"addr",
",",
"int",
"scopeId",
")",
"throws",
"UnknownHostException",
"{",
"if",
"(",
"host",
"!=",
"null",
"&&",
"host",
".",
"length",
"(",
")",
">",
"0",
... | Do not delete. Called from native code. | [
"Do",
"not",
"delete",
".",
"Called",
"from",
"native",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java#L657-L678 |
32,989 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java | InetAddress.getAllByName | public static InetAddress[] getAllByName(String host)
throws UnknownHostException {
return impl.lookupAllHostAddr(host, NETID_UNSET).clone();
} | java | public static InetAddress[] getAllByName(String host)
throws UnknownHostException {
return impl.lookupAllHostAddr(host, NETID_UNSET).clone();
} | [
"public",
"static",
"InetAddress",
"[",
"]",
"getAllByName",
"(",
"String",
"host",
")",
"throws",
"UnknownHostException",
"{",
"return",
"impl",
".",
"lookupAllHostAddr",
"(",
"host",
",",
"NETID_UNSET",
")",
".",
"clone",
"(",
")",
";",
"}"
] | Given the name of a host, returns an array of its IP addresses,
based on the configured name service on the system.
<p> The host name can either be a machine name, such as
"<code>java.sun.com</code>", or a textual representation of its IP
address. If a literal IP address is supplied, only the
validity of the address format is checked.
<p> For <code>host</code> specified in <i>literal IPv6 address</i>,
either the form defined in RFC 2732 or the literal IPv6 address
format defined in RFC 2373 is accepted. A literal IPv6 address may
also be qualified by appending a scoped zone identifier or scope_id.
The syntax and usage of scope_ids is described
<a href="Inet6Address.html#scoped">here</a>.
<p> If the host is <tt>null</tt> then an <tt>InetAddress</tt>
representing an address of the loopback interface is returned.
See <a href="http://www.ietf.org/rfc/rfc3330.txt">RFC 3330</a>
section 2 and <a href="http://www.ietf.org/rfc/rfc2373.txt">RFC 2373</a>
section 2.5.3. </p>
<p> If there is a security manager and <code>host</code> is not
null and <code>host.length() </code> is not equal to zero, the
security manager's
<code>checkConnect</code> method is called
with the hostname and <code>-1</code>
as its arguments to see if the operation is allowed.
@param host the name of the host, or <code>null</code>.
@return an array of all the IP addresses for a given host name.
@exception UnknownHostException if no IP address for the
<code>host</code> could be found, or if a scope_id was specified
for a global IPv6 address.
@exception SecurityException if a security manager exists and its
<code>checkConnect</code> method doesn't allow the operation.
@see SecurityManager#checkConnect | [
"Given",
"the",
"name",
"of",
"a",
"host",
"returns",
"an",
"array",
"of",
"its",
"IP",
"addresses",
"based",
"on",
"the",
"configured",
"name",
"service",
"on",
"the",
"system",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InetAddress.java#L753-L756 |
32,990 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java | Manifest.write | public void write(OutputStream out) throws IOException {
DataOutputStream dos = new DataOutputStream(out);
// Write out the main attributes for the manifest
attr.writeMain(dos);
// Now write out the pre-entry attributes
Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Attributes> e = it.next();
StringBuffer buffer = new StringBuffer("Name: ");
String value = e.getKey();
if (value != null) {
byte[] vb = value.getBytes("UTF8");
value = new String(vb, 0, 0, vb.length);
}
buffer.append(value);
buffer.append("\r\n");
make72Safe(buffer);
dos.writeBytes(buffer.toString());
e.getValue().write(dos);
}
dos.flush();
} | java | public void write(OutputStream out) throws IOException {
DataOutputStream dos = new DataOutputStream(out);
// Write out the main attributes for the manifest
attr.writeMain(dos);
// Now write out the pre-entry attributes
Iterator<Map.Entry<String, Attributes>> it = entries.entrySet().iterator();
while (it.hasNext()) {
Map.Entry<String, Attributes> e = it.next();
StringBuffer buffer = new StringBuffer("Name: ");
String value = e.getKey();
if (value != null) {
byte[] vb = value.getBytes("UTF8");
value = new String(vb, 0, 0, vb.length);
}
buffer.append(value);
buffer.append("\r\n");
make72Safe(buffer);
dos.writeBytes(buffer.toString());
e.getValue().write(dos);
}
dos.flush();
} | [
"public",
"void",
"write",
"(",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DataOutputStream",
"dos",
"=",
"new",
"DataOutputStream",
"(",
"out",
")",
";",
"// Write out the main attributes for the manifest",
"attr",
".",
"writeMain",
"(",
"dos",
")",... | Writes the Manifest to the specified OutputStream.
Attributes.Name.MANIFEST_VERSION must be set in
MainAttributes prior to invoking this method.
@param out the output stream
@exception IOException if an I/O error has occurred
@see #getMainAttributes | [
"Writes",
"the",
"Manifest",
"to",
"the",
"specified",
"OutputStream",
".",
"Attributes",
".",
"Name",
".",
"MANIFEST_VERSION",
"must",
"be",
"set",
"in",
"MainAttributes",
"prior",
"to",
"invoking",
"this",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java#L146-L167 |
32,991 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java | Manifest.make72Safe | static void make72Safe(StringBuffer line) {
int length = line.length();
if (length > 72) {
int index = 70;
while (index < length - 2) {
line.insert(index, "\r\n ");
index += 72;
length += 3;
}
}
return;
} | java | static void make72Safe(StringBuffer line) {
int length = line.length();
if (length > 72) {
int index = 70;
while (index < length - 2) {
line.insert(index, "\r\n ");
index += 72;
length += 3;
}
}
return;
} | [
"static",
"void",
"make72Safe",
"(",
"StringBuffer",
"line",
")",
"{",
"int",
"length",
"=",
"line",
".",
"length",
"(",
")",
";",
"if",
"(",
"length",
">",
"72",
")",
"{",
"int",
"index",
"=",
"70",
";",
"while",
"(",
"index",
"<",
"length",
"-",
... | Adds line breaks to enforce a maximum 72 bytes per line. | [
"Adds",
"line",
"breaks",
"to",
"enforce",
"a",
"maximum",
"72",
"bytes",
"per",
"line",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java#L172-L183 |
32,992 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java | Manifest.read | public void read(InputStream is) throws IOException {
// Buffered input stream for reading manifest data
FastInputStream fis = new FastInputStream(is);
// Line buffer
byte[] lbuf = new byte[512];
// Read the main attributes for the manifest
attr.read(fis, lbuf);
// Total number of entries, attributes read
int ecount = 0, acount = 0;
// Average size of entry attributes
int asize = 2;
// Now parse the manifest entries
int len;
String name = null;
boolean skipEmptyLines = true;
byte[] lastline = null;
while ((len = fis.readLine(lbuf)) != -1) {
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
if (len > 0 && lbuf[len-1] == '\r') {
--len;
}
if (len == 0 && skipEmptyLines) {
continue;
}
skipEmptyLines = false;
if (name == null) {
name = parseName(lbuf, len);
if (name == null) {
throw new IOException("invalid manifest format");
}
if (fis.peek() == ' ') {
// name is wrapped
lastline = new byte[len - 6];
System.arraycopy(lbuf, 6, lastline, 0, len - 6);
continue;
}
} else {
// continuation line
byte[] buf = new byte[lastline.length + len - 1];
System.arraycopy(lastline, 0, buf, 0, lastline.length);
System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
if (fis.peek() == ' ') {
// name is wrapped
lastline = buf;
continue;
}
name = new String(buf, 0, buf.length, "UTF8");
lastline = null;
}
Attributes attr = getAttributes(name);
if (attr == null) {
attr = new Attributes(asize);
entries.put(name, attr);
}
attr.read(fis, lbuf);
ecount++;
acount += attr.size();
//XXX: Fix for when the average is 0. When it is 0,
// you get an Attributes object with an initial
// capacity of 0, which tickles a bug in HashMap.
asize = Math.max(2, acount / ecount);
name = null;
skipEmptyLines = true;
}
} | java | public void read(InputStream is) throws IOException {
// Buffered input stream for reading manifest data
FastInputStream fis = new FastInputStream(is);
// Line buffer
byte[] lbuf = new byte[512];
// Read the main attributes for the manifest
attr.read(fis, lbuf);
// Total number of entries, attributes read
int ecount = 0, acount = 0;
// Average size of entry attributes
int asize = 2;
// Now parse the manifest entries
int len;
String name = null;
boolean skipEmptyLines = true;
byte[] lastline = null;
while ((len = fis.readLine(lbuf)) != -1) {
if (lbuf[--len] != '\n') {
throw new IOException("manifest line too long");
}
if (len > 0 && lbuf[len-1] == '\r') {
--len;
}
if (len == 0 && skipEmptyLines) {
continue;
}
skipEmptyLines = false;
if (name == null) {
name = parseName(lbuf, len);
if (name == null) {
throw new IOException("invalid manifest format");
}
if (fis.peek() == ' ') {
// name is wrapped
lastline = new byte[len - 6];
System.arraycopy(lbuf, 6, lastline, 0, len - 6);
continue;
}
} else {
// continuation line
byte[] buf = new byte[lastline.length + len - 1];
System.arraycopy(lastline, 0, buf, 0, lastline.length);
System.arraycopy(lbuf, 1, buf, lastline.length, len - 1);
if (fis.peek() == ' ') {
// name is wrapped
lastline = buf;
continue;
}
name = new String(buf, 0, buf.length, "UTF8");
lastline = null;
}
Attributes attr = getAttributes(name);
if (attr == null) {
attr = new Attributes(asize);
entries.put(name, attr);
}
attr.read(fis, lbuf);
ecount++;
acount += attr.size();
//XXX: Fix for when the average is 0. When it is 0,
// you get an Attributes object with an initial
// capacity of 0, which tickles a bug in HashMap.
asize = Math.max(2, acount / ecount);
name = null;
skipEmptyLines = true;
}
} | [
"public",
"void",
"read",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"// Buffered input stream for reading manifest data",
"FastInputStream",
"fis",
"=",
"new",
"FastInputStream",
"(",
"is",
")",
";",
"// Line buffer",
"byte",
"[",
"]",
"lbuf",
"="... | Reads the Manifest from the specified InputStream. The entry
names and attributes read will be merged in with the current
manifest entries.
@param is the input stream
@exception IOException if an I/O error has occurred | [
"Reads",
"the",
"Manifest",
"from",
"the",
"specified",
"InputStream",
".",
"The",
"entry",
"names",
"and",
"attributes",
"read",
"will",
"be",
"merged",
"in",
"with",
"the",
"current",
"manifest",
"entries",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/Manifest.java#L193-L262 |
32,993 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java | EnumMap.isValidKey | private boolean isValidKey(Object key) {
if (key == null)
return false;
// Cheaper than instanceof Enum followed by getDeclaringClass
Class<?> keyClass = key.getClass();
return keyClass == keyType || keyClass.getSuperclass() == keyType;
} | java | private boolean isValidKey(Object key) {
if (key == null)
return false;
// Cheaper than instanceof Enum followed by getDeclaringClass
Class<?> keyClass = key.getClass();
return keyClass == keyType || keyClass.getSuperclass() == keyType;
} | [
"private",
"boolean",
"isValidKey",
"(",
"Object",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"null",
")",
"return",
"false",
";",
"// Cheaper than instanceof Enum followed by getDeclaringClass",
"Class",
"<",
"?",
">",
"keyClass",
"=",
"key",
".",
"getClass",
"("... | Returns true if key is of the proper type to be a key in this
enum map. | [
"Returns",
"true",
"if",
"key",
"is",
"of",
"the",
"proper",
"type",
"to",
"be",
"a",
"key",
"in",
"this",
"enum",
"map",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java#L324-L331 |
32,994 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java | EnumMap.getKeyUniverse | private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
// Android-changed: Use JavaLangAccess directly instead of going through
// SharedSecrets.
return JavaLangAccess.getEnumConstantsShared(keyType);
} | java | private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
// Android-changed: Use JavaLangAccess directly instead of going through
// SharedSecrets.
return JavaLangAccess.getEnumConstantsShared(keyType);
} | [
"private",
"static",
"<",
"K",
"extends",
"Enum",
"<",
"K",
">",
">",
"K",
"[",
"]",
"getKeyUniverse",
"(",
"Class",
"<",
"K",
">",
"keyType",
")",
"{",
"// Android-changed: Use JavaLangAccess directly instead of going through",
"// SharedSecrets.",
"return",
"JavaL... | Returns all of the values comprising K.
The result is uncloned, cached, and shared by all callers. | [
"Returns",
"all",
"of",
"the",
"values",
"comprising",
"K",
".",
"The",
"result",
"is",
"uncloned",
"cached",
"and",
"shared",
"by",
"all",
"callers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/EnumMap.java#L774-L778 |
32,995 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getVariableShortName | public String getVariableShortName(VariableElement var) {
String baseName = getVariableBaseName(var);
if (var.getKind().isField() && !ElementUtil.isGlobalVar(var)) {
return baseName + '_';
}
return baseName;
} | java | public String getVariableShortName(VariableElement var) {
String baseName = getVariableBaseName(var);
if (var.getKind().isField() && !ElementUtil.isGlobalVar(var)) {
return baseName + '_';
}
return baseName;
} | [
"public",
"String",
"getVariableShortName",
"(",
"VariableElement",
"var",
")",
"{",
"String",
"baseName",
"=",
"getVariableBaseName",
"(",
"var",
")",
";",
"if",
"(",
"var",
".",
"getKind",
"(",
")",
".",
"isField",
"(",
")",
"&&",
"!",
"ElementUtil",
"."... | Gets the non-qualified variable name, with underscore suffix. | [
"Gets",
"the",
"non",
"-",
"qualified",
"variable",
"name",
"with",
"underscore",
"suffix",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L214-L220 |
32,996 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getVariableQualifiedName | public String getVariableQualifiedName(VariableElement var) {
String shortName = getVariableShortName(var);
if (ElementUtil.isGlobalVar(var)) {
String className = getFullName(ElementUtil.getDeclaringClass(var));
if (ElementUtil.isEnumConstant(var)) {
// Enums are declared in an array, so we use a macro to shorten the
// array access expression.
return "JreEnum(" + className + ", " + shortName + ")";
}
return className + '_' + shortName;
}
return shortName;
} | java | public String getVariableQualifiedName(VariableElement var) {
String shortName = getVariableShortName(var);
if (ElementUtil.isGlobalVar(var)) {
String className = getFullName(ElementUtil.getDeclaringClass(var));
if (ElementUtil.isEnumConstant(var)) {
// Enums are declared in an array, so we use a macro to shorten the
// array access expression.
return "JreEnum(" + className + ", " + shortName + ")";
}
return className + '_' + shortName;
}
return shortName;
} | [
"public",
"String",
"getVariableQualifiedName",
"(",
"VariableElement",
"var",
")",
"{",
"String",
"shortName",
"=",
"getVariableShortName",
"(",
"var",
")",
";",
"if",
"(",
"ElementUtil",
".",
"isGlobalVar",
"(",
"var",
")",
")",
"{",
"String",
"className",
"... | Gets the name of the variable as it is declared in ObjC, fully qualified. | [
"Gets",
"the",
"name",
"of",
"the",
"variable",
"as",
"it",
"is",
"declared",
"in",
"ObjC",
"fully",
"qualified",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L225-L237 |
32,997 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.camelCaseQualifiedName | public static String camelCaseQualifiedName(String fqn) {
StringBuilder sb = new StringBuilder();
for (String part : fqn.split("\\.")) {
sb.append(capitalize(part));
}
return sb.toString();
} | java | public static String camelCaseQualifiedName(String fqn) {
StringBuilder sb = new StringBuilder();
for (String part : fqn.split("\\.")) {
sb.append(capitalize(part));
}
return sb.toString();
} | [
"public",
"static",
"String",
"camelCaseQualifiedName",
"(",
"String",
"fqn",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"part",
":",
"fqn",
".",
"split",
"(",
"\"\\\\.\"",
")",
")",
"{",
"sb",
".",... | Given a period-separated name, return as a camel-cased type name. For
example, java.util.logging.Level is returned as JavaUtilLoggingLevel. | [
"Given",
"a",
"period",
"-",
"separated",
"name",
"return",
"as",
"a",
"camel",
"-",
"cased",
"type",
"name",
".",
"For",
"example",
"java",
".",
"util",
".",
"logging",
".",
"Level",
"is",
"returned",
"as",
"JavaUtilLoggingLevel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L257-L263 |
32,998 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.camelCasePath | public static String camelCasePath(String fqn) {
StringBuilder sb = new StringBuilder();
for (String part : fqn.split(Pattern.quote(File.separator))) {
sb.append(capitalize(part));
}
return sb.toString();
} | java | public static String camelCasePath(String fqn) {
StringBuilder sb = new StringBuilder();
for (String part : fqn.split(Pattern.quote(File.separator))) {
sb.append(capitalize(part));
}
return sb.toString();
} | [
"public",
"static",
"String",
"camelCasePath",
"(",
"String",
"fqn",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"String",
"part",
":",
"fqn",
".",
"split",
"(",
"Pattern",
".",
"quote",
"(",
"File",
".",
"s... | Given a path, return as a camel-cased name. Used, for example, in header guards. | [
"Given",
"a",
"path",
"return",
"as",
"a",
"camel",
"-",
"cased",
"name",
".",
"Used",
"for",
"example",
"in",
"header",
"guards",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L268-L274 |
32,999 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getFullFunctionName | public String getFullFunctionName(ExecutableElement method) {
return getFullName(ElementUtil.getDeclaringClass(method)) + '_' + getFunctionName(method);
} | java | public String getFullFunctionName(ExecutableElement method) {
return getFullName(ElementUtil.getDeclaringClass(method)) + '_' + getFunctionName(method);
} | [
"public",
"String",
"getFullFunctionName",
"(",
"ExecutableElement",
"method",
")",
"{",
"return",
"getFullName",
"(",
"ElementUtil",
".",
"getDeclaringClass",
"(",
"method",
")",
")",
"+",
"'",
"'",
"+",
"getFunctionName",
"(",
"method",
")",
";",
"}"
] | Returns a "Type_method" function name for static methods, such as from
enum types. A combination of classname plus modified selector is
guaranteed to be unique within the app. | [
"Returns",
"a",
"Type_method",
"function",
"name",
"for",
"static",
"methods",
"such",
"as",
"from",
"enum",
"types",
".",
"A",
"combination",
"of",
"classname",
"plus",
"modified",
"selector",
"is",
"guaranteed",
"to",
"be",
"unique",
"within",
"the",
"app",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L413-L415 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.