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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
35,400 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactByteArray.java | CompactByteArray.expand | private void expand()
{
int i;
if (isCompact) {
byte[] tempArray;
hashes = new int[INDEXCOUNT];
tempArray = new byte[UNICODECOUNT];
for (i = 0; i < UNICODECOUNT; ++i) {
byte value = elementAt((char)i);
tempArray[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
for (i = 0; i < INDEXCOUNT; ++i) {
indices[i] = (char)(i<<BLOCKSHIFT);
}
values = null;
values = tempArray;
isCompact = false;
}
} | java | private void expand()
{
int i;
if (isCompact) {
byte[] tempArray;
hashes = new int[INDEXCOUNT];
tempArray = new byte[UNICODECOUNT];
for (i = 0; i < UNICODECOUNT; ++i) {
byte value = elementAt((char)i);
tempArray[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
for (i = 0; i < INDEXCOUNT; ++i) {
indices[i] = (char)(i<<BLOCKSHIFT);
}
values = null;
values = tempArray;
isCompact = false;
}
} | [
"private",
"void",
"expand",
"(",
")",
"{",
"int",
"i",
";",
"if",
"(",
"isCompact",
")",
"{",
"byte",
"[",
"]",
"tempArray",
";",
"hashes",
"=",
"new",
"int",
"[",
"INDEXCOUNT",
"]",
";",
"tempArray",
"=",
"new",
"byte",
"[",
"UNICODECOUNT",
"]",
... | Expanding takes the array back to a 65536 element array. | [
"Expanding",
"takes",
"the",
"array",
"back",
"to",
"a",
"65536",
"element",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactByteArray.java#L375-L394 |
35,401 | google/j2objc | jre_emul/Classes/java/text/IOSCollator.java | IOSCollator.setDecomposition | @Override
public void setDecomposition(int value) {
if (value < Collator.NO_DECOMPOSITION || value > Collator.FULL_DECOMPOSITION) {
throw new IllegalArgumentException();
}
decomposition = value;
} | java | @Override
public void setDecomposition(int value) {
if (value < Collator.NO_DECOMPOSITION || value > Collator.FULL_DECOMPOSITION) {
throw new IllegalArgumentException();
}
decomposition = value;
} | [
"@",
"Override",
"public",
"void",
"setDecomposition",
"(",
"int",
"value",
")",
"{",
"if",
"(",
"value",
"<",
"Collator",
".",
"NO_DECOMPOSITION",
"||",
"value",
">",
"Collator",
".",
"FULL_DECOMPOSITION",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Sets decomposition field, but is otherwise unused. | [
"Sets",
"decomposition",
"field",
"but",
"is",
"otherwise",
"unused",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/java/text/IOSCollator.java#L82-L88 |
35,402 | google/j2objc | jre_emul/Classes/java/text/IOSCollator.java | IOSCollator.setStrength | @Override
public void setStrength(int value) {
if (value < Collator.PRIMARY || value > Collator.IDENTICAL) {
throw new IllegalArgumentException();
}
strength = value;
} | java | @Override
public void setStrength(int value) {
if (value < Collator.PRIMARY || value > Collator.IDENTICAL) {
throw new IllegalArgumentException();
}
strength = value;
} | [
"@",
"Override",
"public",
"void",
"setStrength",
"(",
"int",
"value",
")",
"{",
"if",
"(",
"value",
"<",
"Collator",
".",
"PRIMARY",
"||",
"value",
">",
"Collator",
".",
"IDENTICAL",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"... | Sets strength field, but is otherwise unused. | [
"Sets",
"strength",
"field",
"but",
"is",
"otherwise",
"unused",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/java/text/IOSCollator.java#L93-L99 |
35,403 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java | BitArray.get | public boolean get(int index) throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= length) {
throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
}
return (repn[subscript(index)] & position(index)) != 0;
} | java | public boolean get(int index) throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= length) {
throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
}
return (repn[subscript(index)] & position(index)) != 0;
} | [
"public",
"boolean",
"get",
"(",
"int",
"index",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"length",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"Integer",
".",
"toString",
"("... | Returns the indexed bit in this BitArray. | [
"Returns",
"the",
"indexed",
"bit",
"in",
"this",
"BitArray",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java#L127-L133 |
35,404 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java | BitArray.set | public void set(int index, boolean value)
throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= length) {
throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
}
int idx = subscript(index);
int bit = position(index);
if (value) {
repn[idx] |= bit;
} else {
repn[idx] &= ~bit;
}
} | java | public void set(int index, boolean value)
throws ArrayIndexOutOfBoundsException {
if (index < 0 || index >= length) {
throw new ArrayIndexOutOfBoundsException(Integer.toString(index));
}
int idx = subscript(index);
int bit = position(index);
if (value) {
repn[idx] |= bit;
} else {
repn[idx] &= ~bit;
}
} | [
"public",
"void",
"set",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"length",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"Integer"... | Sets the indexed bit in this BitArray. | [
"Sets",
"the",
"indexed",
"bit",
"in",
"this",
"BitArray",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java#L138-L151 |
35,405 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java | BitArray.toBooleanArray | public boolean[] toBooleanArray() {
boolean[] bits = new boolean[length];
for (int i=0; i < length; i++) {
bits[i] = get(i);
}
return bits;
} | java | public boolean[] toBooleanArray() {
boolean[] bits = new boolean[length];
for (int i=0; i < length; i++) {
bits[i] = get(i);
}
return bits;
} | [
"public",
"boolean",
"[",
"]",
"toBooleanArray",
"(",
")",
"{",
"boolean",
"[",
"]",
"bits",
"=",
"new",
"boolean",
"[",
"length",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"length",
";",
"i",
"++",
")",
"{",
"bits",
"[",
"i",
... | Return a boolean array with the same bit values a this BitArray. | [
"Return",
"a",
"boolean",
"array",
"with",
"the",
"same",
"bit",
"values",
"a",
"this",
"BitArray",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/BitArray.java#L190-L197 |
35,406 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/BaseCalendar.java | BaseCalendar.getCalendarDateFromFixedDate | public void getCalendarDateFromFixedDate(CalendarDate date,
long fixedDate) {
Date gdate = (Date) date;
int year;
long jan1;
boolean isLeap;
if (gdate.hit(fixedDate)) {
year = gdate.getCachedYear();
jan1 = gdate.getCachedJan1();
isLeap = isLeapYear(year);
} else {
// Looking up FIXED_DATES[] here didn't improve performance
// much. So we calculate year and jan1. getFixedDate()
// will look up FIXED_DATES[] actually.
year = getGregorianYearFromFixedDate(fixedDate);
jan1 = getFixedDate(year, JANUARY, 1, null);
isLeap = isLeapYear(year);
// Update the cache data
gdate.setCache (year, jan1, isLeap ? 366 : 365);
}
int priorDays = (int)(fixedDate - jan1);
long mar1 = jan1 + 31 + 28;
if (isLeap) {
++mar1;
}
if (fixedDate >= mar1) {
priorDays += isLeap ? 1 : 2;
}
int month = 12 * priorDays + 373;
if (month > 0) {
month /= 367;
} else {
month = CalendarUtils.floorDivide(month, 367);
}
long month1 = jan1 + ACCUMULATED_DAYS_IN_MONTH[month];
if (isLeap && month >= MARCH) {
++month1;
}
int dayOfMonth = (int)(fixedDate - month1) + 1;
int dayOfWeek = getDayOfWeekFromFixedDate(fixedDate);
assert dayOfWeek > 0 : "negative day of week " + dayOfWeek;
gdate.setNormalizedYear(year);
gdate.setMonth(month);
gdate.setDayOfMonth(dayOfMonth);
gdate.setDayOfWeek(dayOfWeek);
gdate.setLeapYear(isLeap);
gdate.setNormalized(true);
} | java | public void getCalendarDateFromFixedDate(CalendarDate date,
long fixedDate) {
Date gdate = (Date) date;
int year;
long jan1;
boolean isLeap;
if (gdate.hit(fixedDate)) {
year = gdate.getCachedYear();
jan1 = gdate.getCachedJan1();
isLeap = isLeapYear(year);
} else {
// Looking up FIXED_DATES[] here didn't improve performance
// much. So we calculate year and jan1. getFixedDate()
// will look up FIXED_DATES[] actually.
year = getGregorianYearFromFixedDate(fixedDate);
jan1 = getFixedDate(year, JANUARY, 1, null);
isLeap = isLeapYear(year);
// Update the cache data
gdate.setCache (year, jan1, isLeap ? 366 : 365);
}
int priorDays = (int)(fixedDate - jan1);
long mar1 = jan1 + 31 + 28;
if (isLeap) {
++mar1;
}
if (fixedDate >= mar1) {
priorDays += isLeap ? 1 : 2;
}
int month = 12 * priorDays + 373;
if (month > 0) {
month /= 367;
} else {
month = CalendarUtils.floorDivide(month, 367);
}
long month1 = jan1 + ACCUMULATED_DAYS_IN_MONTH[month];
if (isLeap && month >= MARCH) {
++month1;
}
int dayOfMonth = (int)(fixedDate - month1) + 1;
int dayOfWeek = getDayOfWeekFromFixedDate(fixedDate);
assert dayOfWeek > 0 : "negative day of week " + dayOfWeek;
gdate.setNormalizedYear(year);
gdate.setMonth(month);
gdate.setDayOfMonth(dayOfMonth);
gdate.setDayOfWeek(dayOfWeek);
gdate.setLeapYear(isLeap);
gdate.setNormalized(true);
} | [
"public",
"void",
"getCalendarDateFromFixedDate",
"(",
"CalendarDate",
"date",
",",
"long",
"fixedDate",
")",
"{",
"Date",
"gdate",
"=",
"(",
"Date",
")",
"date",
";",
"int",
"year",
";",
"long",
"jan1",
";",
"boolean",
"isLeap",
";",
"if",
"(",
"gdate",
... | should be 'protected' | [
"should",
"be",
"protected"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/BaseCalendar.java#L419-L467 |
35,407 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/BaseCalendar.java | BaseCalendar.getGregorianYearFromFixedDate | final int getGregorianYearFromFixedDate(long fixedDate) {
long d0;
int d1, d2, d3, d4;
int n400, n100, n4, n1;
int year;
if (fixedDate > 0) {
d0 = fixedDate - 1;
n400 = (int)(d0 / 146097);
d1 = (int)(d0 % 146097);
n100 = d1 / 36524;
d2 = d1 % 36524;
n4 = d2 / 1461;
d3 = d2 % 1461;
n1 = d3 / 365;
d4 = (d3 % 365) + 1;
} else {
d0 = fixedDate - 1;
n400 = (int)CalendarUtils.floorDivide(d0, 146097L);
d1 = (int)CalendarUtils.mod(d0, 146097L);
n100 = CalendarUtils.floorDivide(d1, 36524);
d2 = CalendarUtils.mod(d1, 36524);
n4 = CalendarUtils.floorDivide(d2, 1461);
d3 = CalendarUtils.mod(d2, 1461);
n1 = CalendarUtils.floorDivide(d3, 365);
d4 = CalendarUtils.mod(d3, 365) + 1;
}
year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
if (!(n100 == 4 || n1 == 4)) {
++year;
}
return year;
} | java | final int getGregorianYearFromFixedDate(long fixedDate) {
long d0;
int d1, d2, d3, d4;
int n400, n100, n4, n1;
int year;
if (fixedDate > 0) {
d0 = fixedDate - 1;
n400 = (int)(d0 / 146097);
d1 = (int)(d0 % 146097);
n100 = d1 / 36524;
d2 = d1 % 36524;
n4 = d2 / 1461;
d3 = d2 % 1461;
n1 = d3 / 365;
d4 = (d3 % 365) + 1;
} else {
d0 = fixedDate - 1;
n400 = (int)CalendarUtils.floorDivide(d0, 146097L);
d1 = (int)CalendarUtils.mod(d0, 146097L);
n100 = CalendarUtils.floorDivide(d1, 36524);
d2 = CalendarUtils.mod(d1, 36524);
n4 = CalendarUtils.floorDivide(d2, 1461);
d3 = CalendarUtils.mod(d2, 1461);
n1 = CalendarUtils.floorDivide(d3, 365);
d4 = CalendarUtils.mod(d3, 365) + 1;
}
year = 400 * n400 + 100 * n100 + 4 * n4 + n1;
if (!(n100 == 4 || n1 == 4)) {
++year;
}
return year;
} | [
"final",
"int",
"getGregorianYearFromFixedDate",
"(",
"long",
"fixedDate",
")",
"{",
"long",
"d0",
";",
"int",
"d1",
",",
"d2",
",",
"d3",
",",
"d4",
";",
"int",
"n400",
",",
"n100",
",",
"n4",
",",
"n1",
";",
"int",
"year",
";",
"if",
"(",
"fixedD... | Returns the Gregorian year number of the given fixed date. | [
"Returns",
"the",
"Gregorian",
"year",
"number",
"of",
"the",
"given",
"fixed",
"date",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/calendar/BaseCalendar.java#L492-L524 |
35,408 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/NumberFormat.java | NumberFormat.setMaximumFractionDigits | public void setMaximumFractionDigits(int newValue) {
maximumFractionDigits = Math.max(0,newValue);
if (maximumFractionDigits < minimumFractionDigits) {
minimumFractionDigits = maximumFractionDigits;
}
} | java | public void setMaximumFractionDigits(int newValue) {
maximumFractionDigits = Math.max(0,newValue);
if (maximumFractionDigits < minimumFractionDigits) {
minimumFractionDigits = maximumFractionDigits;
}
} | [
"public",
"void",
"setMaximumFractionDigits",
"(",
"int",
"newValue",
")",
"{",
"maximumFractionDigits",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"newValue",
")",
";",
"if",
"(",
"maximumFractionDigits",
"<",
"minimumFractionDigits",
")",
"{",
"minimumFractionDigit... | Sets the maximum number of digits allowed in the fraction portion of a
number. maximumFractionDigits must be >= minimumFractionDigits. If the
new value for maximumFractionDigits is less than the current value
of minimumFractionDigits, then minimumFractionDigits will also be set to
the new value.
@param newValue the maximum number of fraction digits to be shown; if
less than zero, then zero is used. The concrete subclass may enforce an
upper limit to this value appropriate to the numeric type being formatted.
@see #getMaximumFractionDigits | [
"Sets",
"the",
"maximum",
"number",
"of",
"digits",
"allowed",
"in",
"the",
"fraction",
"portion",
"of",
"a",
"number",
".",
"maximumFractionDigits",
"must",
"be",
">",
"=",
"minimumFractionDigits",
".",
"If",
"the",
"new",
"value",
"for",
"maximumFractionDigits... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/NumberFormat.java#L624-L629 |
35,409 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/NumberFormat.java | NumberFormat.adjustForCurrencyDefaultFractionDigits | private static void adjustForCurrencyDefaultFractionDigits(
DecimalFormat format, DecimalFormatSymbols symbols) {
Currency currency = symbols.getCurrency();
if (currency == null) {
try {
currency = Currency.getInstance(symbols.getInternationalCurrencySymbol());
} catch (IllegalArgumentException e) {
}
}
if (currency != null) {
int digits = currency.getDefaultFractionDigits();
if (digits != -1) {
int oldMinDigits = format.getMinimumFractionDigits();
// Common patterns are "#.##", "#.00", "#".
// Try to adjust all of them in a reasonable way.
if (oldMinDigits == format.getMaximumFractionDigits()) {
format.setMinimumFractionDigits(digits);
format.setMaximumFractionDigits(digits);
} else {
format.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
format.setMaximumFractionDigits(digits);
}
}
}
} | java | private static void adjustForCurrencyDefaultFractionDigits(
DecimalFormat format, DecimalFormatSymbols symbols) {
Currency currency = symbols.getCurrency();
if (currency == null) {
try {
currency = Currency.getInstance(symbols.getInternationalCurrencySymbol());
} catch (IllegalArgumentException e) {
}
}
if (currency != null) {
int digits = currency.getDefaultFractionDigits();
if (digits != -1) {
int oldMinDigits = format.getMinimumFractionDigits();
// Common patterns are "#.##", "#.00", "#".
// Try to adjust all of them in a reasonable way.
if (oldMinDigits == format.getMaximumFractionDigits()) {
format.setMinimumFractionDigits(digits);
format.setMaximumFractionDigits(digits);
} else {
format.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
format.setMaximumFractionDigits(digits);
}
}
}
} | [
"private",
"static",
"void",
"adjustForCurrencyDefaultFractionDigits",
"(",
"DecimalFormat",
"format",
",",
"DecimalFormatSymbols",
"symbols",
")",
"{",
"Currency",
"currency",
"=",
"symbols",
".",
"getCurrency",
"(",
")",
";",
"if",
"(",
"currency",
"==",
"null",
... | Adjusts the minimum and maximum fraction digits to values that
are reasonable for the currency's default fraction digits. | [
"Adjusts",
"the",
"minimum",
"and",
"maximum",
"fraction",
"digits",
"to",
"values",
"that",
"are",
"reasonable",
"for",
"the",
"currency",
"s",
"default",
"fraction",
"digits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/NumberFormat.java#L783-L807 |
35,410 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java | GZIPOutputStream.write | public synchronized void write(byte[] buf, int off, int len)
throws IOException
{
super.write(buf, off, len);
crc.update(buf, off, len);
} | java | public synchronized void write(byte[] buf, int off, int len)
throws IOException
{
super.write(buf, off, len);
crc.update(buf, off, len);
} | [
"public",
"synchronized",
"void",
"write",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"super",
".",
"write",
"(",
"buf",
",",
"off",
",",
"len",
")",
";",
"crc",
".",
"update",
"(",
"buf",... | Writes array of bytes to the compressed output stream. This method
will block until all the bytes are written.
@param buf the data to be written
@param off the start offset of the data
@param len the length of the data
@exception IOException If an I/O error has occurred. | [
"Writes",
"array",
"of",
"bytes",
"to",
"the",
"compressed",
"output",
"stream",
".",
"This",
"method",
"will",
"block",
"until",
"all",
"the",
"bytes",
"are",
"written",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java#L142-L147 |
35,411 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java | GZIPOutputStream.finish | public void finish() throws IOException {
if (!def.finished()) {
def.finish();
while (!def.finished()) {
int len = def.deflate(buf, 0, buf.length);
if (def.finished() && len <= buf.length - TRAILER_SIZE) {
// last deflater buffer. Fit trailer at the end
writeTrailer(buf, len);
len = len + TRAILER_SIZE;
out.write(buf, 0, len);
return;
}
if (len > 0)
out.write(buf, 0, len);
}
// if we can't fit the trailer at the end of the last
// deflater buffer, we write it separately
byte[] trailer = new byte[TRAILER_SIZE];
writeTrailer(trailer, 0);
out.write(trailer);
}
} | java | public void finish() throws IOException {
if (!def.finished()) {
def.finish();
while (!def.finished()) {
int len = def.deflate(buf, 0, buf.length);
if (def.finished() && len <= buf.length - TRAILER_SIZE) {
// last deflater buffer. Fit trailer at the end
writeTrailer(buf, len);
len = len + TRAILER_SIZE;
out.write(buf, 0, len);
return;
}
if (len > 0)
out.write(buf, 0, len);
}
// if we can't fit the trailer at the end of the last
// deflater buffer, we write it separately
byte[] trailer = new byte[TRAILER_SIZE];
writeTrailer(trailer, 0);
out.write(trailer);
}
} | [
"public",
"void",
"finish",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"def",
".",
"finished",
"(",
")",
")",
"{",
"def",
".",
"finish",
"(",
")",
";",
"while",
"(",
"!",
"def",
".",
"finished",
"(",
")",
")",
"{",
"int",
"len",
"=... | Finishes writing compressed data to the output stream without closing
the underlying stream. Use this method when applying multiple filters
in succession to the same output stream.
@exception IOException if an I/O error has occurred | [
"Finishes",
"writing",
"compressed",
"data",
"to",
"the",
"output",
"stream",
"without",
"closing",
"the",
"underlying",
"stream",
".",
"Use",
"this",
"method",
"when",
"applying",
"multiple",
"filters",
"in",
"succession",
"to",
"the",
"same",
"output",
"stream... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/GZIPOutputStream.java#L155-L176 |
35,412 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java | EasterRule.firstBetween | @Override
public Date firstBetween(Date start, Date end)
{
return doFirstBetween(start, end);
} | java | @Override
public Date firstBetween(Date start, Date end)
{
return doFirstBetween(start, end);
} | [
"@",
"Override",
"public",
"Date",
"firstBetween",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"return",
"doFirstBetween",
"(",
"start",
",",
"end",
")",
";",
"}"
] | Return the first occurrence of this rule on or after
the given start date and before the given end date. | [
"Return",
"the",
"first",
"occurrence",
"of",
"this",
"rule",
"on",
"or",
"after",
"the",
"given",
"start",
"date",
"and",
"before",
"the",
"given",
"end",
"date",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java#L161-L165 |
35,413 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java | EasterRule.isOn | @Override
public boolean isOn(Date date)
{
synchronized(calendar) {
calendar.setTime(date);
int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
calendar.setTime(computeInYear(calendar.getTime(), calendar));
return calendar.get(Calendar.DAY_OF_YEAR) == dayOfYear;
}
} | java | @Override
public boolean isOn(Date date)
{
synchronized(calendar) {
calendar.setTime(date);
int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
calendar.setTime(computeInYear(calendar.getTime(), calendar));
return calendar.get(Calendar.DAY_OF_YEAR) == dayOfYear;
}
} | [
"@",
"Override",
"public",
"boolean",
"isOn",
"(",
"Date",
"date",
")",
"{",
"synchronized",
"(",
"calendar",
")",
"{",
"calendar",
".",
"setTime",
"(",
"date",
")",
";",
"int",
"dayOfYear",
"=",
"calendar",
".",
"get",
"(",
"Calendar",
".",
"DAY_OF_YEAR... | Return true if the given Date is on the same day as Easter | [
"Return",
"true",
"if",
"the",
"given",
"Date",
"is",
"on",
"the",
"same",
"day",
"as",
"Easter"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java#L170-L181 |
35,414 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java | EasterRule.isBetween | @Override
public boolean isBetween(Date start, Date end)
{
return firstBetween(start, end) != null; // TODO: optimize?
} | java | @Override
public boolean isBetween(Date start, Date end)
{
return firstBetween(start, end) != null; // TODO: optimize?
} | [
"@",
"Override",
"public",
"boolean",
"isBetween",
"(",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"return",
"firstBetween",
"(",
"start",
",",
"end",
")",
"!=",
"null",
";",
"// TODO: optimize?",
"}"
] | Return true if Easter occurs between the two dates given | [
"Return",
"true",
"if",
"Easter",
"occurs",
"between",
"the",
"two",
"dates",
"given"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/EasterHoliday.java#L186-L190 |
35,415 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java | ZoneRulesProvider.getProvider | private static ZoneRulesProvider getProvider(String zoneId) {
ZoneRulesProvider provider = ZONES.get(zoneId);
if (provider == null) {
if (ZONES.isEmpty()) {
throw new ZoneRulesException("No time-zone data files registered");
}
throw new ZoneRulesException("Unknown time-zone ID: " + zoneId);
}
return provider;
} | java | private static ZoneRulesProvider getProvider(String zoneId) {
ZoneRulesProvider provider = ZONES.get(zoneId);
if (provider == null) {
if (ZONES.isEmpty()) {
throw new ZoneRulesException("No time-zone data files registered");
}
throw new ZoneRulesException("Unknown time-zone ID: " + zoneId);
}
return provider;
} | [
"private",
"static",
"ZoneRulesProvider",
"getProvider",
"(",
"String",
"zoneId",
")",
"{",
"ZoneRulesProvider",
"provider",
"=",
"ZONES",
".",
"get",
"(",
"zoneId",
")",
";",
"if",
"(",
"provider",
"==",
"null",
")",
"{",
"if",
"(",
"ZONES",
".",
"isEmpty... | Gets the provider for the zone ID.
@param zoneId the zone ID as defined by {@code ZoneId}, not null
@return the provider, not null
@throws ZoneRulesException if the zone ID is unknown | [
"Gets",
"the",
"provider",
"for",
"the",
"zone",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRulesProvider.java#L222-L231 |
35,416 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.formatMeasurePerUnit | public StringBuilder formatMeasurePerUnit(
Measure measure,
MeasureUnit perUnit,
StringBuilder appendTo,
FieldPosition pos) {
MeasureUnit resolvedUnit = MeasureUnit.resolveUnitPerUnit(
measure.getUnit(), perUnit);
if (resolvedUnit != null) {
Measure newMeasure = new Measure(measure.getNumber(), resolvedUnit);
return formatMeasure(newMeasure, numberFormat, appendTo, pos);
}
FieldPosition fpos = new FieldPosition(
pos.getFieldAttribute(), pos.getField());
int offset = withPerUnitAndAppend(
formatMeasure(measure, numberFormat, new StringBuilder(), fpos),
perUnit,
appendTo);
if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) {
pos.setBeginIndex(fpos.getBeginIndex() + offset);
pos.setEndIndex(fpos.getEndIndex() + offset);
}
return appendTo;
} | java | public StringBuilder formatMeasurePerUnit(
Measure measure,
MeasureUnit perUnit,
StringBuilder appendTo,
FieldPosition pos) {
MeasureUnit resolvedUnit = MeasureUnit.resolveUnitPerUnit(
measure.getUnit(), perUnit);
if (resolvedUnit != null) {
Measure newMeasure = new Measure(measure.getNumber(), resolvedUnit);
return formatMeasure(newMeasure, numberFormat, appendTo, pos);
}
FieldPosition fpos = new FieldPosition(
pos.getFieldAttribute(), pos.getField());
int offset = withPerUnitAndAppend(
formatMeasure(measure, numberFormat, new StringBuilder(), fpos),
perUnit,
appendTo);
if (fpos.getBeginIndex() != 0 || fpos.getEndIndex() != 0) {
pos.setBeginIndex(fpos.getBeginIndex() + offset);
pos.setEndIndex(fpos.getEndIndex() + offset);
}
return appendTo;
} | [
"public",
"StringBuilder",
"formatMeasurePerUnit",
"(",
"Measure",
"measure",
",",
"MeasureUnit",
"perUnit",
",",
"StringBuilder",
"appendTo",
",",
"FieldPosition",
"pos",
")",
"{",
"MeasureUnit",
"resolvedUnit",
"=",
"MeasureUnit",
".",
"resolveUnitPerUnit",
"(",
"me... | Formats a single measure per unit.
An example of such a formatted string is "3.5 meters per second."
@param measure the measure object. In above example, 3.5 meters.
@param perUnit the per unit. In above example, it is MeasureUnit.SECOND
@param appendTo formatted string appended here.
@param pos The field position.
@return appendTo. | [
"Formats",
"a",
"single",
"measure",
"per",
"unit",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L480-L502 |
35,417 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.formatMeasures | public StringBuilder formatMeasures(
StringBuilder appendTo, FieldPosition fieldPosition, Measure... measures) {
// fast track for trivial cases
if (measures.length == 0) {
return appendTo;
}
if (measures.length == 1) {
return formatMeasure(measures[0], numberFormat, appendTo, fieldPosition);
}
if (formatWidth == FormatWidth.NUMERIC) {
// If we have just hour, minute, or second follow the numeric
// track.
Number[] hms = toHMS(measures);
if (hms != null) {
return formatNumeric(hms, appendTo);
}
}
ListFormatter listFormatter = ListFormatter.getInstance(
getLocale(), formatWidth.getListFormatterStyle());
if (fieldPosition != DontCareFieldPosition.INSTANCE) {
return formatMeasuresSlowTrack(listFormatter, appendTo, fieldPosition, measures);
}
// Fast track: No field position.
String[] results = new String[measures.length];
for (int i = 0; i < measures.length; i++) {
results[i] = formatMeasure(
measures[i],
i == measures.length - 1 ? numberFormat : integerFormat);
}
return appendTo.append(listFormatter.format((Object[]) results));
} | java | public StringBuilder formatMeasures(
StringBuilder appendTo, FieldPosition fieldPosition, Measure... measures) {
// fast track for trivial cases
if (measures.length == 0) {
return appendTo;
}
if (measures.length == 1) {
return formatMeasure(measures[0], numberFormat, appendTo, fieldPosition);
}
if (formatWidth == FormatWidth.NUMERIC) {
// If we have just hour, minute, or second follow the numeric
// track.
Number[] hms = toHMS(measures);
if (hms != null) {
return formatNumeric(hms, appendTo);
}
}
ListFormatter listFormatter = ListFormatter.getInstance(
getLocale(), formatWidth.getListFormatterStyle());
if (fieldPosition != DontCareFieldPosition.INSTANCE) {
return formatMeasuresSlowTrack(listFormatter, appendTo, fieldPosition, measures);
}
// Fast track: No field position.
String[] results = new String[measures.length];
for (int i = 0; i < measures.length; i++) {
results[i] = formatMeasure(
measures[i],
i == measures.length - 1 ? numberFormat : integerFormat);
}
return appendTo.append(listFormatter.format((Object[]) results));
} | [
"public",
"StringBuilder",
"formatMeasures",
"(",
"StringBuilder",
"appendTo",
",",
"FieldPosition",
"fieldPosition",
",",
"Measure",
"...",
"measures",
")",
"{",
"// fast track for trivial cases",
"if",
"(",
"measures",
".",
"length",
"==",
"0",
")",
"{",
"return",... | Formats a sequence of measures.
If the fieldPosition argument identifies a NumberFormat field,
then its indices are set to the beginning and end of the first such field
encountered. MeasureFormat itself does not supply any fields.
@param appendTo the formatted string appended here.
@param fieldPosition Identifies a field in the formatted text.
@param measures the measures to format.
@return appendTo.
@see MeasureFormat#formatMeasures(Measure...) | [
"Formats",
"a",
"sequence",
"of",
"measures",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L517-L550 |
35,418 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.loadLocaleData | private static MeasureFormatData loadLocaleData(ULocale locale) {
ICUResourceBundle resource =
(ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_UNIT_BASE_NAME, locale);
MeasureFormatData cacheData = new MeasureFormatData();
UnitDataSink sink = new UnitDataSink(cacheData);
resource.getAllItemsWithFallback("", sink);
return cacheData;
} | java | private static MeasureFormatData loadLocaleData(ULocale locale) {
ICUResourceBundle resource =
(ICUResourceBundle)UResourceBundle.getBundleInstance(ICUData.ICU_UNIT_BASE_NAME, locale);
MeasureFormatData cacheData = new MeasureFormatData();
UnitDataSink sink = new UnitDataSink(cacheData);
resource.getAllItemsWithFallback("", sink);
return cacheData;
} | [
"private",
"static",
"MeasureFormatData",
"loadLocaleData",
"(",
"ULocale",
"locale",
")",
"{",
"ICUResourceBundle",
"resource",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_UNIT_BASE_NAME",
",",
"locale",
... | Returns formatting data for all MeasureUnits except for currency ones. | [
"Returns",
"formatting",
"data",
"for",
"all",
"MeasureUnits",
"except",
"for",
"currency",
"ones",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L952-L959 |
35,419 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.loadNumericDurationFormat | private static DateFormat loadNumericDurationFormat(
ICUResourceBundle r, String type) {
r = r.getWithFallback(String.format("durationUnits/%s", type));
// We replace 'h' with 'H' because 'h' does not make sense in the context of durations.
DateFormat result = new SimpleDateFormat(r.getString().replace("h", "H"));
result.setTimeZone(TimeZone.GMT_ZONE);
return result;
} | java | private static DateFormat loadNumericDurationFormat(
ICUResourceBundle r, String type) {
r = r.getWithFallback(String.format("durationUnits/%s", type));
// We replace 'h' with 'H' because 'h' does not make sense in the context of durations.
DateFormat result = new SimpleDateFormat(r.getString().replace("h", "H"));
result.setTimeZone(TimeZone.GMT_ZONE);
return result;
} | [
"private",
"static",
"DateFormat",
"loadNumericDurationFormat",
"(",
"ICUResourceBundle",
"r",
",",
"String",
"type",
")",
"{",
"r",
"=",
"r",
".",
"getWithFallback",
"(",
"String",
".",
"format",
"(",
"\"durationUnits/%s\"",
",",
"type",
")",
")",
";",
"// We... | type is one of "hm", "ms" or "hms" | [
"type",
"is",
"one",
"of",
"hm",
"ms",
"or",
"hms"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L1195-L1202 |
35,420 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.toHMS | private static Number[] toHMS(Measure[] measures) {
Number[] result = new Number[3];
int lastIdx = -1;
for (Measure m : measures) {
if (m.getNumber().doubleValue() < 0.0) {
return null;
}
Integer idxObj = hmsTo012.get(m.getUnit());
if (idxObj == null) {
return null;
}
int idx = idxObj.intValue();
if (idx <= lastIdx) {
// hour before minute before second
return null;
}
lastIdx = idx;
result[idx] = m.getNumber();
}
return result;
} | java | private static Number[] toHMS(Measure[] measures) {
Number[] result = new Number[3];
int lastIdx = -1;
for (Measure m : measures) {
if (m.getNumber().doubleValue() < 0.0) {
return null;
}
Integer idxObj = hmsTo012.get(m.getUnit());
if (idxObj == null) {
return null;
}
int idx = idxObj.intValue();
if (idx <= lastIdx) {
// hour before minute before second
return null;
}
lastIdx = idx;
result[idx] = m.getNumber();
}
return result;
} | [
"private",
"static",
"Number",
"[",
"]",
"toHMS",
"(",
"Measure",
"[",
"]",
"measures",
")",
"{",
"Number",
"[",
"]",
"result",
"=",
"new",
"Number",
"[",
"3",
"]",
";",
"int",
"lastIdx",
"=",
"-",
"1",
";",
"for",
"(",
"Measure",
"m",
":",
"meas... | returned array will be null. | [
"returned",
"array",
"will",
"be",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L1209-L1229 |
35,421 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.formatNumeric | private StringBuilder formatNumeric(Number[] hms, StringBuilder appendable) {
// find the start and end of non-nil values in hms array. We have to know if we
// have hour-minute; minute-second; or hour-minute-second.
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < hms.length; i++) {
if (hms[i] != null) {
endIndex = i;
if (startIndex == -1) {
startIndex = endIndex;
}
} else {
// Replace nil value with 0.
hms[i] = Integer.valueOf(0);
}
}
// convert hours, minutes, seconds into milliseconds.
long millis = (long) (((Math.floor(hms[0].doubleValue()) * 60.0
+ Math.floor(hms[1].doubleValue())) * 60.0
+ Math.floor(hms[2].doubleValue())) * 1000.0);
Date d = new Date(millis);
// if hour-minute-second
if (startIndex == 0 && endIndex == 2) {
return formatNumeric(
d,
numericFormatters.getHourMinuteSecond(),
DateFormat.Field.SECOND,
hms[endIndex],
appendable);
}
// if minute-second
if (startIndex == 1 && endIndex == 2) {
return formatNumeric(
d,
numericFormatters.getMinuteSecond(),
DateFormat.Field.SECOND,
hms[endIndex],
appendable);
}
// if hour-minute
if (startIndex == 0 && endIndex == 1) {
return formatNumeric(
d,
numericFormatters.getHourMinute(),
DateFormat.Field.MINUTE,
hms[endIndex],
appendable);
}
throw new IllegalStateException();
} | java | private StringBuilder formatNumeric(Number[] hms, StringBuilder appendable) {
// find the start and end of non-nil values in hms array. We have to know if we
// have hour-minute; minute-second; or hour-minute-second.
int startIndex = -1;
int endIndex = -1;
for (int i = 0; i < hms.length; i++) {
if (hms[i] != null) {
endIndex = i;
if (startIndex == -1) {
startIndex = endIndex;
}
} else {
// Replace nil value with 0.
hms[i] = Integer.valueOf(0);
}
}
// convert hours, minutes, seconds into milliseconds.
long millis = (long) (((Math.floor(hms[0].doubleValue()) * 60.0
+ Math.floor(hms[1].doubleValue())) * 60.0
+ Math.floor(hms[2].doubleValue())) * 1000.0);
Date d = new Date(millis);
// if hour-minute-second
if (startIndex == 0 && endIndex == 2) {
return formatNumeric(
d,
numericFormatters.getHourMinuteSecond(),
DateFormat.Field.SECOND,
hms[endIndex],
appendable);
}
// if minute-second
if (startIndex == 1 && endIndex == 2) {
return formatNumeric(
d,
numericFormatters.getMinuteSecond(),
DateFormat.Field.SECOND,
hms[endIndex],
appendable);
}
// if hour-minute
if (startIndex == 0 && endIndex == 1) {
return formatNumeric(
d,
numericFormatters.getHourMinute(),
DateFormat.Field.MINUTE,
hms[endIndex],
appendable);
}
throw new IllegalStateException();
} | [
"private",
"StringBuilder",
"formatNumeric",
"(",
"Number",
"[",
"]",
"hms",
",",
"StringBuilder",
"appendable",
")",
"{",
"// find the start and end of non-nil values in hms array. We have to know if we",
"// have hour-minute; minute-second; or hour-minute-second.",
"int",
"startInd... | values in hms with 0. | [
"values",
"in",
"hms",
"with",
"0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L1233-L1283 |
35,422 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java | MeasureFormat.formatNumeric | private StringBuilder formatNumeric(
Date duration,
DateFormat formatter,
DateFormat.Field smallestField,
Number smallestAmount,
StringBuilder appendTo) {
// Format the smallest amount ahead of time.
String smallestAmountFormatted;
// Format the smallest amount using this object's number format, but keep track
// of the integer portion of this formatted amount. We have to replace just the
// integer part with the corresponding value from formatting the date. Otherwise
// when formatting 0 minutes 9 seconds, we may get "00:9" instead of "00:09"
FieldPosition intFieldPosition = new FieldPosition(NumberFormat.INTEGER_FIELD);
smallestAmountFormatted = numberFormat.format(
smallestAmount, new StringBuffer(), intFieldPosition).toString();
// Give up if there is no integer field.
if (intFieldPosition.getBeginIndex() == 0 && intFieldPosition.getEndIndex() == 0) {
throw new IllegalStateException();
}
// Format our duration as a date, but keep track of where the smallest field is
// so that we can use it to replace the integer portion of the smallest value.
FieldPosition smallestFieldPosition = new FieldPosition(smallestField);
String draft = formatter.format(
duration, new StringBuffer(), smallestFieldPosition).toString();
// If we find the smallest field
if (smallestFieldPosition.getBeginIndex() != 0
|| smallestFieldPosition.getEndIndex() != 0) {
// add everything up to the start of the smallest field in duration.
appendTo.append(draft, 0, smallestFieldPosition.getBeginIndex());
// add everything in the smallest field up to the integer portion
appendTo.append(smallestAmountFormatted, 0, intFieldPosition.getBeginIndex());
// Add the smallest field in formatted duration in lieu of the integer portion
// of smallest field
appendTo.append(
draft,
smallestFieldPosition.getBeginIndex(),
smallestFieldPosition.getEndIndex());
// Add the rest of the smallest field
appendTo.append(
smallestAmountFormatted,
intFieldPosition.getEndIndex(),
smallestAmountFormatted.length());
appendTo.append(draft, smallestFieldPosition.getEndIndex(), draft.length());
} else {
// As fallback, just use the formatted duration.
appendTo.append(draft);
}
return appendTo;
} | java | private StringBuilder formatNumeric(
Date duration,
DateFormat formatter,
DateFormat.Field smallestField,
Number smallestAmount,
StringBuilder appendTo) {
// Format the smallest amount ahead of time.
String smallestAmountFormatted;
// Format the smallest amount using this object's number format, but keep track
// of the integer portion of this formatted amount. We have to replace just the
// integer part with the corresponding value from formatting the date. Otherwise
// when formatting 0 minutes 9 seconds, we may get "00:9" instead of "00:09"
FieldPosition intFieldPosition = new FieldPosition(NumberFormat.INTEGER_FIELD);
smallestAmountFormatted = numberFormat.format(
smallestAmount, new StringBuffer(), intFieldPosition).toString();
// Give up if there is no integer field.
if (intFieldPosition.getBeginIndex() == 0 && intFieldPosition.getEndIndex() == 0) {
throw new IllegalStateException();
}
// Format our duration as a date, but keep track of where the smallest field is
// so that we can use it to replace the integer portion of the smallest value.
FieldPosition smallestFieldPosition = new FieldPosition(smallestField);
String draft = formatter.format(
duration, new StringBuffer(), smallestFieldPosition).toString();
// If we find the smallest field
if (smallestFieldPosition.getBeginIndex() != 0
|| smallestFieldPosition.getEndIndex() != 0) {
// add everything up to the start of the smallest field in duration.
appendTo.append(draft, 0, smallestFieldPosition.getBeginIndex());
// add everything in the smallest field up to the integer portion
appendTo.append(smallestAmountFormatted, 0, intFieldPosition.getBeginIndex());
// Add the smallest field in formatted duration in lieu of the integer portion
// of smallest field
appendTo.append(
draft,
smallestFieldPosition.getBeginIndex(),
smallestFieldPosition.getEndIndex());
// Add the rest of the smallest field
appendTo.append(
smallestAmountFormatted,
intFieldPosition.getEndIndex(),
smallestAmountFormatted.length());
appendTo.append(draft, smallestFieldPosition.getEndIndex(), draft.length());
} else {
// As fallback, just use the formatted duration.
appendTo.append(draft);
}
return appendTo;
} | [
"private",
"StringBuilder",
"formatNumeric",
"(",
"Date",
"duration",
",",
"DateFormat",
"formatter",
",",
"DateFormat",
".",
"Field",
"smallestField",
",",
"Number",
"smallestAmount",
",",
"StringBuilder",
"appendTo",
")",
"{",
"// Format the smallest amount ahead of tim... | appendTo is where the formatted string is appended. | [
"appendTo",
"is",
"where",
"the",
"formatted",
"string",
"is",
"appended",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MeasureFormat.java#L1294-L1347 |
35,423 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/SAXException.java | SAXException.getMessage | public String getMessage ()
{
String message = super.getMessage();
if (message == null && exception != null) {
return exception.getMessage();
} else {
return message;
}
} | java | public String getMessage ()
{
String message = super.getMessage();
if (message == null && exception != null) {
return exception.getMessage();
} else {
return message;
}
} | [
"public",
"String",
"getMessage",
"(",
")",
"{",
"String",
"message",
"=",
"super",
".",
"getMessage",
"(",
")",
";",
"if",
"(",
"message",
"==",
"null",
"&&",
"exception",
"!=",
"null",
")",
"{",
"return",
"exception",
".",
"getMessage",
"(",
")",
";"... | Return a detail message for this exception.
<p>If there is an embedded exception, and if the SAXException
has no detail message of its own, this method will return
the detail message from the embedded exception.</p>
@return The error or warning message. | [
"Return",
"a",
"detail",
"message",
"for",
"this",
"exception",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/SAXException.java#L100-L109 |
35,424 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java | PluralRules.parseDescription | public static PluralRules parseDescription(String description)
throws ParseException {
description = description.trim();
return description.length() == 0 ? DEFAULT : new PluralRules(parseRuleChain(description));
} | java | public static PluralRules parseDescription(String description)
throws ParseException {
description = description.trim();
return description.length() == 0 ? DEFAULT : new PluralRules(parseRuleChain(description));
} | [
"public",
"static",
"PluralRules",
"parseDescription",
"(",
"String",
"description",
")",
"throws",
"ParseException",
"{",
"description",
"=",
"description",
".",
"trim",
"(",
")",
";",
"return",
"description",
".",
"length",
"(",
")",
"==",
"0",
"?",
"DEFAULT... | Parses a plural rules description and returns a PluralRules.
@param description the rule description.
@throws ParseException if the description cannot be parsed.
The exception index is typically not set, it will be -1. | [
"Parses",
"a",
"plural",
"rules",
"description",
"and",
"returns",
"a",
"PluralRules",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java#L384-L389 |
35,425 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java | PluralRules.select | @Deprecated
public String select(double number, int countVisibleFractionDigits, long fractionaldigits) {
return rules.select(new FixedDecimal(number, countVisibleFractionDigits, fractionaldigits));
} | java | @Deprecated
public String select(double number, int countVisibleFractionDigits, long fractionaldigits) {
return rules.select(new FixedDecimal(number, countVisibleFractionDigits, fractionaldigits));
} | [
"@",
"Deprecated",
"public",
"String",
"select",
"(",
"double",
"number",
",",
"int",
"countVisibleFractionDigits",
",",
"long",
"fractionaldigits",
")",
"{",
"return",
"rules",
".",
"select",
"(",
"new",
"FixedDecimal",
"(",
"number",
",",
"countVisibleFractionDi... | Given a number, returns the keyword of the first rule that applies to
the number.
@param number The number for which the rule has to be determined.
@return The keyword of the selected rule.
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Given",
"a",
"number",
"returns",
"the",
"keyword",
"of",
"the",
"first",
"rule",
"that",
"applies",
"to",
"the",
"number",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java#L2000-L2003 |
35,426 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java | PluralRules.matches | @Deprecated
public boolean matches(FixedDecimal sample, String keyword) {
return rules.select(sample, keyword);
} | java | @Deprecated
public boolean matches(FixedDecimal sample, String keyword) {
return rules.select(sample, keyword);
} | [
"@",
"Deprecated",
"public",
"boolean",
"matches",
"(",
"FixedDecimal",
"sample",
",",
"String",
"keyword",
")",
"{",
"return",
"rules",
".",
"select",
"(",
"sample",
",",
"keyword",
")",
";",
"}"
] | Given a number information, and keyword, return whether the keyword would match the number.
@param sample The number information for which the rule has to be determined.
@param keyword The keyword to filter on
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Given",
"a",
"number",
"information",
"and",
"keyword",
"return",
"whether",
"the",
"keyword",
"would",
"match",
"the",
"number",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralRules.java#L2029-L2032 |
35,427 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIteratorSorted.java | WalkingIteratorSorted.canBeWalkedInNaturalDocOrderStatic | boolean canBeWalkedInNaturalDocOrderStatic()
{
if (null != m_firstWalker)
{
AxesWalker walker = m_firstWalker;
int prevAxis = -1;
boolean prevIsSimpleDownAxis = true;
for(int i = 0; null != walker; i++)
{
int axis = walker.getAxis();
if(walker.isDocOrdered())
{
boolean isSimpleDownAxis = ((axis == Axis.CHILD)
|| (axis == Axis.SELF)
|| (axis == Axis.ROOT));
// Catching the filtered list here is only OK because
// FilterExprWalker#isDocOrdered() did the right thing.
if(isSimpleDownAxis || (axis == -1))
walker = walker.getNextWalker();
else
{
boolean isLastWalker = (null == walker.getNextWalker());
if(isLastWalker)
{
if(walker.isDocOrdered() && (axis == Axis.DESCENDANT ||
axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT
|| axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE))
return true;
}
return false;
}
}
else
return false;
}
return true;
}
return false;
} | java | boolean canBeWalkedInNaturalDocOrderStatic()
{
if (null != m_firstWalker)
{
AxesWalker walker = m_firstWalker;
int prevAxis = -1;
boolean prevIsSimpleDownAxis = true;
for(int i = 0; null != walker; i++)
{
int axis = walker.getAxis();
if(walker.isDocOrdered())
{
boolean isSimpleDownAxis = ((axis == Axis.CHILD)
|| (axis == Axis.SELF)
|| (axis == Axis.ROOT));
// Catching the filtered list here is only OK because
// FilterExprWalker#isDocOrdered() did the right thing.
if(isSimpleDownAxis || (axis == -1))
walker = walker.getNextWalker();
else
{
boolean isLastWalker = (null == walker.getNextWalker());
if(isLastWalker)
{
if(walker.isDocOrdered() && (axis == Axis.DESCENDANT ||
axis == Axis.DESCENDANTORSELF || axis == Axis.DESCENDANTSFROMROOT
|| axis == Axis.DESCENDANTSORSELFFROMROOT) || (axis == Axis.ATTRIBUTE))
return true;
}
return false;
}
}
else
return false;
}
return true;
}
return false;
} | [
"boolean",
"canBeWalkedInNaturalDocOrderStatic",
"(",
")",
"{",
"if",
"(",
"null",
"!=",
"m_firstWalker",
")",
"{",
"AxesWalker",
"walker",
"=",
"m_firstWalker",
";",
"int",
"prevAxis",
"=",
"-",
"1",
";",
"boolean",
"prevIsSimpleDownAxis",
"=",
"true",
";",
"... | Tell if the nodeset can be walked in doc order, via static analysis.
@return true if the nodeset can be walked in doc order, without sorting. | [
"Tell",
"if",
"the",
"nodeset",
"can",
"be",
"walked",
"in",
"doc",
"order",
"via",
"static",
"analysis",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIteratorSorted.java#L93-L134 |
35,428 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIteratorSorted.java | WalkingIteratorSorted.fixupVariables | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
int analysis = getAnalysisBits();
if(WalkerFactory.isNaturalDocOrder(analysis))
{
m_inNaturalOrderStatic = true;
}
else
{
m_inNaturalOrderStatic = false;
// System.out.println("Setting natural doc order to false: "+
// WalkerFactory.getAnalysisString(analysis));
}
} | java | public void fixupVariables(java.util.Vector vars, int globalsSize)
{
super.fixupVariables(vars, globalsSize);
int analysis = getAnalysisBits();
if(WalkerFactory.isNaturalDocOrder(analysis))
{
m_inNaturalOrderStatic = true;
}
else
{
m_inNaturalOrderStatic = false;
// System.out.println("Setting natural doc order to false: "+
// WalkerFactory.getAnalysisString(analysis));
}
} | [
"public",
"void",
"fixupVariables",
"(",
"java",
".",
"util",
".",
"Vector",
"vars",
",",
"int",
"globalsSize",
")",
"{",
"super",
".",
"fixupVariables",
"(",
"vars",
",",
"globalsSize",
")",
";",
"int",
"analysis",
"=",
"getAnalysisBits",
"(",
")",
";",
... | This function is used to perform some extra analysis of the iterator.
@param vars List of QNames that correspond to variables. This list
should be searched backwards for the first qualified name that
corresponds to the variable reference qname. The position of the
QName in the vector from the start of the vector will be its position
in the stack frame (but variables above the globalsTop value will need
to be offset to the current stack frame). | [
"This",
"function",
"is",
"used",
"to",
"perform",
"some",
"extra",
"analysis",
"of",
"the",
"iterator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/WalkingIteratorSorted.java#L196-L212 |
35,429 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java | SecretKeyFactory.translateKey | public final SecretKey translateKey(SecretKey key)
throws InvalidKeyException {
if (serviceIterator == null) {
return spi.engineTranslateKey(key);
}
Exception failure = null;
SecretKeyFactorySpi mySpi = spi;
do {
try {
return mySpi.engineTranslateKey(key);
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi);
}
} while (mySpi != null);
if (failure instanceof InvalidKeyException) {
throw (InvalidKeyException)failure;
}
throw new InvalidKeyException
("Could not translate key", failure);
} | java | public final SecretKey translateKey(SecretKey key)
throws InvalidKeyException {
if (serviceIterator == null) {
return spi.engineTranslateKey(key);
}
Exception failure = null;
SecretKeyFactorySpi mySpi = spi;
do {
try {
return mySpi.engineTranslateKey(key);
} catch (Exception e) {
if (failure == null) {
failure = e;
}
mySpi = nextSpi(mySpi);
}
} while (mySpi != null);
if (failure instanceof InvalidKeyException) {
throw (InvalidKeyException)failure;
}
throw new InvalidKeyException
("Could not translate key", failure);
} | [
"public",
"final",
"SecretKey",
"translateKey",
"(",
"SecretKey",
"key",
")",
"throws",
"InvalidKeyException",
"{",
"if",
"(",
"serviceIterator",
"==",
"null",
")",
"{",
"return",
"spi",
".",
"engineTranslateKey",
"(",
"key",
")",
";",
"}",
"Exception",
"failu... | Translates a key object, whose provider may be unknown or potentially
untrusted, into a corresponding key object of this secret-key factory.
@param key the key whose provider is unknown or untrusted
@return the translated key
@exception InvalidKeyException if the given key cannot be processed
by this secret-key factory. | [
"Translates",
"a",
"key",
"object",
"whose",
"provider",
"may",
"be",
"unknown",
"or",
"potentially",
"untrusted",
"into",
"a",
"corresponding",
"key",
"object",
"of",
"this",
"secret",
"-",
"key",
"factory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/SecretKeyFactory.java#L590-L612 |
35,430 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java | CyclicBarrier.dowait | private int dowait(boolean timed, long nanos)
throws InterruptedException, BrokenBarrierException,
TimeoutException {
final ReentrantLock lock = this.lock;
lock.lock();
try {
// The call to trip.await() further down will release the lock while this thread blocks.
// The @RetainedLocalRef annotation ensures that "g" is still a valid reference after
// returning from the trip.await() call.
@RetainedLocalRef
final Generation g = generation;
if (g.broken)
throw new BrokenBarrierException();
if (Thread.interrupted()) {
breakBarrier();
throw new InterruptedException();
}
int index = --count;
if (index == 0) { // tripped
boolean ranAction = false;
try {
final Runnable command = barrierCommand;
if (command != null)
command.run();
ranAction = true;
nextGeneration();
return 0;
} finally {
if (!ranAction)
breakBarrier();
}
}
// loop until tripped, broken, interrupted, or timed out
for (;;) {
try {
if (!timed)
trip.await();
else if (nanos > 0L)
nanos = trip.awaitNanos(nanos);
} catch (InterruptedException ie) {
if (g == generation && ! g.broken) {
breakBarrier();
throw ie;
} else {
// We're about to finish waiting even if we had not
// been interrupted, so this interrupt is deemed to
// "belong" to subsequent execution.
Thread.currentThread().interrupt();
}
}
if (g.broken)
throw new BrokenBarrierException();
if (g != generation)
return index;
if (timed && nanos <= 0L) {
breakBarrier();
throw new TimeoutException();
}
}
} finally {
lock.unlock();
}
} | java | private int dowait(boolean timed, long nanos)
throws InterruptedException, BrokenBarrierException,
TimeoutException {
final ReentrantLock lock = this.lock;
lock.lock();
try {
// The call to trip.await() further down will release the lock while this thread blocks.
// The @RetainedLocalRef annotation ensures that "g" is still a valid reference after
// returning from the trip.await() call.
@RetainedLocalRef
final Generation g = generation;
if (g.broken)
throw new BrokenBarrierException();
if (Thread.interrupted()) {
breakBarrier();
throw new InterruptedException();
}
int index = --count;
if (index == 0) { // tripped
boolean ranAction = false;
try {
final Runnable command = barrierCommand;
if (command != null)
command.run();
ranAction = true;
nextGeneration();
return 0;
} finally {
if (!ranAction)
breakBarrier();
}
}
// loop until tripped, broken, interrupted, or timed out
for (;;) {
try {
if (!timed)
trip.await();
else if (nanos > 0L)
nanos = trip.awaitNanos(nanos);
} catch (InterruptedException ie) {
if (g == generation && ! g.broken) {
breakBarrier();
throw ie;
} else {
// We're about to finish waiting even if we had not
// been interrupted, so this interrupt is deemed to
// "belong" to subsequent execution.
Thread.currentThread().interrupt();
}
}
if (g.broken)
throw new BrokenBarrierException();
if (g != generation)
return index;
if (timed && nanos <= 0L) {
breakBarrier();
throw new TimeoutException();
}
}
} finally {
lock.unlock();
}
} | [
"private",
"int",
"dowait",
"(",
"boolean",
"timed",
",",
"long",
"nanos",
")",
"throws",
"InterruptedException",
",",
"BrokenBarrierException",
",",
"TimeoutException",
"{",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
... | Main barrier code, covering the various policies. | [
"Main",
"barrier",
"code",
"covering",
"the",
"various",
"policies",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java#L201-L270 |
35,431 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java | CyclicBarrier.isBroken | public boolean isBroken() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
return generation.broken;
} finally {
lock.unlock();
}
} | java | public boolean isBroken() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
return generation.broken;
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"isBroken",
"(",
")",
"{",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"generation",
".",
"broken",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"... | Queries if this barrier is in a broken state.
@return {@code true} if one or more parties broke out of this
barrier due to interruption or timeout since
construction or the last reset, or a barrier action
failed due to an exception; {@code false} otherwise. | [
"Queries",
"if",
"this",
"barrier",
"is",
"in",
"a",
"broken",
"state",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java#L453-L461 |
35,432 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java | CyclicBarrier.getNumberWaiting | public int getNumberWaiting() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
return parties - count;
} finally {
lock.unlock();
}
} | java | public int getNumberWaiting() {
final ReentrantLock lock = this.lock;
lock.lock();
try {
return parties - count;
} finally {
lock.unlock();
}
} | [
"public",
"int",
"getNumberWaiting",
"(",
")",
"{",
"final",
"ReentrantLock",
"lock",
"=",
"this",
".",
"lock",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"return",
"parties",
"-",
"count",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"... | Returns the number of parties currently waiting at the barrier.
This method is primarily useful for debugging and assertions.
@return the number of parties currently blocked in {@link #await} | [
"Returns",
"the",
"number",
"of",
"parties",
"currently",
"waiting",
"at",
"the",
"barrier",
".",
"This",
"method",
"is",
"primarily",
"useful",
"for",
"debugging",
"and",
"assertions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CyclicBarrier.java#L489-L497 |
35,433 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java | CollationData.getCEFromOffsetCE32 | long getCEFromOffsetCE32(int c, int ce32) {
long dataCE = ces[Collation.indexFromCE32(ce32)];
return Collation.makeCE(Collation.getThreeBytePrimaryForOffsetData(c, dataCE));
} | java | long getCEFromOffsetCE32(int c, int ce32) {
long dataCE = ces[Collation.indexFromCE32(ce32)];
return Collation.makeCE(Collation.getThreeBytePrimaryForOffsetData(c, dataCE));
} | [
"long",
"getCEFromOffsetCE32",
"(",
"int",
"c",
",",
"int",
"ce32",
")",
"{",
"long",
"dataCE",
"=",
"ces",
"[",
"Collation",
".",
"indexFromCE32",
"(",
"ce32",
")",
"]",
";",
"return",
"Collation",
".",
"makeCE",
"(",
"Collation",
".",
"getThreeBytePrimar... | Computes a CE from c's ce32 which has the OFFSET_TAG. | [
"Computes",
"a",
"CE",
"from",
"c",
"s",
"ce32",
"which",
"has",
"the",
"OFFSET_TAG",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java#L111-L114 |
35,434 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java | CollationData.getSingleCE | long getSingleCE(int c) {
CollationData d;
int ce32 = getCE32(c);
if(ce32 == Collation.FALLBACK_CE32) {
d = base;
ce32 = base.getCE32(c);
} else {
d = this;
}
while(Collation.isSpecialCE32(ce32)) {
switch(Collation.tagFromCE32(ce32)) {
case Collation.LATIN_EXPANSION_TAG:
case Collation.BUILDER_DATA_TAG:
case Collation.PREFIX_TAG:
case Collation.CONTRACTION_TAG:
case Collation.HANGUL_TAG:
case Collation.LEAD_SURROGATE_TAG:
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
case Collation.FALLBACK_TAG:
case Collation.RESERVED_TAG_3:
throw new AssertionError(String.format(
"unexpected CE32 tag for U+%04X (CE32 0x%08x)", c, ce32));
case Collation.LONG_PRIMARY_TAG:
return Collation.ceFromLongPrimaryCE32(ce32);
case Collation.LONG_SECONDARY_TAG:
return Collation.ceFromLongSecondaryCE32(ce32);
case Collation.EXPANSION32_TAG:
if(Collation.lengthFromCE32(ce32) == 1) {
ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
break;
} else {
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
}
case Collation.EXPANSION_TAG: {
if(Collation.lengthFromCE32(ce32) == 1) {
return d.ces[Collation.indexFromCE32(ce32)];
} else {
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
}
}
case Collation.DIGIT_TAG:
// Fetch the non-numeric-collation CE32 and continue.
ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
break;
case Collation.U0000_TAG:
assert(c == 0);
// Fetch the normal ce32 for U+0000 and continue.
ce32 = d.ce32s[0];
break;
case Collation.OFFSET_TAG:
return d.getCEFromOffsetCE32(c, ce32);
case Collation.IMPLICIT_TAG:
return Collation.unassignedCEFromCodePoint(c);
}
}
return Collation.ceFromSimpleCE32(ce32);
} | java | long getSingleCE(int c) {
CollationData d;
int ce32 = getCE32(c);
if(ce32 == Collation.FALLBACK_CE32) {
d = base;
ce32 = base.getCE32(c);
} else {
d = this;
}
while(Collation.isSpecialCE32(ce32)) {
switch(Collation.tagFromCE32(ce32)) {
case Collation.LATIN_EXPANSION_TAG:
case Collation.BUILDER_DATA_TAG:
case Collation.PREFIX_TAG:
case Collation.CONTRACTION_TAG:
case Collation.HANGUL_TAG:
case Collation.LEAD_SURROGATE_TAG:
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
case Collation.FALLBACK_TAG:
case Collation.RESERVED_TAG_3:
throw new AssertionError(String.format(
"unexpected CE32 tag for U+%04X (CE32 0x%08x)", c, ce32));
case Collation.LONG_PRIMARY_TAG:
return Collation.ceFromLongPrimaryCE32(ce32);
case Collation.LONG_SECONDARY_TAG:
return Collation.ceFromLongSecondaryCE32(ce32);
case Collation.EXPANSION32_TAG:
if(Collation.lengthFromCE32(ce32) == 1) {
ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
break;
} else {
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
}
case Collation.EXPANSION_TAG: {
if(Collation.lengthFromCE32(ce32) == 1) {
return d.ces[Collation.indexFromCE32(ce32)];
} else {
throw new UnsupportedOperationException(String.format(
"there is not exactly one collation element for U+%04X (CE32 0x%08x)",
c, ce32));
}
}
case Collation.DIGIT_TAG:
// Fetch the non-numeric-collation CE32 and continue.
ce32 = d.ce32s[Collation.indexFromCE32(ce32)];
break;
case Collation.U0000_TAG:
assert(c == 0);
// Fetch the normal ce32 for U+0000 and continue.
ce32 = d.ce32s[0];
break;
case Collation.OFFSET_TAG:
return d.getCEFromOffsetCE32(c, ce32);
case Collation.IMPLICIT_TAG:
return Collation.unassignedCEFromCodePoint(c);
}
}
return Collation.ceFromSimpleCE32(ce32);
} | [
"long",
"getSingleCE",
"(",
"int",
"c",
")",
"{",
"CollationData",
"d",
";",
"int",
"ce32",
"=",
"getCE32",
"(",
"c",
")",
";",
"if",
"(",
"ce32",
"==",
"Collation",
".",
"FALLBACK_CE32",
")",
"{",
"d",
"=",
"base",
";",
"ce32",
"=",
"base",
".",
... | Returns the single CE that c maps to.
Throws UnsupportedOperationException if c does not map to a single CE. | [
"Returns",
"the",
"single",
"CE",
"that",
"c",
"maps",
"to",
".",
"Throws",
"UnsupportedOperationException",
"if",
"c",
"does",
"not",
"map",
"to",
"a",
"single",
"CE",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java#L120-L182 |
35,435 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java | CollationData.getLastPrimaryForGroup | public long getLastPrimaryForGroup(int script) {
int index = getScriptIndex(script);
if(index == 0) {
return 0;
}
long limit = scriptStarts[index + 1];
return (limit << 16) - 1;
} | java | public long getLastPrimaryForGroup(int script) {
int index = getScriptIndex(script);
if(index == 0) {
return 0;
}
long limit = scriptStarts[index + 1];
return (limit << 16) - 1;
} | [
"public",
"long",
"getLastPrimaryForGroup",
"(",
"int",
"script",
")",
"{",
"int",
"index",
"=",
"getScriptIndex",
"(",
"script",
")",
";",
"if",
"(",
"index",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"long",
"limit",
"=",
"scriptStarts",
"[",
"in... | Returns the last primary for the script's reordering group.
@return the last primary of the group
(not an actual root collator primary weight),
or 0 if the script is unknown | [
"Returns",
"the",
"last",
"primary",
"for",
"the",
"script",
"s",
"reordering",
"group",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java#L208-L215 |
35,436 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java | CollationData.getGroupForPrimary | public int getGroupForPrimary(long p) {
p >>= 16;
if(p < scriptStarts[1] || scriptStarts[scriptStarts.length - 1] <= p) {
return -1;
}
int index = 1;
while(p >= scriptStarts[index + 1]) { ++index; }
for(int i = 0; i < numScripts; ++i) {
if(scriptsIndex[i] == index) {
return i;
}
}
for(int i = 0; i < MAX_NUM_SPECIAL_REORDER_CODES; ++i) {
if(scriptsIndex[numScripts + i] == index) {
return Collator.ReorderCodes.FIRST + i;
}
}
return -1;
} | java | public int getGroupForPrimary(long p) {
p >>= 16;
if(p < scriptStarts[1] || scriptStarts[scriptStarts.length - 1] <= p) {
return -1;
}
int index = 1;
while(p >= scriptStarts[index + 1]) { ++index; }
for(int i = 0; i < numScripts; ++i) {
if(scriptsIndex[i] == index) {
return i;
}
}
for(int i = 0; i < MAX_NUM_SPECIAL_REORDER_CODES; ++i) {
if(scriptsIndex[numScripts + i] == index) {
return Collator.ReorderCodes.FIRST + i;
}
}
return -1;
} | [
"public",
"int",
"getGroupForPrimary",
"(",
"long",
"p",
")",
"{",
"p",
">>=",
"16",
";",
"if",
"(",
"p",
"<",
"scriptStarts",
"[",
"1",
"]",
"||",
"scriptStarts",
"[",
"scriptStarts",
".",
"length",
"-",
"1",
"]",
"<=",
"p",
")",
"{",
"return",
"-... | Finds the reordering group which contains the primary weight.
@return the first script of the group, or -1 if the weight is beyond the last group | [
"Finds",
"the",
"reordering",
"group",
"which",
"contains",
"the",
"primary",
"weight",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationData.java#L221-L239 |
35,437 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/Charsets.java | Charsets.toBigEndianUtf16Bytes | public static byte[] toBigEndianUtf16Bytes(char[] chars, int offset, int length) {
byte[] result = new byte[length * 2];
int end = offset + length;
int resultIndex = 0;
for (int i = offset; i < end; ++i) {
char ch = chars[i];
result[resultIndex++] = (byte) (ch >> 8);
result[resultIndex++] = (byte) ch;
}
return result;
} | java | public static byte[] toBigEndianUtf16Bytes(char[] chars, int offset, int length) {
byte[] result = new byte[length * 2];
int end = offset + length;
int resultIndex = 0;
for (int i = offset; i < end; ++i) {
char ch = chars[i];
result[resultIndex++] = (byte) (ch >> 8);
result[resultIndex++] = (byte) ch;
}
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"toBigEndianUtf16Bytes",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"length",
"*",
"2",
"]",
";",
"int",
"end",
"=... | Returns a new byte array containing the bytes corresponding to the given characters,
encoded in UTF-16BE. All characters are representable in UTF-16BE. | [
"Returns",
"a",
"new",
"byte",
"array",
"containing",
"the",
"bytes",
"corresponding",
"to",
"the",
"given",
"characters",
"encoded",
"in",
"UTF",
"-",
"16BE",
".",
"All",
"characters",
"are",
"representable",
"in",
"UTF",
"-",
"16BE",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/Charsets.java#L66-L76 |
35,438 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMStringPool.java | DTMStringPool.main | public static void main(String[] args)
{
String[] word={
"Zero","One","Two","Three","Four","Five",
"Six","Seven","Eight","Nine","Ten",
"Eleven","Twelve","Thirteen","Fourteen","Fifteen",
"Sixteen","Seventeen","Eighteen","Nineteen","Twenty",
"Twenty-One","Twenty-Two","Twenty-Three","Twenty-Four",
"Twenty-Five","Twenty-Six","Twenty-Seven","Twenty-Eight",
"Twenty-Nine","Thirty","Thirty-One","Thirty-Two",
"Thirty-Three","Thirty-Four","Thirty-Five","Thirty-Six",
"Thirty-Seven","Thirty-Eight","Thirty-Nine"};
DTMStringPool pool=new DTMStringPool();
System.out.println("If no complaints are printed below, we passed initial test.");
for(int pass=0;pass<=1;++pass)
{
int i;
for(i=0;i<word.length;++i)
{
int j=pool.stringToIndex(word[i]);
if(j!=i)
System.out.println("\tMismatch populating pool: assigned "+
j+" for create "+i);
}
for(i=0;i<word.length;++i)
{
int j=pool.stringToIndex(word[i]);
if(j!=i)
System.out.println("\tMismatch in stringToIndex: returned "+
j+" for lookup "+i);
}
for(i=0;i<word.length;++i)
{
String w=pool.indexToString(i);
if(!word[i].equals(w))
System.out.println("\tMismatch in indexToString: returned"+
w+" for lookup "+i);
}
pool.removeAllElements();
System.out.println("\nPass "+pass+" complete\n");
} // end pass loop
} | java | public static void main(String[] args)
{
String[] word={
"Zero","One","Two","Three","Four","Five",
"Six","Seven","Eight","Nine","Ten",
"Eleven","Twelve","Thirteen","Fourteen","Fifteen",
"Sixteen","Seventeen","Eighteen","Nineteen","Twenty",
"Twenty-One","Twenty-Two","Twenty-Three","Twenty-Four",
"Twenty-Five","Twenty-Six","Twenty-Seven","Twenty-Eight",
"Twenty-Nine","Thirty","Thirty-One","Thirty-Two",
"Thirty-Three","Thirty-Four","Thirty-Five","Thirty-Six",
"Thirty-Seven","Thirty-Eight","Thirty-Nine"};
DTMStringPool pool=new DTMStringPool();
System.out.println("If no complaints are printed below, we passed initial test.");
for(int pass=0;pass<=1;++pass)
{
int i;
for(i=0;i<word.length;++i)
{
int j=pool.stringToIndex(word[i]);
if(j!=i)
System.out.println("\tMismatch populating pool: assigned "+
j+" for create "+i);
}
for(i=0;i<word.length;++i)
{
int j=pool.stringToIndex(word[i]);
if(j!=i)
System.out.println("\tMismatch in stringToIndex: returned "+
j+" for lookup "+i);
}
for(i=0;i<word.length;++i)
{
String w=pool.indexToString(i);
if(!word[i].equals(w))
System.out.println("\tMismatch in indexToString: returned"+
w+" for lookup "+i);
}
pool.removeAllElements();
System.out.println("\nPass "+pass+" complete\n");
} // end pass loop
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"{",
"String",
"[",
"]",
"word",
"=",
"{",
"\"Zero\"",
",",
"\"One\"",
",",
"\"Two\"",
",",
"\"Three\"",
",",
"\"Four\"",
",",
"\"Five\"",
",",
"\"Six\"",
",",
"\"Seven\"",
",",
... | Command-line unit test driver. This test relies on the fact that
this version of the pool assigns indices consecutively, starting
from zero, as new unique strings are encountered. | [
"Command",
"-",
"line",
"unit",
"test",
"driver",
".",
"This",
"test",
"relies",
"on",
"the",
"fact",
"that",
"this",
"version",
"of",
"the",
"pool",
"assigns",
"indices",
"consecutively",
"starting",
"from",
"zero",
"as",
"new",
"unique",
"strings",
"are",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMStringPool.java#L141-L190 |
35,439 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedOutputStream.java | PipedOutputStream.close | @Override
public void close() throws IOException {
// Is the pipe connected?
PipedInputStream stream = target;
if (stream != null) {
stream.done();
target = null;
}
} | java | @Override
public void close() throws IOException {
// Is the pipe connected?
PipedInputStream stream = target;
if (stream != null) {
stream.done();
target = null;
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"// Is the pipe connected?",
"PipedInputStream",
"stream",
"=",
"target",
";",
"if",
"(",
"stream",
"!=",
"null",
")",
"{",
"stream",
".",
"done",
"(",
")",
";",
"target",
... | Closes this stream. If this stream is connected to an input stream, the
input stream is closed and the pipe is disconnected.
@throws IOException
if an error occurs while closing this stream. | [
"Closes",
"this",
"stream",
".",
"If",
"this",
"stream",
"is",
"connected",
"to",
"an",
"input",
"stream",
"the",
"input",
"stream",
"is",
"closed",
"and",
"the",
"pipe",
"is",
"disconnected",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedOutputStream.java#L63-L71 |
35,440 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Inflater.java | Inflater.reset | public void reset() {
synchronized (zsRef) {
ensureOpen();
reset(zsRef.address());
buf = defaultBuf;
finished = false;
needDict = false;
off = len = 0;
bytesRead = bytesWritten = 0;
}
} | java | public void reset() {
synchronized (zsRef) {
ensureOpen();
reset(zsRef.address());
buf = defaultBuf;
finished = false;
needDict = false;
off = len = 0;
bytesRead = bytesWritten = 0;
}
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"synchronized",
"(",
"zsRef",
")",
"{",
"ensureOpen",
"(",
")",
";",
"reset",
"(",
"zsRef",
".",
"address",
"(",
")",
")",
";",
"buf",
"=",
"defaultBuf",
";",
"finished",
"=",
"false",
";",
"needDict",
"=",
... | Resets inflater so that a new set of input data can be processed. | [
"Resets",
"inflater",
"so",
"that",
"a",
"new",
"set",
"of",
"input",
"data",
"can",
"be",
"processed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/Inflater.java#L352-L362 |
35,441 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/AnnualTimeZoneRule.java | AnnualTimeZoneRule.getStartInYear | public Date getStartInYear(int year, int prevRawOffset, int prevDSTSavings) {
if (year < startYear || year > endYear) {
return null;
}
long ruleDay;
int type = dateTimeRule.getDateRuleType();
if (type == DateTimeRule.DOM) {
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(), dateTimeRule.getRuleDayOfMonth());
} else {
boolean after = true;
if (type == DateTimeRule.DOW) {
int weeks = dateTimeRule.getRuleWeekInMonth();
if (weeks > 0) {
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(), 1);
ruleDay += 7 * (weeks - 1);
} else {
after = false;
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(),
Grego.monthLength(year, dateTimeRule.getRuleMonth()));
ruleDay += 7 * (weeks + 1);
}
} else {
int month = dateTimeRule.getRuleMonth();
int dom = dateTimeRule.getRuleDayOfMonth();
if (type == DateTimeRule.DOW_LEQ_DOM) {
after = false;
// Handle Feb <=29
if (month == Calendar.FEBRUARY && dom == 29 && !Grego.isLeapYear(year)) {
dom--;
}
}
ruleDay = Grego.fieldsToDay(year, month, dom);
}
int dow = Grego.dayOfWeek(ruleDay);
int delta = dateTimeRule.getRuleDayOfWeek() - dow;
if (after) {
delta = delta < 0 ? delta + 7 : delta;
} else {
delta = delta > 0 ? delta - 7 : delta;
}
ruleDay += delta;
}
long ruleTime = ruleDay * Grego.MILLIS_PER_DAY + dateTimeRule.getRuleMillisInDay();
if (dateTimeRule.getTimeRuleType() != DateTimeRule.UTC_TIME) {
ruleTime -= prevRawOffset;
}
if (dateTimeRule.getTimeRuleType() == DateTimeRule.WALL_TIME) {
ruleTime -= prevDSTSavings;
}
return new Date(ruleTime);
} | java | public Date getStartInYear(int year, int prevRawOffset, int prevDSTSavings) {
if (year < startYear || year > endYear) {
return null;
}
long ruleDay;
int type = dateTimeRule.getDateRuleType();
if (type == DateTimeRule.DOM) {
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(), dateTimeRule.getRuleDayOfMonth());
} else {
boolean after = true;
if (type == DateTimeRule.DOW) {
int weeks = dateTimeRule.getRuleWeekInMonth();
if (weeks > 0) {
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(), 1);
ruleDay += 7 * (weeks - 1);
} else {
after = false;
ruleDay = Grego.fieldsToDay(year, dateTimeRule.getRuleMonth(),
Grego.monthLength(year, dateTimeRule.getRuleMonth()));
ruleDay += 7 * (weeks + 1);
}
} else {
int month = dateTimeRule.getRuleMonth();
int dom = dateTimeRule.getRuleDayOfMonth();
if (type == DateTimeRule.DOW_LEQ_DOM) {
after = false;
// Handle Feb <=29
if (month == Calendar.FEBRUARY && dom == 29 && !Grego.isLeapYear(year)) {
dom--;
}
}
ruleDay = Grego.fieldsToDay(year, month, dom);
}
int dow = Grego.dayOfWeek(ruleDay);
int delta = dateTimeRule.getRuleDayOfWeek() - dow;
if (after) {
delta = delta < 0 ? delta + 7 : delta;
} else {
delta = delta > 0 ? delta - 7 : delta;
}
ruleDay += delta;
}
long ruleTime = ruleDay * Grego.MILLIS_PER_DAY + dateTimeRule.getRuleMillisInDay();
if (dateTimeRule.getTimeRuleType() != DateTimeRule.UTC_TIME) {
ruleTime -= prevRawOffset;
}
if (dateTimeRule.getTimeRuleType() == DateTimeRule.WALL_TIME) {
ruleTime -= prevDSTSavings;
}
return new Date(ruleTime);
} | [
"public",
"Date",
"getStartInYear",
"(",
"int",
"year",
",",
"int",
"prevRawOffset",
",",
"int",
"prevDSTSavings",
")",
"{",
"if",
"(",
"year",
"<",
"startYear",
"||",
"year",
">",
"endYear",
")",
"{",
"return",
"null",
";",
"}",
"long",
"ruleDay",
";",
... | Gets the time when this rule takes effect in the given year.
@param year The Gregorian year, with 0 == 1 BCE, -1 == 2 BCE, etc.
@param prevRawOffset The standard time offset from UTC before this rule
takes effect in milliseconds.
@param prevDSTSavings The amount of daylight saving offset from the
standard time.
@return The time when this rule takes effect in the year, or
null if this rule is not applicable in the year. | [
"Gets",
"the",
"time",
"when",
"this",
"rule",
"takes",
"effect",
"in",
"the",
"given",
"year",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/AnnualTimeZoneRule.java#L101-L155 |
35,442 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getAvailableULocales | public ULocale[] getAvailableULocales() {
Set<String> keys = getLocaleIdToRulesIdMap(PluralType.CARDINAL).keySet();
ULocale[] locales = new ULocale[keys.size()];
int n = 0;
for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
locales[n++] = ULocale.createCanonical(iter.next());
}
return locales;
} | java | public ULocale[] getAvailableULocales() {
Set<String> keys = getLocaleIdToRulesIdMap(PluralType.CARDINAL).keySet();
ULocale[] locales = new ULocale[keys.size()];
int n = 0;
for (Iterator<String> iter = keys.iterator(); iter.hasNext();) {
locales[n++] = ULocale.createCanonical(iter.next());
}
return locales;
} | [
"public",
"ULocale",
"[",
"]",
"getAvailableULocales",
"(",
")",
"{",
"Set",
"<",
"String",
">",
"keys",
"=",
"getLocaleIdToRulesIdMap",
"(",
"PluralType",
".",
"CARDINAL",
")",
".",
"keySet",
"(",
")",
";",
"ULocale",
"[",
"]",
"locales",
"=",
"new",
"U... | Returns the locales for which we have plurals data. Utility for testing. | [
"Returns",
"the",
"locales",
"for",
"which",
"we",
"have",
"plurals",
"data",
".",
"Utility",
"for",
"testing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L50-L58 |
35,443 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getFunctionalEquivalent | public ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) {
if (isAvailable != null && isAvailable.length > 0) {
String localeId = ULocale.canonicalize(locale.getBaseName());
Map<String, String> idMap = getLocaleIdToRulesIdMap(PluralType.CARDINAL);
isAvailable[0] = idMap.containsKey(localeId);
}
String rulesId = getRulesIdForLocale(locale, PluralType.CARDINAL);
if (rulesId == null || rulesId.trim().length() == 0) {
return ULocale.ROOT; // ultimate fallback
}
ULocale result = getRulesIdToEquivalentULocaleMap().get(
rulesId);
if (result == null) {
return ULocale.ROOT; // ultimate fallback
}
return result;
} | java | public ULocale getFunctionalEquivalent(ULocale locale, boolean[] isAvailable) {
if (isAvailable != null && isAvailable.length > 0) {
String localeId = ULocale.canonicalize(locale.getBaseName());
Map<String, String> idMap = getLocaleIdToRulesIdMap(PluralType.CARDINAL);
isAvailable[0] = idMap.containsKey(localeId);
}
String rulesId = getRulesIdForLocale(locale, PluralType.CARDINAL);
if (rulesId == null || rulesId.trim().length() == 0) {
return ULocale.ROOT; // ultimate fallback
}
ULocale result = getRulesIdToEquivalentULocaleMap().get(
rulesId);
if (result == null) {
return ULocale.ROOT; // ultimate fallback
}
return result;
} | [
"public",
"ULocale",
"getFunctionalEquivalent",
"(",
"ULocale",
"locale",
",",
"boolean",
"[",
"]",
"isAvailable",
")",
"{",
"if",
"(",
"isAvailable",
"!=",
"null",
"&&",
"isAvailable",
".",
"length",
">",
"0",
")",
"{",
"String",
"localeId",
"=",
"ULocale",... | Returns the functionally equivalent locale. | [
"Returns",
"the",
"functionally",
"equivalent",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L63-L82 |
35,444 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getLocaleIdToRulesIdMap | private Map<String, String> getLocaleIdToRulesIdMap(PluralType type) {
checkBuildRulesIdMaps();
return (type == PluralType.CARDINAL) ? localeIdToCardinalRulesId : localeIdToOrdinalRulesId;
} | java | private Map<String, String> getLocaleIdToRulesIdMap(PluralType type) {
checkBuildRulesIdMaps();
return (type == PluralType.CARDINAL) ? localeIdToCardinalRulesId : localeIdToOrdinalRulesId;
} | [
"private",
"Map",
"<",
"String",
",",
"String",
">",
"getLocaleIdToRulesIdMap",
"(",
"PluralType",
"type",
")",
"{",
"checkBuildRulesIdMaps",
"(",
")",
";",
"return",
"(",
"type",
"==",
"PluralType",
".",
"CARDINAL",
")",
"?",
"localeIdToCardinalRulesId",
":",
... | Returns the lazily-constructed map. | [
"Returns",
"the",
"lazily",
"-",
"constructed",
"map",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L87-L90 |
35,445 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.checkBuildRulesIdMaps | private void checkBuildRulesIdMaps() {
boolean haveMap;
synchronized (this) {
haveMap = localeIdToCardinalRulesId != null;
}
if (!haveMap) {
Map<String, String> tempLocaleIdToCardinalRulesId;
Map<String, String> tempLocaleIdToOrdinalRulesId;
Map<String, ULocale> tempRulesIdToEquivalentULocale;
try {
UResourceBundle pluralb = getPluralBundle();
// Read cardinal-number rules.
UResourceBundle localeb = pluralb.get("locales");
// sort for convenience of getAvailableULocales
tempLocaleIdToCardinalRulesId = new TreeMap<String, String>();
// not visible
tempRulesIdToEquivalentULocale = new HashMap<String, ULocale>();
for (int i = 0; i < localeb.getSize(); ++i) {
UResourceBundle b = localeb.get(i);
String id = b.getKey();
String value = b.getString().intern();
tempLocaleIdToCardinalRulesId.put(id, value);
if (!tempRulesIdToEquivalentULocale.containsKey(value)) {
tempRulesIdToEquivalentULocale.put(value, new ULocale(id));
}
}
// Read ordinal-number rules.
localeb = pluralb.get("locales_ordinals");
tempLocaleIdToOrdinalRulesId = new TreeMap<String, String>();
for (int i = 0; i < localeb.getSize(); ++i) {
UResourceBundle b = localeb.get(i);
String id = b.getKey();
String value = b.getString().intern();
tempLocaleIdToOrdinalRulesId.put(id, value);
}
} catch (MissingResourceException e) {
// dummy so we don't try again
tempLocaleIdToCardinalRulesId = Collections.emptyMap();
tempLocaleIdToOrdinalRulesId = Collections.emptyMap();
tempRulesIdToEquivalentULocale = Collections.emptyMap();
}
synchronized(this) {
if (localeIdToCardinalRulesId == null) {
localeIdToCardinalRulesId = tempLocaleIdToCardinalRulesId;
localeIdToOrdinalRulesId = tempLocaleIdToOrdinalRulesId;
rulesIdToEquivalentULocale = tempRulesIdToEquivalentULocale;
}
}
}
} | java | private void checkBuildRulesIdMaps() {
boolean haveMap;
synchronized (this) {
haveMap = localeIdToCardinalRulesId != null;
}
if (!haveMap) {
Map<String, String> tempLocaleIdToCardinalRulesId;
Map<String, String> tempLocaleIdToOrdinalRulesId;
Map<String, ULocale> tempRulesIdToEquivalentULocale;
try {
UResourceBundle pluralb = getPluralBundle();
// Read cardinal-number rules.
UResourceBundle localeb = pluralb.get("locales");
// sort for convenience of getAvailableULocales
tempLocaleIdToCardinalRulesId = new TreeMap<String, String>();
// not visible
tempRulesIdToEquivalentULocale = new HashMap<String, ULocale>();
for (int i = 0; i < localeb.getSize(); ++i) {
UResourceBundle b = localeb.get(i);
String id = b.getKey();
String value = b.getString().intern();
tempLocaleIdToCardinalRulesId.put(id, value);
if (!tempRulesIdToEquivalentULocale.containsKey(value)) {
tempRulesIdToEquivalentULocale.put(value, new ULocale(id));
}
}
// Read ordinal-number rules.
localeb = pluralb.get("locales_ordinals");
tempLocaleIdToOrdinalRulesId = new TreeMap<String, String>();
for (int i = 0; i < localeb.getSize(); ++i) {
UResourceBundle b = localeb.get(i);
String id = b.getKey();
String value = b.getString().intern();
tempLocaleIdToOrdinalRulesId.put(id, value);
}
} catch (MissingResourceException e) {
// dummy so we don't try again
tempLocaleIdToCardinalRulesId = Collections.emptyMap();
tempLocaleIdToOrdinalRulesId = Collections.emptyMap();
tempRulesIdToEquivalentULocale = Collections.emptyMap();
}
synchronized(this) {
if (localeIdToCardinalRulesId == null) {
localeIdToCardinalRulesId = tempLocaleIdToCardinalRulesId;
localeIdToOrdinalRulesId = tempLocaleIdToOrdinalRulesId;
rulesIdToEquivalentULocale = tempRulesIdToEquivalentULocale;
}
}
}
} | [
"private",
"void",
"checkBuildRulesIdMaps",
"(",
")",
"{",
"boolean",
"haveMap",
";",
"synchronized",
"(",
"this",
")",
"{",
"haveMap",
"=",
"localeIdToCardinalRulesId",
"!=",
"null",
";",
"}",
"if",
"(",
"!",
"haveMap",
")",
"{",
"Map",
"<",
"String",
","... | Lazily constructs the localeIdToRulesId and rulesIdToEquivalentULocale
maps if necessary. These exactly reflect the contents of the locales
resource in plurals.res. | [
"Lazily",
"constructs",
"the",
"localeIdToRulesId",
"and",
"rulesIdToEquivalentULocale",
"maps",
"if",
"necessary",
".",
"These",
"exactly",
"reflect",
"the",
"contents",
"of",
"the",
"locales",
"resource",
"in",
"plurals",
".",
"res",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L105-L159 |
35,446 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getRulesIdForLocale | public String getRulesIdForLocale(ULocale locale, PluralType type) {
Map<String, String> idMap = getLocaleIdToRulesIdMap(type);
String localeId = ULocale.canonicalize(locale.getBaseName());
String rulesId = null;
while (null == (rulesId = idMap.get(localeId))) {
int ix = localeId.lastIndexOf("_");
if (ix == -1) {
break;
}
localeId = localeId.substring(0, ix);
}
return rulesId;
} | java | public String getRulesIdForLocale(ULocale locale, PluralType type) {
Map<String, String> idMap = getLocaleIdToRulesIdMap(type);
String localeId = ULocale.canonicalize(locale.getBaseName());
String rulesId = null;
while (null == (rulesId = idMap.get(localeId))) {
int ix = localeId.lastIndexOf("_");
if (ix == -1) {
break;
}
localeId = localeId.substring(0, ix);
}
return rulesId;
} | [
"public",
"String",
"getRulesIdForLocale",
"(",
"ULocale",
"locale",
",",
"PluralType",
"type",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"idMap",
"=",
"getLocaleIdToRulesIdMap",
"(",
"type",
")",
";",
"String",
"localeId",
"=",
"ULocale",
".",
"ca... | Gets the rulesId from the locale,with locale fallback. If there is no
rulesId, return null. The rulesId might be the empty string if the rule
is the default rule. | [
"Gets",
"the",
"rulesId",
"from",
"the",
"locale",
"with",
"locale",
"fallback",
".",
"If",
"there",
"is",
"no",
"rulesId",
"return",
"null",
".",
"The",
"rulesId",
"might",
"be",
"the",
"empty",
"string",
"if",
"the",
"rule",
"is",
"the",
"default",
"ru... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L166-L178 |
35,447 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getRulesForRulesId | public PluralRules getRulesForRulesId(String rulesId) {
// synchronize on the map. release the lock temporarily while we build the rules.
PluralRules rules = null;
boolean hasRules; // Separate boolean because stored rules can be null.
synchronized (rulesIdToRules) {
hasRules = rulesIdToRules.containsKey(rulesId);
if (hasRules) {
rules = rulesIdToRules.get(rulesId); // can be null
}
}
if (!hasRules) {
try {
UResourceBundle pluralb = getPluralBundle();
UResourceBundle rulesb = pluralb.get("rules");
UResourceBundle setb = rulesb.get(rulesId);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < setb.getSize(); ++i) {
UResourceBundle b = setb.get(i);
if (i > 0) {
sb.append("; ");
}
sb.append(b.getKey());
sb.append(": ");
sb.append(b.getString());
}
rules = PluralRules.parseDescription(sb.toString());
} catch (ParseException e) {
} catch (MissingResourceException e) {
}
synchronized (rulesIdToRules) {
if (rulesIdToRules.containsKey(rulesId)) {
rules = rulesIdToRules.get(rulesId);
} else {
rulesIdToRules.put(rulesId, rules); // can be null
}
}
}
return rules;
} | java | public PluralRules getRulesForRulesId(String rulesId) {
// synchronize on the map. release the lock temporarily while we build the rules.
PluralRules rules = null;
boolean hasRules; // Separate boolean because stored rules can be null.
synchronized (rulesIdToRules) {
hasRules = rulesIdToRules.containsKey(rulesId);
if (hasRules) {
rules = rulesIdToRules.get(rulesId); // can be null
}
}
if (!hasRules) {
try {
UResourceBundle pluralb = getPluralBundle();
UResourceBundle rulesb = pluralb.get("rules");
UResourceBundle setb = rulesb.get(rulesId);
StringBuilder sb = new StringBuilder();
for (int i = 0; i < setb.getSize(); ++i) {
UResourceBundle b = setb.get(i);
if (i > 0) {
sb.append("; ");
}
sb.append(b.getKey());
sb.append(": ");
sb.append(b.getString());
}
rules = PluralRules.parseDescription(sb.toString());
} catch (ParseException e) {
} catch (MissingResourceException e) {
}
synchronized (rulesIdToRules) {
if (rulesIdToRules.containsKey(rulesId)) {
rules = rulesIdToRules.get(rulesId);
} else {
rulesIdToRules.put(rulesId, rules); // can be null
}
}
}
return rules;
} | [
"public",
"PluralRules",
"getRulesForRulesId",
"(",
"String",
"rulesId",
")",
"{",
"// synchronize on the map. release the lock temporarily while we build the rules.",
"PluralRules",
"rules",
"=",
"null",
";",
"boolean",
"hasRules",
";",
"// Separate boolean because stored rules c... | Gets the rule from the rulesId. If there is no rule for this rulesId,
return null. | [
"Gets",
"the",
"rule",
"from",
"the",
"rulesId",
".",
"If",
"there",
"is",
"no",
"rule",
"for",
"this",
"rulesId",
"return",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L184-L223 |
35,448 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.getPluralBundle | public UResourceBundle getPluralBundle() throws MissingResourceException {
return ICUResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME, "plurals",
ICUResourceBundle.ICU_DATA_CLASS_LOADER, true);
} | java | public UResourceBundle getPluralBundle() throws MissingResourceException {
return ICUResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME, "plurals",
ICUResourceBundle.ICU_DATA_CLASS_LOADER, true);
} | [
"public",
"UResourceBundle",
"getPluralBundle",
"(",
")",
"throws",
"MissingResourceException",
"{",
"return",
"ICUResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",
"\"plurals\"",
",",
"ICUResourceBundle",
".",
"ICU_DATA_CLASS_LOADER",
... | Return the plurals resource. Note MissingResourceException is unchecked,
listed here for clarity. Callers should handle this exception. | [
"Return",
"the",
"plurals",
"resource",
".",
"Note",
"MissingResourceException",
"is",
"unchecked",
"listed",
"here",
"for",
"clarity",
".",
"Callers",
"should",
"handle",
"this",
"exception",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L229-L233 |
35,449 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java | PluralRulesLoader.forLocale | public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT;
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT;
}
return rules;
} | java | public PluralRules forLocale(ULocale locale, PluralRules.PluralType type) {
String rulesId = getRulesIdForLocale(locale, type);
if (rulesId == null || rulesId.trim().length() == 0) {
return PluralRules.DEFAULT;
}
PluralRules rules = getRulesForRulesId(rulesId);
if (rules == null) {
rules = PluralRules.DEFAULT;
}
return rules;
} | [
"public",
"PluralRules",
"forLocale",
"(",
"ULocale",
"locale",
",",
"PluralRules",
".",
"PluralType",
"type",
")",
"{",
"String",
"rulesId",
"=",
"getRulesIdForLocale",
"(",
"locale",
",",
"type",
")",
";",
"if",
"(",
"rulesId",
"==",
"null",
"||",
"rulesId... | Returns the plural rules for the the locale. If we don't have data,
android.icu.text.PluralRules.DEFAULT is returned. | [
"Returns",
"the",
"plural",
"rules",
"for",
"the",
"the",
"locale",
".",
"If",
"we",
"don",
"t",
"have",
"data",
"android",
".",
"icu",
".",
"text",
".",
"PluralRules",
".",
"DEFAULT",
"is",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PluralRulesLoader.java#L239-L249 |
35,450 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java | CharsetDecoder.replaceWith | public final CharsetDecoder replaceWith(String newReplacement) {
if (newReplacement == null)
throw new IllegalArgumentException("Null replacement");
int len = newReplacement.length();
if (len == 0)
throw new IllegalArgumentException("Empty replacement");
if (len > maxCharsPerByte)
throw new IllegalArgumentException("Replacement too long");
this.replacement = newReplacement;
implReplaceWith(newReplacement);
return this;
} | java | public final CharsetDecoder replaceWith(String newReplacement) {
if (newReplacement == null)
throw new IllegalArgumentException("Null replacement");
int len = newReplacement.length();
if (len == 0)
throw new IllegalArgumentException("Empty replacement");
if (len > maxCharsPerByte)
throw new IllegalArgumentException("Replacement too long");
this.replacement = newReplacement;
implReplaceWith(newReplacement);
return this;
} | [
"public",
"final",
"CharsetDecoder",
"replaceWith",
"(",
"String",
"newReplacement",
")",
"{",
"if",
"(",
"newReplacement",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null replacement\"",
")",
";",
"int",
"len",
"=",
"newReplacement",
"... | Changes this decoder's replacement value.
<p> This method invokes the {@link #implReplaceWith implReplaceWith}
method, passing the new replacement, after checking that the new
replacement is acceptable. </p>
@param newReplacement
The new replacement; must not be <tt>null</tt>
and must have non-zero length
@return This decoder
@throws IllegalArgumentException
If the preconditions on the parameter do not hold | [
"Changes",
"this",
"decoder",
"s",
"replacement",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java#L278-L293 |
35,451 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java | CharsetDecoder.onUnmappableCharacter | public final CharsetDecoder onUnmappableCharacter(CodingErrorAction
newAction)
{
if (newAction == null)
throw new IllegalArgumentException("Null action");
unmappableCharacterAction = newAction;
implOnUnmappableCharacter(newAction);
return this;
} | java | public final CharsetDecoder onUnmappableCharacter(CodingErrorAction
newAction)
{
if (newAction == null)
throw new IllegalArgumentException("Null action");
unmappableCharacterAction = newAction;
implOnUnmappableCharacter(newAction);
return this;
} | [
"public",
"final",
"CharsetDecoder",
"onUnmappableCharacter",
"(",
"CodingErrorAction",
"newAction",
")",
"{",
"if",
"(",
"newAction",
"==",
"null",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Null action\"",
")",
";",
"unmappableCharacterAction",
"=",
"n... | Changes this decoder's action for unmappable-character errors.
<p> This method invokes the {@link #implOnUnmappableCharacter
implOnUnmappableCharacter} method, passing the new action. </p>
@param newAction The new action; must not be <tt>null</tt>
@return This decoder
@throws IllegalArgumentException
If the precondition on the parameter does not hold | [
"Changes",
"this",
"decoder",
"s",
"action",
"for",
"unmappable",
"-",
"character",
"errors",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java#L410-L418 |
35,452 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java | CharsetDecoder.decode | public final CoderResult decode(ByteBuffer in, CharBuffer out,
boolean endOfInput)
{
int newState = endOfInput ? ST_END : ST_CODING;
if ((state != ST_RESET) && (state != ST_CODING)
&& !(endOfInput && (state == ST_END)))
throwIllegalStateException(state, newState);
state = newState;
for (;;) {
CoderResult cr;
try {
cr = decodeLoop(in, out);
} catch (BufferUnderflowException x) {
throw new CoderMalfunctionError(x);
} catch (BufferOverflowException x) {
throw new CoderMalfunctionError(x);
}
if (cr.isOverflow())
return cr;
if (cr.isUnderflow()) {
if (endOfInput && in.hasRemaining()) {
cr = CoderResult.malformedForLength(in.remaining());
// Fall through to malformed-input case
} else {
return cr;
}
}
CodingErrorAction action = null;
if (cr.isMalformed())
action = malformedInputAction;
else if (cr.isUnmappable())
action = unmappableCharacterAction;
else
assert false : cr.toString();
if (action == CodingErrorAction.REPORT)
return cr;
if (action == CodingErrorAction.REPLACE) {
if (out.remaining() < replacement.length())
return CoderResult.OVERFLOW;
out.put(replacement);
}
if ((action == CodingErrorAction.IGNORE)
|| (action == CodingErrorAction.REPLACE)) {
// Skip erroneous input either way
in.position(in.position() + cr.length());
continue;
}
assert false;
}
} | java | public final CoderResult decode(ByteBuffer in, CharBuffer out,
boolean endOfInput)
{
int newState = endOfInput ? ST_END : ST_CODING;
if ((state != ST_RESET) && (state != ST_CODING)
&& !(endOfInput && (state == ST_END)))
throwIllegalStateException(state, newState);
state = newState;
for (;;) {
CoderResult cr;
try {
cr = decodeLoop(in, out);
} catch (BufferUnderflowException x) {
throw new CoderMalfunctionError(x);
} catch (BufferOverflowException x) {
throw new CoderMalfunctionError(x);
}
if (cr.isOverflow())
return cr;
if (cr.isUnderflow()) {
if (endOfInput && in.hasRemaining()) {
cr = CoderResult.malformedForLength(in.remaining());
// Fall through to malformed-input case
} else {
return cr;
}
}
CodingErrorAction action = null;
if (cr.isMalformed())
action = malformedInputAction;
else if (cr.isUnmappable())
action = unmappableCharacterAction;
else
assert false : cr.toString();
if (action == CodingErrorAction.REPORT)
return cr;
if (action == CodingErrorAction.REPLACE) {
if (out.remaining() < replacement.length())
return CoderResult.OVERFLOW;
out.put(replacement);
}
if ((action == CodingErrorAction.IGNORE)
|| (action == CodingErrorAction.REPLACE)) {
// Skip erroneous input either way
in.position(in.position() + cr.length());
continue;
}
assert false;
}
} | [
"public",
"final",
"CoderResult",
"decode",
"(",
"ByteBuffer",
"in",
",",
"CharBuffer",
"out",
",",
"boolean",
"endOfInput",
")",
"{",
"int",
"newState",
"=",
"endOfInput",
"?",
"ST_END",
":",
"ST_CODING",
";",
"if",
"(",
"(",
"state",
"!=",
"ST_RESET",
")... | Decodes as many bytes as possible from the given input buffer,
writing the results to the given output buffer.
<p> The buffers are read from, and written to, starting at their current
positions. At most {@link Buffer#remaining in.remaining()} bytes
will be read and at most {@link Buffer#remaining out.remaining()}
characters will be written. The buffers' positions will be advanced to
reflect the bytes read and the characters written, but their marks and
limits will not be modified.
<p> In addition to reading bytes from the input buffer and writing
characters to the output buffer, this method returns a {@link CoderResult}
object to describe its reason for termination:
<ul>
<li><p> {@link CoderResult#UNDERFLOW} indicates that as much of the
input buffer as possible has been decoded. If there is no further
input then the invoker can proceed to the next step of the
<a href="#steps">decoding operation</a>. Otherwise this method
should be invoked again with further input. </p></li>
<li><p> {@link CoderResult#OVERFLOW} indicates that there is
insufficient space in the output buffer to decode any more bytes.
This method should be invoked again with an output buffer that has
more {@linkplain Buffer#remaining remaining} characters. This is
typically done by draining any decoded characters from the output
buffer. </p></li>
<li><p> A {@link CoderResult#malformedForLength
</code>malformed-input<code>} result indicates that a malformed-input
error has been detected. The malformed bytes begin at the input
buffer's (possibly incremented) position; the number of malformed
bytes may be determined by invoking the result object's {@link
CoderResult#length() length} method. This case applies only if the
{@link #onMalformedInput </code>malformed action<code>} of this decoder
is {@link CodingErrorAction#REPORT}; otherwise the malformed input
will be ignored or replaced, as requested. </p></li>
<li><p> An {@link CoderResult#unmappableForLength
</code>unmappable-character<code>} result indicates that an
unmappable-character error has been detected. The bytes that
decode the unmappable character begin at the input buffer's (possibly
incremented) position; the number of such bytes may be determined
by invoking the result object's {@link CoderResult#length() length}
method. This case applies only if the {@link #onUnmappableCharacter
</code>unmappable action<code>} of this decoder is {@link
CodingErrorAction#REPORT}; otherwise the unmappable character will be
ignored or replaced, as requested. </p></li>
</ul>
In any case, if this method is to be reinvoked in the same decoding
operation then care should be taken to preserve any bytes remaining
in the input buffer so that they are available to the next invocation.
<p> The <tt>endOfInput</tt> parameter advises this method as to whether
the invoker can provide further input beyond that contained in the given
input buffer. If there is a possibility of providing additional input
then the invoker should pass <tt>false</tt> for this parameter; if there
is no possibility of providing further input then the invoker should
pass <tt>true</tt>. It is not erroneous, and in fact it is quite
common, to pass <tt>false</tt> in one invocation and later discover that
no further input was actually available. It is critical, however, that
the final invocation of this method in a sequence of invocations always
pass <tt>true</tt> so that any remaining undecoded input will be treated
as being malformed.
<p> This method works by invoking the {@link #decodeLoop decodeLoop}
method, interpreting its results, handling error conditions, and
reinvoking it as necessary. </p>
@param in
The input byte buffer
@param out
The output character buffer
@param endOfInput
<tt>true</tt> if, and only if, the invoker can provide no
additional input bytes beyond those in the given buffer
@return A coder-result object describing the reason for termination
@throws IllegalStateException
If a decoding operation is already in progress and the previous
step was an invocation neither of the {@link #reset reset}
method, nor of this method with a value of <tt>false</tt> for
the <tt>endOfInput</tt> parameter, nor of this method with a
value of <tt>true</tt> for the <tt>endOfInput</tt> parameter
but a return value indicating an incomplete decoding operation
@throws CoderMalfunctionError
If an invocation of the decodeLoop method threw
an unexpected exception | [
"Decodes",
"as",
"many",
"bytes",
"as",
"possible",
"from",
"the",
"given",
"input",
"buffer",
"writing",
"the",
"results",
"to",
"the",
"given",
"output",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java#L551-L610 |
35,453 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java | CharsetDecoder.flush | public final CoderResult flush(CharBuffer out) {
if (state == ST_END) {
CoderResult cr = implFlush(out);
if (cr.isUnderflow())
state = ST_FLUSHED;
return cr;
}
if (state != ST_FLUSHED)
throwIllegalStateException(state, ST_FLUSHED);
return CoderResult.UNDERFLOW; // Already flushed
} | java | public final CoderResult flush(CharBuffer out) {
if (state == ST_END) {
CoderResult cr = implFlush(out);
if (cr.isUnderflow())
state = ST_FLUSHED;
return cr;
}
if (state != ST_FLUSHED)
throwIllegalStateException(state, ST_FLUSHED);
return CoderResult.UNDERFLOW; // Already flushed
} | [
"public",
"final",
"CoderResult",
"flush",
"(",
"CharBuffer",
"out",
")",
"{",
"if",
"(",
"state",
"==",
"ST_END",
")",
"{",
"CoderResult",
"cr",
"=",
"implFlush",
"(",
"out",
")",
";",
"if",
"(",
"cr",
".",
"isUnderflow",
"(",
")",
")",
"state",
"="... | Flushes this decoder.
<p> Some decoders maintain internal state and may need to write some
final characters to the output buffer once the overall input sequence has
been read.
<p> Any additional output is written to the output buffer beginning at
its current position. At most {@link Buffer#remaining out.remaining()}
characters will be written. The buffer's position will be advanced
appropriately, but its mark and limit will not be modified.
<p> If this method completes successfully then it returns {@link
CoderResult#UNDERFLOW}. If there is insufficient room in the output
buffer then it returns {@link CoderResult#OVERFLOW}. If this happens
then this method must be invoked again, with an output buffer that has
more room, in order to complete the current <a href="#steps">decoding
operation</a>.
<p> If this decoder has already been flushed then invoking this method
has no effect.
<p> This method invokes the {@link #implFlush implFlush} method to
perform the actual flushing operation. </p>
@param out
The output character buffer
@return A coder-result object, either {@link CoderResult#UNDERFLOW} or
{@link CoderResult#OVERFLOW}
@throws IllegalStateException
If the previous step of the current decoding operation was an
invocation neither of the {@link #flush flush} method nor of
the three-argument {@link
#decode(ByteBuffer,CharBuffer,boolean) decode} method
with a value of <tt>true</tt> for the <tt>endOfInput</tt>
parameter | [
"Flushes",
"this",
"decoder",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/charset/CharsetDecoder.java#L651-L663 |
35,454 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | ICUBinary.readHeader | public static int readHeader(ByteBuffer bytes, int dataFormat, Authenticate authenticate)
throws IOException {
assert bytes != null && bytes.position() == 0;
byte magic1 = bytes.get(2);
byte magic2 = bytes.get(3);
if (magic1 != MAGIC1 || magic2 != MAGIC2) {
throw new IOException(MAGIC_NUMBER_AUTHENTICATION_FAILED_);
}
byte isBigEndian = bytes.get(8);
byte charsetFamily = bytes.get(9);
byte sizeofUChar = bytes.get(10);
if (isBigEndian < 0 || 1 < isBigEndian ||
charsetFamily != CHAR_SET_ || sizeofUChar != CHAR_SIZE_) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_);
}
bytes.order(isBigEndian != 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
int headerSize = bytes.getChar(0);
int sizeofUDataInfo = bytes.getChar(4);
if (sizeofUDataInfo < 20 || headerSize < (sizeofUDataInfo + 4)) {
throw new IOException("Internal Error: Header size error");
}
// TODO: Change Authenticate to take int major, int minor, int milli, int micro
// to avoid array allocation.
byte[] formatVersion = new byte[] {
bytes.get(16), bytes.get(17), bytes.get(18), bytes.get(19)
};
if (bytes.get(12) != (byte)(dataFormat >> 24) ||
bytes.get(13) != (byte)(dataFormat >> 16) ||
bytes.get(14) != (byte)(dataFormat >> 8) ||
bytes.get(15) != (byte)dataFormat ||
(authenticate != null && !authenticate.isDataVersionAcceptable(formatVersion))) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_ +
String.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d",
bytes.get(12), bytes.get(13), bytes.get(14), bytes.get(15),
formatVersion[0] & 0xff, formatVersion[1] & 0xff,
formatVersion[2] & 0xff, formatVersion[3] & 0xff));
}
bytes.position(headerSize);
return // dataVersion
(bytes.get(20) << 24) |
((bytes.get(21) & 0xff) << 16) |
((bytes.get(22) & 0xff) << 8) |
(bytes.get(23) & 0xff);
} | java | public static int readHeader(ByteBuffer bytes, int dataFormat, Authenticate authenticate)
throws IOException {
assert bytes != null && bytes.position() == 0;
byte magic1 = bytes.get(2);
byte magic2 = bytes.get(3);
if (magic1 != MAGIC1 || magic2 != MAGIC2) {
throw new IOException(MAGIC_NUMBER_AUTHENTICATION_FAILED_);
}
byte isBigEndian = bytes.get(8);
byte charsetFamily = bytes.get(9);
byte sizeofUChar = bytes.get(10);
if (isBigEndian < 0 || 1 < isBigEndian ||
charsetFamily != CHAR_SET_ || sizeofUChar != CHAR_SIZE_) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_);
}
bytes.order(isBigEndian != 0 ? ByteOrder.BIG_ENDIAN : ByteOrder.LITTLE_ENDIAN);
int headerSize = bytes.getChar(0);
int sizeofUDataInfo = bytes.getChar(4);
if (sizeofUDataInfo < 20 || headerSize < (sizeofUDataInfo + 4)) {
throw new IOException("Internal Error: Header size error");
}
// TODO: Change Authenticate to take int major, int minor, int milli, int micro
// to avoid array allocation.
byte[] formatVersion = new byte[] {
bytes.get(16), bytes.get(17), bytes.get(18), bytes.get(19)
};
if (bytes.get(12) != (byte)(dataFormat >> 24) ||
bytes.get(13) != (byte)(dataFormat >> 16) ||
bytes.get(14) != (byte)(dataFormat >> 8) ||
bytes.get(15) != (byte)dataFormat ||
(authenticate != null && !authenticate.isDataVersionAcceptable(formatVersion))) {
throw new IOException(HEADER_AUTHENTICATION_FAILED_ +
String.format("; data format %02x%02x%02x%02x, format version %d.%d.%d.%d",
bytes.get(12), bytes.get(13), bytes.get(14), bytes.get(15),
formatVersion[0] & 0xff, formatVersion[1] & 0xff,
formatVersion[2] & 0xff, formatVersion[3] & 0xff));
}
bytes.position(headerSize);
return // dataVersion
(bytes.get(20) << 24) |
((bytes.get(21) & 0xff) << 16) |
((bytes.get(22) & 0xff) << 8) |
(bytes.get(23) & 0xff);
} | [
"public",
"static",
"int",
"readHeader",
"(",
"ByteBuffer",
"bytes",
",",
"int",
"dataFormat",
",",
"Authenticate",
"authenticate",
")",
"throws",
"IOException",
"{",
"assert",
"bytes",
"!=",
"null",
"&&",
"bytes",
".",
"position",
"(",
")",
"==",
"0",
";",
... | Reads an ICU data header, checks the data format, and returns the data version.
<p>Assumes that the ByteBuffer position is 0 on input.
The buffer byte order is set according to the data.
The buffer position is advanced past the header (including UDataInfo and comment).
<p>See C++ ucmndata.h and unicode/udata.h.
@return dataVersion
@throws IOException if this is not a valid ICU data item of the expected dataFormat | [
"Reads",
"an",
"ICU",
"data",
"header",
"checks",
"the",
"data",
"format",
"and",
"returns",
"the",
"data",
"version",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java#L575-L621 |
35,455 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | ICUBinary.writeHeader | public static int writeHeader(int dataFormat, int formatVersion, int dataVersion,
DataOutputStream dos) throws IOException {
// ucmndata.h MappedData
dos.writeChar(32); // headerSize
dos.writeByte(MAGIC1);
dos.writeByte(MAGIC2);
// unicode/udata.h UDataInfo
dos.writeChar(20); // sizeof(UDataInfo)
dos.writeChar(0); // reservedWord
dos.writeByte(1); // isBigEndian
dos.writeByte(CHAR_SET_); // charsetFamily
dos.writeByte(CHAR_SIZE_); // sizeofUChar
dos.writeByte(0); // reservedByte
dos.writeInt(dataFormat);
dos.writeInt(formatVersion);
dos.writeInt(dataVersion);
// 8 bytes padding for 32 bytes headerSize (multiple of 16).
dos.writeLong(0);
assert dos.size() == 32;
return 32;
} | java | public static int writeHeader(int dataFormat, int formatVersion, int dataVersion,
DataOutputStream dos) throws IOException {
// ucmndata.h MappedData
dos.writeChar(32); // headerSize
dos.writeByte(MAGIC1);
dos.writeByte(MAGIC2);
// unicode/udata.h UDataInfo
dos.writeChar(20); // sizeof(UDataInfo)
dos.writeChar(0); // reservedWord
dos.writeByte(1); // isBigEndian
dos.writeByte(CHAR_SET_); // charsetFamily
dos.writeByte(CHAR_SIZE_); // sizeofUChar
dos.writeByte(0); // reservedByte
dos.writeInt(dataFormat);
dos.writeInt(formatVersion);
dos.writeInt(dataVersion);
// 8 bytes padding for 32 bytes headerSize (multiple of 16).
dos.writeLong(0);
assert dos.size() == 32;
return 32;
} | [
"public",
"static",
"int",
"writeHeader",
"(",
"int",
"dataFormat",
",",
"int",
"formatVersion",
",",
"int",
"dataVersion",
",",
"DataOutputStream",
"dos",
")",
"throws",
"IOException",
"{",
"// ucmndata.h MappedData",
"dos",
".",
"writeChar",
"(",
"32",
")",
";... | Writes an ICU data header.
Does not write a copyright string.
@return The length of the header (number of bytes written).
@throws IOException from the DataOutputStream | [
"Writes",
"an",
"ICU",
"data",
"header",
".",
"Does",
"not",
"write",
"a",
"copyright",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java#L630-L650 |
35,456 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java | ICUBinary.getByteBufferFromInputStreamAndCloseStream | public static ByteBuffer getByteBufferFromInputStreamAndCloseStream(InputStream is) throws IOException {
try {
// is.available() may return 0, or 1, or the total number of bytes in the stream,
// or some other number.
// Do not try to use is.available() == 0 to find the end of the stream!
byte[] bytes;
int avail = is.available();
if (avail > 32) {
// There are more bytes available than just the ICU data header length.
// With luck, it is the total number of bytes.
bytes = new byte[avail];
} else {
bytes = new byte[128]; // empty .res files are even smaller
}
// Call is.read(...) until one returns a negative value.
int length = 0;
for(;;) {
if (length < bytes.length) {
int numRead = is.read(bytes, length, bytes.length - length);
if (numRead < 0) {
break; // end of stream
}
length += numRead;
} else {
// See if we are at the end of the stream before we grow the array.
int nextByte = is.read();
if (nextByte < 0) {
break;
}
int capacity = 2 * bytes.length;
if (capacity < 128) {
capacity = 128;
} else if (capacity < 0x4000) {
capacity *= 2; // Grow faster until we reach 16kB.
}
// TODO Java 6 replace new byte[] and arraycopy(): bytes = Arrays.copyOf(bytes, capacity);
byte[] newBytes = new byte[capacity];
System.arraycopy(bytes, 0, newBytes, 0, length);
bytes = newBytes;
bytes[length++] = (byte) nextByte;
}
}
return ByteBuffer.wrap(bytes, 0, length);
} finally {
is.close();
}
} | java | public static ByteBuffer getByteBufferFromInputStreamAndCloseStream(InputStream is) throws IOException {
try {
// is.available() may return 0, or 1, or the total number of bytes in the stream,
// or some other number.
// Do not try to use is.available() == 0 to find the end of the stream!
byte[] bytes;
int avail = is.available();
if (avail > 32) {
// There are more bytes available than just the ICU data header length.
// With luck, it is the total number of bytes.
bytes = new byte[avail];
} else {
bytes = new byte[128]; // empty .res files are even smaller
}
// Call is.read(...) until one returns a negative value.
int length = 0;
for(;;) {
if (length < bytes.length) {
int numRead = is.read(bytes, length, bytes.length - length);
if (numRead < 0) {
break; // end of stream
}
length += numRead;
} else {
// See if we are at the end of the stream before we grow the array.
int nextByte = is.read();
if (nextByte < 0) {
break;
}
int capacity = 2 * bytes.length;
if (capacity < 128) {
capacity = 128;
} else if (capacity < 0x4000) {
capacity *= 2; // Grow faster until we reach 16kB.
}
// TODO Java 6 replace new byte[] and arraycopy(): bytes = Arrays.copyOf(bytes, capacity);
byte[] newBytes = new byte[capacity];
System.arraycopy(bytes, 0, newBytes, 0, length);
bytes = newBytes;
bytes[length++] = (byte) nextByte;
}
}
return ByteBuffer.wrap(bytes, 0, length);
} finally {
is.close();
}
} | [
"public",
"static",
"ByteBuffer",
"getByteBufferFromInputStreamAndCloseStream",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"try",
"{",
"// is.available() may return 0, or 1, or the total number of bytes in the stream,",
"// or some other number.",
"// Do not try to us... | Reads the entire contents from the stream into a byte array
and wraps it into a ByteBuffer. Closes the InputStream at the end. | [
"Reads",
"the",
"entire",
"contents",
"from",
"the",
"stream",
"into",
"a",
"byte",
"array",
"and",
"wraps",
"it",
"into",
"a",
"ByteBuffer",
".",
"Closes",
"the",
"InputStream",
"at",
"the",
"end",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUBinary.java#L705-L751 |
35,457 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharacterIteration.java | CharacterIteration.next32 | public static int next32(CharacterIterator ci) {
// If the current position is at a surrogate pair, move to the trail surrogate
// which leaves it in position for underlying iterator's next() to work.
int c = ci.current();
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE && c<=UTF16.LEAD_SURROGATE_MAX_VALUE) {
c = ci.next();
if (c<UTF16.TRAIL_SURROGATE_MIN_VALUE || c>UTF16.TRAIL_SURROGATE_MAX_VALUE) {
ci.previous();
}
}
// For BMP chars, this next() is the real deal.
c = ci.next();
// If we might have a lead surrogate, we need to peak ahead to get the trail
// even though we don't want to really be positioned there.
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(ci, c);
}
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c != DONE32) {
// We got a supplementary char. Back the iterator up to the postion
// of the lead surrogate.
ci.previous();
}
return c;
} | java | public static int next32(CharacterIterator ci) {
// If the current position is at a surrogate pair, move to the trail surrogate
// which leaves it in position for underlying iterator's next() to work.
int c = ci.current();
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE && c<=UTF16.LEAD_SURROGATE_MAX_VALUE) {
c = ci.next();
if (c<UTF16.TRAIL_SURROGATE_MIN_VALUE || c>UTF16.TRAIL_SURROGATE_MAX_VALUE) {
ci.previous();
}
}
// For BMP chars, this next() is the real deal.
c = ci.next();
// If we might have a lead surrogate, we need to peak ahead to get the trail
// even though we don't want to really be positioned there.
if (c >= UTF16.LEAD_SURROGATE_MIN_VALUE) {
c = nextTrail32(ci, c);
}
if (c >= UTF16.SUPPLEMENTARY_MIN_VALUE && c != DONE32) {
// We got a supplementary char. Back the iterator up to the postion
// of the lead surrogate.
ci.previous();
}
return c;
} | [
"public",
"static",
"int",
"next32",
"(",
"CharacterIterator",
"ci",
")",
"{",
"// If the current position is at a surrogate pair, move to the trail surrogate",
"// which leaves it in position for underlying iterator's next() to work.",
"int",
"c",
"=",
"ci",
".",
"current",
"(",... | Move the iterator forward to the next code point, and return that code point,
leaving the iterator positioned at char returned.
For Supplementary chars, the iterator is left positioned at the lead surrogate.
@param ci The character iterator
@return The next code point. | [
"Move",
"the",
"iterator",
"forward",
"to",
"the",
"next",
"code",
"point",
"and",
"return",
"that",
"code",
"point",
"leaving",
"the",
"iterator",
"positioned",
"at",
"char",
"returned",
".",
"For",
"Supplementary",
"chars",
"the",
"iterator",
"is",
"left",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CharacterIteration.java#L35-L61 |
35,458 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StringWriter.java | StringWriter.append | public StringWriter append(CharSequence csq, int start, int end) {
CharSequence cs = (csq == null ? "null" : csq);
write(cs.subSequence(start, end).toString());
return this;
} | java | public StringWriter append(CharSequence csq, int start, int end) {
CharSequence cs = (csq == null ? "null" : csq);
write(cs.subSequence(start, end).toString());
return this;
} | [
"public",
"StringWriter",
"append",
"(",
"CharSequence",
"csq",
",",
"int",
"start",
",",
"int",
"end",
")",
"{",
"CharSequence",
"cs",
"=",
"(",
"csq",
"==",
"null",
"?",
"\"null\"",
":",
"csq",
")",
";",
"write",
"(",
"cs",
".",
"subSequence",
"(",
... | Appends a subsequence of the specified character sequence to this writer.
<p> An invocation of this method of the form <tt>out.append(csq, start,
end)</tt> when <tt>csq</tt> is not <tt>null</tt>, behaves in
exactly the same way as the invocation
<pre>
out.write(csq.subSequence(start, end).toString()) </pre>
@param csq
The character sequence from which a subsequence will be
appended. If <tt>csq</tt> is <tt>null</tt>, then characters
will be appended as if <tt>csq</tt> contained the four
characters <tt>"null"</tt>.
@param start
The index of the first character in the subsequence
@param end
The index of the character following the last character in the
subsequence
@return This writer
@throws IndexOutOfBoundsException
If <tt>start</tt> or <tt>end</tt> are negative, <tt>start</tt>
is greater than <tt>end</tt>, or <tt>end</tt> is greater than
<tt>csq.length()</tt>
@since 1.5 | [
"Appends",
"a",
"subsequence",
"of",
"the",
"specified",
"character",
"sequence",
"to",
"this",
"writer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/StringWriter.java#L179-L183 |
35,459 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.init | public void init(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
initPredicateInfo(compiler, opPos);
// int testType = compiler.getOp(nodeTestOpPos);
} | java | public void init(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
initPredicateInfo(compiler, opPos);
// int testType = compiler.getOp(nodeTestOpPos);
} | [
"public",
"void",
"init",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"int",
"stepType",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"initPredicateInfo",
"(",
"compiler",
",",
"opPos",
")",
";",
"// int ... | Initialize an AxesWalker during the parse of the XPath expression.
@param compiler The Compiler object that has information about this
walker in the op map.
@param opPos The op code position of this location step.
@param stepType The type of location step.
@throws javax.xml.transform.TransformerException | [
"Initialize",
"an",
"AxesWalker",
"during",
"the",
"parse",
"of",
"the",
"XPath",
"expression",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L71-L78 |
35,460 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.cloneDeep | AxesWalker cloneDeep(WalkingIterator cloneOwner, Vector cloneList)
throws CloneNotSupportedException
{
AxesWalker clone = findClone(this, cloneList);
if(null != clone)
return clone;
clone = (AxesWalker)this.clone();
clone.setLocPathIterator(cloneOwner);
if(null != cloneList)
{
cloneList.addElement(this);
cloneList.addElement(clone);
}
if(wi().m_lastUsedWalker == this)
cloneOwner.m_lastUsedWalker = clone;
if(null != m_nextWalker)
clone.m_nextWalker = m_nextWalker.cloneDeep(cloneOwner, cloneList);
// If you don't check for the cloneList here, you'll go into an
// recursive infinate loop.
if(null != cloneList)
{
if(null != m_prevWalker)
clone.m_prevWalker = m_prevWalker.cloneDeep(cloneOwner, cloneList);
}
else
{
if(null != m_nextWalker)
clone.m_nextWalker.m_prevWalker = clone;
}
return clone;
} | java | AxesWalker cloneDeep(WalkingIterator cloneOwner, Vector cloneList)
throws CloneNotSupportedException
{
AxesWalker clone = findClone(this, cloneList);
if(null != clone)
return clone;
clone = (AxesWalker)this.clone();
clone.setLocPathIterator(cloneOwner);
if(null != cloneList)
{
cloneList.addElement(this);
cloneList.addElement(clone);
}
if(wi().m_lastUsedWalker == this)
cloneOwner.m_lastUsedWalker = clone;
if(null != m_nextWalker)
clone.m_nextWalker = m_nextWalker.cloneDeep(cloneOwner, cloneList);
// If you don't check for the cloneList here, you'll go into an
// recursive infinate loop.
if(null != cloneList)
{
if(null != m_prevWalker)
clone.m_prevWalker = m_prevWalker.cloneDeep(cloneOwner, cloneList);
}
else
{
if(null != m_nextWalker)
clone.m_nextWalker.m_prevWalker = clone;
}
return clone;
} | [
"AxesWalker",
"cloneDeep",
"(",
"WalkingIterator",
"cloneOwner",
",",
"Vector",
"cloneList",
")",
"throws",
"CloneNotSupportedException",
"{",
"AxesWalker",
"clone",
"=",
"findClone",
"(",
"this",
",",
"cloneList",
")",
";",
"if",
"(",
"null",
"!=",
"clone",
")"... | Do a deep clone of this walker, including next and previous walkers.
If the this AxesWalker is on the clone list, don't clone but
return the already cloned version.
@param cloneOwner non-null reference to the cloned location path
iterator to which this clone will be added.
@param cloneList non-null vector of sources in odd elements, and the
corresponding clones in even vectors.
@return non-null clone, which may be a new clone, or may be a clone
contained on the cloneList. | [
"Do",
"a",
"deep",
"clone",
"of",
"this",
"walker",
"including",
"next",
"and",
"previous",
"walkers",
".",
"If",
"the",
"this",
"AxesWalker",
"is",
"on",
"the",
"clone",
"list",
"don",
"t",
"clone",
"but",
"return",
"the",
"already",
"cloned",
"version",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L113-L146 |
35,461 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.findClone | static AxesWalker findClone(AxesWalker key, Vector cloneList)
{
if(null != cloneList)
{
// First, look for clone on list.
int n = cloneList.size();
for (int i = 0; i < n; i+=2)
{
if(key == cloneList.elementAt(i))
return (AxesWalker)cloneList.elementAt(i+1);
}
}
return null;
} | java | static AxesWalker findClone(AxesWalker key, Vector cloneList)
{
if(null != cloneList)
{
// First, look for clone on list.
int n = cloneList.size();
for (int i = 0; i < n; i+=2)
{
if(key == cloneList.elementAt(i))
return (AxesWalker)cloneList.elementAt(i+1);
}
}
return null;
} | [
"static",
"AxesWalker",
"findClone",
"(",
"AxesWalker",
"key",
",",
"Vector",
"cloneList",
")",
"{",
"if",
"(",
"null",
"!=",
"cloneList",
")",
"{",
"// First, look for clone on list.",
"int",
"n",
"=",
"cloneList",
".",
"size",
"(",
")",
";",
"for",
"(",
... | Find a clone that corresponds to the key argument.
@param key The original AxesWalker for which there may be a clone.
@param cloneList vector of sources in odd elements, and the
corresponding clones in even vectors, may be null.
@return A clone that corresponds to the key, or null if key not found. | [
"Find",
"a",
"clone",
"that",
"corresponds",
"to",
"the",
"key",
"argument",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L157-L170 |
35,462 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.detach | public void detach()
{
m_currentNode = DTM.NULL;
m_dtm = null;
m_traverser = null;
m_isFresh = true;
m_root = DTM.NULL;
} | java | public void detach()
{
m_currentNode = DTM.NULL;
m_dtm = null;
m_traverser = null;
m_isFresh = true;
m_root = DTM.NULL;
} | [
"public",
"void",
"detach",
"(",
")",
"{",
"m_currentNode",
"=",
"DTM",
".",
"NULL",
";",
"m_dtm",
"=",
"null",
";",
"m_traverser",
"=",
"null",
";",
"m_isFresh",
"=",
"true",
";",
"m_root",
"=",
"DTM",
".",
"NULL",
";",
"}"
] | Detaches the walker from the set which it iterated over, releasing
any computational resources and placing the iterator in the INVALID
state. | [
"Detaches",
"the",
"walker",
"from",
"the",
"set",
"which",
"it",
"iterated",
"over",
"releasing",
"any",
"computational",
"resources",
"and",
"placing",
"the",
"iterator",
"in",
"the",
"INVALID",
"state",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L177-L184 |
35,463 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.getLastPos | public int getLastPos(XPathContext xctxt)
{
int pos = getProximityPosition();
AxesWalker walker;
try
{
walker = (AxesWalker) clone();
}
catch (CloneNotSupportedException cnse)
{
return -1;
}
walker.setPredicateCount(m_predicateIndex);
walker.setNextWalker(null);
walker.setPrevWalker(null);
WalkingIterator lpi = wi();
AxesWalker savedWalker = lpi.getLastUsedWalker();
try
{
lpi.setLastUsedWalker(walker);
int next;
while (DTM.NULL != (next = walker.nextNode()))
{
pos++;
}
// TODO: Should probably save this in the iterator.
}
finally
{
lpi.setLastUsedWalker(savedWalker);
}
// System.out.println("pos: "+pos);
return pos;
} | java | public int getLastPos(XPathContext xctxt)
{
int pos = getProximityPosition();
AxesWalker walker;
try
{
walker = (AxesWalker) clone();
}
catch (CloneNotSupportedException cnse)
{
return -1;
}
walker.setPredicateCount(m_predicateIndex);
walker.setNextWalker(null);
walker.setPrevWalker(null);
WalkingIterator lpi = wi();
AxesWalker savedWalker = lpi.getLastUsedWalker();
try
{
lpi.setLastUsedWalker(walker);
int next;
while (DTM.NULL != (next = walker.nextNode()))
{
pos++;
}
// TODO: Should probably save this in the iterator.
}
finally
{
lpi.setLastUsedWalker(savedWalker);
}
// System.out.println("pos: "+pos);
return pos;
} | [
"public",
"int",
"getLastPos",
"(",
"XPathContext",
"xctxt",
")",
"{",
"int",
"pos",
"=",
"getProximityPosition",
"(",
")",
";",
"AxesWalker",
"walker",
";",
"try",
"{",
"walker",
"=",
"(",
"AxesWalker",
")",
"clone",
"(",
")",
";",
"}",
"catch",
"(",
... | Get the index of the last node that can be itterated to.
@param xctxt XPath runtime context.
@return the index of the last node that can be itterated to. | [
"Get",
"the",
"index",
"of",
"the",
"last",
"node",
"that",
"can",
"be",
"itterated",
"to",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L412-L455 |
35,464 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java | AxesWalker.callVisitors | public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)
{
if(visitor.visitStep(owner, this))
{
callPredicateVisitors(visitor);
if(null != m_nextWalker)
{
m_nextWalker.callVisitors(this, visitor);
}
}
} | java | public void callVisitors(ExpressionOwner owner, XPathVisitor visitor)
{
if(visitor.visitStep(owner, this))
{
callPredicateVisitors(visitor);
if(null != m_nextWalker)
{
m_nextWalker.callVisitors(this, visitor);
}
}
} | [
"public",
"void",
"callVisitors",
"(",
"ExpressionOwner",
"owner",
",",
"XPathVisitor",
"visitor",
")",
"{",
"if",
"(",
"visitor",
".",
"visitStep",
"(",
"owner",
",",
"this",
")",
")",
"{",
"callPredicateVisitors",
"(",
"visitor",
")",
";",
"if",
"(",
"nu... | This will traverse the heararchy, calling the visitor for
each member. If the called visitor method returns
false, the subtree should not be called.
@param owner The owner of the visitor, where that path may be
rewritten if needed.
@param visitor The visitor whose appropriate method will be called. | [
"This",
"will",
"traverse",
"the",
"heararchy",
"calling",
"the",
"visitor",
"for",
"each",
"member",
".",
"If",
"the",
"called",
"visitor",
"method",
"returns",
"false",
"the",
"subtree",
"should",
"not",
"be",
"called",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/AxesWalker.java#L520-L530 |
35,465 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | DTMNodeProxy.getDocumentElement | public final Element getDocumentElement()
{
int dochandle=dtm.getDocument();
int elementhandle=DTM.NULL;
for(int kidhandle=dtm.getFirstChild(dochandle);
kidhandle!=DTM.NULL;
kidhandle=dtm.getNextSibling(kidhandle))
{
switch(dtm.getNodeType(kidhandle))
{
case Node.ELEMENT_NODE:
if(elementhandle!=DTM.NULL)
{
elementhandle=DTM.NULL; // More than one; ill-formed.
kidhandle=dtm.getLastChild(dochandle); // End loop
}
else
elementhandle=kidhandle;
break;
// These are harmless; document is still wellformed
case Node.COMMENT_NODE:
case Node.PROCESSING_INSTRUCTION_NODE:
case Node.DOCUMENT_TYPE_NODE:
break;
default:
elementhandle=DTM.NULL; // ill-formed
kidhandle=dtm.getLastChild(dochandle); // End loop
break;
}
}
if(elementhandle==DTM.NULL)
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
else
return (Element)(dtm.getNode(elementhandle));
} | java | public final Element getDocumentElement()
{
int dochandle=dtm.getDocument();
int elementhandle=DTM.NULL;
for(int kidhandle=dtm.getFirstChild(dochandle);
kidhandle!=DTM.NULL;
kidhandle=dtm.getNextSibling(kidhandle))
{
switch(dtm.getNodeType(kidhandle))
{
case Node.ELEMENT_NODE:
if(elementhandle!=DTM.NULL)
{
elementhandle=DTM.NULL; // More than one; ill-formed.
kidhandle=dtm.getLastChild(dochandle); // End loop
}
else
elementhandle=kidhandle;
break;
// These are harmless; document is still wellformed
case Node.COMMENT_NODE:
case Node.PROCESSING_INSTRUCTION_NODE:
case Node.DOCUMENT_TYPE_NODE:
break;
default:
elementhandle=DTM.NULL; // ill-formed
kidhandle=dtm.getLastChild(dochandle); // End loop
break;
}
}
if(elementhandle==DTM.NULL)
throw new DTMDOMException(DOMException.NOT_SUPPORTED_ERR);
else
return (Element)(dtm.getNode(elementhandle));
} | [
"public",
"final",
"Element",
"getDocumentElement",
"(",
")",
"{",
"int",
"dochandle",
"=",
"dtm",
".",
"getDocument",
"(",
")",
";",
"int",
"elementhandle",
"=",
"DTM",
".",
"NULL",
";",
"for",
"(",
"int",
"kidhandle",
"=",
"dtm",
".",
"getFirstChild",
... | This is a bit of a problem in DTM, since a DTM may be a Document
Fragment and hence not have a clear-cut Document Element. We can
make it work in the well-formed cases but would that be confusing for others?
@see org.w3c.dom.Document | [
"This",
"is",
"a",
"bit",
"of",
"a",
"problem",
"in",
"DTM",
"since",
"a",
"DTM",
"may",
"be",
"a",
"Document",
"Fragment",
"and",
"hence",
"not",
"have",
"a",
"clear",
"-",
"cut",
"Document",
"Element",
".",
"We",
"can",
"make",
"it",
"work",
"in",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java#L590-L626 |
35,466 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java | DTMNodeProxy.getOwnerElement | public final Element getOwnerElement()
{
if (getNodeType() != Node.ATTRIBUTE_NODE)
return null;
// In XPath and DTM data models, unlike DOM, an Attr's parent is its
// owner element.
int newnode = dtm.getParent(node);
return (newnode == DTM.NULL) ? null : (Element)(dtm.getNode(newnode));
} | java | public final Element getOwnerElement()
{
if (getNodeType() != Node.ATTRIBUTE_NODE)
return null;
// In XPath and DTM data models, unlike DOM, an Attr's parent is its
// owner element.
int newnode = dtm.getParent(node);
return (newnode == DTM.NULL) ? null : (Element)(dtm.getNode(newnode));
} | [
"public",
"final",
"Element",
"getOwnerElement",
"(",
")",
"{",
"if",
"(",
"getNodeType",
"(",
")",
"!=",
"Node",
".",
"ATTRIBUTE_NODE",
")",
"return",
"null",
";",
"// In XPath and DTM data models, unlike DOM, an Attr's parent is its",
"// owner element.",
"int",
"newn... | Get the owner element of an attribute.
@see org.w3c.dom.Attr as of DOM Level 2 | [
"Get",
"the",
"owner",
"element",
"of",
"an",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMNodeProxy.java#L1312-L1320 |
35,467 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundleReader.java | ICUResourceBundleReader.getFullName | public static String getFullName(String baseName, String localeName) {
if (baseName == null || baseName.length() == 0) {
if (localeName.length() == 0) {
return localeName = ULocale.getDefault().toString();
}
return localeName + ICU_RESOURCE_SUFFIX;
} else {
if (baseName.indexOf('.') == -1) {
if (baseName.charAt(baseName.length() - 1) != '/') {
return baseName + "/" + localeName + ICU_RESOURCE_SUFFIX;
} else {
return baseName + localeName + ICU_RESOURCE_SUFFIX;
}
} else {
baseName = baseName.replace('.', '/');
if (localeName.length() == 0) {
return baseName + ICU_RESOURCE_SUFFIX;
} else {
return baseName + "_" + localeName + ICU_RESOURCE_SUFFIX;
}
}
}
} | java | public static String getFullName(String baseName, String localeName) {
if (baseName == null || baseName.length() == 0) {
if (localeName.length() == 0) {
return localeName = ULocale.getDefault().toString();
}
return localeName + ICU_RESOURCE_SUFFIX;
} else {
if (baseName.indexOf('.') == -1) {
if (baseName.charAt(baseName.length() - 1) != '/') {
return baseName + "/" + localeName + ICU_RESOURCE_SUFFIX;
} else {
return baseName + localeName + ICU_RESOURCE_SUFFIX;
}
} else {
baseName = baseName.replace('.', '/');
if (localeName.length() == 0) {
return baseName + ICU_RESOURCE_SUFFIX;
} else {
return baseName + "_" + localeName + ICU_RESOURCE_SUFFIX;
}
}
}
} | [
"public",
"static",
"String",
"getFullName",
"(",
"String",
"baseName",
",",
"String",
"localeName",
")",
"{",
"if",
"(",
"baseName",
"==",
"null",
"||",
"baseName",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"localeName",
".",
"length",
... | Gets the full name of the resource with suffix. | [
"Gets",
"the",
"full",
"name",
"of",
"the",
"resource",
"with",
"suffix",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUResourceBundleReader.java#L1375-L1397 |
35,468 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java | AttributeListImpl.setAttributeList | public void setAttributeList (AttributeList atts)
{
int count = atts.getLength();
clear();
for (int i = 0; i < count; i++) {
addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
}
} | java | public void setAttributeList (AttributeList atts)
{
int count = atts.getLength();
clear();
for (int i = 0; i < count; i++) {
addAttribute(atts.getName(i), atts.getType(i), atts.getValue(i));
}
} | [
"public",
"void",
"setAttributeList",
"(",
"AttributeList",
"atts",
")",
"{",
"int",
"count",
"=",
"atts",
".",
"getLength",
"(",
")",
";",
"clear",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"count",
";",
"i",
"++",
")",
"{"... | Set the attribute list, discarding previous contents.
<p>This method allows an application writer to reuse an
attribute list easily.</p>
@param atts The attribute list to copy. | [
"Set",
"the",
"attribute",
"list",
"discarding",
"previous",
"contents",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java#L114-L123 |
35,469 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java | AttributeListImpl.addAttribute | public void addAttribute(String name, String type, String value) {
names.add(name);
types.add(type);
values.add(value);
} | java | public void addAttribute(String name, String type, String value) {
names.add(name);
types.add(type);
values.add(value);
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"name",
",",
"String",
"type",
",",
"String",
"value",
")",
"{",
"names",
".",
"add",
"(",
"name",
")",
";",
"types",
".",
"add",
"(",
"type",
")",
";",
"values",
".",
"add",
"(",
"value",
")",
";",
... | Add an attribute to an attribute list.
<p>This method is provided for SAX parser writers, to allow them
to build up an attribute list incrementally before delivering
it to the application.</p>
@param name The attribute name.
@param type The attribute type ("NMTOKEN" for an enumeration).
@param value The attribute value (must not be null).
@see #removeAttribute
@see org.xml.sax.DocumentHandler#startElement | [
"Add",
"an",
"attribute",
"to",
"an",
"attribute",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/AttributeListImpl.java#L139-L143 |
35,470 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.readObject | private void readObject(ObjectInputStream stream)
throws IOException, TransformerException
{
// System.out.println("Reading Stylesheet");
try
{
stream.defaultReadObject();
}
catch (ClassNotFoundException cnfe)
{
throw new TransformerException(cnfe);
}
// System.out.println("Done reading Stylesheet");
} | java | private void readObject(ObjectInputStream stream)
throws IOException, TransformerException
{
// System.out.println("Reading Stylesheet");
try
{
stream.defaultReadObject();
}
catch (ClassNotFoundException cnfe)
{
throw new TransformerException(cnfe);
}
// System.out.println("Done reading Stylesheet");
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
",",
"TransformerException",
"{",
"// System.out.println(\"Reading Stylesheet\");",
"try",
"{",
"stream",
".",
"defaultReadObject",
"(",
")",
";",
"}",
"catch",
"(",
"Cl... | Read the stylesheet from a serialization stream.
@param stream Input stream to read from
@throws IOException
@throws TransformerException | [
"Read",
"the",
"stylesheet",
"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/xalan/templates/Stylesheet.java#L146-L161 |
35,471 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java | Stylesheet.getStylesheetComposed | public StylesheetComposed getStylesheetComposed()
{
Stylesheet sheet = this;
while (!sheet.isAggregatedType())
{
sheet = sheet.getStylesheetParent();
}
return (StylesheetComposed) sheet;
} | java | public StylesheetComposed getStylesheetComposed()
{
Stylesheet sheet = this;
while (!sheet.isAggregatedType())
{
sheet = sheet.getStylesheetParent();
}
return (StylesheetComposed) sheet;
} | [
"public",
"StylesheetComposed",
"getStylesheetComposed",
"(",
")",
"{",
"Stylesheet",
"sheet",
"=",
"this",
";",
"while",
"(",
"!",
"sheet",
".",
"isAggregatedType",
"(",
")",
")",
"{",
"sheet",
"=",
"sheet",
".",
"getStylesheetParent",
"(",
")",
";",
"}",
... | Get the owning aggregated stylesheet, or this
stylesheet if it is aggregated.
@return the owning aggregated stylesheet or itself | [
"Get",
"the",
"owning",
"aggregated",
"stylesheet",
"or",
"this",
"stylesheet",
"if",
"it",
"is",
"aggregated",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/Stylesheet.java#L1315-L1326 |
35,472 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/SocketFactory.java | SocketFactory.createSocket | public Socket createSocket() throws IOException {
//
// bug 6771432:
// The Exception is used by HttpsClient to signal that
// unconnected sockets have not been implemented.
//
UnsupportedOperationException uop = new
UnsupportedOperationException();
SocketException se = new SocketException(
"Unconnected sockets not implemented");
se.initCause(uop);
throw se;
} | java | public Socket createSocket() throws IOException {
//
// bug 6771432:
// The Exception is used by HttpsClient to signal that
// unconnected sockets have not been implemented.
//
UnsupportedOperationException uop = new
UnsupportedOperationException();
SocketException se = new SocketException(
"Unconnected sockets not implemented");
se.initCause(uop);
throw se;
} | [
"public",
"Socket",
"createSocket",
"(",
")",
"throws",
"IOException",
"{",
"//",
"// bug 6771432:",
"// The Exception is used by HttpsClient to signal that",
"// unconnected sockets have not been implemented.",
"//",
"UnsupportedOperationException",
"uop",
"=",
"new",
"Unsupported... | Creates an unconnected socket.
@return the unconnected socket
@throws IOException if the socket cannot be created
@see java.net.Socket#connect(java.net.SocketAddress)
@see java.net.Socket#connect(java.net.SocketAddress, int)
@see java.net.Socket#Socket() | [
"Creates",
"an",
"unconnected",
"socket",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/SocketFactory.java#L124-L136 |
35,473 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java | StylesheetComposed.recompose | public void recompose(Vector recomposableElements) throws TransformerException
{
//recomposeImports(); // Calculate the number of this import.
//recomposeIncludes(this); // Build the global include list for this stylesheet.
// Now add in all of the recomposable elements at this precedence level
int n = getIncludeCountComposed();
for (int i = -1; i < n; i++)
{
Stylesheet included = getIncludeComposed(i);
// Add in the output elements
int s = included.getOutputCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getOutput(j));
}
// Next, add in the attribute-set elements
s = included.getAttributeSetCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getAttributeSet(j));
}
// Now the decimal-formats
s = included.getDecimalFormatCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getDecimalFormat(j));
}
// Now the keys
s = included.getKeyCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getKey(j));
}
// And the namespace aliases
s = included.getNamespaceAliasCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getNamespaceAlias(j));
}
// Next comes the templates
s = included.getTemplateCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getTemplate(j));
}
// Then, the variables
s = included.getVariableOrParamCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getVariableOrParam(j));
}
// And lastly the whitespace preserving and stripping elements
s = included.getStripSpaceCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getStripSpace(j));
}
s = included.getPreserveSpaceCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getPreserveSpace(j));
}
}
} | java | public void recompose(Vector recomposableElements) throws TransformerException
{
//recomposeImports(); // Calculate the number of this import.
//recomposeIncludes(this); // Build the global include list for this stylesheet.
// Now add in all of the recomposable elements at this precedence level
int n = getIncludeCountComposed();
for (int i = -1; i < n; i++)
{
Stylesheet included = getIncludeComposed(i);
// Add in the output elements
int s = included.getOutputCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getOutput(j));
}
// Next, add in the attribute-set elements
s = included.getAttributeSetCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getAttributeSet(j));
}
// Now the decimal-formats
s = included.getDecimalFormatCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getDecimalFormat(j));
}
// Now the keys
s = included.getKeyCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getKey(j));
}
// And the namespace aliases
s = included.getNamespaceAliasCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getNamespaceAlias(j));
}
// Next comes the templates
s = included.getTemplateCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getTemplate(j));
}
// Then, the variables
s = included.getVariableOrParamCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getVariableOrParam(j));
}
// And lastly the whitespace preserving and stripping elements
s = included.getStripSpaceCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getStripSpace(j));
}
s = included.getPreserveSpaceCount();
for (int j = 0; j < s; j++)
{
recomposableElements.addElement(included.getPreserveSpace(j));
}
}
} | [
"public",
"void",
"recompose",
"(",
"Vector",
"recomposableElements",
")",
"throws",
"TransformerException",
"{",
"//recomposeImports(); // Calculate the number of this import.",
"//recomposeIncludes(this); // Build the global include list for this stylesheet.",
"// Now add in all... | Adds all recomposable values for this precedence level into the recomposableElements Vector
that was passed in as the first parameter. All elements added to the
recomposableElements vector should extend ElemTemplateElement.
@param recomposableElements a Vector of ElemTemplateElement objects that we will add all of
our recomposable objects to. | [
"Adds",
"all",
"recomposable",
"values",
"for",
"this",
"precedence",
"level",
"into",
"the",
"recomposableElements",
"Vector",
"that",
"was",
"passed",
"in",
"as",
"the",
"first",
"parameter",
".",
"All",
"elements",
"added",
"to",
"the",
"recomposableElements",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java#L77-L161 |
35,474 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java | StylesheetComposed.recomposeImports | void recomposeImports()
{
m_importNumber = getStylesheetRoot().getImportNumber(this);
StylesheetRoot root = getStylesheetRoot();
int globalImportCount = root.getGlobalImportCount();
m_importCountComposed = (globalImportCount - m_importNumber) - 1;
// Now get the count of composed imports from this stylesheet's imports
int count = getImportCount();
if ( count > 0)
{
m_endImportCountComposed += count;
while (count > 0)
m_endImportCountComposed += this.getImport(--count).getEndImportCountComposed();
}
// Now get the count of composed imports from this stylesheet's
// composed includes.
count = getIncludeCountComposed();
while (count>0)
{
int imports = getIncludeComposed(--count).getImportCount();
m_endImportCountComposed += imports;
while (imports > 0)
m_endImportCountComposed +=getIncludeComposed(count).getImport(--imports).getEndImportCountComposed();
}
} | java | void recomposeImports()
{
m_importNumber = getStylesheetRoot().getImportNumber(this);
StylesheetRoot root = getStylesheetRoot();
int globalImportCount = root.getGlobalImportCount();
m_importCountComposed = (globalImportCount - m_importNumber) - 1;
// Now get the count of composed imports from this stylesheet's imports
int count = getImportCount();
if ( count > 0)
{
m_endImportCountComposed += count;
while (count > 0)
m_endImportCountComposed += this.getImport(--count).getEndImportCountComposed();
}
// Now get the count of composed imports from this stylesheet's
// composed includes.
count = getIncludeCountComposed();
while (count>0)
{
int imports = getIncludeComposed(--count).getImportCount();
m_endImportCountComposed += imports;
while (imports > 0)
m_endImportCountComposed +=getIncludeComposed(count).getImport(--imports).getEndImportCountComposed();
}
} | [
"void",
"recomposeImports",
"(",
")",
"{",
"m_importNumber",
"=",
"getStylesheetRoot",
"(",
")",
".",
"getImportNumber",
"(",
"this",
")",
";",
"StylesheetRoot",
"root",
"=",
"getStylesheetRoot",
"(",
")",
";",
"int",
"globalImportCount",
"=",
"root",
".",
"ge... | Recalculate the precedence of this stylesheet in the global
import list. The lowest precedence stylesheet is 0. A higher
number has a higher precedence. | [
"Recalculate",
"the",
"precedence",
"of",
"this",
"stylesheet",
"in",
"the",
"global",
"import",
"list",
".",
"The",
"lowest",
"precedence",
"stylesheet",
"is",
"0",
".",
"A",
"higher",
"number",
"has",
"a",
"higher",
"precedence",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java#L182-L212 |
35,475 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java | StylesheetComposed.recomposeIncludes | void recomposeIncludes(Stylesheet including)
{
int n = including.getIncludeCount();
if (n > 0)
{
if (null == m_includesComposed)
m_includesComposed = new Vector();
for (int i = 0; i < n; i++)
{
Stylesheet included = including.getInclude(i);
m_includesComposed.addElement(included);
recomposeIncludes(included);
}
}
} | java | void recomposeIncludes(Stylesheet including)
{
int n = including.getIncludeCount();
if (n > 0)
{
if (null == m_includesComposed)
m_includesComposed = new Vector();
for (int i = 0; i < n; i++)
{
Stylesheet included = including.getInclude(i);
m_includesComposed.addElement(included);
recomposeIncludes(included);
}
}
} | [
"void",
"recomposeIncludes",
"(",
"Stylesheet",
"including",
")",
"{",
"int",
"n",
"=",
"including",
".",
"getIncludeCount",
"(",
")",
";",
"if",
"(",
"n",
">",
"0",
")",
"{",
"if",
"(",
"null",
"==",
"m_includesComposed",
")",
"m_includesComposed",
"=",
... | Recompose the value of the composed include list. Builds a composite
list of all stylesheets included by this stylesheet to any depth.
@param including Stylesheet to recompose | [
"Recompose",
"the",
"value",
"of",
"the",
"composed",
"include",
"list",
".",
"Builds",
"a",
"composite",
"list",
"of",
"all",
"stylesheets",
"included",
"by",
"this",
"stylesheet",
"to",
"any",
"depth",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetComposed.java#L272-L289 |
35,476 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/StringRange.java | StringRange.compact | public static void compact(Set<String> source, Adder adder, boolean shorterPairs, boolean moreCompact) {
if (!moreCompact) {
String start = null;
String end = null;
int lastCp = 0;
int prefixLen = 0;
for (String s : source) {
if (start != null) { // We have something queued up
if (s.regionMatches(0, start, 0, prefixLen)) {
int currentCp = s.codePointAt(prefixLen);
if (currentCp == 1+lastCp && s.length() == prefixLen + Character.charCount(currentCp)) {
end = s;
lastCp = currentCp;
continue;
}
}
// We failed to find continuation. Add what we have and restart
adder.add(start, end == null ? null
: !shorterPairs ? end
: end.substring(prefixLen, end.length()));
}
// new possible range
start = s;
end = null;
lastCp = s.codePointBefore(s.length());
prefixLen = s.length() - Character.charCount(lastCp);
}
adder.add(start, end == null ? null
: !shorterPairs ? end
: end.substring(prefixLen, end.length()));
} else {
// not a fast algorithm, but ok for now
// TODO rewire to use the first (slower) algorithm to generate the ranges, then compact them from there.
// first sort by lengths
Relation<Integer,Ranges> lengthToArrays = Relation.of(new TreeMap<Integer,Set<Ranges>>(), TreeSet.class);
for (String s : source) {
Ranges item = new Ranges(s);
lengthToArrays.put(item.size(), item);
}
// then compact items of each length and emit compacted sets
for (Entry<Integer, Set<Ranges>> entry : lengthToArrays.keyValuesSet()) {
LinkedList<Ranges> compacted = compact(entry.getKey(), entry.getValue());
for (Ranges ranges : compacted) {
adder.add(ranges.start(), ranges.end(shorterPairs));
}
}
}
} | java | public static void compact(Set<String> source, Adder adder, boolean shorterPairs, boolean moreCompact) {
if (!moreCompact) {
String start = null;
String end = null;
int lastCp = 0;
int prefixLen = 0;
for (String s : source) {
if (start != null) { // We have something queued up
if (s.regionMatches(0, start, 0, prefixLen)) {
int currentCp = s.codePointAt(prefixLen);
if (currentCp == 1+lastCp && s.length() == prefixLen + Character.charCount(currentCp)) {
end = s;
lastCp = currentCp;
continue;
}
}
// We failed to find continuation. Add what we have and restart
adder.add(start, end == null ? null
: !shorterPairs ? end
: end.substring(prefixLen, end.length()));
}
// new possible range
start = s;
end = null;
lastCp = s.codePointBefore(s.length());
prefixLen = s.length() - Character.charCount(lastCp);
}
adder.add(start, end == null ? null
: !shorterPairs ? end
: end.substring(prefixLen, end.length()));
} else {
// not a fast algorithm, but ok for now
// TODO rewire to use the first (slower) algorithm to generate the ranges, then compact them from there.
// first sort by lengths
Relation<Integer,Ranges> lengthToArrays = Relation.of(new TreeMap<Integer,Set<Ranges>>(), TreeSet.class);
for (String s : source) {
Ranges item = new Ranges(s);
lengthToArrays.put(item.size(), item);
}
// then compact items of each length and emit compacted sets
for (Entry<Integer, Set<Ranges>> entry : lengthToArrays.keyValuesSet()) {
LinkedList<Ranges> compacted = compact(entry.getKey(), entry.getValue());
for (Ranges ranges : compacted) {
adder.add(ranges.start(), ranges.end(shorterPairs));
}
}
}
} | [
"public",
"static",
"void",
"compact",
"(",
"Set",
"<",
"String",
">",
"source",
",",
"Adder",
"adder",
",",
"boolean",
"shorterPairs",
",",
"boolean",
"moreCompact",
")",
"{",
"if",
"(",
"!",
"moreCompact",
")",
"{",
"String",
"start",
"=",
"null",
";",... | Compact the set of strings.
@param source set of strings
@param adder adds each pair to the output. See the {@link Adder} interface.
@param shorterPairs use abc-d instead of abc-abd
@param moreCompact use a more compact form, at the expense of more processing. If false, source must be sorted. | [
"Compact",
"the",
"set",
"of",
"strings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/StringRange.java#L60-L107 |
35,477 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/StringRange.java | StringRange.compact | public static void compact(Set<String> source, Adder adder, boolean shorterPairs) {
compact(source,adder,shorterPairs,false);
} | java | public static void compact(Set<String> source, Adder adder, boolean shorterPairs) {
compact(source,adder,shorterPairs,false);
} | [
"public",
"static",
"void",
"compact",
"(",
"Set",
"<",
"String",
">",
"source",
",",
"Adder",
"adder",
",",
"boolean",
"shorterPairs",
")",
"{",
"compact",
"(",
"source",
",",
"adder",
",",
"shorterPairs",
",",
"false",
")",
";",
"}"
] | Faster but not as good compaction. Only looks at final codepoint.
@param source set of strings
@param adder adds each pair to the output. See the {@link Adder} interface.
@param shorterPairs use abc-d instead of abc-abd | [
"Faster",
"but",
"not",
"as",
"good",
"compaction",
".",
"Only",
"looks",
"at",
"final",
"codepoint",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/StringRange.java#L115-L117 |
35,478 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/Hashing.java | Hashing.singleWordWangJenkinsHash | public static int singleWordWangJenkinsHash(Object k) {
int h = k.hashCode();
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
h += (h << 3);
h ^= (h >>> 6);
h += (h << 2) + (h << 14);
return h ^ (h >>> 16);
} | java | public static int singleWordWangJenkinsHash(Object k) {
int h = k.hashCode();
h += (h << 15) ^ 0xffffcd7d;
h ^= (h >>> 10);
h += (h << 3);
h ^= (h >>> 6);
h += (h << 2) + (h << 14);
return h ^ (h >>> 16);
} | [
"public",
"static",
"int",
"singleWordWangJenkinsHash",
"(",
"Object",
"k",
")",
"{",
"int",
"h",
"=",
"k",
".",
"hashCode",
"(",
")",
";",
"h",
"+=",
"(",
"h",
"<<",
"15",
")",
"^",
"0xffffcd7d",
";",
"h",
"^=",
"(",
"h",
">>>",
"10",
")",
";",
... | Based on commit 1424a2a1a9fc53dc8b859a77c02c924. | [
"Based",
"on",
"commit",
"1424a2a1a9fc53dc8b859a77c02c924",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/Hashing.java#L47-L56 |
35,479 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.initXPath | public void initXPath(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0,OpCodes.OP_XPATH);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);
// Patch for Christine's gripe. She wants her errorHandler to return from
// a fatal error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
//
// %REVIEW% Is there a better way of doing this?
// %REVIEW% Are there any other cases which need the safety net?
// (and if so do we care right now, or should we rewrite the XPath
// grammar engine and can fix it at that time?)
try {
nextToken();
Expr();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
}
catch (org.apache.xpath.XPathProcessorException e)
{
if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
{
// What I _want_ to do is null out this XPath.
// I doubt this has the desired effect, but I'm not sure what else to do.
// %REVIEW%!!!
initXPath(compiler, "/..", namespaceContext);
}
else
throw e;
}
compiler.shrink();
} | java | public void initXPath(
Compiler compiler, String expression, PrefixResolver namespaceContext)
throws javax.xml.transform.TransformerException
{
m_ops = compiler;
m_namespaceContext = namespaceContext;
m_functionTable = compiler.getFunctionTable();
Lexer lexer = new Lexer(compiler, namespaceContext, this);
lexer.tokenize(expression);
m_ops.setOp(0,OpCodes.OP_XPATH);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,2);
// Patch for Christine's gripe. She wants her errorHandler to return from
// a fatal error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
//
// %REVIEW% Is there a better way of doing this?
// %REVIEW% Are there any other cases which need the safety net?
// (and if so do we care right now, or should we rewrite the XPath
// grammar engine and can fix it at that time?)
try {
nextToken();
Expr();
if (null != m_token)
{
String extraTokens = "";
while (null != m_token)
{
extraTokens += "'" + m_token + "'";
nextToken();
if (null != m_token)
extraTokens += ", ";
}
error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
new Object[]{ extraTokens }); //"Extra illegal tokens: "+extraTokens);
}
}
catch (org.apache.xpath.XPathProcessorException e)
{
if(CONTINUE_AFTER_FATAL_ERROR.equals(e.getMessage()))
{
// What I _want_ to do is null out this XPath.
// I doubt this has the desired effect, but I'm not sure what else to do.
// %REVIEW%!!!
initXPath(compiler, "/..", namespaceContext);
}
else
throw e;
}
compiler.shrink();
} | [
"public",
"void",
"initXPath",
"(",
"Compiler",
"compiler",
",",
"String",
"expression",
",",
"PrefixResolver",
"namespaceContext",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"m_ops",
"=",
"compiler",
";",
"m_namespaceC... | Given an string, init an XPath object for selections,
in order that a parse doesn't
have to be done each time the expression is evaluated.
@param compiler The compiler object.
@param expression A string conforming to the XPath grammar.
@param namespaceContext An object that is able to resolve prefixes in
the XPath to namespaces.
@throws javax.xml.transform.TransformerException | [
"Given",
"an",
"string",
"init",
"an",
"XPath",
"object",
"for",
"selections",
"in",
"order",
"that",
"a",
"parse",
"doesn",
"t",
"have",
"to",
"be",
"done",
"each",
"time",
"the",
"expression",
"is",
"evaluated",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L101-L164 |
35,480 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.tokenIs | final boolean tokenIs(String s)
{
return (m_token != null) ? (m_token.equals(s)) : (s == null);
} | java | final boolean tokenIs(String s)
{
return (m_token != null) ? (m_token.equals(s)) : (s == null);
} | [
"final",
"boolean",
"tokenIs",
"(",
"String",
"s",
")",
"{",
"return",
"(",
"m_token",
"!=",
"null",
")",
"?",
"(",
"m_token",
".",
"equals",
"(",
"s",
")",
")",
":",
"(",
"s",
"==",
"null",
")",
";",
"}"
] | Check whether m_token matches the target string.
@param s A string reference or null.
@return If m_token is null, returns false (or true if s is also null), or
return true if the current token matches the string, else false. | [
"Check",
"whether",
"m_token",
"matches",
"the",
"target",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L262-L265 |
35,481 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.lookbehind | private final boolean lookbehind(char c, int n)
{
boolean isToken;
int lookBehindPos = m_queueMark - (n + 1);
if (lookBehindPos >= 0)
{
String lookbehind = (String) m_ops.m_tokenQueue.elementAt(lookBehindPos);
if (lookbehind.length() == 1)
{
char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
isToken = (c0 == '|') ? false : (c0 == c);
}
else
{
isToken = false;
}
}
else
{
isToken = false;
}
return isToken;
} | java | private final boolean lookbehind(char c, int n)
{
boolean isToken;
int lookBehindPos = m_queueMark - (n + 1);
if (lookBehindPos >= 0)
{
String lookbehind = (String) m_ops.m_tokenQueue.elementAt(lookBehindPos);
if (lookbehind.length() == 1)
{
char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
isToken = (c0 == '|') ? false : (c0 == c);
}
else
{
isToken = false;
}
}
else
{
isToken = false;
}
return isToken;
} | [
"private",
"final",
"boolean",
"lookbehind",
"(",
"char",
"c",
",",
"int",
"n",
")",
"{",
"boolean",
"isToken",
";",
"int",
"lookBehindPos",
"=",
"m_queueMark",
"-",
"(",
"n",
"+",
"1",
")",
";",
"if",
"(",
"lookBehindPos",
">=",
"0",
")",
"{",
"Stri... | Look behind the first character of the current token in order to
make a branching decision.
@param c the character to compare it to.
@param n number of tokens to look behind. Must be
greater than 1. Note that the look behind terminates
at either the beginning of the string or on a '|'
character. Because of this, this method should only
be used for pattern matching.
@return true if the token behind the current token matches the character
argument. | [
"Look",
"behind",
"the",
"first",
"character",
"of",
"the",
"current",
"token",
"in",
"order",
"to",
"make",
"a",
"branching",
"decision",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L325-L352 |
35,482 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.lookbehindHasToken | private final boolean lookbehindHasToken(int n)
{
boolean hasToken;
if ((m_queueMark - n) > 0)
{
String lookbehind = (String) m_ops.m_tokenQueue.elementAt(m_queueMark - (n - 1));
char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
hasToken = (c0 == '|') ? false : true;
}
else
{
hasToken = false;
}
return hasToken;
} | java | private final boolean lookbehindHasToken(int n)
{
boolean hasToken;
if ((m_queueMark - n) > 0)
{
String lookbehind = (String) m_ops.m_tokenQueue.elementAt(m_queueMark - (n - 1));
char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
hasToken = (c0 == '|') ? false : true;
}
else
{
hasToken = false;
}
return hasToken;
} | [
"private",
"final",
"boolean",
"lookbehindHasToken",
"(",
"int",
"n",
")",
"{",
"boolean",
"hasToken",
";",
"if",
"(",
"(",
"m_queueMark",
"-",
"n",
")",
">",
"0",
")",
"{",
"String",
"lookbehind",
"=",
"(",
"String",
")",
"m_ops",
".",
"m_tokenQueue",
... | look behind the current token in order to
see if there is a useable token.
@param n number of tokens to look behind. Must be
greater than 1. Note that the look behind terminates
at either the beginning of the string or on a '|'
character. Because of this, this method should only
be used for pattern matching.
@return true if look behind has a token, false otherwise. | [
"look",
"behind",
"the",
"current",
"token",
"in",
"order",
"to",
"see",
"if",
"there",
"is",
"a",
"useable",
"token",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L366-L384 |
35,483 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.nextToken | private final void nextToken()
{
if (m_queueMark < m_ops.getTokenQueueSize())
{
m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark++);
m_tokenChar = m_token.charAt(0);
}
else
{
m_token = null;
m_tokenChar = 0;
}
} | java | private final void nextToken()
{
if (m_queueMark < m_ops.getTokenQueueSize())
{
m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark++);
m_tokenChar = m_token.charAt(0);
}
else
{
m_token = null;
m_tokenChar = 0;
}
} | [
"private",
"final",
"void",
"nextToken",
"(",
")",
"{",
"if",
"(",
"m_queueMark",
"<",
"m_ops",
".",
"getTokenQueueSize",
"(",
")",
")",
"{",
"m_token",
"=",
"(",
"String",
")",
"m_ops",
".",
"m_tokenQueue",
".",
"elementAt",
"(",
"m_queueMark",
"++",
")... | Retrieve the next token from the command and
store it in m_token string. | [
"Retrieve",
"the",
"next",
"token",
"from",
"the",
"command",
"and",
"store",
"it",
"in",
"m_token",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L420-L433 |
35,484 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.getTokenRelative | private final String getTokenRelative(int i)
{
String tok;
int relative = m_queueMark + i;
if ((relative > 0) && (relative < m_ops.getTokenQueueSize()))
{
tok = (String) m_ops.m_tokenQueue.elementAt(relative);
}
else
{
tok = null;
}
return tok;
} | java | private final String getTokenRelative(int i)
{
String tok;
int relative = m_queueMark + i;
if ((relative > 0) && (relative < m_ops.getTokenQueueSize()))
{
tok = (String) m_ops.m_tokenQueue.elementAt(relative);
}
else
{
tok = null;
}
return tok;
} | [
"private",
"final",
"String",
"getTokenRelative",
"(",
"int",
"i",
")",
"{",
"String",
"tok",
";",
"int",
"relative",
"=",
"m_queueMark",
"+",
"i",
";",
"if",
"(",
"(",
"relative",
">",
"0",
")",
"&&",
"(",
"relative",
"<",
"m_ops",
".",
"getTokenQueue... | Retrieve a token relative to the current token.
@param i Position relative to current token.
@return The string at the given index, or null if the index is out
of range. | [
"Retrieve",
"a",
"token",
"relative",
"to",
"the",
"current",
"token",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L443-L459 |
35,485 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.prevToken | private final void prevToken()
{
if (m_queueMark > 0)
{
m_queueMark--;
m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark);
m_tokenChar = m_token.charAt(0);
}
else
{
m_token = null;
m_tokenChar = 0;
}
} | java | private final void prevToken()
{
if (m_queueMark > 0)
{
m_queueMark--;
m_token = (String) m_ops.m_tokenQueue.elementAt(m_queueMark);
m_tokenChar = m_token.charAt(0);
}
else
{
m_token = null;
m_tokenChar = 0;
}
} | [
"private",
"final",
"void",
"prevToken",
"(",
")",
"{",
"if",
"(",
"m_queueMark",
">",
"0",
")",
"{",
"m_queueMark",
"--",
";",
"m_token",
"=",
"(",
"String",
")",
"m_ops",
".",
"m_tokenQueue",
".",
"elementAt",
"(",
"m_queueMark",
")",
";",
"m_tokenChar... | Retrieve the previous token from the command and
store it in m_token string. | [
"Retrieve",
"the",
"previous",
"token",
"from",
"the",
"command",
"and",
"store",
"it",
"in",
"m_token",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L465-L480 |
35,486 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.consumeExpected | private final void consumeExpected(String expected)
throws javax.xml.transform.TransformerException
{
if (tokenIs(expected))
{
nextToken();
}
else
{
error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
m_token }); //"Expected "+expected+", but found: "+m_token);
// Patch for Christina's gripe. She wants her errorHandler to return from
// this error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
}
} | java | private final void consumeExpected(String expected)
throws javax.xml.transform.TransformerException
{
if (tokenIs(expected))
{
nextToken();
}
else
{
error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
m_token }); //"Expected "+expected+", but found: "+m_token);
// Patch for Christina's gripe. She wants her errorHandler to return from
// this error and continue trying to parse, rather than throwing an exception.
// Without the patch, that put us into an endless loop.
throw new XPathProcessorException(CONTINUE_AFTER_FATAL_ERROR);
}
} | [
"private",
"final",
"void",
"consumeExpected",
"(",
"String",
"expected",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"if",
"(",
"tokenIs",
"(",
"expected",
")",
")",
"{",
"nextToken",
"(",
")",
";",
"}",
"else",... | Consume an expected token, throwing an exception if it
isn't there.
@param expected The string to be expected.
@throws javax.xml.transform.TransformerException | [
"Consume",
"an",
"expected",
"token",
"throwing",
"an",
"exception",
"if",
"it",
"isn",
"t",
"there",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L490-L508 |
35,487 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.dumpRemainingTokenQueue | protected String dumpRemainingTokenQueue()
{
int q = m_queueMark;
String returnMsg;
if (q < m_ops.getTokenQueueSize())
{
String msg = "\n Remaining tokens: (";
while (q < m_ops.getTokenQueueSize())
{
String t = (String) m_ops.m_tokenQueue.elementAt(q++);
msg += (" '" + t + "'");
}
returnMsg = msg + ")";
}
else
{
returnMsg = "";
}
return returnMsg;
} | java | protected String dumpRemainingTokenQueue()
{
int q = m_queueMark;
String returnMsg;
if (q < m_ops.getTokenQueueSize())
{
String msg = "\n Remaining tokens: (";
while (q < m_ops.getTokenQueueSize())
{
String t = (String) m_ops.m_tokenQueue.elementAt(q++);
msg += (" '" + t + "'");
}
returnMsg = msg + ")";
}
else
{
returnMsg = "";
}
return returnMsg;
} | [
"protected",
"String",
"dumpRemainingTokenQueue",
"(",
")",
"{",
"int",
"q",
"=",
"m_queueMark",
";",
"String",
"returnMsg",
";",
"if",
"(",
"q",
"<",
"m_ops",
".",
"getTokenQueueSize",
"(",
")",
")",
"{",
"String",
"msg",
"=",
"\"\\n Remaining tokens: (\"",
... | Dump the remaining token queue.
Thanks to Craig for this.
@return A dump of the remaining token queue, which may be appended to
an error message. | [
"Dump",
"the",
"remaining",
"token",
"queue",
".",
"Thanks",
"to",
"Craig",
"for",
"this",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L674-L699 |
35,488 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.getFunctionToken | final int getFunctionToken(String key)
{
int tok;
Object id;
try
{
// These are nodetests, xpathparser treats them as functions when parsing
// a FilterExpr.
id = Keywords.lookupNodeTest(key);
if (null == id) id = m_functionTable.getFunctionID(key);
tok = ((Integer) id).intValue();
}
catch (NullPointerException npe)
{
tok = -1;
}
catch (ClassCastException cce)
{
tok = -1;
}
return tok;
} | java | final int getFunctionToken(String key)
{
int tok;
Object id;
try
{
// These are nodetests, xpathparser treats them as functions when parsing
// a FilterExpr.
id = Keywords.lookupNodeTest(key);
if (null == id) id = m_functionTable.getFunctionID(key);
tok = ((Integer) id).intValue();
}
catch (NullPointerException npe)
{
tok = -1;
}
catch (ClassCastException cce)
{
tok = -1;
}
return tok;
} | [
"final",
"int",
"getFunctionToken",
"(",
"String",
"key",
")",
"{",
"int",
"tok",
";",
"Object",
"id",
";",
"try",
"{",
"// These are nodetests, xpathparser treats them as functions when parsing",
"// a FilterExpr. ",
"id",
"=",
"Keywords",
".",
"lookupNodeTest",
"(",
... | Given a string, return the corresponding function token.
@param key A local name of a function.
@return The function ID, which may correspond to one of the FUNC_XXX
values found in {@link org.apache.xpath.compiler.FunctionTable}, but may
be a value installed by an external module. | [
"Given",
"a",
"string",
"return",
"the",
"corresponding",
"function",
"token",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L710-L735 |
35,489 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.insertOp | void insertOp(int pos, int length, int op)
{
int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
for (int i = totalLen - 1; i >= pos; i--)
{
m_ops.setOp(i + length, m_ops.getOp(i));
}
m_ops.setOp(pos,op);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,totalLen + length);
} | java | void insertOp(int pos, int length, int op)
{
int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
for (int i = totalLen - 1; i >= pos; i--)
{
m_ops.setOp(i + length, m_ops.getOp(i));
}
m_ops.setOp(pos,op);
m_ops.setOp(OpMap.MAPINDEX_LENGTH,totalLen + length);
} | [
"void",
"insertOp",
"(",
"int",
"pos",
",",
"int",
"length",
",",
"int",
"op",
")",
"{",
"int",
"totalLen",
"=",
"m_ops",
".",
"getOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
")",
";",
"for",
"(",
"int",
"i",
"=",
"totalLen",
"-",
"1",
";",
"i",
"... | Insert room for operation. This will NOT set
the length value of the operation, but will update
the length value for the total expression.
@param pos The position where the op is to be inserted.
@param length The length of the operation space in the op map.
@param op The op code to the inserted. | [
"Insert",
"room",
"for",
"operation",
".",
"This",
"will",
"NOT",
"set",
"the",
"length",
"value",
"of",
"the",
"operation",
"but",
"will",
"update",
"the",
"length",
"value",
"for",
"the",
"total",
"expression",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L746-L758 |
35,490 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.appendOp | void appendOp(int length, int op)
{
int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
m_ops.setOp(totalLen, op);
m_ops.setOp(totalLen + OpMap.MAPINDEX_LENGTH, length);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, totalLen + length);
} | java | void appendOp(int length, int op)
{
int totalLen = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
m_ops.setOp(totalLen, op);
m_ops.setOp(totalLen + OpMap.MAPINDEX_LENGTH, length);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, totalLen + length);
} | [
"void",
"appendOp",
"(",
"int",
"length",
",",
"int",
"op",
")",
"{",
"int",
"totalLen",
"=",
"m_ops",
".",
"getOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
")",
";",
"m_ops",
".",
"setOp",
"(",
"totalLen",
",",
"op",
")",
";",
"m_ops",
".",
"setOp",
... | Insert room for operation. This WILL set
the length value of the operation, and will update
the length value for the total expression.
@param length The length of the operation.
@param op The op code to the inserted. | [
"Insert",
"room",
"for",
"operation",
".",
"This",
"WILL",
"set",
"the",
"length",
"value",
"of",
"the",
"operation",
"and",
"will",
"update",
"the",
"length",
"value",
"for",
"the",
"total",
"expression",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L768-L776 |
35,491 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.UnionExpr | protected void UnionExpr() throws javax.xml.transform.TransformerException
{
int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
boolean continueOrLoop = true;
boolean foundUnion = false;
do
{
PathExpr();
if (tokenIs('|'))
{
if (false == foundUnion)
{
foundUnion = true;
insertOp(opPos, 2, OpCodes.OP_UNION);
}
nextToken();
}
else
{
break;
}
// this.m_testForDocOrder = true;
}
while (continueOrLoop);
m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
} | java | protected void UnionExpr() throws javax.xml.transform.TransformerException
{
int opPos = m_ops.getOp(OpMap.MAPINDEX_LENGTH);
boolean continueOrLoop = true;
boolean foundUnion = false;
do
{
PathExpr();
if (tokenIs('|'))
{
if (false == foundUnion)
{
foundUnion = true;
insertOp(opPos, 2, OpCodes.OP_UNION);
}
nextToken();
}
else
{
break;
}
// this.m_testForDocOrder = true;
}
while (continueOrLoop);
m_ops.setOp(opPos + OpMap.MAPINDEX_LENGTH,
m_ops.getOp(OpMap.MAPINDEX_LENGTH) - opPos);
} | [
"protected",
"void",
"UnionExpr",
"(",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"opPos",
"=",
"m_ops",
".",
"getOp",
"(",
"OpMap",
".",
"MAPINDEX_LENGTH",
")",
";",
"boolean",
"continueOrLoop",
"=",
"true... | The context of the right hand side expressions is the context of the
left hand side expression. The results of the right hand side expressions
are node sets. The result of the left hand side UnionExpr is the union
of the results of the right hand side expressions.
UnionExpr ::= PathExpr
| UnionExpr '|' PathExpr
@throws javax.xml.transform.TransformerException | [
"The",
"context",
"of",
"the",
"right",
"hand",
"side",
"expressions",
"is",
"the",
"context",
"of",
"the",
"left",
"hand",
"side",
"expression",
".",
"The",
"results",
"of",
"the",
"right",
"hand",
"side",
"expressions",
"are",
"node",
"sets",
".",
"The",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L1227-L1260 |
35,492 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java | XPathParser.Literal | protected void Literal() throws javax.xml.transform.TransformerException
{
int last = m_token.length() - 1;
char c0 = m_tokenChar;
char cX = m_token.charAt(last);
if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
{
// Mutate the token to remove the quotes and have the XString object
// already made.
int tokenQueuePos = m_queueMark - 1;
m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);
Object obj = new XString(m_token.substring(1, last));
m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);
// lit = m_token.substring(1, last);
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);
nextToken();
}
else
{
error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!");
}
} | java | protected void Literal() throws javax.xml.transform.TransformerException
{
int last = m_token.length() - 1;
char c0 = m_tokenChar;
char cX = m_token.charAt(last);
if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
{
// Mutate the token to remove the quotes and have the XString object
// already made.
int tokenQueuePos = m_queueMark - 1;
m_ops.m_tokenQueue.setElementAt(null,tokenQueuePos);
Object obj = new XString(m_token.substring(1, last));
m_ops.m_tokenQueue.setElementAt(obj,tokenQueuePos);
// lit = m_token.substring(1, last);
m_ops.setOp(m_ops.getOp(OpMap.MAPINDEX_LENGTH), tokenQueuePos);
m_ops.setOp(OpMap.MAPINDEX_LENGTH, m_ops.getOp(OpMap.MAPINDEX_LENGTH) + 1);
nextToken();
}
else
{
error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
new Object[]{ m_token }); //"Pattern literal ("+m_token+") needs to be quoted!");
}
} | [
"protected",
"void",
"Literal",
"(",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"int",
"last",
"=",
"m_token",
".",
"length",
"(",
")",
"-",
"1",
";",
"char",
"c0",
"=",
"m_tokenChar",
";",
"char",
"cX",
"="... | The value of the Literal is the sequence of characters inside
the " or ' characters>.
Literal ::= '"' [^"]* '"'
| "'" [^']* "'"
@throws javax.xml.transform.TransformerException | [
"The",
"value",
"of",
"the",
"Literal",
"is",
"the",
"sequence",
"of",
"characters",
"inside",
"the",
"or",
"characters",
">",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/XPathParser.java#L2017-L2048 |
35,493 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java | XMLStringFactoryImpl.newstr | public XMLString newstr(FastStringBuffer fsb, int start, int length)
{
return new XStringForFSB(fsb, start, length);
} | java | public XMLString newstr(FastStringBuffer fsb, int start, int length)
{
return new XStringForFSB(fsb, start, length);
} | [
"public",
"XMLString",
"newstr",
"(",
"FastStringBuffer",
"fsb",
",",
"int",
"start",
",",
"int",
"length",
")",
"{",
"return",
"new",
"XStringForFSB",
"(",
"fsb",
",",
"start",
",",
"length",
")",
";",
"}"
] | Create a XMLString from a FastStringBuffer.
@param fsb FastStringBuffer reference, which must be non-null.
@param start The start position in the array.
@param length The number of characters to read from the array.
@return An XMLString object that wraps the FastStringBuffer reference. | [
"Create",
"a",
"XMLString",
"from",
"a",
"FastStringBuffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XMLStringFactoryImpl.java#L71-L74 |
35,494 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/InitializationNormalizer.java | InitializationNormalizer.getInitLocation | private List<Statement> getInitLocation(MethodDeclaration node) {
List<Statement> stmts = node.getBody().getStatements();
if (!stmts.isEmpty() && stmts.get(0) instanceof SuperConstructorInvocation) {
return stmts.subList(0, 1);
}
// java.lang.Object supertype is null. All other types should have a super() call.
assert TypeUtil.isNone(
ElementUtil.getDeclaringClass(node.getExecutableElement()).getSuperclass())
: "Constructor didn't have a super() call.";
return stmts.subList(0, 0);
} | java | private List<Statement> getInitLocation(MethodDeclaration node) {
List<Statement> stmts = node.getBody().getStatements();
if (!stmts.isEmpty() && stmts.get(0) instanceof SuperConstructorInvocation) {
return stmts.subList(0, 1);
}
// java.lang.Object supertype is null. All other types should have a super() call.
assert TypeUtil.isNone(
ElementUtil.getDeclaringClass(node.getExecutableElement()).getSuperclass())
: "Constructor didn't have a super() call.";
return stmts.subList(0, 0);
} | [
"private",
"List",
"<",
"Statement",
">",
"getInitLocation",
"(",
"MethodDeclaration",
"node",
")",
"{",
"List",
"<",
"Statement",
">",
"stmts",
"=",
"node",
".",
"getBody",
"(",
")",
".",
"getStatements",
"(",
")",
";",
"if",
"(",
"!",
"stmts",
".",
"... | Finds the location in a constructor where init statements should be added. | [
"Finds",
"the",
"location",
"in",
"a",
"constructor",
"where",
"init",
"statements",
"should",
"be",
"added",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/InitializationNormalizer.java#L192-L202 |
35,495 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/URIName.java | URIName.nameConstraint | public static URIName nameConstraint(DerValue value) throws IOException {
URI uri;
String name = value.getIA5String();
try {
uri = new URI(name);
} catch (URISyntaxException use) {
throw new IOException("invalid URI name constraint:" + name, use);
}
if (uri.getScheme() == null) {
String host = uri.getSchemeSpecificPart();
try {
DNSName hostDNS;
if (host.charAt(0) == '.') {
hostDNS = new DNSName(host.substring(1));
} else {
hostDNS = new DNSName(host);
}
return new URIName(uri, host, hostDNS);
} catch (IOException ioe) {
throw new IOException("invalid URI name constraint:" + name, ioe);
}
} else {
throw new IOException("invalid URI name constraint (should not " +
"include scheme):" + name);
}
} | java | public static URIName nameConstraint(DerValue value) throws IOException {
URI uri;
String name = value.getIA5String();
try {
uri = new URI(name);
} catch (URISyntaxException use) {
throw new IOException("invalid URI name constraint:" + name, use);
}
if (uri.getScheme() == null) {
String host = uri.getSchemeSpecificPart();
try {
DNSName hostDNS;
if (host.charAt(0) == '.') {
hostDNS = new DNSName(host.substring(1));
} else {
hostDNS = new DNSName(host);
}
return new URIName(uri, host, hostDNS);
} catch (IOException ioe) {
throw new IOException("invalid URI name constraint:" + name, ioe);
}
} else {
throw new IOException("invalid URI name constraint (should not " +
"include scheme):" + name);
}
} | [
"public",
"static",
"URIName",
"nameConstraint",
"(",
"DerValue",
"value",
")",
"throws",
"IOException",
"{",
"URI",
"uri",
";",
"String",
"name",
"=",
"value",
".",
"getIA5String",
"(",
")",
";",
"try",
"{",
"uri",
"=",
"new",
"URI",
"(",
"name",
")",
... | Create the URIName object with the specified name constraint. URI
name constraints syntax is different than SubjectAltNames, etc. See
4.2.1.11 of RFC 3280.
@param value the URI name constraint
@throws IOException if name is not a proper URI name constraint | [
"Create",
"the",
"URIName",
"object",
"with",
"the",
"specified",
"name",
"constraint",
".",
"URI",
"name",
"constraints",
"syntax",
"is",
"different",
"than",
"SubjectAltNames",
"etc",
".",
"See",
"4",
".",
"2",
".",
"1",
".",
"11",
"of",
"RFC",
"3280",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/URIName.java#L156-L181 |
35,496 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/ast/PropertyAnnotation.java | PropertyAnnotation.getAttributeKeyValue | private String getAttributeKeyValue(String key) {
String prefix = key + '=';
String attribute = getAttribute(prefix);
return attribute != null ? attribute.substring(prefix.length()) : null;
} | java | private String getAttributeKeyValue(String key) {
String prefix = key + '=';
String attribute = getAttribute(prefix);
return attribute != null ? attribute.substring(prefix.length()) : null;
} | [
"private",
"String",
"getAttributeKeyValue",
"(",
"String",
"key",
")",
"{",
"String",
"prefix",
"=",
"key",
"+",
"'",
"'",
";",
"String",
"attribute",
"=",
"getAttribute",
"(",
"prefix",
")",
";",
"return",
"attribute",
"!=",
"null",
"?",
"attribute",
"."... | Return the value for a specified key. Attributes are sequentially searched
rather than use a map, because most attributes are not key-value pairs. | [
"Return",
"the",
"value",
"for",
"a",
"specified",
"key",
".",
"Attributes",
"are",
"sequentially",
"searched",
"rather",
"than",
"use",
"a",
"map",
"because",
"most",
"attributes",
"are",
"not",
"key",
"-",
"value",
"pairs",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/PropertyAnnotation.java#L129-L133 |
35,497 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/ast/PropertyAnnotation.java | PropertyAnnotation.toAttributeString | public static String toAttributeString(Set<String> attributes) {
List<String> list = new ArrayList<String>(attributes);
Collections.sort(list, ATTRIBUTES_COMPARATOR);
return Joiner.on(", ").join(list);
} | java | public static String toAttributeString(Set<String> attributes) {
List<String> list = new ArrayList<String>(attributes);
Collections.sort(list, ATTRIBUTES_COMPARATOR);
return Joiner.on(", ").join(list);
} | [
"public",
"static",
"String",
"toAttributeString",
"(",
"Set",
"<",
"String",
">",
"attributes",
")",
"{",
"List",
"<",
"String",
">",
"list",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"attributes",
")",
";",
"Collections",
".",
"sort",
"(",
"lis... | Return a sorted comma-separated list of the property attributes for this annotation. | [
"Return",
"a",
"sorted",
"comma",
"-",
"separated",
"list",
"of",
"the",
"property",
"attributes",
"for",
"this",
"annotation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/PropertyAnnotation.java#L142-L146 |
35,498 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/Extension.java | Extension.newExtension | public static Extension newExtension(ObjectIdentifier extensionId,
boolean critical, byte[] rawExtensionValue) throws IOException {
Extension ext = new Extension();
ext.extensionId = extensionId;
ext.critical = critical;
ext.extensionValue = rawExtensionValue;
return ext;
} | java | public static Extension newExtension(ObjectIdentifier extensionId,
boolean critical, byte[] rawExtensionValue) throws IOException {
Extension ext = new Extension();
ext.extensionId = extensionId;
ext.critical = critical;
ext.extensionValue = rawExtensionValue;
return ext;
} | [
"public",
"static",
"Extension",
"newExtension",
"(",
"ObjectIdentifier",
"extensionId",
",",
"boolean",
"critical",
",",
"byte",
"[",
"]",
"rawExtensionValue",
")",
"throws",
"IOException",
"{",
"Extension",
"ext",
"=",
"new",
"Extension",
"(",
")",
";",
"ext",... | Constructs an Extension from individual components of ObjectIdentifier,
criticality and the raw encoded extension value.
@param extensionId the ObjectIdentifier of the extension
@param critical the boolean indicating if the extension is critical
@param rawExtensionValue the raw DER-encoded extension value (this
is not the encoded OctetString). | [
"Constructs",
"an",
"Extension",
"from",
"individual",
"components",
"of",
"ObjectIdentifier",
"criticality",
"and",
"the",
"raw",
"encoded",
"extension",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/Extension.java#L135-L142 |
35,499 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Currency.java | Currency.getAvailableCurrencies | public static Set<Currency> getAvailableCurrencies() {
Set<Currency> result = new LinkedHashSet<Currency>();
for (String currencyCode : availableCurrencyCodes) {
result.add(Currency.getInstance(currencyCode));
}
return result;
} | java | public static Set<Currency> getAvailableCurrencies() {
Set<Currency> result = new LinkedHashSet<Currency>();
for (String currencyCode : availableCurrencyCodes) {
result.add(Currency.getInstance(currencyCode));
}
return result;
} | [
"public",
"static",
"Set",
"<",
"Currency",
">",
"getAvailableCurrencies",
"(",
")",
"{",
"Set",
"<",
"Currency",
">",
"result",
"=",
"new",
"LinkedHashSet",
"<",
"Currency",
">",
"(",
")",
";",
"for",
"(",
"String",
"currencyCode",
":",
"availableCurrencyCo... | Returns a set of all known currencies.
@since 1.7 | [
"Returns",
"a",
"set",
"of",
"all",
"known",
"currencies",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Currency.java#L104-L110 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.