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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,400 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.clear | public final void clear(int field)
{
if (areFieldsVirtuallySet) {
computeFields();
}
fields[field] = 0;
stamp[field] = UNSET;
isTimeSet = areFieldsSet = areAllFieldsSet = areFieldsVirtuallySet = false;
} | java | public final void clear(int field)
{
if (areFieldsVirtuallySet) {
computeFields();
}
fields[field] = 0;
stamp[field] = UNSET;
isTimeSet = areFieldsSet = areAllFieldsSet = areFieldsVirtuallySet = false;
} | [
"public",
"final",
"void",
"clear",
"(",
"int",
"field",
")",
"{",
"if",
"(",
"areFieldsVirtuallySet",
")",
"{",
"computeFields",
"(",
")",
";",
"}",
"fields",
"[",
"field",
"]",
"=",
"0",
";",
"stamp",
"[",
"field",
"]",
"=",
"UNSET",
";",
"isTimeSe... | Clears the value in the given time field.
@param field the time field to be cleared. | [
"Clears",
"the",
"value",
"in",
"the",
"given",
"time",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L2236-L2244 |
33,401 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.compare | private long compare(Object that) {
long thatMs;
if (that instanceof Calendar) {
thatMs = ((Calendar)that).getTimeInMillis();
} else if (that instanceof Date) {
thatMs = ((Date)that).getTime();
} else {
throw new IllegalArgumentException(that + "is not a Calendar or Date");
}
return getTimeInMillis() - thatMs;
} | java | private long compare(Object that) {
long thatMs;
if (that instanceof Calendar) {
thatMs = ((Calendar)that).getTimeInMillis();
} else if (that instanceof Date) {
thatMs = ((Date)that).getTime();
} else {
throw new IllegalArgumentException(that + "is not a Calendar or Date");
}
return getTimeInMillis() - thatMs;
} | [
"private",
"long",
"compare",
"(",
"Object",
"that",
")",
"{",
"long",
"thatMs",
";",
"if",
"(",
"that",
"instanceof",
"Calendar",
")",
"{",
"thatMs",
"=",
"(",
"(",
"Calendar",
")",
"that",
")",
".",
"getTimeInMillis",
"(",
")",
";",
"}",
"else",
"i... | Returns the difference in milliseconds between the moment this
calendar is set to and the moment the given calendar or Date object
is set to. | [
"Returns",
"the",
"difference",
"in",
"milliseconds",
"between",
"the",
"moment",
"this",
"calendar",
"is",
"set",
"to",
"and",
"the",
"moment",
"the",
"given",
"calendar",
"or",
"Date",
"object",
"is",
"set",
"to",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L2338-L2348 |
33,402 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.prepareGetActual | protected void prepareGetActual(int field, boolean isMinimum) {
set(MILLISECONDS_IN_DAY, 0);
switch (field) {
case YEAR:
case EXTENDED_YEAR:
set(DAY_OF_YEAR, getGreatestMinimum(DAY_OF_YEAR));
break;
case YEAR_WOY:
set(WEEK_OF_YEAR, getGreatestMinimum(WEEK_OF_YEAR));
break;
case MONTH:
set(DAY_OF_MONTH, getGreatestMinimum(DAY_OF_MONTH));
break;
case DAY_OF_WEEK_IN_MONTH:
// For dowim, the maximum occurs for the DOW of the first of the
// month.
set(DAY_OF_MONTH, 1);
set(DAY_OF_WEEK, get(DAY_OF_WEEK)); // Make this user set
break;
case WEEK_OF_MONTH:
case WEEK_OF_YEAR:
// If we're counting weeks, set the day of the week to either the
// first or last localized DOW. We know the last week of a month
// or year will contain the first day of the week, and that the
// first week will contain the last DOW.
{
int dow = firstDayOfWeek;
if (isMinimum) {
dow = (dow + 6) % 7; // set to last DOW
if (dow < SUNDAY) {
dow += 7;
}
}
set(DAY_OF_WEEK, dow);
}
break;
}
// Do this last to give it the newest time stamp
set(field, getGreatestMinimum(field));
} | java | protected void prepareGetActual(int field, boolean isMinimum) {
set(MILLISECONDS_IN_DAY, 0);
switch (field) {
case YEAR:
case EXTENDED_YEAR:
set(DAY_OF_YEAR, getGreatestMinimum(DAY_OF_YEAR));
break;
case YEAR_WOY:
set(WEEK_OF_YEAR, getGreatestMinimum(WEEK_OF_YEAR));
break;
case MONTH:
set(DAY_OF_MONTH, getGreatestMinimum(DAY_OF_MONTH));
break;
case DAY_OF_WEEK_IN_MONTH:
// For dowim, the maximum occurs for the DOW of the first of the
// month.
set(DAY_OF_MONTH, 1);
set(DAY_OF_WEEK, get(DAY_OF_WEEK)); // Make this user set
break;
case WEEK_OF_MONTH:
case WEEK_OF_YEAR:
// If we're counting weeks, set the day of the week to either the
// first or last localized DOW. We know the last week of a month
// or year will contain the first day of the week, and that the
// first week will contain the last DOW.
{
int dow = firstDayOfWeek;
if (isMinimum) {
dow = (dow + 6) % 7; // set to last DOW
if (dow < SUNDAY) {
dow += 7;
}
}
set(DAY_OF_WEEK, dow);
}
break;
}
// Do this last to give it the newest time stamp
set(field, getGreatestMinimum(field));
} | [
"protected",
"void",
"prepareGetActual",
"(",
"int",
"field",
",",
"boolean",
"isMinimum",
")",
"{",
"set",
"(",
"MILLISECONDS_IN_DAY",
",",
"0",
")",
";",
"switch",
"(",
"field",
")",
"{",
"case",
"YEAR",
":",
"case",
"EXTENDED_YEAR",
":",
"set",
"(",
"... | Prepare this calendar for computing the actual minimum or maximum.
This method modifies this calendar's fields; it is called on a
temporary calendar.
<p>Rationale: The semantics of getActualXxx() is to return the
maximum or minimum value that the given field can take, taking into
account other relevant fields. In general these other fields are
larger fields. For example, when computing the actual maximum
DAY_OF_MONTH, the current value of DAY_OF_MONTH itself is ignored,
as is the value of any field smaller.
<p>The time fields all have fixed minima and maxima, so we don't
need to worry about them. This also lets us set the
MILLISECONDS_IN_DAY to zero to erase any effects the time fields
might have when computing date fields.
<p>DAY_OF_WEEK is adjusted specially for the WEEK_OF_MONTH and
WEEK_OF_YEAR fields to ensure that they are computed correctly. | [
"Prepare",
"this",
"calendar",
"for",
"computing",
"the",
"actual",
"minimum",
"or",
"maximum",
".",
"This",
"method",
"modifies",
"this",
"calendar",
"s",
"fields",
";",
"it",
"is",
"called",
"on",
"a",
"temporary",
"calendar",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L2510-L2555 |
33,403 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.getPatternData | private static PatternData getPatternData(ULocale locale, String calType) {
ICUResourceBundle rb =
(ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
ICUResourceBundle dtPatternsRb = rb.findWithFallback("calendar/" + calType + "/DateTimePatterns");
if (dtPatternsRb == null) {
dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns");
}
int patternsSize = dtPatternsRb.getSize();
String[] dateTimePatterns = new String[patternsSize];
String[] dateTimePatternsOverrides = new String[patternsSize];
for (int i = 0; i < patternsSize; i++) {
ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(i);
switch (concatenationPatternRb.getType()) {
case UResourceBundle.STRING:
dateTimePatterns[i] = concatenationPatternRb.getString();
break;
case UResourceBundle.ARRAY:
dateTimePatterns[i] = concatenationPatternRb.getString(0);
dateTimePatternsOverrides[i] = concatenationPatternRb.getString(1);
break;
}
}
return new PatternData(dateTimePatterns, dateTimePatternsOverrides);
} | java | private static PatternData getPatternData(ULocale locale, String calType) {
ICUResourceBundle rb =
(ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
ICUResourceBundle dtPatternsRb = rb.findWithFallback("calendar/" + calType + "/DateTimePatterns");
if (dtPatternsRb == null) {
dtPatternsRb = rb.getWithFallback("calendar/gregorian/DateTimePatterns");
}
int patternsSize = dtPatternsRb.getSize();
String[] dateTimePatterns = new String[patternsSize];
String[] dateTimePatternsOverrides = new String[patternsSize];
for (int i = 0; i < patternsSize; i++) {
ICUResourceBundle concatenationPatternRb = (ICUResourceBundle) dtPatternsRb.get(i);
switch (concatenationPatternRb.getType()) {
case UResourceBundle.STRING:
dateTimePatterns[i] = concatenationPatternRb.getString();
break;
case UResourceBundle.ARRAY:
dateTimePatterns[i] = concatenationPatternRb.getString(0);
dateTimePatternsOverrides[i] = concatenationPatternRb.getString(1);
break;
}
}
return new PatternData(dateTimePatterns, dateTimePatternsOverrides);
} | [
"private",
"static",
"PatternData",
"getPatternData",
"(",
"ULocale",
"locale",
",",
"String",
"calType",
")",
"{",
"ICUResourceBundle",
"rb",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",... | Retrieves the DateTime patterns and overrides from the resource bundle and generates a
new PatternData object.
@param locale Locale to retrieve.
@param calType Calendar type to retrieve. If not found will fallback to gregorian.
@return PatternData object for this locale and calendarType. | [
"Retrieves",
"the",
"DateTime",
"patterns",
"and",
"overrides",
"from",
"the",
"resource",
"bundle",
"and",
"generates",
"a",
"new",
"PatternData",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L3574-L3598 |
33,404 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.setMinimalDaysInFirstWeek | public void setMinimalDaysInFirstWeek(int value)
{
// Values less than 1 have the same effect as 1; values greater
// than 7 have the same effect as 7. However, we normalize values
// so operator== and so forth work.
if (value < 1) {
value = 1;
} else if (value > 7) {
value = 7;
}
if (minimalDaysInFirstWeek != value) {
minimalDaysInFirstWeek = value;
areFieldsSet = false;
}
} | java | public void setMinimalDaysInFirstWeek(int value)
{
// Values less than 1 have the same effect as 1; values greater
// than 7 have the same effect as 7. However, we normalize values
// so operator== and so forth work.
if (value < 1) {
value = 1;
} else if (value > 7) {
value = 7;
}
if (minimalDaysInFirstWeek != value) {
minimalDaysInFirstWeek = value;
areFieldsSet = false;
}
} | [
"public",
"void",
"setMinimalDaysInFirstWeek",
"(",
"int",
"value",
")",
"{",
"// Values less than 1 have the same effect as 1; values greater",
"// than 7 have the same effect as 7. However, we normalize values",
"// so operator== and so forth work.",
"if",
"(",
"value",
"<",
"1",
"... | Sets what the minimal days required in the first week of the year are.
For example, if the first week is defined as one that contains the first
day of the first month of a year, call the method with value 1. If it
must be a full week, use value 7.
@param value the given minimal days required in the first week
of the year. | [
"Sets",
"what",
"the",
"minimal",
"days",
"required",
"in",
"the",
"first",
"week",
"of",
"the",
"year",
"are",
".",
"For",
"example",
"if",
"the",
"first",
"week",
"is",
"defined",
"as",
"one",
"that",
"contains",
"the",
"first",
"day",
"of",
"the",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L4209-L4223 |
33,405 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.getLimit | protected int getLimit(int field, int limitType) {
switch (field) {
case DAY_OF_WEEK:
case AM_PM:
case HOUR:
case HOUR_OF_DAY:
case MINUTE:
case SECOND:
case MILLISECOND:
case ZONE_OFFSET:
case DST_OFFSET:
case DOW_LOCAL:
case JULIAN_DAY:
case MILLISECONDS_IN_DAY:
case IS_LEAP_MONTH:
return LIMITS[field][limitType];
case WEEK_OF_MONTH:
{
int limit;
if (limitType == MINIMUM) {
limit = getMinimalDaysInFirstWeek() == 1 ? 1 : 0;
} else if (limitType == GREATEST_MINIMUM){
limit = 1;
} else {
int minDaysInFirst = getMinimalDaysInFirstWeek();
int daysInMonth = handleGetLimit(DAY_OF_MONTH, limitType);
if (limitType == LEAST_MAXIMUM) {
limit = (daysInMonth + (7 - minDaysInFirst)) / 7;
} else { // limitType == MAXIMUM
limit = (daysInMonth + 6 + (7 - minDaysInFirst)) / 7;
}
}
return limit;
}
}
return handleGetLimit(field, limitType);
} | java | protected int getLimit(int field, int limitType) {
switch (field) {
case DAY_OF_WEEK:
case AM_PM:
case HOUR:
case HOUR_OF_DAY:
case MINUTE:
case SECOND:
case MILLISECOND:
case ZONE_OFFSET:
case DST_OFFSET:
case DOW_LOCAL:
case JULIAN_DAY:
case MILLISECONDS_IN_DAY:
case IS_LEAP_MONTH:
return LIMITS[field][limitType];
case WEEK_OF_MONTH:
{
int limit;
if (limitType == MINIMUM) {
limit = getMinimalDaysInFirstWeek() == 1 ? 1 : 0;
} else if (limitType == GREATEST_MINIMUM){
limit = 1;
} else {
int minDaysInFirst = getMinimalDaysInFirstWeek();
int daysInMonth = handleGetLimit(DAY_OF_MONTH, limitType);
if (limitType == LEAST_MAXIMUM) {
limit = (daysInMonth + (7 - minDaysInFirst)) / 7;
} else { // limitType == MAXIMUM
limit = (daysInMonth + 6 + (7 - minDaysInFirst)) / 7;
}
}
return limit;
}
}
return handleGetLimit(field, limitType);
} | [
"protected",
"int",
"getLimit",
"(",
"int",
"field",
",",
"int",
"limitType",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"DAY_OF_WEEK",
":",
"case",
"AM_PM",
":",
"case",
"HOUR",
":",
"case",
"HOUR_OF_DAY",
":",
"case",
"MINUTE",
":",
"case",
... | Returns a limit for a field.
@param field the field, from 0..<code>getFieldCount()-1</code>
@param limitType the type specifier for the limit
@see #MINIMUM
@see #GREATEST_MINIMUM
@see #LEAST_MAXIMUM
@see #MAXIMUM | [
"Returns",
"a",
"limit",
"for",
"a",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L4296-L4334 |
33,406 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.updateTime | private void updateTime() {
computeTime();
// If we are lenient, we need to recompute the fields to normalize
// the values. Also, if we haven't set all the fields yet (i.e.,
// in a newly-created object), we need to fill in the fields. [LIU]
if (isLenient() || !areAllFieldsSet) areFieldsSet = false;
isTimeSet = true;
areFieldsVirtuallySet = false;
} | java | private void updateTime() {
computeTime();
// If we are lenient, we need to recompute the fields to normalize
// the values. Also, if we haven't set all the fields yet (i.e.,
// in a newly-created object), we need to fill in the fields. [LIU]
if (isLenient() || !areAllFieldsSet) areFieldsSet = false;
isTimeSet = true;
areFieldsVirtuallySet = false;
} | [
"private",
"void",
"updateTime",
"(",
")",
"{",
"computeTime",
"(",
")",
";",
"// If we are lenient, we need to recompute the fields to normalize",
"// the values. Also, if we haven't set all the fields yet (i.e.,",
"// in a newly-created object), we need to fill in the fields. [LIU]",
"i... | Recompute the time and update the status fields isTimeSet
and areFieldsSet. Callers should check isTimeSet and only
call this method if isTimeSet is false. | [
"Recompute",
"the",
"time",
"and",
"update",
"the",
"status",
"fields",
"isTimeSet",
"and",
"areFieldsSet",
".",
"Callers",
"should",
"check",
"isTimeSet",
"and",
"only",
"call",
"this",
"method",
"if",
"isTimeSet",
"is",
"false",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L4797-L4805 |
33,407 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.computeGregorianAndDOWFields | private final void computeGregorianAndDOWFields(int julianDay) {
computeGregorianFields(julianDay);
// Compute day of week: JD 0 = Monday
int dow = fields[DAY_OF_WEEK] = julianDayToDayOfWeek(julianDay);
// Calculate 1-based localized day of week
int dowLocal = dow - getFirstDayOfWeek() + 1;
if (dowLocal < 1) {
dowLocal += 7;
}
fields[DOW_LOCAL] = dowLocal;
} | java | private final void computeGregorianAndDOWFields(int julianDay) {
computeGregorianFields(julianDay);
// Compute day of week: JD 0 = Monday
int dow = fields[DAY_OF_WEEK] = julianDayToDayOfWeek(julianDay);
// Calculate 1-based localized day of week
int dowLocal = dow - getFirstDayOfWeek() + 1;
if (dowLocal < 1) {
dowLocal += 7;
}
fields[DOW_LOCAL] = dowLocal;
} | [
"private",
"final",
"void",
"computeGregorianAndDOWFields",
"(",
"int",
"julianDay",
")",
"{",
"computeGregorianFields",
"(",
"julianDay",
")",
";",
"// Compute day of week: JD 0 = Monday",
"int",
"dow",
"=",
"fields",
"[",
"DAY_OF_WEEK",
"]",
"=",
"julianDayToDayOfWeek... | Compute the Gregorian calendar year, month, and day of month from
the given Julian day. These values are not stored in fields, but in
member variables gregorianXxx. Also compute the DAY_OF_WEEK and
DOW_LOCAL fields. | [
"Compute",
"the",
"Gregorian",
"calendar",
"year",
"month",
"and",
"day",
"of",
"month",
"from",
"the",
"given",
"Julian",
"day",
".",
"These",
"values",
"are",
"not",
"stored",
"in",
"fields",
"but",
"in",
"member",
"variables",
"gregorianXxx",
".",
"Also",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L4920-L4932 |
33,408 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.computeWeekFields | private final void computeWeekFields() {
int eyear = fields[EXTENDED_YEAR];
int dayOfWeek = fields[DAY_OF_WEEK];
int dayOfYear = fields[DAY_OF_YEAR];
// WEEK_OF_YEAR start
// Compute the week of the year. For the Gregorian calendar, valid week
// numbers run from 1 to 52 or 53, depending on the year, the first day
// of the week, and the minimal days in the first week. For other
// calendars, the valid range may be different -- it depends on the year
// length. Days at the start of the year may fall into the last week of
// the previous year; days at the end of the year may fall into the
// first week of the next year. ASSUME that the year length is less than
// 7000 days.
int yearOfWeekOfYear = eyear;
int relDow = (dayOfWeek + 7 - getFirstDayOfWeek()) % 7; // 0..6
int relDowJan1 = (dayOfWeek - dayOfYear + 7001 - getFirstDayOfWeek()) % 7; // 0..6
int woy = (dayOfYear - 1 + relDowJan1) / 7; // 0..53
if ((7 - relDowJan1) >= getMinimalDaysInFirstWeek()) {
++woy;
}
// Adjust for weeks at the year end that overlap into the previous or
// next calendar year.
if (woy == 0) {
// We are the last week of the previous year.
// Check to see if we are in the last week; if so, we need
// to handle the case in which we are the first week of the
// next year.
int prevDoy = dayOfYear + handleGetYearLength(eyear - 1);
woy = weekNumber(prevDoy, dayOfWeek);
yearOfWeekOfYear--;
} else {
int lastDoy = handleGetYearLength(eyear);
// Fast check: For it to be week 1 of the next year, the DOY
// must be on or after L-5, where L is yearLength(), then it
// cannot possibly be week 1 of the next year:
// L-5 L
// doy: 359 360 361 362 363 364 365 001
// dow: 1 2 3 4 5 6 7
if (dayOfYear >= (lastDoy - 5)) {
int lastRelDow = (relDow + lastDoy - dayOfYear) % 7;
if (lastRelDow < 0) {
lastRelDow += 7;
}
if (((6 - lastRelDow) >= getMinimalDaysInFirstWeek()) &&
((dayOfYear + 7 - relDow) > lastDoy)) {
woy = 1;
yearOfWeekOfYear++;
}
}
}
fields[WEEK_OF_YEAR] = woy;
fields[YEAR_WOY] = yearOfWeekOfYear;
// WEEK_OF_YEAR end
int dayOfMonth = fields[DAY_OF_MONTH];
fields[WEEK_OF_MONTH] = weekNumber(dayOfMonth, dayOfWeek);
fields[DAY_OF_WEEK_IN_MONTH] = (dayOfMonth-1) / 7 + 1;
} | java | private final void computeWeekFields() {
int eyear = fields[EXTENDED_YEAR];
int dayOfWeek = fields[DAY_OF_WEEK];
int dayOfYear = fields[DAY_OF_YEAR];
// WEEK_OF_YEAR start
// Compute the week of the year. For the Gregorian calendar, valid week
// numbers run from 1 to 52 or 53, depending on the year, the first day
// of the week, and the minimal days in the first week. For other
// calendars, the valid range may be different -- it depends on the year
// length. Days at the start of the year may fall into the last week of
// the previous year; days at the end of the year may fall into the
// first week of the next year. ASSUME that the year length is less than
// 7000 days.
int yearOfWeekOfYear = eyear;
int relDow = (dayOfWeek + 7 - getFirstDayOfWeek()) % 7; // 0..6
int relDowJan1 = (dayOfWeek - dayOfYear + 7001 - getFirstDayOfWeek()) % 7; // 0..6
int woy = (dayOfYear - 1 + relDowJan1) / 7; // 0..53
if ((7 - relDowJan1) >= getMinimalDaysInFirstWeek()) {
++woy;
}
// Adjust for weeks at the year end that overlap into the previous or
// next calendar year.
if (woy == 0) {
// We are the last week of the previous year.
// Check to see if we are in the last week; if so, we need
// to handle the case in which we are the first week of the
// next year.
int prevDoy = dayOfYear + handleGetYearLength(eyear - 1);
woy = weekNumber(prevDoy, dayOfWeek);
yearOfWeekOfYear--;
} else {
int lastDoy = handleGetYearLength(eyear);
// Fast check: For it to be week 1 of the next year, the DOY
// must be on or after L-5, where L is yearLength(), then it
// cannot possibly be week 1 of the next year:
// L-5 L
// doy: 359 360 361 362 363 364 365 001
// dow: 1 2 3 4 5 6 7
if (dayOfYear >= (lastDoy - 5)) {
int lastRelDow = (relDow + lastDoy - dayOfYear) % 7;
if (lastRelDow < 0) {
lastRelDow += 7;
}
if (((6 - lastRelDow) >= getMinimalDaysInFirstWeek()) &&
((dayOfYear + 7 - relDow) > lastDoy)) {
woy = 1;
yearOfWeekOfYear++;
}
}
}
fields[WEEK_OF_YEAR] = woy;
fields[YEAR_WOY] = yearOfWeekOfYear;
// WEEK_OF_YEAR end
int dayOfMonth = fields[DAY_OF_MONTH];
fields[WEEK_OF_MONTH] = weekNumber(dayOfMonth, dayOfWeek);
fields[DAY_OF_WEEK_IN_MONTH] = (dayOfMonth-1) / 7 + 1;
} | [
"private",
"final",
"void",
"computeWeekFields",
"(",
")",
"{",
"int",
"eyear",
"=",
"fields",
"[",
"EXTENDED_YEAR",
"]",
";",
"int",
"dayOfWeek",
"=",
"fields",
"[",
"DAY_OF_WEEK",
"]",
";",
"int",
"dayOfYear",
"=",
"fields",
"[",
"DAY_OF_YEAR",
"]",
";",... | Compute the fields WEEK_OF_YEAR, YEAR_WOY, WEEK_OF_MONTH,
DAY_OF_WEEK_IN_MONTH, and DOW_LOCAL from EXTENDED_YEAR, YEAR,
DAY_OF_WEEK, and DAY_OF_YEAR. The latter fields are computed by the
subclass based on the calendar system.
<p>The YEAR_WOY field is computed simplistically. It is equal to YEAR
most of the time, but at the year boundary it may be adjusted to YEAR-1
or YEAR+1 to reflect the overlap of a week into an adjacent year. In
this case, a simple increment or decrement is performed on YEAR, even
though this may yield an invalid YEAR value. For instance, if the YEAR
is part of a calendar system with an N-year cycle field CYCLE, then
incrementing the YEAR may involve incrementing CYCLE and setting YEAR
back to 0 or 1. This is not handled by this code, and in fact cannot be
simply handled without having subclasses define an entire parallel set of
fields for fields larger than or equal to a year. This additional
complexity is not warranted, since the intention of the YEAR_WOY field is
to support ISO 8601 notation, so it will typically be used with a
proleptic Gregorian calendar, which has no field larger than a year. | [
"Compute",
"the",
"fields",
"WEEK_OF_YEAR",
"YEAR_WOY",
"WEEK_OF_MONTH",
"DAY_OF_WEEK_IN_MONTH",
"and",
"DOW_LOCAL",
"from",
"EXTENDED_YEAR",
"YEAR",
"DAY_OF_WEEK",
"and",
"DAY_OF_YEAR",
".",
"The",
"latter",
"fields",
"are",
"computed",
"by",
"the",
"subclass",
"base... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5003-L5063 |
33,409 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.resolveFields | protected int resolveFields(int[][][] precedenceTable) {
int bestField = -1;
int tempBestField;
for (int g=0; g<precedenceTable.length && bestField < 0; ++g) {
int[][] group = precedenceTable[g];
int bestStamp = UNSET;
linesInGroup:
for (int l=0; l<group.length; ++l) {
int[] line= group[l];
int lineStamp = UNSET;
// Skip over first entry if it is negative
for (int i=(line[0]>=RESOLVE_REMAP)?1:0; i<line.length; ++i) {
int s = stamp[line[i]];
// If any field is unset then don't use this line
if (s == UNSET) {
continue linesInGroup;
} else {
lineStamp = Math.max(lineStamp, s);
}
}
// Record new maximum stamp & field no.
if (lineStamp > bestStamp) {
tempBestField = line[0]; // First field refers to entire line
if (tempBestField >= RESOLVE_REMAP) {
tempBestField &= (RESOLVE_REMAP-1);
// This check is needed to resolve some issues with UCAL_YEAR precedence mapping
if (tempBestField != DATE || (stamp[WEEK_OF_MONTH] < stamp[tempBestField])) {
bestField = tempBestField;
}
} else {
bestField = tempBestField;
}
if (bestField == tempBestField) {
bestStamp = lineStamp;
}
}
}
}
return (bestField>=RESOLVE_REMAP)?(bestField&(RESOLVE_REMAP-1)):bestField;
} | java | protected int resolveFields(int[][][] precedenceTable) {
int bestField = -1;
int tempBestField;
for (int g=0; g<precedenceTable.length && bestField < 0; ++g) {
int[][] group = precedenceTable[g];
int bestStamp = UNSET;
linesInGroup:
for (int l=0; l<group.length; ++l) {
int[] line= group[l];
int lineStamp = UNSET;
// Skip over first entry if it is negative
for (int i=(line[0]>=RESOLVE_REMAP)?1:0; i<line.length; ++i) {
int s = stamp[line[i]];
// If any field is unset then don't use this line
if (s == UNSET) {
continue linesInGroup;
} else {
lineStamp = Math.max(lineStamp, s);
}
}
// Record new maximum stamp & field no.
if (lineStamp > bestStamp) {
tempBestField = line[0]; // First field refers to entire line
if (tempBestField >= RESOLVE_REMAP) {
tempBestField &= (RESOLVE_REMAP-1);
// This check is needed to resolve some issues with UCAL_YEAR precedence mapping
if (tempBestField != DATE || (stamp[WEEK_OF_MONTH] < stamp[tempBestField])) {
bestField = tempBestField;
}
} else {
bestField = tempBestField;
}
if (bestField == tempBestField) {
bestStamp = lineStamp;
}
}
}
}
return (bestField>=RESOLVE_REMAP)?(bestField&(RESOLVE_REMAP-1)):bestField;
} | [
"protected",
"int",
"resolveFields",
"(",
"int",
"[",
"]",
"[",
"]",
"[",
"]",
"precedenceTable",
")",
"{",
"int",
"bestField",
"=",
"-",
"1",
";",
"int",
"tempBestField",
";",
"for",
"(",
"int",
"g",
"=",
"0",
";",
"g",
"<",
"precedenceTable",
".",
... | Given a precedence table, return the newest field combination in
the table, or -1 if none is found.
<p>The precedence table is a 3-dimensional array of integers. It
may be thought of as an array of groups. Each group is an array of
lines. Each line is an array of field numbers. Within a line, if
all fields are set, then the time stamp of the line is taken to be
the stamp of the most recently set field. If any field of a line is
unset, then the line fails to match. Within a group, the line with
the newest time stamp is selected. The first field of the line is
returned to indicate which line matched.
<p>In some cases, it may be desirable to map a line to field that
whose stamp is NOT examined. For example, if the best field is
DAY_OF_WEEK then the DAY_OF_WEEK_IN_MONTH algorithm may be used. In
order to do this, insert the value <code>REMAP_RESOLVE | F</code> at
the start of the line, where <code>F</code> is the desired return
field value. This field will NOT be examined; it only determines
the return value if the other fields in the line are the newest.
<p>If all lines of a group contain at least one unset field, then no
line will match, and the group as a whole will fail to match. In
that case, the next group will be processed. If all groups fail to
match, then -1 is returned. | [
"Given",
"a",
"precedence",
"table",
"return",
"the",
"newest",
"field",
"combination",
"in",
"the",
"table",
"or",
"-",
"1",
"if",
"none",
"is",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5132-L5172 |
33,410 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.newestStamp | protected int newestStamp(int first, int last, int bestStampSoFar) {
int bestStamp = bestStampSoFar;
for (int i=first; i<=last; ++i) {
if (stamp[i] > bestStamp) {
bestStamp = stamp[i];
}
}
return bestStamp;
} | java | protected int newestStamp(int first, int last, int bestStampSoFar) {
int bestStamp = bestStampSoFar;
for (int i=first; i<=last; ++i) {
if (stamp[i] > bestStamp) {
bestStamp = stamp[i];
}
}
return bestStamp;
} | [
"protected",
"int",
"newestStamp",
"(",
"int",
"first",
",",
"int",
"last",
",",
"int",
"bestStampSoFar",
")",
"{",
"int",
"bestStamp",
"=",
"bestStampSoFar",
";",
"for",
"(",
"int",
"i",
"=",
"first",
";",
"i",
"<=",
"last",
";",
"++",
"i",
")",
"{"... | Returns the newest stamp of a given range of fields. | [
"Returns",
"the",
"newest",
"stamp",
"of",
"a",
"given",
"range",
"of",
"fields",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5177-L5185 |
33,411 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.getImmediatePreviousZoneTransition | private Long getImmediatePreviousZoneTransition(long base) {
Long transitionTime = null;
if (zone instanceof BasicTimeZone) {
TimeZoneTransition transition = ((BasicTimeZone) zone).getPreviousTransition(base, true);
if (transition != null) {
transitionTime = transition.getTime();
}
} else {
// Usually, it is enough to check past one hour because such transition is most
// likely +1 hour shift. However, there is an example jumped +24 hour in the tz database.
transitionTime = getPreviousZoneTransitionTime(zone, base, 2 * 60 * 60 * 1000); // check last 2 hours
if (transitionTime == null) {
transitionTime = getPreviousZoneTransitionTime(zone, base, 30 * 60 * 60 * 1000); // try last 30 hours
}
}
return transitionTime;
} | java | private Long getImmediatePreviousZoneTransition(long base) {
Long transitionTime = null;
if (zone instanceof BasicTimeZone) {
TimeZoneTransition transition = ((BasicTimeZone) zone).getPreviousTransition(base, true);
if (transition != null) {
transitionTime = transition.getTime();
}
} else {
// Usually, it is enough to check past one hour because such transition is most
// likely +1 hour shift. However, there is an example jumped +24 hour in the tz database.
transitionTime = getPreviousZoneTransitionTime(zone, base, 2 * 60 * 60 * 1000); // check last 2 hours
if (transitionTime == null) {
transitionTime = getPreviousZoneTransitionTime(zone, base, 30 * 60 * 60 * 1000); // try last 30 hours
}
}
return transitionTime;
} | [
"private",
"Long",
"getImmediatePreviousZoneTransition",
"(",
"long",
"base",
")",
"{",
"Long",
"transitionTime",
"=",
"null",
";",
"if",
"(",
"zone",
"instanceof",
"BasicTimeZone",
")",
"{",
"TimeZoneTransition",
"transition",
"=",
"(",
"(",
"BasicTimeZone",
")",... | Find the previous zone transtion near the given time.
@param base The base time, inclusive.
@return The time of the previous transition, or null if not found. | [
"Find",
"the",
"previous",
"zone",
"transtion",
"near",
"the",
"given",
"time",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5369-L5386 |
33,412 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.computeZoneOffset | protected int computeZoneOffset(long millis, int millisInDay) {
int[] offsets = new int[2];
long wall = millis + millisInDay;
if (zone instanceof BasicTimeZone) {
int duplicatedTimeOpt = (repeatedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_FORMER : BasicTimeZone.LOCAL_LATTER;
int nonExistingTimeOpt = (skippedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_LATTER : BasicTimeZone.LOCAL_FORMER;
((BasicTimeZone)zone).getOffsetFromLocal(wall, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
} else {
// By default, TimeZone#getOffset behaves WALLTIME_LAST for both.
zone.getOffset(wall, true, offsets);
boolean sawRecentNegativeShift = false;
if (repeatedWallTime == WALLTIME_FIRST) {
// Check if the given wall time falls into repeated time range
long tgmt = wall - (offsets[0] + offsets[1]);
// Any negative zone transition within last 6 hours?
// Note: The maximum historic negative zone transition is -3 hours in the tz database.
// 6 hour window would be sufficient for this purpose.
int offsetBefore6 = zone.getOffset(tgmt - 6*60*60*1000);
int offsetDelta = (offsets[0] + offsets[1]) - offsetBefore6;
assert offsetDelta > -6*60*60*1000 : offsetDelta;
if (offsetDelta < 0) {
sawRecentNegativeShift = true;
// Negative shift within last 6 hours. When WALLTIME_FIRST is used and the given wall time falls
// into the repeated time range, use offsets before the transition.
// Note: If it does not fall into the repeated time range, offsets remain unchanged below.
zone.getOffset(wall + offsetDelta, true, offsets);
}
}
if (!sawRecentNegativeShift && skippedWallTime == WALLTIME_FIRST) {
// When skipped wall time option is WALLTIME_FIRST,
// recalculate offsets from the resolved time (non-wall).
// When the given wall time falls into skipped wall time,
// the offsets will be based on the zone offsets AFTER
// the transition (which means, earliest possibe interpretation).
long tgmt = wall - (offsets[0] + offsets[1]);
zone.getOffset(tgmt, false, offsets);
}
}
return offsets[0] + offsets[1];
} | java | protected int computeZoneOffset(long millis, int millisInDay) {
int[] offsets = new int[2];
long wall = millis + millisInDay;
if (zone instanceof BasicTimeZone) {
int duplicatedTimeOpt = (repeatedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_FORMER : BasicTimeZone.LOCAL_LATTER;
int nonExistingTimeOpt = (skippedWallTime == WALLTIME_FIRST) ? BasicTimeZone.LOCAL_LATTER : BasicTimeZone.LOCAL_FORMER;
((BasicTimeZone)zone).getOffsetFromLocal(wall, nonExistingTimeOpt, duplicatedTimeOpt, offsets);
} else {
// By default, TimeZone#getOffset behaves WALLTIME_LAST for both.
zone.getOffset(wall, true, offsets);
boolean sawRecentNegativeShift = false;
if (repeatedWallTime == WALLTIME_FIRST) {
// Check if the given wall time falls into repeated time range
long tgmt = wall - (offsets[0] + offsets[1]);
// Any negative zone transition within last 6 hours?
// Note: The maximum historic negative zone transition is -3 hours in the tz database.
// 6 hour window would be sufficient for this purpose.
int offsetBefore6 = zone.getOffset(tgmt - 6*60*60*1000);
int offsetDelta = (offsets[0] + offsets[1]) - offsetBefore6;
assert offsetDelta > -6*60*60*1000 : offsetDelta;
if (offsetDelta < 0) {
sawRecentNegativeShift = true;
// Negative shift within last 6 hours. When WALLTIME_FIRST is used and the given wall time falls
// into the repeated time range, use offsets before the transition.
// Note: If it does not fall into the repeated time range, offsets remain unchanged below.
zone.getOffset(wall + offsetDelta, true, offsets);
}
}
if (!sawRecentNegativeShift && skippedWallTime == WALLTIME_FIRST) {
// When skipped wall time option is WALLTIME_FIRST,
// recalculate offsets from the resolved time (non-wall).
// When the given wall time falls into skipped wall time,
// the offsets will be based on the zone offsets AFTER
// the transition (which means, earliest possibe interpretation).
long tgmt = wall - (offsets[0] + offsets[1]);
zone.getOffset(tgmt, false, offsets);
}
}
return offsets[0] + offsets[1];
} | [
"protected",
"int",
"computeZoneOffset",
"(",
"long",
"millis",
",",
"int",
"millisInDay",
")",
"{",
"int",
"[",
"]",
"offsets",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"long",
"wall",
"=",
"millis",
"+",
"millisInDay",
";",
"if",
"(",
"zone",
"instance... | This method can assume EXTENDED_YEAR has been set.
@param millis milliseconds of the date fields (local midnight millis)
@param millisInDay milliseconds of the time fields; may be out
or range.
@return total zone offset (raw + DST) for the given moment
@deprecated This method suffers from a potential integer overflow and may be removed or
changed in a future release. See <a href="http://bugs.icu-project.org/trac/ticket/11632">
ICU ticket #11632</a> for details. | [
"This",
"method",
"can",
"assume",
"EXTENDED_YEAR",
"has",
"been",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5531-L5573 |
33,413 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.computeJulianDay | protected int computeJulianDay() {
// We want to see if any of the date fields is newer than the
// JULIAN_DAY. If not, then we use JULIAN_DAY. If so, then we do
// the normal resolution. We only use JULIAN_DAY if it has been
// set by the user. This makes it possible for the caller to set
// the calendar to a time and call clear(MONTH) to reset the MONTH
// to January. This is legacy behavior. Without this,
// clear(MONTH) has no effect, since the internally set JULIAN_DAY
// is used.
if (stamp[JULIAN_DAY] >= MINIMUM_USER_STAMP) {
int bestStamp = newestStamp(ERA, DAY_OF_WEEK_IN_MONTH, UNSET);
bestStamp = newestStamp(YEAR_WOY, EXTENDED_YEAR, bestStamp);
if (bestStamp <= stamp[JULIAN_DAY]) {
return internalGet(JULIAN_DAY);
}
}
int bestField = resolveFields(getFieldResolutionTable());
if (bestField < 0) {
bestField = DAY_OF_MONTH;
}
return handleComputeJulianDay(bestField);
} | java | protected int computeJulianDay() {
// We want to see if any of the date fields is newer than the
// JULIAN_DAY. If not, then we use JULIAN_DAY. If so, then we do
// the normal resolution. We only use JULIAN_DAY if it has been
// set by the user. This makes it possible for the caller to set
// the calendar to a time and call clear(MONTH) to reset the MONTH
// to January. This is legacy behavior. Without this,
// clear(MONTH) has no effect, since the internally set JULIAN_DAY
// is used.
if (stamp[JULIAN_DAY] >= MINIMUM_USER_STAMP) {
int bestStamp = newestStamp(ERA, DAY_OF_WEEK_IN_MONTH, UNSET);
bestStamp = newestStamp(YEAR_WOY, EXTENDED_YEAR, bestStamp);
if (bestStamp <= stamp[JULIAN_DAY]) {
return internalGet(JULIAN_DAY);
}
}
int bestField = resolveFields(getFieldResolutionTable());
if (bestField < 0) {
bestField = DAY_OF_MONTH;
}
return handleComputeJulianDay(bestField);
} | [
"protected",
"int",
"computeJulianDay",
"(",
")",
"{",
"// We want to see if any of the date fields is newer than the",
"// JULIAN_DAY. If not, then we use JULIAN_DAY. If so, then we do",
"// the normal resolution. We only use JULIAN_DAY if it has been",
"// set by the user. This makes it poss... | Compute the Julian day number as specified by this calendar's fields. | [
"Compute",
"the",
"Julian",
"day",
"number",
"as",
"specified",
"by",
"this",
"calendar",
"s",
"fields",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5578-L5602 |
33,414 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java | Calendar.handleGetMonthLength | protected int handleGetMonthLength(int extendedYear, int month) {
return handleComputeMonthStart(extendedYear, month+1, true) -
handleComputeMonthStart(extendedYear, month, true);
} | java | protected int handleGetMonthLength(int extendedYear, int month) {
return handleComputeMonthStart(extendedYear, month+1, true) -
handleComputeMonthStart(extendedYear, month, true);
} | [
"protected",
"int",
"handleGetMonthLength",
"(",
"int",
"extendedYear",
",",
"int",
"month",
")",
"{",
"return",
"handleComputeMonthStart",
"(",
"extendedYear",
",",
"month",
"+",
"1",
",",
"true",
")",
"-",
"handleComputeMonthStart",
"(",
"extendedYear",
",",
"... | Returns the number of days in the given month of the given extended
year of this calendar system. Subclasses should override this
method if they can provide a more correct or more efficient
implementation than the default implementation in Calendar. | [
"Returns",
"the",
"number",
"of",
"days",
"in",
"the",
"given",
"month",
"of",
"the",
"given",
"extended",
"year",
"of",
"this",
"calendar",
"system",
".",
"Subclasses",
"should",
"override",
"this",
"method",
"if",
"they",
"can",
"provide",
"a",
"more",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/Calendar.java#L5648-L5651 |
33,415 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.getIdForNamespace | public int getIdForNamespace(String uri)
{
int index = m_values.indexOf(uri);
if (index < 0)
{
m_values.addElement(uri);
return m_valueIndex++;
}
else
return index;
} | java | public int getIdForNamespace(String uri)
{
int index = m_values.indexOf(uri);
if (index < 0)
{
m_values.addElement(uri);
return m_valueIndex++;
}
else
return index;
} | [
"public",
"int",
"getIdForNamespace",
"(",
"String",
"uri",
")",
"{",
"int",
"index",
"=",
"m_values",
".",
"indexOf",
"(",
"uri",
")",
";",
"if",
"(",
"index",
"<",
"0",
")",
"{",
"m_values",
".",
"addElement",
"(",
"uri",
")",
";",
"return",
"m_val... | Get a prefix either from the uri mapping, or just make
one up!
@param uri The namespace URI, which may be null.
@return The prefix if there is one, or null. | [
"Get",
"a",
"prefix",
"either",
"from",
"the",
"uri",
"mapping",
"or",
"just",
"make",
"one",
"up!"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L2047-L2057 |
33,416 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.getStringValue | public String getStringValue()
{
int child = _firstch2(ROOTNODE);
if (child == DTM.NULL) return EMPTY_STR;
// optimization: only create StringBuffer if > 1 child
if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL))
{
int dataIndex = m_dataOrQName.elementAt(child);
if (dataIndex >= 0)
return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX);
else
return m_chars.getString(m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex + 1));
}
else
return getStringValueX(getDocument());
} | java | public String getStringValue()
{
int child = _firstch2(ROOTNODE);
if (child == DTM.NULL) return EMPTY_STR;
// optimization: only create StringBuffer if > 1 child
if ((_exptype2(child) == DTM.TEXT_NODE) && (_nextsib2(child) == DTM.NULL))
{
int dataIndex = m_dataOrQName.elementAt(child);
if (dataIndex >= 0)
return m_chars.getString(dataIndex >>> TEXT_LENGTH_BITS, dataIndex & TEXT_LENGTH_MAX);
else
return m_chars.getString(m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex + 1));
}
else
return getStringValueX(getDocument());
} | [
"public",
"String",
"getStringValue",
"(",
")",
"{",
"int",
"child",
"=",
"_firstch2",
"(",
"ROOTNODE",
")",
";",
"if",
"(",
"child",
"==",
"DTM",
".",
"NULL",
")",
"return",
"EMPTY_STR",
";",
"// optimization: only create StringBuffer if > 1 child",
"if",
"(",
... | Returns the string value of the entire tree | [
"Returns",
"the",
"string",
"value",
"of",
"the",
"entire",
"tree"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L2974-L2992 |
33,417 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyTextNode | protected final void copyTextNode(final int nodeID, SerializationHandler handler)
throws SAXException
{
if (nodeID != DTM.NULL) {
int dataIndex = m_dataOrQName.elementAt(nodeID);
if (dataIndex >= 0) {
m_chars.sendSAXcharacters(handler,
dataIndex >>> TEXT_LENGTH_BITS,
dataIndex & TEXT_LENGTH_MAX);
} else {
m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex+1));
}
}
} | java | protected final void copyTextNode(final int nodeID, SerializationHandler handler)
throws SAXException
{
if (nodeID != DTM.NULL) {
int dataIndex = m_dataOrQName.elementAt(nodeID);
if (dataIndex >= 0) {
m_chars.sendSAXcharacters(handler,
dataIndex >>> TEXT_LENGTH_BITS,
dataIndex & TEXT_LENGTH_MAX);
} else {
m_chars.sendSAXcharacters(handler, m_data.elementAt(-dataIndex),
m_data.elementAt(-dataIndex+1));
}
}
} | [
"protected",
"final",
"void",
"copyTextNode",
"(",
"final",
"int",
"nodeID",
",",
"SerializationHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"nodeID",
"!=",
"DTM",
".",
"NULL",
")",
"{",
"int",
"dataIndex",
"=",
"m_dataOrQName",
".",
"... | Copy the String value of a Text node to a SerializationHandler | [
"Copy",
"the",
"String",
"value",
"of",
"a",
"Text",
"node",
"to",
"a",
"SerializationHandler"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3168-L3182 |
33,418 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyElement | protected final String copyElement(int nodeID, int exptype,
SerializationHandler handler)
throws SAXException
{
final ExtendedType extType = m_extendedTypes[exptype];
String uri = extType.getNamespace();
String name = extType.getLocalName();
if (uri.length() == 0) {
handler.startElement(name);
return name;
}
else {
int qnameIndex = m_dataOrQName.elementAt(nodeID);
if (qnameIndex == 0) {
handler.startElement(name);
handler.namespaceAfterStartElement(EMPTY_STR, uri);
return name;
}
if (qnameIndex < 0) {
qnameIndex = -qnameIndex;
qnameIndex = m_data.elementAt(qnameIndex);
}
String qName = m_valuesOrPrefixes.indexToString(qnameIndex);
handler.startElement(qName);
int prefixIndex = qName.indexOf(':');
String prefix;
if (prefixIndex > 0) {
prefix = qName.substring(0, prefixIndex);
}
else {
prefix = null;
}
handler.namespaceAfterStartElement(prefix, uri);
return qName;
}
} | java | protected final String copyElement(int nodeID, int exptype,
SerializationHandler handler)
throws SAXException
{
final ExtendedType extType = m_extendedTypes[exptype];
String uri = extType.getNamespace();
String name = extType.getLocalName();
if (uri.length() == 0) {
handler.startElement(name);
return name;
}
else {
int qnameIndex = m_dataOrQName.elementAt(nodeID);
if (qnameIndex == 0) {
handler.startElement(name);
handler.namespaceAfterStartElement(EMPTY_STR, uri);
return name;
}
if (qnameIndex < 0) {
qnameIndex = -qnameIndex;
qnameIndex = m_data.elementAt(qnameIndex);
}
String qName = m_valuesOrPrefixes.indexToString(qnameIndex);
handler.startElement(qName);
int prefixIndex = qName.indexOf(':');
String prefix;
if (prefixIndex > 0) {
prefix = qName.substring(0, prefixIndex);
}
else {
prefix = null;
}
handler.namespaceAfterStartElement(prefix, uri);
return qName;
}
} | [
"protected",
"final",
"String",
"copyElement",
"(",
"int",
"nodeID",
",",
"int",
"exptype",
",",
"SerializationHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"final",
"ExtendedType",
"extType",
"=",
"m_extendedTypes",
"[",
"exptype",
"]",
";",
"String",
... | Copy an Element node to a SerializationHandler.
@param nodeID The node identity
@param exptype The expanded type of the Element node
@param handler The SerializationHandler
@return The qualified name of the Element node. | [
"Copy",
"an",
"Element",
"node",
"to",
"a",
"SerializationHandler",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3192-L3232 |
33,419 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyNS | protected final void copyNS(final int nodeID, SerializationHandler handler, boolean inScope)
throws SAXException
{
// %OPT% Optimization for documents which does not have any explicit
// namespace nodes. For these documents, there is an implicit
// namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace")
// declared on the root element node. In this case, there is no
// need to do namespace copying. We can safely return without
// doing anything.
if (m_namespaceDeclSetElements != null &&
m_namespaceDeclSetElements.size() == 1 &&
m_namespaceDeclSets != null &&
((SuballocatedIntVector)m_namespaceDeclSets.elementAt(0))
.size() == 1)
return;
SuballocatedIntVector nsContext = null;
int nextNSNode;
// Find the first namespace node
if (inScope) {
nsContext = findNamespaceContext(nodeID);
if (nsContext == null || nsContext.size() < 1)
return;
else
nextNSNode = makeNodeIdentity(nsContext.elementAt(0));
}
else
nextNSNode = getNextNamespaceNode2(nodeID);
int nsIndex = 1;
while (nextNSNode != DTM.NULL) {
// Retrieve the name of the namespace node
int eType = _exptype2(nextNSNode);
String nodeName = m_extendedTypes[eType].getLocalName();
// Retrieve the node value of the namespace node
int dataIndex = m_dataOrQName.elementAt(nextNSNode);
if (dataIndex < 0) {
dataIndex = -dataIndex;
dataIndex = m_data.elementAt(dataIndex + 1);
}
String nodeValue = (String)m_values.elementAt(dataIndex);
handler.namespaceAfterStartElement(nodeName, nodeValue);
if (inScope) {
if (nsIndex < nsContext.size()) {
nextNSNode = makeNodeIdentity(nsContext.elementAt(nsIndex));
nsIndex++;
}
else
return;
}
else
nextNSNode = getNextNamespaceNode2(nextNSNode);
}
} | java | protected final void copyNS(final int nodeID, SerializationHandler handler, boolean inScope)
throws SAXException
{
// %OPT% Optimization for documents which does not have any explicit
// namespace nodes. For these documents, there is an implicit
// namespace node (xmlns:xml="http://www.w3.org/XML/1998/namespace")
// declared on the root element node. In this case, there is no
// need to do namespace copying. We can safely return without
// doing anything.
if (m_namespaceDeclSetElements != null &&
m_namespaceDeclSetElements.size() == 1 &&
m_namespaceDeclSets != null &&
((SuballocatedIntVector)m_namespaceDeclSets.elementAt(0))
.size() == 1)
return;
SuballocatedIntVector nsContext = null;
int nextNSNode;
// Find the first namespace node
if (inScope) {
nsContext = findNamespaceContext(nodeID);
if (nsContext == null || nsContext.size() < 1)
return;
else
nextNSNode = makeNodeIdentity(nsContext.elementAt(0));
}
else
nextNSNode = getNextNamespaceNode2(nodeID);
int nsIndex = 1;
while (nextNSNode != DTM.NULL) {
// Retrieve the name of the namespace node
int eType = _exptype2(nextNSNode);
String nodeName = m_extendedTypes[eType].getLocalName();
// Retrieve the node value of the namespace node
int dataIndex = m_dataOrQName.elementAt(nextNSNode);
if (dataIndex < 0) {
dataIndex = -dataIndex;
dataIndex = m_data.elementAt(dataIndex + 1);
}
String nodeValue = (String)m_values.elementAt(dataIndex);
handler.namespaceAfterStartElement(nodeName, nodeValue);
if (inScope) {
if (nsIndex < nsContext.size()) {
nextNSNode = makeNodeIdentity(nsContext.elementAt(nsIndex));
nsIndex++;
}
else
return;
}
else
nextNSNode = getNextNamespaceNode2(nextNSNode);
}
} | [
"protected",
"final",
"void",
"copyNS",
"(",
"final",
"int",
"nodeID",
",",
"SerializationHandler",
"handler",
",",
"boolean",
"inScope",
")",
"throws",
"SAXException",
"{",
"// %OPT% Optimization for documents which does not have any explicit",
"// namespace nodes. For these d... | Copy namespace nodes.
@param nodeID The Element node identity
@param handler The SerializationHandler
@param inScope true if all namespaces in scope should be copied,
false if only the namespace declarations should be copied. | [
"Copy",
"namespace",
"nodes",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3242-L3301 |
33,420 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.getNextNamespaceNode2 | protected final int getNextNamespaceNode2(int baseID) {
int type;
while ((type = _type2(++baseID)) == DTM.ATTRIBUTE_NODE);
if (type == DTM.NAMESPACE_NODE)
return baseID;
else
return NULL;
} | java | protected final int getNextNamespaceNode2(int baseID) {
int type;
while ((type = _type2(++baseID)) == DTM.ATTRIBUTE_NODE);
if (type == DTM.NAMESPACE_NODE)
return baseID;
else
return NULL;
} | [
"protected",
"final",
"int",
"getNextNamespaceNode2",
"(",
"int",
"baseID",
")",
"{",
"int",
"type",
";",
"while",
"(",
"(",
"type",
"=",
"_type2",
"(",
"++",
"baseID",
")",
")",
"==",
"DTM",
".",
"ATTRIBUTE_NODE",
")",
";",
"if",
"(",
"type",
"==",
... | Return the next namespace node following the given base node.
@baseID The node identity of the base node, which can be an
element, attribute or namespace node.
@return The namespace node immediately following the base node. | [
"Return",
"the",
"next",
"namespace",
"node",
"following",
"the",
"given",
"base",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3310-L3318 |
33,421 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyAttributes | protected final void copyAttributes(final int nodeID, SerializationHandler handler)
throws SAXException{
for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){
int eType = _exptype2(current);
copyAttribute(current, eType, handler);
}
} | java | protected final void copyAttributes(final int nodeID, SerializationHandler handler)
throws SAXException{
for(int current = getFirstAttributeIdentity(nodeID); current != DTM.NULL; current = getNextAttributeIdentity(current)){
int eType = _exptype2(current);
copyAttribute(current, eType, handler);
}
} | [
"protected",
"final",
"void",
"copyAttributes",
"(",
"final",
"int",
"nodeID",
",",
"SerializationHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"for",
"(",
"int",
"current",
"=",
"getFirstAttributeIdentity",
"(",
"nodeID",
")",
";",
"current",
"!=",
"... | Copy attribute nodes from an element .
@param nodeID The Element node identity
@param handler The SerializationHandler | [
"Copy",
"attribute",
"nodes",
"from",
"an",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3326-L3333 |
33,422 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java | SAX2DTM2.copyAttribute | protected final void copyAttribute(int nodeID, int exptype,
SerializationHandler handler)
throws SAXException
{
/*
final String uri = getNamespaceName(node);
if (uri.length() != 0) {
final String prefix = getPrefix(node);
handler.namespaceAfterStartElement(prefix, uri);
}
handler.addAttribute(getNodeName(node), getNodeValue(node));
*/
final ExtendedType extType = m_extendedTypes[exptype];
final String uri = extType.getNamespace();
final String localName = extType.getLocalName();
String prefix = null;
String qname = null;
int dataIndex = _dataOrQName(nodeID);
int valueIndex = dataIndex;
if (dataIndex <= 0) {
int prefixIndex = m_data.elementAt(-dataIndex);
valueIndex = m_data.elementAt(-dataIndex+1);
qname = m_valuesOrPrefixes.indexToString(prefixIndex);
int colonIndex = qname.indexOf(':');
if (colonIndex > 0) {
prefix = qname.substring(0, colonIndex);
}
}
if (uri.length() != 0) {
handler.namespaceAfterStartElement(prefix, uri);
}
String nodeName = (prefix != null) ? qname : localName;
String nodeValue = (String)m_values.elementAt(valueIndex);
handler.addAttribute(nodeName, nodeValue);
} | java | protected final void copyAttribute(int nodeID, int exptype,
SerializationHandler handler)
throws SAXException
{
/*
final String uri = getNamespaceName(node);
if (uri.length() != 0) {
final String prefix = getPrefix(node);
handler.namespaceAfterStartElement(prefix, uri);
}
handler.addAttribute(getNodeName(node), getNodeValue(node));
*/
final ExtendedType extType = m_extendedTypes[exptype];
final String uri = extType.getNamespace();
final String localName = extType.getLocalName();
String prefix = null;
String qname = null;
int dataIndex = _dataOrQName(nodeID);
int valueIndex = dataIndex;
if (dataIndex <= 0) {
int prefixIndex = m_data.elementAt(-dataIndex);
valueIndex = m_data.elementAt(-dataIndex+1);
qname = m_valuesOrPrefixes.indexToString(prefixIndex);
int colonIndex = qname.indexOf(':');
if (colonIndex > 0) {
prefix = qname.substring(0, colonIndex);
}
}
if (uri.length() != 0) {
handler.namespaceAfterStartElement(prefix, uri);
}
String nodeName = (prefix != null) ? qname : localName;
String nodeValue = (String)m_values.elementAt(valueIndex);
handler.addAttribute(nodeName, nodeValue);
} | [
"protected",
"final",
"void",
"copyAttribute",
"(",
"int",
"nodeID",
",",
"int",
"exptype",
",",
"SerializationHandler",
"handler",
")",
"throws",
"SAXException",
"{",
"/*\n final String uri = getNamespaceName(node);\n if (uri.length() != 0) {\n ... | Copy an Attribute node to a SerializationHandler
@param nodeID The node identity
@param exptype The expanded type of the Element node
@param handler The SerializationHandler | [
"Copy",
"an",
"Attribute",
"node",
"to",
"a",
"SerializationHandler"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2DTM2.java#L3344-L3381 |
33,423 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIteratorSimple.java | FilterExprIteratorSimple.executeFilterExpr | public static XNodeSet executeFilterExpr(int context, XPathContext xctxt,
PrefixResolver prefixResolver,
boolean isTopLevel,
int stackFrame,
Expression expr )
throws org.apache.xml.utils.WrappedRuntimeException
{
PrefixResolver savedResolver = xctxt.getNamespaceContext();
XNodeSet result = null;
try
{
xctxt.pushCurrentNode(context);
xctxt.setNamespaceContext(prefixResolver);
// The setRoot operation can take place with a reset operation,
// and so we may not be in the context of LocPathIterator#nextNode,
// so we have to set up the variable context, execute the expression,
// and then restore the variable context.
if (isTopLevel)
{
// System.out.println("calling m_expr.execute(getXPathContext())");
VariableStack vars = xctxt.getVarStack();
// These three statements need to be combined into one operation.
int savedStart = vars.getStackFrame();
vars.setStackFrame(stackFrame);
result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt);
result.setShouldCacheNodes(true);
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
}
else
result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt);
}
catch (javax.xml.transform.TransformerException se)
{
// TODO: Fix...
throw new org.apache.xml.utils.WrappedRuntimeException(se);
}
finally
{
xctxt.popCurrentNode();
xctxt.setNamespaceContext(savedResolver);
}
return result;
} | java | public static XNodeSet executeFilterExpr(int context, XPathContext xctxt,
PrefixResolver prefixResolver,
boolean isTopLevel,
int stackFrame,
Expression expr )
throws org.apache.xml.utils.WrappedRuntimeException
{
PrefixResolver savedResolver = xctxt.getNamespaceContext();
XNodeSet result = null;
try
{
xctxt.pushCurrentNode(context);
xctxt.setNamespaceContext(prefixResolver);
// The setRoot operation can take place with a reset operation,
// and so we may not be in the context of LocPathIterator#nextNode,
// so we have to set up the variable context, execute the expression,
// and then restore the variable context.
if (isTopLevel)
{
// System.out.println("calling m_expr.execute(getXPathContext())");
VariableStack vars = xctxt.getVarStack();
// These three statements need to be combined into one operation.
int savedStart = vars.getStackFrame();
vars.setStackFrame(stackFrame);
result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt);
result.setShouldCacheNodes(true);
// These two statements need to be combined into one operation.
vars.setStackFrame(savedStart);
}
else
result = (org.apache.xpath.objects.XNodeSet) expr.execute(xctxt);
}
catch (javax.xml.transform.TransformerException se)
{
// TODO: Fix...
throw new org.apache.xml.utils.WrappedRuntimeException(se);
}
finally
{
xctxt.popCurrentNode();
xctxt.setNamespaceContext(savedResolver);
}
return result;
} | [
"public",
"static",
"XNodeSet",
"executeFilterExpr",
"(",
"int",
"context",
",",
"XPathContext",
"xctxt",
",",
"PrefixResolver",
"prefixResolver",
",",
"boolean",
"isTopLevel",
",",
"int",
"stackFrame",
",",
"Expression",
"expr",
")",
"throws",
"org",
".",
"apache... | Execute the expression. Meant for reuse by other FilterExpr iterators
that are not derived from this object. | [
"Execute",
"the",
"expression",
".",
"Meant",
"for",
"reuse",
"by",
"other",
"FilterExpr",
"iterators",
"that",
"are",
"not",
"derived",
"from",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprIteratorSimple.java#L87-L138 |
33,424 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.characters | public void characters(char[] ch, int start, int length)
throws org.xml.sax.SAXException
{
// Actually creating the text node is handled by
// processAccumulatedText(); here we just accumulate the
// characters into the buffer.
m_char.append(ch,start,length);
} | java | public void characters(char[] ch, int start, int length)
throws org.xml.sax.SAXException
{
// Actually creating the text node is handled by
// processAccumulatedText(); here we just accumulate the
// characters into the buffer.
m_char.append(ch,start,length);
} | [
"public",
"void",
"characters",
"(",
"char",
"[",
"]",
"ch",
",",
"int",
"start",
",",
"int",
"length",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"// Actually creating the text node is handled by",
"// processAccumulatedText(); here we ... | Replaces the deprecated DocumentHandler interface. | [
"Replaces",
"the",
"deprecated",
"DocumentHandler",
"interface",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L407-L414 |
33,425 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.processAccumulatedText | private void processAccumulatedText()
{
int len=m_char.length();
if(len!=m_char_current_start)
{
// The FastStringBuffer has been previously agreed upon
appendTextChild(m_char_current_start,len-m_char_current_start);
m_char_current_start=len;
}
} | java | private void processAccumulatedText()
{
int len=m_char.length();
if(len!=m_char_current_start)
{
// The FastStringBuffer has been previously agreed upon
appendTextChild(m_char_current_start,len-m_char_current_start);
m_char_current_start=len;
}
} | [
"private",
"void",
"processAccumulatedText",
"(",
")",
"{",
"int",
"len",
"=",
"m_char",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"!=",
"m_char_current_start",
")",
"{",
"// The FastStringBuffer has been previously agreed upon",
"appendTextChild",
"(",
"m_cha... | Flush string accumulation into a text node | [
"Flush",
"string",
"accumulation",
"into",
"a",
"text",
"node"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L417-L426 |
33,426 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getFirstAttribute | public int getFirstAttribute(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
// %REVIEW% jjk: Just a quick observation: If you're going to
// call readEntry repeatedly on the same node, it may be
// more efficiently to do a readSlot to get the data locally,
// reducing the addressing and call-and-return overhead.
// Should we check if handle is element (do we want sanity checks?)
if (ELEMENT_NODE != (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
return NULL;
// First Attribute (if any) should be at next position in table
nodeHandle++;
return(ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) ?
nodeHandle | m_docHandle : NULL;
} | java | public int getFirstAttribute(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
// %REVIEW% jjk: Just a quick observation: If you're going to
// call readEntry repeatedly on the same node, it may be
// more efficiently to do a readSlot to get the data locally,
// reducing the addressing and call-and-return overhead.
// Should we check if handle is element (do we want sanity checks?)
if (ELEMENT_NODE != (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
return NULL;
// First Attribute (if any) should be at next position in table
nodeHandle++;
return(ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF)) ?
nodeHandle | m_docHandle : NULL;
} | [
"public",
"int",
"getFirstAttribute",
"(",
"int",
"nodeHandle",
")",
"{",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"// %REVIEW% jjk: Just a quick observation: If you're going to",
"// call readEntry repeatedly on the same node, it may be",
"// more efficiently to do a readSlot to get ... | Given a node handle, get the index of the node's first attribute.
@param nodeHandle int Handle of the Element node.
@return Handle of first attribute, or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"get",
"the",
"index",
"of",
"the",
"node",
"s",
"first",
"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/DTMDocumentImpl.java#L1112-L1127 |
33,427 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getNextSibling | public int getNextSibling(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
// Document root has no next sibling
if (nodeHandle == 0)
return NULL;
short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF);
if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) ||
(type == ENTITY_REFERENCE_NODE)) {
int nextSib = nodes.readEntry(nodeHandle, 2);
if (nextSib == NULL)
return NULL;
if (nextSib != 0)
return (m_docHandle | nextSib);
// ###shs should cycle/wait if nextSib is 0? Working on threading next
}
// Next Sibling is in the next position if it shares the same parent
int thisParent = nodes.readEntry(nodeHandle, 1);
if (nodes.readEntry(++nodeHandle, 1) == thisParent)
return (m_docHandle | nodeHandle);
return NULL;
} | java | public int getNextSibling(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
// Document root has no next sibling
if (nodeHandle == 0)
return NULL;
short type = (short) (nodes.readEntry(nodeHandle, 0) & 0xFFFF);
if ((type == ELEMENT_NODE) || (type == ATTRIBUTE_NODE) ||
(type == ENTITY_REFERENCE_NODE)) {
int nextSib = nodes.readEntry(nodeHandle, 2);
if (nextSib == NULL)
return NULL;
if (nextSib != 0)
return (m_docHandle | nextSib);
// ###shs should cycle/wait if nextSib is 0? Working on threading next
}
// Next Sibling is in the next position if it shares the same parent
int thisParent = nodes.readEntry(nodeHandle, 1);
if (nodes.readEntry(++nodeHandle, 1) == thisParent)
return (m_docHandle | nodeHandle);
return NULL;
} | [
"public",
"int",
"getNextSibling",
"(",
"int",
"nodeHandle",
")",
"{",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"// Document root has no next sibling",
"if",
"(",
"nodeHandle",
"==",
"0",
")",
"return",
"NULL",
";",
"short",
"type",
"=",
"(",
"short",
")",
... | Given a node handle, advance to its next sibling.
%TBD% This currently uses the DTM-internal definition of
sibling; eg, the last attr's next sib is the first
child. In the old DTM, the DOM proxy layer provided the
additional logic for the public view. If we're rewriting
for XPath emulation, that test must be done here.
%TBD% CODE INTERACTION WITH INCREMENTAL PARSE - If not yet
resolved, should wait for more nodes to be added to the document
and tries again.
@param nodeHandle int Handle of the node.
@return int Node-number of next sibling,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"its",
"next",
"sibling",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1164-L1187 |
33,428 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getNextAttribute | public int getNextAttribute(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
nodes.readSlot(nodeHandle, gotslot);
//%REVIEW% Why are we using short here? There's no storage
//reduction for an automatic variable, especially one used
//so briefly, and it typically costs more cycles to process
//than an int would.
short type = (short) (gotslot[0] & 0xFFFF);
if (type == ELEMENT_NODE) {
return getFirstAttribute(nodeHandle);
} else if (type == ATTRIBUTE_NODE) {
if (gotslot[2] != NULL)
return (m_docHandle | gotslot[2]);
}
return NULL;
} | java | public int getNextAttribute(int nodeHandle) {
nodeHandle &= NODEHANDLE_MASK;
nodes.readSlot(nodeHandle, gotslot);
//%REVIEW% Why are we using short here? There's no storage
//reduction for an automatic variable, especially one used
//so briefly, and it typically costs more cycles to process
//than an int would.
short type = (short) (gotslot[0] & 0xFFFF);
if (type == ELEMENT_NODE) {
return getFirstAttribute(nodeHandle);
} else if (type == ATTRIBUTE_NODE) {
if (gotslot[2] != NULL)
return (m_docHandle | gotslot[2]);
}
return NULL;
} | [
"public",
"int",
"getNextAttribute",
"(",
"int",
"nodeHandle",
")",
"{",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"nodes",
".",
"readSlot",
"(",
"nodeHandle",
",",
"gotslot",
")",
";",
"//%REVIEW% Why are we using short here? There's no storage",
"//reduction for an au... | Given a node handle, advance to the next attribute. If an
element, we advance to its first attribute; if an attr, we advance to
the next attr on the same node.
@param nodeHandle int Handle of the node.
@return int DTM node-number of the resolved attr,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"the",
"next",
"attribute",
".",
"If",
"an",
"element",
"we",
"advance",
"to",
"its",
"first",
"attribute",
";",
"if",
"an",
"attr",
"we",
"advance",
"to",
"the",
"next",
"attr",
"on",
"the",
"same",
"no... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1222-L1239 |
33,429 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getNextDescendant | public int getNextDescendant(int subtreeRootHandle, int nodeHandle) {
subtreeRootHandle &= NODEHANDLE_MASK;
nodeHandle &= NODEHANDLE_MASK;
// Document root [Document Node? -- jjk] - no next-sib
if (nodeHandle == 0)
return NULL;
while (!m_isError) {
// Document done and node out of bounds
if (done && (nodeHandle > nodes.slotsUsed()))
break;
if (nodeHandle > subtreeRootHandle) {
nodes.readSlot(nodeHandle+1, gotslot);
if (gotslot[2] != 0) {
short type = (short) (gotslot[0] & 0xFFFF);
if (type == ATTRIBUTE_NODE) {
nodeHandle +=2;
} else {
int nextParentPos = gotslot[1];
if (nextParentPos >= subtreeRootHandle)
return (m_docHandle | (nodeHandle+1));
else
break;
}
} else if (!done) {
// Add wait logic here
} else
break;
} else {
nodeHandle++;
}
}
// Probably should throw error here like original instead of returning
return NULL;
} | java | public int getNextDescendant(int subtreeRootHandle, int nodeHandle) {
subtreeRootHandle &= NODEHANDLE_MASK;
nodeHandle &= NODEHANDLE_MASK;
// Document root [Document Node? -- jjk] - no next-sib
if (nodeHandle == 0)
return NULL;
while (!m_isError) {
// Document done and node out of bounds
if (done && (nodeHandle > nodes.slotsUsed()))
break;
if (nodeHandle > subtreeRootHandle) {
nodes.readSlot(nodeHandle+1, gotslot);
if (gotslot[2] != 0) {
short type = (short) (gotslot[0] & 0xFFFF);
if (type == ATTRIBUTE_NODE) {
nodeHandle +=2;
} else {
int nextParentPos = gotslot[1];
if (nextParentPos >= subtreeRootHandle)
return (m_docHandle | (nodeHandle+1));
else
break;
}
} else if (!done) {
// Add wait logic here
} else
break;
} else {
nodeHandle++;
}
}
// Probably should throw error here like original instead of returning
return NULL;
} | [
"public",
"int",
"getNextDescendant",
"(",
"int",
"subtreeRootHandle",
",",
"int",
"nodeHandle",
")",
"{",
"subtreeRootHandle",
"&=",
"NODEHANDLE_MASK",
";",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"// Document root [Document Node? -- jjk] - no next-sib",
"if",
"(",
"... | Given a node handle, advance to its next descendant.
If not yet resolved, waits for more nodes to be added to the document and
tries again.
@param subtreeRootHandle
@param nodeHandle int Handle of the node.
@return handle of next descendant,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"its",
"next",
"descendant",
".",
"If",
"not",
"yet",
"resolved",
"waits",
"for",
"more",
"nodes",
"to",
"be",
"added",
"to",
"the",
"document",
"and",
"tries",
"again",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1266-L1299 |
33,430 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getNextPreceding | public int getNextPreceding(int axisContextHandle, int nodeHandle) {
// ###shs copied from Xalan 1, what is this suppose to do?
nodeHandle &= NODEHANDLE_MASK;
while (nodeHandle > 1) {
nodeHandle--;
if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
continue;
// if nodeHandle is _not_ an ancestor of
// axisContextHandle, specialFind will return it.
// If it _is_ an ancestor, specialFind will return -1
// %REVIEW% unconditional return defeats the
// purpose of the while loop -- does this
// logic make any sense?
return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle));
}
return NULL;
} | java | public int getNextPreceding(int axisContextHandle, int nodeHandle) {
// ###shs copied from Xalan 1, what is this suppose to do?
nodeHandle &= NODEHANDLE_MASK;
while (nodeHandle > 1) {
nodeHandle--;
if (ATTRIBUTE_NODE == (nodes.readEntry(nodeHandle, 0) & 0xFFFF))
continue;
// if nodeHandle is _not_ an ancestor of
// axisContextHandle, specialFind will return it.
// If it _is_ an ancestor, specialFind will return -1
// %REVIEW% unconditional return defeats the
// purpose of the while loop -- does this
// logic make any sense?
return (m_docHandle | nodes.specialFind(axisContextHandle, nodeHandle));
}
return NULL;
} | [
"public",
"int",
"getNextPreceding",
"(",
"int",
"axisContextHandle",
",",
"int",
"nodeHandle",
")",
"{",
"// ###shs copied from Xalan 1, what is this suppose to do?",
"nodeHandle",
"&=",
"NODEHANDLE_MASK",
";",
"while",
"(",
"nodeHandle",
">",
"1",
")",
"{",
"nodeHandl... | Given a node handle, advance to the next node on the preceding axis.
@param axisContextHandle the start of the axis that is being traversed.
@param nodeHandle the id of the node.
@return int Node-number of preceding sibling,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"advance",
"to",
"the",
"next",
"node",
"on",
"the",
"preceding",
"axis",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1322-L1341 |
33,431 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.getLocalNameFromExpandedNameID | public String getLocalNameFromExpandedNameID(int ExpandedNameID) {
// Get expanded name
String expandedName = m_localNames.indexToString(ExpandedNameID);
// Remove prefix from expanded name
int colonpos = expandedName.indexOf(":");
String localName = expandedName.substring(colonpos+1);
return localName;
} | java | public String getLocalNameFromExpandedNameID(int ExpandedNameID) {
// Get expanded name
String expandedName = m_localNames.indexToString(ExpandedNameID);
// Remove prefix from expanded name
int colonpos = expandedName.indexOf(":");
String localName = expandedName.substring(colonpos+1);
return localName;
} | [
"public",
"String",
"getLocalNameFromExpandedNameID",
"(",
"int",
"ExpandedNameID",
")",
"{",
"// Get expanded name",
"String",
"expandedName",
"=",
"m_localNames",
".",
"indexToString",
"(",
"ExpandedNameID",
")",
";",
"// Remove prefix from expanded name",
"int",
"colonpo... | Given an expanded-name ID, return the local name part.
@param ExpandedNameID an ID that represents an expanded-name.
@return String Local name of this node. | [
"Given",
"an",
"expanded",
"-",
"name",
"ID",
"return",
"the",
"local",
"name",
"part",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L1554-L1562 |
33,432 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.appendChild | public void appendChild(int newChild, boolean clone, boolean cloneDepth) {
boolean sameDoc = ((newChild & DOCHANDLE_MASK) == m_docHandle);
if (clone || !sameDoc) {
} else {
}
} | java | public void appendChild(int newChild, boolean clone, boolean cloneDepth) {
boolean sameDoc = ((newChild & DOCHANDLE_MASK) == m_docHandle);
if (clone || !sameDoc) {
} else {
}
} | [
"public",
"void",
"appendChild",
"(",
"int",
"newChild",
",",
"boolean",
"clone",
",",
"boolean",
"cloneDepth",
")",
"{",
"boolean",
"sameDoc",
"=",
"(",
"(",
"newChild",
"&",
"DOCHANDLE_MASK",
")",
"==",
"m_docHandle",
")",
";",
"if",
"(",
"clone",
"||",
... | Append a child to the end of the child list of the current node. Please note that the node
is always cloned if it is owned by another document.
<p>%REVIEW% "End of the document" needs to be defined more clearly.
Does it become the last child of the Document? Of the root element?</p>
@param newChild Must be a valid new node handle.
@param clone true if the child should be cloned into the document.
@param cloneDepth if the clone argument is true, specifies that the
clone should include all it's children. | [
"Append",
"a",
"child",
"to",
"the",
"end",
"of",
"the",
"child",
"list",
"of",
"the",
"current",
"node",
".",
"Please",
"note",
"that",
"the",
"node",
"is",
"always",
"cloned",
"if",
"it",
"is",
"owned",
"by",
"another",
"document",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L2055-L2062 |
33,433 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java | DTMDocumentImpl.appendEndElement | void appendEndElement()
{
// pop up the stacks
if (previousSiblingWasParent)
nodes.writeEntry(previousSibling, 2, NULL);
// Pop parentage
previousSibling = currentParent;
nodes.readSlot(currentParent, gotslot);
currentParent = gotslot[1] & 0xFFFF;
// The element just being finished will be
// the previous sibling for the next operation
previousSiblingWasParent = true;
// Pop a level of namespace table
// namespaceTable.removeLastElem();
} | java | void appendEndElement()
{
// pop up the stacks
if (previousSiblingWasParent)
nodes.writeEntry(previousSibling, 2, NULL);
// Pop parentage
previousSibling = currentParent;
nodes.readSlot(currentParent, gotslot);
currentParent = gotslot[1] & 0xFFFF;
// The element just being finished will be
// the previous sibling for the next operation
previousSiblingWasParent = true;
// Pop a level of namespace table
// namespaceTable.removeLastElem();
} | [
"void",
"appendEndElement",
"(",
")",
"{",
"// pop up the stacks",
"if",
"(",
"previousSiblingWasParent",
")",
"nodes",
".",
"writeEntry",
"(",
"previousSibling",
",",
"2",
",",
"NULL",
")",
";",
"// Pop parentage",
"previousSibling",
"=",
"currentParent",
";",
"n... | Terminate the element currently acting as an insertion point. Subsequent
insertions will occur as the last child of this element's parent. | [
"Terminate",
"the",
"element",
"currently",
"acting",
"as",
"an",
"insertion",
"point",
".",
"Subsequent",
"insertions",
"will",
"occur",
"as",
"the",
"last",
"child",
"of",
"this",
"element",
"s",
"parent",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDocumentImpl.java#L2316-L2334 |
33,434 | google/j2objc | jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java | KXmlParser.readDoctype | private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
read(START_DOCTYPE);
int startPosition = -1;
if (saveDtdText) {
bufferCapture = new StringBuilder();
startPosition = position;
}
try {
skip();
rootElementName = readName();
readExternalId(true, true);
skip();
if (peekCharacter() == '[') {
readInternalSubset();
}
skip();
} finally {
if (saveDtdText) {
bufferCapture.append(buffer, 0, position);
bufferCapture.delete(0, startPosition);
text = bufferCapture.toString();
bufferCapture = null;
}
}
read('>');
skip();
} | java | private void readDoctype(boolean saveDtdText) throws IOException, XmlPullParserException {
read(START_DOCTYPE);
int startPosition = -1;
if (saveDtdText) {
bufferCapture = new StringBuilder();
startPosition = position;
}
try {
skip();
rootElementName = readName();
readExternalId(true, true);
skip();
if (peekCharacter() == '[') {
readInternalSubset();
}
skip();
} finally {
if (saveDtdText) {
bufferCapture.append(buffer, 0, position);
bufferCapture.delete(0, startPosition);
text = bufferCapture.toString();
bufferCapture = null;
}
}
read('>');
skip();
} | [
"private",
"void",
"readDoctype",
"(",
"boolean",
"saveDtdText",
")",
"throws",
"IOException",
",",
"XmlPullParserException",
"{",
"read",
"(",
"START_DOCTYPE",
")",
";",
"int",
"startPosition",
"=",
"-",
"1",
";",
"if",
"(",
"saveDtdText",
")",
"{",
"bufferCa... | Read the document's DTD. Although this parser is non-validating, the DTD
must be parsed to capture entity values and default attribute values. | [
"Read",
"the",
"document",
"s",
"DTD",
".",
"Although",
"this",
"parser",
"is",
"non",
"-",
"validating",
"the",
"DTD",
"must",
"be",
"parsed",
"to",
"capture",
"entity",
"values",
"and",
"default",
"attribute",
"values",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java#L580-L608 |
33,435 | google/j2objc | jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java | KXmlParser.nextTag | public int nextTag() throws XmlPullParserException, IOException {
next();
if (type == TEXT && isWhitespace) {
next();
}
if (type != END_TAG && type != START_TAG) {
throw new XmlPullParserException("unexpected type", this, null);
}
return type;
} | java | public int nextTag() throws XmlPullParserException, IOException {
next();
if (type == TEXT && isWhitespace) {
next();
}
if (type != END_TAG && type != START_TAG) {
throw new XmlPullParserException("unexpected type", this, null);
}
return type;
} | [
"public",
"int",
"nextTag",
"(",
")",
"throws",
"XmlPullParserException",
",",
"IOException",
"{",
"next",
"(",
")",
";",
"if",
"(",
"type",
"==",
"TEXT",
"&&",
"isWhitespace",
")",
"{",
"next",
"(",
")",
";",
"}",
"if",
"(",
"type",
"!=",
"END_TAG",
... | utility methods to make XML parsing easier ... | [
"utility",
"methods",
"to",
"make",
"XML",
"parsing",
"easier",
"..."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java#L2049-L2060 |
33,436 | google/j2objc | jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java | KXmlParser.popContentSource | private void popContentSource() {
buffer = nextContentSource.buffer;
position = nextContentSource.position;
limit = nextContentSource.limit;
nextContentSource = nextContentSource.next;
} | java | private void popContentSource() {
buffer = nextContentSource.buffer;
position = nextContentSource.position;
limit = nextContentSource.limit;
nextContentSource = nextContentSource.next;
} | [
"private",
"void",
"popContentSource",
"(",
")",
"{",
"buffer",
"=",
"nextContentSource",
".",
"buffer",
";",
"position",
"=",
"nextContentSource",
".",
"position",
";",
"limit",
"=",
"nextContentSource",
".",
"limit",
";",
"nextContentSource",
"=",
"nextContentSo... | Replaces the current exhausted buffer with the next buffer in the chain. | [
"Replaces",
"the",
"current",
"exhausted",
"buffer",
"with",
"the",
"next",
"buffer",
"in",
"the",
"chain",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/kxml2/io/KXmlParser.java#L2172-L2177 |
33,437 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java | RelativeDateFormat.getStringForDay | private String getStringForDay(int day) {
if(fDates == null) {
loadDates();
}
for(URelativeString dayItem : fDates) {
if(dayItem.offset == day) {
return dayItem.string;
}
}
return null;
} | java | private String getStringForDay(int day) {
if(fDates == null) {
loadDates();
}
for(URelativeString dayItem : fDates) {
if(dayItem.offset == day) {
return dayItem.string;
}
}
return null;
} | [
"private",
"String",
"getStringForDay",
"(",
"int",
"day",
")",
"{",
"if",
"(",
"fDates",
"==",
"null",
")",
"{",
"loadDates",
"(",
")",
";",
"}",
"for",
"(",
"URelativeString",
"dayItem",
":",
"fDates",
")",
"{",
"if",
"(",
"dayItem",
".",
"offset",
... | Get the string at a specific offset.
@param day day offset ( -1, 0, 1, etc.. ). Does not require sorting by offset.
@return the string, or NULL if none at that location. | [
"Get",
"the",
"string",
"at",
"a",
"specific",
"offset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java#L237-L247 |
33,438 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java | RelativeDateFormat.loadDates | private synchronized void loadDates() {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, fLocale);
// Use sink mechanism to traverse data structure.
fDates = new ArrayList<URelativeString>();
RelDateFmtDataSink sink = new RelDateFmtDataSink();
rb.getAllItemsWithFallback("fields/day/relative", sink);
} | java | private synchronized void loadDates() {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, fLocale);
// Use sink mechanism to traverse data structure.
fDates = new ArrayList<URelativeString>();
RelDateFmtDataSink sink = new RelDateFmtDataSink();
rb.getAllItemsWithFallback("fields/day/relative", sink);
} | [
"private",
"synchronized",
"void",
"loadDates",
"(",
")",
"{",
"ICUResourceBundle",
"rb",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",
"fLocale",
")",
";",
"// Use sink mechanism to travers... | Load the Date string array | [
"Load",
"the",
"Date",
"string",
"array"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java#L281-L288 |
33,439 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java | RelativeDateFormat.initCapitalizationContextInfo | private void initCapitalizationContextInfo(ULocale locale) {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
try {
ICUResourceBundle rdb = rb.getWithFallback("contextTransforms/relative");
int[] intVector = rdb.getIntVector();
if (intVector.length >= 2) {
capitalizationOfRelativeUnitsForListOrMenu = (intVector[0] != 0);
capitalizationOfRelativeUnitsForStandAlone = (intVector[1] != 0);
}
} catch (MissingResourceException e) {
// use default
}
} | java | private void initCapitalizationContextInfo(ULocale locale) {
ICUResourceBundle rb = (ICUResourceBundle) UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, locale);
try {
ICUResourceBundle rdb = rb.getWithFallback("contextTransforms/relative");
int[] intVector = rdb.getIntVector();
if (intVector.length >= 2) {
capitalizationOfRelativeUnitsForListOrMenu = (intVector[0] != 0);
capitalizationOfRelativeUnitsForStandAlone = (intVector[1] != 0);
}
} catch (MissingResourceException e) {
// use default
}
} | [
"private",
"void",
"initCapitalizationContextInfo",
"(",
"ULocale",
"locale",
")",
"{",
"ICUResourceBundle",
"rb",
"=",
"(",
"ICUResourceBundle",
")",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",
"locale",
")",
";",
"try",
... | Set capitalizationOfRelativeUnitsForListOrMenu, capitalizationOfRelativeUnitsForStandAlone | [
"Set",
"capitalizationOfRelativeUnitsForListOrMenu",
"capitalizationOfRelativeUnitsForStandAlone"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java#L293-L305 |
33,440 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java | RelativeDateFormat.initializeCalendar | private Calendar initializeCalendar(TimeZone zone, ULocale locale) {
if (calendar == null) {
if(zone == null) {
calendar = Calendar.getInstance(locale);
} else {
calendar = Calendar.getInstance(zone, locale);
}
}
return calendar;
} | java | private Calendar initializeCalendar(TimeZone zone, ULocale locale) {
if (calendar == null) {
if(zone == null) {
calendar = Calendar.getInstance(locale);
} else {
calendar = Calendar.getInstance(zone, locale);
}
}
return calendar;
} | [
"private",
"Calendar",
"initializeCalendar",
"(",
"TimeZone",
"zone",
",",
"ULocale",
"locale",
")",
"{",
"if",
"(",
"calendar",
"==",
"null",
")",
"{",
"if",
"(",
"zone",
"==",
"null",
")",
"{",
"calendar",
"=",
"Calendar",
".",
"getInstance",
"(",
"loc... | initializes fCalendar from parameters. Returns fCalendar as a convenience.
@param zone Zone to be adopted, or NULL for TimeZone::createDefault().
@param locale Locale of the calendar
@param status Error code
@return the newly constructed fCalendar | [
"initializes",
"fCalendar",
"from",
"parameters",
".",
"Returns",
"fCalendar",
"as",
"a",
"convenience",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RelativeDateFormat.java#L326-L335 |
33,441 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.setTimeZoneNames | public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
_tznames = tznames;
// TimeZoneGenericNames must be changed to utilize the new TimeZoneNames instance.
_gnames = new TimeZoneGenericNames(_locale, _tznames);
return this;
} | java | public TimeZoneFormat setTimeZoneNames(TimeZoneNames tznames) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
_tznames = tznames;
// TimeZoneGenericNames must be changed to utilize the new TimeZoneNames instance.
_gnames = new TimeZoneGenericNames(_locale, _tznames);
return this;
} | [
"public",
"TimeZoneFormat",
"setTimeZoneNames",
"(",
"TimeZoneNames",
"tznames",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify frozen object\"",
")",
";",
"}",
"_tznames",
"=",
"tzname... | Sets the time zone display name data to this instance.
@param tznames the time zone display name data.
@return this object.
@throws UnsupportedOperationException when this object is frozen.
@see #getTimeZoneNames() | [
"Sets",
"the",
"time",
"zone",
"display",
"name",
"data",
"to",
"this",
"instance",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L526-L534 |
33,442 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.setGMTOffsetPattern | public TimeZoneFormat setGMTOffsetPattern(GMTOffsetPatternType type, String pattern) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (pattern == null) {
throw new NullPointerException("Null GMT offset pattern");
}
Object[] parsedItems = parseOffsetPattern(pattern, type.required());
_gmtOffsetPatterns[type.ordinal()] = pattern;
_gmtOffsetPatternItems[type.ordinal()] = parsedItems;
checkAbuttingHoursAndMinutes();
return this;
} | java | public TimeZoneFormat setGMTOffsetPattern(GMTOffsetPatternType type, String pattern) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (pattern == null) {
throw new NullPointerException("Null GMT offset pattern");
}
Object[] parsedItems = parseOffsetPattern(pattern, type.required());
_gmtOffsetPatterns[type.ordinal()] = pattern;
_gmtOffsetPatternItems[type.ordinal()] = parsedItems;
checkAbuttingHoursAndMinutes();
return this;
} | [
"public",
"TimeZoneFormat",
"setGMTOffsetPattern",
"(",
"GMTOffsetPatternType",
"type",
",",
"String",
"pattern",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify frozen object\"",
")",
";"... | Sets the offset pattern for the given offset type.
@param type the offset pattern.
@param pattern the pattern string.
@return this object.
@throws IllegalArgumentException when the pattern string does not have required time field letters.
@throws UnsupportedOperationException when this object is frozen.
@see #getGMTOffsetPattern(GMTOffsetPatternType) | [
"Sets",
"the",
"offset",
"pattern",
"for",
"the",
"given",
"offset",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L584-L599 |
33,443 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getGMTOffsetDigits | public String getGMTOffsetDigits() {
StringBuilder buf = new StringBuilder(_gmtOffsetDigits.length);
for (String digit : _gmtOffsetDigits) {
buf.append(digit);
}
return buf.toString();
} | java | public String getGMTOffsetDigits() {
StringBuilder buf = new StringBuilder(_gmtOffsetDigits.length);
for (String digit : _gmtOffsetDigits) {
buf.append(digit);
}
return buf.toString();
} | [
"public",
"String",
"getGMTOffsetDigits",
"(",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
"_gmtOffsetDigits",
".",
"length",
")",
";",
"for",
"(",
"String",
"digit",
":",
"_gmtOffsetDigits",
")",
"{",
"buf",
".",
"append",
"(",
"digi... | Returns the decimal digit characters used for localized GMT format in a single string
containing from 0 to 9 in the ascending order.
@return the decimal digits for localized GMT format.
@see #setGMTOffsetDigits(String) | [
"Returns",
"the",
"decimal",
"digit",
"characters",
"used",
"for",
"localized",
"GMT",
"format",
"in",
"a",
"single",
"string",
"containing",
"from",
"0",
"to",
"9",
"in",
"the",
"ascending",
"order",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L608-L614 |
33,444 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.setGMTOffsetDigits | public TimeZoneFormat setGMTOffsetDigits(String digits) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (digits == null) {
throw new NullPointerException("Null GMT offset digits");
}
String[] digitArray = toCodePoints(digits);
if (digitArray.length != 10) {
throw new IllegalArgumentException("Length of digits must be 10");
}
_gmtOffsetDigits = digitArray;
return this;
} | java | public TimeZoneFormat setGMTOffsetDigits(String digits) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify frozen object");
}
if (digits == null) {
throw new NullPointerException("Null GMT offset digits");
}
String[] digitArray = toCodePoints(digits);
if (digitArray.length != 10) {
throw new IllegalArgumentException("Length of digits must be 10");
}
_gmtOffsetDigits = digitArray;
return this;
} | [
"public",
"TimeZoneFormat",
"setGMTOffsetDigits",
"(",
"String",
"digits",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify frozen object\"",
")",
";",
"}",
"if",
"(",
"digits",
"==",
... | Sets the decimal digit characters used for localized GMT format.
@param digits a string contains the decimal digit characters from 0 to 9 n the ascending order.
@return this object.
@throws IllegalArgumentException when the string did not contain ten characters.
@throws UnsupportedOperationException when this object is frozen.
@see #getGMTOffsetDigits() | [
"Sets",
"the",
"decimal",
"digit",
"characters",
"used",
"for",
"localized",
"GMT",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L625-L638 |
33,445 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.formatOffsetISO8601Basic | public final String formatOffsetISO8601Basic(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds) {
return formatOffsetISO8601(offset, true, useUtcIndicator, isShort, ignoreSeconds);
} | java | public final String formatOffsetISO8601Basic(int offset, boolean useUtcIndicator, boolean isShort, boolean ignoreSeconds) {
return formatOffsetISO8601(offset, true, useUtcIndicator, isShort, ignoreSeconds);
} | [
"public",
"final",
"String",
"formatOffsetISO8601Basic",
"(",
"int",
"offset",
",",
"boolean",
"useUtcIndicator",
",",
"boolean",
"isShort",
",",
"boolean",
"ignoreSeconds",
")",
"{",
"return",
"formatOffsetISO8601",
"(",
"offset",
",",
"true",
",",
"useUtcIndicator... | Returns the ISO 8601 basic time zone string for the given offset.
For example, "-08", "-0830" and "Z"
@param offset the offset from GMT(UTC) in milliseconds.
@param useUtcIndicator true if ISO 8601 UTC indicator "Z" is used when the offset is 0.
@param isShort true if shortest form is used.
@param ignoreSeconds true if non-zero offset seconds is appended.
@return the ISO 8601 basic format.
@throws IllegalArgumentException if the specified offset is out of supported range
(-24 hours < offset < +24 hours).
@see #formatOffsetISO8601Extended(int, boolean, boolean, boolean)
@see #parseOffsetISO8601(String, ParsePosition) | [
"Returns",
"the",
"ISO",
"8601",
"basic",
"time",
"zone",
"string",
"for",
"the",
"given",
"offset",
".",
"For",
"example",
"-",
"08",
"-",
"0830",
"and",
"Z"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L718-L720 |
33,446 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.format | public final String format(Style style, TimeZone tz, long date) {
return format(style, tz, date, null);
} | java | public final String format(Style style, TimeZone tz, long date) {
return format(style, tz, date, null);
} | [
"public",
"final",
"String",
"format",
"(",
"Style",
"style",
",",
"TimeZone",
"tz",
",",
"long",
"date",
")",
"{",
"return",
"format",
"(",
"style",
",",
"tz",
",",
"date",
",",
"null",
")",
";",
"}"
] | Returns the display name of the time zone at the given date for
the style.
<p><b>Note</b>: A style may have fallback styles defined. For example,
when <code>GENERIC_LONG</code> is requested, but there is no display name
data available for <code>GENERIC_LONG</code> style, the implementation
may use <code>GENERIC_LOCATION</code> or <code>LOCALIZED_GMT</code>.
See UTS#35 UNICODE LOCALE DATA MARKUP LANGUAGE (LDML)
<a href="http://www.unicode.org/reports/tr35/#Time_Zone_Fallback">Appendix J: Time Zone Display Name</a>
for the details.
@param style the style enum (e.g. <code>GENERIC_LONG</code>, <code>LOCALIZED_GMT</code>...)
@param tz the time zone.
@param date the date.
@return the display name of the time zone.
@see Style
@see #format(Style, TimeZone, long, Output) | [
"Returns",
"the",
"display",
"name",
"of",
"the",
"time",
"zone",
"at",
"the",
"given",
"date",
"for",
"the",
"style",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L803-L805 |
33,447 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.formatOffsetLocalizedGMT | private String formatOffsetLocalizedGMT(int offset, boolean isShort) {
if (offset == 0) {
return _gmtZeroFormat;
}
StringBuilder buf = new StringBuilder();
boolean positive = true;
if (offset < 0) {
offset = -offset;
positive = false;
}
int offsetH = offset / MILLIS_PER_HOUR;
offset = offset % MILLIS_PER_HOUR;
int offsetM = offset / MILLIS_PER_MINUTE;
offset = offset % MILLIS_PER_MINUTE;
int offsetS = offset / MILLIS_PER_SECOND;
if (offsetH > MAX_OFFSET_HOUR || offsetM > MAX_OFFSET_MINUTE || offsetS > MAX_OFFSET_SECOND) {
throw new IllegalArgumentException("Offset out of range :" + offset);
}
Object[] offsetPatternItems;
if (positive) {
if (offsetS != 0) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_HMS.ordinal()];
} else if (offsetM != 0 || !isShort) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_HM.ordinal()];
} else {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_H.ordinal()];
}
} else {
if (offsetS != 0) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_HMS.ordinal()];
} else if (offsetM != 0 || !isShort) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_HM.ordinal()];
} else {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_H.ordinal()];
}
}
// Building the GMT format string
buf.append(_gmtPatternPrefix);
for (Object item : offsetPatternItems) {
if (item instanceof String) {
// pattern literal
buf.append((String)item);
} else if (item instanceof GMTOffsetField) {
// Hour/minute/second field
GMTOffsetField field = (GMTOffsetField)item;
switch (field.getType()) {
case 'H':
appendOffsetDigits(buf, offsetH, (isShort ? 1 : 2));
break;
case 'm':
appendOffsetDigits(buf, offsetM, 2);
break;
case 's':
appendOffsetDigits(buf, offsetS, 2);
break;
}
}
}
buf.append(_gmtPatternSuffix);
return buf.toString();
} | java | private String formatOffsetLocalizedGMT(int offset, boolean isShort) {
if (offset == 0) {
return _gmtZeroFormat;
}
StringBuilder buf = new StringBuilder();
boolean positive = true;
if (offset < 0) {
offset = -offset;
positive = false;
}
int offsetH = offset / MILLIS_PER_HOUR;
offset = offset % MILLIS_PER_HOUR;
int offsetM = offset / MILLIS_PER_MINUTE;
offset = offset % MILLIS_PER_MINUTE;
int offsetS = offset / MILLIS_PER_SECOND;
if (offsetH > MAX_OFFSET_HOUR || offsetM > MAX_OFFSET_MINUTE || offsetS > MAX_OFFSET_SECOND) {
throw new IllegalArgumentException("Offset out of range :" + offset);
}
Object[] offsetPatternItems;
if (positive) {
if (offsetS != 0) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_HMS.ordinal()];
} else if (offsetM != 0 || !isShort) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_HM.ordinal()];
} else {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.POSITIVE_H.ordinal()];
}
} else {
if (offsetS != 0) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_HMS.ordinal()];
} else if (offsetM != 0 || !isShort) {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_HM.ordinal()];
} else {
offsetPatternItems = _gmtOffsetPatternItems[GMTOffsetPatternType.NEGATIVE_H.ordinal()];
}
}
// Building the GMT format string
buf.append(_gmtPatternPrefix);
for (Object item : offsetPatternItems) {
if (item instanceof String) {
// pattern literal
buf.append((String)item);
} else if (item instanceof GMTOffsetField) {
// Hour/minute/second field
GMTOffsetField field = (GMTOffsetField)item;
switch (field.getType()) {
case 'H':
appendOffsetDigits(buf, offsetH, (isShort ? 1 : 2));
break;
case 'm':
appendOffsetDigits(buf, offsetM, 2);
break;
case 's':
appendOffsetDigits(buf, offsetS, 2);
break;
}
}
}
buf.append(_gmtPatternSuffix);
return buf.toString();
} | [
"private",
"String",
"formatOffsetLocalizedGMT",
"(",
"int",
"offset",
",",
"boolean",
"isShort",
")",
"{",
"if",
"(",
"offset",
"==",
"0",
")",
"{",
"return",
"_gmtZeroFormat",
";",
"}",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
... | Private method used for localized GMT formatting.
@param offset the zone's UTC offset
@param isShort true if the short localized GMT format is desired
@return the localized GMT string | [
"Private",
"method",
"used",
"for",
"localized",
"GMT",
"formatting",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1565-L1631 |
33,448 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.formatSpecific | private String formatSpecific(TimeZone tz, NameType stdType, NameType dstType, long date, Output<TimeType> timeType) {
assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD);
assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT);
boolean isDaylight = tz.inDaylightTime(new Date(date));
String name = isDaylight?
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), dstType, date) :
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), stdType, date);
if (name != null && timeType != null) {
timeType.value = isDaylight ? TimeType.DAYLIGHT : TimeType.STANDARD;
}
return name;
} | java | private String formatSpecific(TimeZone tz, NameType stdType, NameType dstType, long date, Output<TimeType> timeType) {
assert(stdType == NameType.LONG_STANDARD || stdType == NameType.SHORT_STANDARD);
assert(dstType == NameType.LONG_DAYLIGHT || dstType == NameType.SHORT_DAYLIGHT);
boolean isDaylight = tz.inDaylightTime(new Date(date));
String name = isDaylight?
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), dstType, date) :
getTimeZoneNames().getDisplayName(ZoneMeta.getCanonicalCLDRID(tz), stdType, date);
if (name != null && timeType != null) {
timeType.value = isDaylight ? TimeType.DAYLIGHT : TimeType.STANDARD;
}
return name;
} | [
"private",
"String",
"formatSpecific",
"(",
"TimeZone",
"tz",
",",
"NameType",
"stdType",
",",
"NameType",
"dstType",
",",
"long",
"date",
",",
"Output",
"<",
"TimeType",
">",
"timeType",
")",
"{",
"assert",
"(",
"stdType",
"==",
"NameType",
".",
"LONG_STAND... | Private method returning the time zone's specific format string.
@param tz the time zone
@param stdType the name type used for standard time
@param dstType the name type used for daylight time
@param date the date
@param timeType when null, actual time type is set
@return the time zone's specific format name string | [
"Private",
"method",
"returning",
"the",
"time",
"zone",
"s",
"specific",
"format",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1710-L1723 |
33,449 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.formatExemplarLocation | private String formatExemplarLocation(TimeZone tz) {
String location = getTimeZoneNames().getExemplarLocationName(ZoneMeta.getCanonicalCLDRID(tz));
if (location == null) {
// Use "unknown" location
location = getTimeZoneNames().getExemplarLocationName(UNKNOWN_ZONE_ID);
if (location == null) {
// last resort
location = UNKNOWN_LOCATION;
}
}
return location;
} | java | private String formatExemplarLocation(TimeZone tz) {
String location = getTimeZoneNames().getExemplarLocationName(ZoneMeta.getCanonicalCLDRID(tz));
if (location == null) {
// Use "unknown" location
location = getTimeZoneNames().getExemplarLocationName(UNKNOWN_ZONE_ID);
if (location == null) {
// last resort
location = UNKNOWN_LOCATION;
}
}
return location;
} | [
"private",
"String",
"formatExemplarLocation",
"(",
"TimeZone",
"tz",
")",
"{",
"String",
"location",
"=",
"getTimeZoneNames",
"(",
")",
".",
"getExemplarLocationName",
"(",
"ZoneMeta",
".",
"getCanonicalCLDRID",
"(",
"tz",
")",
")",
";",
"if",
"(",
"location",
... | Private method returning the time zone's exemplar location string.
This method will never return null.
@param tz the time zone
@return the time zone's exemplar location name. | [
"Private",
"method",
"returning",
"the",
"time",
"zone",
"s",
"exemplar",
"location",
"string",
".",
"This",
"method",
"will",
"never",
"return",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1732-L1743 |
33,450 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getTimeZoneID | private String getTimeZoneID(String tzID, String mzID) {
String id = tzID;
if (id == null) {
assert (mzID != null);
id = _tznames.getReferenceZoneID(mzID, getTargetRegion());
if (id == null) {
throw new IllegalArgumentException("Invalid mzID: " + mzID);
}
}
return id;
} | java | private String getTimeZoneID(String tzID, String mzID) {
String id = tzID;
if (id == null) {
assert (mzID != null);
id = _tznames.getReferenceZoneID(mzID, getTargetRegion());
if (id == null) {
throw new IllegalArgumentException("Invalid mzID: " + mzID);
}
}
return id;
} | [
"private",
"String",
"getTimeZoneID",
"(",
"String",
"tzID",
",",
"String",
"mzID",
")",
"{",
"String",
"id",
"=",
"tzID",
";",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"assert",
"(",
"mzID",
"!=",
"null",
")",
";",
"id",
"=",
"_tznames",
".",
"get... | Private method returns a time zone ID. If tzID is not null, the value of tzID is returned.
If tzID is null, then this method look up a time zone ID for the current region. This is a
small helper method used by the parse implementation method
@param tzID
the time zone ID or null
@param mzID
the meta zone ID or null
@return A time zone ID
@throws IllegalArgumentException
when both tzID and mzID are null | [
"Private",
"method",
"returns",
"a",
"time",
"zone",
"ID",
".",
"If",
"tzID",
"is",
"not",
"null",
"the",
"value",
"of",
"tzID",
"is",
"returned",
".",
"If",
"tzID",
"is",
"null",
"then",
"this",
"method",
"look",
"up",
"a",
"time",
"zone",
"ID",
"fo... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1758-L1768 |
33,451 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getTargetRegion | private synchronized String getTargetRegion() {
if (_region == null) {
_region = _locale.getCountry();
if (_region.length() == 0) {
ULocale tmp = ULocale.addLikelySubtags(_locale);
_region = tmp.getCountry();
if (_region.length() == 0) {
_region = "001";
}
}
}
return _region;
} | java | private synchronized String getTargetRegion() {
if (_region == null) {
_region = _locale.getCountry();
if (_region.length() == 0) {
ULocale tmp = ULocale.addLikelySubtags(_locale);
_region = tmp.getCountry();
if (_region.length() == 0) {
_region = "001";
}
}
}
return _region;
} | [
"private",
"synchronized",
"String",
"getTargetRegion",
"(",
")",
"{",
"if",
"(",
"_region",
"==",
"null",
")",
"{",
"_region",
"=",
"_locale",
".",
"getCountry",
"(",
")",
";",
"if",
"(",
"_region",
".",
"length",
"(",
")",
"==",
"0",
")",
"{",
"ULo... | Private method returning the target region. The target regions is determined by
the locale of this instance. When a generic name is coming from
a meta zone, this region is used for checking if the time zone
is a reference zone of the meta zone.
@return the target region | [
"Private",
"method",
"returning",
"the",
"target",
"region",
".",
"The",
"target",
"regions",
"is",
"determined",
"by",
"the",
"locale",
"of",
"this",
"instance",
".",
"When",
"a",
"generic",
"name",
"is",
"coming",
"from",
"a",
"meta",
"zone",
"this",
"re... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1778-L1790 |
33,452 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getTimeType | private TimeType getTimeType(NameType nameType) {
switch (nameType) {
case LONG_STANDARD:
case SHORT_STANDARD:
return TimeType.STANDARD;
case LONG_DAYLIGHT:
case SHORT_DAYLIGHT:
return TimeType.DAYLIGHT;
default:
return TimeType.UNKNOWN;
}
} | java | private TimeType getTimeType(NameType nameType) {
switch (nameType) {
case LONG_STANDARD:
case SHORT_STANDARD:
return TimeType.STANDARD;
case LONG_DAYLIGHT:
case SHORT_DAYLIGHT:
return TimeType.DAYLIGHT;
default:
return TimeType.UNKNOWN;
}
} | [
"private",
"TimeType",
"getTimeType",
"(",
"NameType",
"nameType",
")",
"{",
"switch",
"(",
"nameType",
")",
"{",
"case",
"LONG_STANDARD",
":",
"case",
"SHORT_STANDARD",
":",
"return",
"TimeType",
".",
"STANDARD",
";",
"case",
"LONG_DAYLIGHT",
":",
"case",
"SH... | Returns the time type for the given name type
@param nameType the name type
@return the time type (unknown/standard/daylight) | [
"Returns",
"the",
"time",
"type",
"for",
"the",
"given",
"name",
"type"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1797-L1810 |
33,453 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.unquote | private static String unquote(String s) {
if (s.indexOf('\'') < 0) {
return s;
}
boolean isPrevQuote = false;
boolean inQuote = false;
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\'') {
if (isPrevQuote) {
buf.append(c);
isPrevQuote = false;
} else {
isPrevQuote = true;
}
inQuote = !inQuote;
} else {
isPrevQuote = false;
buf.append(c);
}
}
return buf.toString();
} | java | private static String unquote(String s) {
if (s.indexOf('\'') < 0) {
return s;
}
boolean isPrevQuote = false;
boolean inQuote = false;
StringBuilder buf = new StringBuilder();
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\'') {
if (isPrevQuote) {
buf.append(c);
isPrevQuote = false;
} else {
isPrevQuote = true;
}
inQuote = !inQuote;
} else {
isPrevQuote = false;
buf.append(c);
}
}
return buf.toString();
} | [
"private",
"static",
"String",
"unquote",
"(",
"String",
"s",
")",
"{",
"if",
"(",
"s",
".",
"indexOf",
"(",
"'",
"'",
")",
"<",
"0",
")",
"{",
"return",
"s",
";",
"}",
"boolean",
"isPrevQuote",
"=",
"false",
";",
"boolean",
"inQuote",
"=",
"false"... | Unquotes the message format style pattern.
@param s the pattern
@return the unquoted pattern string | [
"Unquotes",
"the",
"message",
"format",
"style",
"pattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L1837-L1860 |
33,454 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.getTimeZoneForOffset | private TimeZone getTimeZoneForOffset(int offset) {
if (offset == 0) {
// when offset is 0, we should use "Etc/GMT"
return TimeZone.getTimeZone(TZID_GMT);
}
return ZoneMeta.getCustomTimeZone(offset);
} | java | private TimeZone getTimeZoneForOffset(int offset) {
if (offset == 0) {
// when offset is 0, we should use "Etc/GMT"
return TimeZone.getTimeZone(TZID_GMT);
}
return ZoneMeta.getCustomTimeZone(offset);
} | [
"private",
"TimeZone",
"getTimeZoneForOffset",
"(",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
"==",
"0",
")",
"{",
"// when offset is 0, we should use \"Etc/GMT\"",
"return",
"TimeZone",
".",
"getTimeZone",
"(",
"TZID_GMT",
")",
";",
"}",
"return",
"ZoneMeta... | Creates an instance of TimeZone for the given offset
@param offset the offset
@return A TimeZone with the given offset | [
"Creates",
"an",
"instance",
"of",
"TimeZone",
"for",
"the",
"given",
"offset"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2110-L2116 |
33,455 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseOffsetLocalizedGMTPattern | private int parseOffsetLocalizedGMTPattern(String text, int start, boolean isShort, int[] parsedLen) {
int idx = start;
int offset = 0;
boolean parsed = false;
do {
// Prefix part
int len = _gmtPatternPrefix.length();
if (len > 0 && !text.regionMatches(true, idx, _gmtPatternPrefix, 0, len)) {
// prefix match failed
break;
}
idx += len;
// Offset part
int[] offsetLen = new int[1];
offset = parseOffsetFields(text, idx, false, offsetLen);
if (offsetLen[0] == 0) {
// offset field match failed
break;
}
idx += offsetLen[0];
// Suffix part
len = _gmtPatternSuffix.length();
if (len > 0 && !text.regionMatches(true, idx, _gmtPatternSuffix, 0, len)) {
// no suffix match
break;
}
idx += len;
parsed = true;
} while (false);
parsedLen[0] = parsed ? idx - start : 0;
return offset;
} | java | private int parseOffsetLocalizedGMTPattern(String text, int start, boolean isShort, int[] parsedLen) {
int idx = start;
int offset = 0;
boolean parsed = false;
do {
// Prefix part
int len = _gmtPatternPrefix.length();
if (len > 0 && !text.regionMatches(true, idx, _gmtPatternPrefix, 0, len)) {
// prefix match failed
break;
}
idx += len;
// Offset part
int[] offsetLen = new int[1];
offset = parseOffsetFields(text, idx, false, offsetLen);
if (offsetLen[0] == 0) {
// offset field match failed
break;
}
idx += offsetLen[0];
// Suffix part
len = _gmtPatternSuffix.length();
if (len > 0 && !text.regionMatches(true, idx, _gmtPatternSuffix, 0, len)) {
// no suffix match
break;
}
idx += len;
parsed = true;
} while (false);
parsedLen[0] = parsed ? idx - start : 0;
return offset;
} | [
"private",
"int",
"parseOffsetLocalizedGMTPattern",
"(",
"String",
"text",
",",
"int",
"start",
",",
"boolean",
"isShort",
",",
"int",
"[",
"]",
"parsedLen",
")",
"{",
"int",
"idx",
"=",
"start",
";",
"int",
"offset",
"=",
"0",
";",
"boolean",
"parsed",
... | Parse localized GMT format generated by the pattern used by this formatter, except
GMT Zero format.
@param text the input text
@param start the start index
@param isShort true if the short localized GMT format is parsed.
@param parsedLen the parsed length, or 0 on failure.
@return the parsed offset in milliseconds. | [
"Parse",
"localized",
"GMT",
"format",
"generated",
"by",
"the",
"pattern",
"used",
"by",
"this",
"formatter",
"except",
"GMT",
"Zero",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2196-L2231 |
33,456 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseOffsetFields | private int parseOffsetFields(String text, int start, boolean isShort, int[] parsedLen) {
int outLen = 0;
int offset = 0;
int sign = 1;
if (parsedLen != null && parsedLen.length >= 1) {
parsedLen[0] = 0;
}
int offsetH, offsetM, offsetS;
offsetH = offsetM = offsetS = 0;
int[] fields = {0, 0, 0};
for (GMTOffsetPatternType gmtPatType : PARSE_GMT_OFFSET_TYPES) {
Object[] items = _gmtOffsetPatternItems[gmtPatType.ordinal()];
assert items != null;
outLen = parseOffsetFieldsWithPattern(text, start, items, false, fields);
if (outLen > 0) {
sign = gmtPatType.isPositive() ? 1 : -1;
offsetH = fields[0];
offsetM = fields[1];
offsetS = fields[2];
break;
}
}
if (outLen > 0 && _abuttingOffsetHoursAndMinutes) {
// When hours field is abutting minutes field,
// the parse result above may not be appropriate.
// For example, "01020" is parsed as 01:02 above,
// but it should be parsed as 00:10:20.
int tmpLen = 0;
int tmpSign = 1;
for (GMTOffsetPatternType gmtPatType : PARSE_GMT_OFFSET_TYPES) {
Object[] items = _gmtOffsetPatternItems[gmtPatType.ordinal()];
assert items != null;
// forcing parse to use single hour digit
tmpLen = parseOffsetFieldsWithPattern(text, start, items, true, fields);
if (tmpLen > 0) {
tmpSign = gmtPatType.isPositive() ? 1 : -1;
break;
}
}
if (tmpLen > outLen) {
// Better parse result with single hour digit
outLen = tmpLen;
sign = tmpSign;
offsetH = fields[0];
offsetM = fields[1];
offsetS = fields[2];
}
}
if (parsedLen != null && parsedLen.length >= 1) {
parsedLen[0] = outLen;
}
if (outLen > 0) {
offset = ((((offsetH * 60) + offsetM) * 60) + offsetS) * 1000 * sign;
}
return offset;
} | java | private int parseOffsetFields(String text, int start, boolean isShort, int[] parsedLen) {
int outLen = 0;
int offset = 0;
int sign = 1;
if (parsedLen != null && parsedLen.length >= 1) {
parsedLen[0] = 0;
}
int offsetH, offsetM, offsetS;
offsetH = offsetM = offsetS = 0;
int[] fields = {0, 0, 0};
for (GMTOffsetPatternType gmtPatType : PARSE_GMT_OFFSET_TYPES) {
Object[] items = _gmtOffsetPatternItems[gmtPatType.ordinal()];
assert items != null;
outLen = parseOffsetFieldsWithPattern(text, start, items, false, fields);
if (outLen > 0) {
sign = gmtPatType.isPositive() ? 1 : -1;
offsetH = fields[0];
offsetM = fields[1];
offsetS = fields[2];
break;
}
}
if (outLen > 0 && _abuttingOffsetHoursAndMinutes) {
// When hours field is abutting minutes field,
// the parse result above may not be appropriate.
// For example, "01020" is parsed as 01:02 above,
// but it should be parsed as 00:10:20.
int tmpLen = 0;
int tmpSign = 1;
for (GMTOffsetPatternType gmtPatType : PARSE_GMT_OFFSET_TYPES) {
Object[] items = _gmtOffsetPatternItems[gmtPatType.ordinal()];
assert items != null;
// forcing parse to use single hour digit
tmpLen = parseOffsetFieldsWithPattern(text, start, items, true, fields);
if (tmpLen > 0) {
tmpSign = gmtPatType.isPositive() ? 1 : -1;
break;
}
}
if (tmpLen > outLen) {
// Better parse result with single hour digit
outLen = tmpLen;
sign = tmpSign;
offsetH = fields[0];
offsetM = fields[1];
offsetS = fields[2];
}
}
if (parsedLen != null && parsedLen.length >= 1) {
parsedLen[0] = outLen;
}
if (outLen > 0) {
offset = ((((offsetH * 60) + offsetM) * 60) + offsetS) * 1000 * sign;
}
return offset;
} | [
"private",
"int",
"parseOffsetFields",
"(",
"String",
"text",
",",
"int",
"start",
",",
"boolean",
"isShort",
",",
"int",
"[",
"]",
"parsedLen",
")",
"{",
"int",
"outLen",
"=",
"0",
";",
"int",
"offset",
"=",
"0",
";",
"int",
"sign",
"=",
"1",
";",
... | Parses localized GMT offset fields into offset.
@param text the input text
@param start the start index
@param isShort true if this is a short format - currently not used
@param parsedLen the parsed length, or 0 on failure.
@return the parsed offset in milliseconds. | [
"Parses",
"localized",
"GMT",
"offset",
"fields",
"into",
"offset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2242-L2305 |
33,457 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseOffsetFieldsWithPattern | private int parseOffsetFieldsWithPattern(String text, int start, Object[] patternItems, boolean forceSingleHourDigit, int fields[]) {
assert (fields != null && fields.length >= 3);
fields[0] = fields[1] = fields[2] = 0;
boolean failed = false;
int offsetH, offsetM, offsetS;
offsetH = offsetM = offsetS = 0;
int idx = start;
int[] tmpParsedLen = {0};
for (int i = 0; i < patternItems.length; i++) {
if (patternItems[i] instanceof String) {
String patStr = (String)patternItems[i];
int len = patStr.length();
if (!text.regionMatches(true, idx, patStr, 0, len)) {
failed = true;
break;
}
idx += len;
} else {
assert(patternItems[i] instanceof GMTOffsetField);
GMTOffsetField field = (GMTOffsetField)patternItems[i];
char fieldType = field.getType();
if (fieldType == 'H') {
int maxDigits = forceSingleHourDigit ? 1 : 2;
offsetH = parseOffsetFieldWithLocalizedDigits(text, idx, 1, maxDigits, 0, MAX_OFFSET_HOUR, tmpParsedLen);
} else if (fieldType == 'm') {
offsetM = parseOffsetFieldWithLocalizedDigits(text, idx, 2, 2, 0, MAX_OFFSET_MINUTE, tmpParsedLen);
} else if (fieldType == 's') {
offsetS = parseOffsetFieldWithLocalizedDigits(text, idx, 2, 2, 0, MAX_OFFSET_SECOND, tmpParsedLen);
}
if (tmpParsedLen[0] == 0) {
failed = true;
break;
}
idx += tmpParsedLen[0];
}
}
if (failed) {
return 0;
}
fields[0] = offsetH;
fields[1] = offsetM;
fields[2] = offsetS;
return idx - start;
} | java | private int parseOffsetFieldsWithPattern(String text, int start, Object[] patternItems, boolean forceSingleHourDigit, int fields[]) {
assert (fields != null && fields.length >= 3);
fields[0] = fields[1] = fields[2] = 0;
boolean failed = false;
int offsetH, offsetM, offsetS;
offsetH = offsetM = offsetS = 0;
int idx = start;
int[] tmpParsedLen = {0};
for (int i = 0; i < patternItems.length; i++) {
if (patternItems[i] instanceof String) {
String patStr = (String)patternItems[i];
int len = patStr.length();
if (!text.regionMatches(true, idx, patStr, 0, len)) {
failed = true;
break;
}
idx += len;
} else {
assert(patternItems[i] instanceof GMTOffsetField);
GMTOffsetField field = (GMTOffsetField)patternItems[i];
char fieldType = field.getType();
if (fieldType == 'H') {
int maxDigits = forceSingleHourDigit ? 1 : 2;
offsetH = parseOffsetFieldWithLocalizedDigits(text, idx, 1, maxDigits, 0, MAX_OFFSET_HOUR, tmpParsedLen);
} else if (fieldType == 'm') {
offsetM = parseOffsetFieldWithLocalizedDigits(text, idx, 2, 2, 0, MAX_OFFSET_MINUTE, tmpParsedLen);
} else if (fieldType == 's') {
offsetS = parseOffsetFieldWithLocalizedDigits(text, idx, 2, 2, 0, MAX_OFFSET_SECOND, tmpParsedLen);
}
if (tmpParsedLen[0] == 0) {
failed = true;
break;
}
idx += tmpParsedLen[0];
}
}
if (failed) {
return 0;
}
fields[0] = offsetH;
fields[1] = offsetM;
fields[2] = offsetS;
return idx - start;
} | [
"private",
"int",
"parseOffsetFieldsWithPattern",
"(",
"String",
"text",
",",
"int",
"start",
",",
"Object",
"[",
"]",
"patternItems",
",",
"boolean",
"forceSingleHourDigit",
",",
"int",
"fields",
"[",
"]",
")",
"{",
"assert",
"(",
"fields",
"!=",
"null",
"&... | Parses localized GMT offset fields with the given pattern
@param text the input text
@param start the start index
@param patternItems the pattern (already itemized)
@param forceSingleHourDigit true if hours field is parsed as a single digit
@param fields receives the parsed hours/minutes/seconds
@return parsed length | [
"Parses",
"localized",
"GMT",
"offset",
"fields",
"with",
"the",
"given",
"pattern"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2317-L2365 |
33,458 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseDefaultOffsetFields | private int parseDefaultOffsetFields(String text, int start, char separator, int[] parsedLen) {
int max = text.length();
int idx = start;
int[] len = {0};
int hour = 0, min = 0, sec = 0;
do {
hour = parseOffsetFieldWithLocalizedDigits(text, idx, 1, 2, 0, MAX_OFFSET_HOUR, len);
if (len[0] == 0) {
break;
}
idx += len[0];
if (idx + 1 < max && text.charAt(idx) == separator) {
min = parseOffsetFieldWithLocalizedDigits(text, idx + 1, 2, 2, 0, MAX_OFFSET_MINUTE, len);
if (len[0] == 0) {
break;
}
idx += (1 + len[0]);
if (idx + 1 < max && text.charAt(idx) == separator) {
sec = parseOffsetFieldWithLocalizedDigits(text, idx + 1, 2, 2, 0, MAX_OFFSET_SECOND, len);
if (len[0] == 0) {
break;
}
idx += (1 + len[0]);
}
}
} while (false);
if (idx == start) {
parsedLen[0] = 0;
return 0;
}
parsedLen[0] = idx - start;
return hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
} | java | private int parseDefaultOffsetFields(String text, int start, char separator, int[] parsedLen) {
int max = text.length();
int idx = start;
int[] len = {0};
int hour = 0, min = 0, sec = 0;
do {
hour = parseOffsetFieldWithLocalizedDigits(text, idx, 1, 2, 0, MAX_OFFSET_HOUR, len);
if (len[0] == 0) {
break;
}
idx += len[0];
if (idx + 1 < max && text.charAt(idx) == separator) {
min = parseOffsetFieldWithLocalizedDigits(text, idx + 1, 2, 2, 0, MAX_OFFSET_MINUTE, len);
if (len[0] == 0) {
break;
}
idx += (1 + len[0]);
if (idx + 1 < max && text.charAt(idx) == separator) {
sec = parseOffsetFieldWithLocalizedDigits(text, idx + 1, 2, 2, 0, MAX_OFFSET_SECOND, len);
if (len[0] == 0) {
break;
}
idx += (1 + len[0]);
}
}
} while (false);
if (idx == start) {
parsedLen[0] = 0;
return 0;
}
parsedLen[0] = idx - start;
return hour * MILLIS_PER_HOUR + min * MILLIS_PER_MINUTE + sec * MILLIS_PER_SECOND;
} | [
"private",
"int",
"parseDefaultOffsetFields",
"(",
"String",
"text",
",",
"int",
"start",
",",
"char",
"separator",
",",
"int",
"[",
"]",
"parsedLen",
")",
"{",
"int",
"max",
"=",
"text",
".",
"length",
"(",
")",
";",
"int",
"idx",
"=",
"start",
";",
... | Parses the input GMT offset fields with the default offset pattern.
@param text the input text
@param start the start index
@param separator the separator character, e.g. ':'
@param parsedLen the parsed length, or 0 on failure.
@return the parsed offset in milliseconds. | [
"Parses",
"the",
"input",
"GMT",
"offset",
"fields",
"with",
"the",
"default",
"offset",
"pattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2446-L2483 |
33,459 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseSingleLocalizedDigit | private int parseSingleLocalizedDigit(String text, int start, int[] len) {
int digit = -1;
len[0] = 0;
if (start < text.length()) {
int cp = Character.codePointAt(text, start);
// First, try digits configured for this instance
for (int i = 0; i < _gmtOffsetDigits.length; i++) {
if (cp == _gmtOffsetDigits[i].codePointAt(0)) {
digit = i;
break;
}
}
// If failed, check if this is a Unicode digit
if (digit < 0) {
digit = UCharacter.digit(cp);
}
if (digit >= 0) {
len[0] = Character.charCount(cp);
}
}
return digit;
} | java | private int parseSingleLocalizedDigit(String text, int start, int[] len) {
int digit = -1;
len[0] = 0;
if (start < text.length()) {
int cp = Character.codePointAt(text, start);
// First, try digits configured for this instance
for (int i = 0; i < _gmtOffsetDigits.length; i++) {
if (cp == _gmtOffsetDigits[i].codePointAt(0)) {
digit = i;
break;
}
}
// If failed, check if this is a Unicode digit
if (digit < 0) {
digit = UCharacter.digit(cp);
}
if (digit >= 0) {
len[0] = Character.charCount(cp);
}
}
return digit;
} | [
"private",
"int",
"parseSingleLocalizedDigit",
"(",
"String",
"text",
",",
"int",
"start",
",",
"int",
"[",
"]",
"len",
")",
"{",
"int",
"digit",
"=",
"-",
"1",
";",
"len",
"[",
"0",
"]",
"=",
"0",
";",
"if",
"(",
"start",
"<",
"text",
".",
"leng... | Reads a single decimal digit, either localized digits used by this object
or any Unicode numeric character.
@param text the text
@param start the start index
@param len the actual length read from the text
the start index is not a decimal number.
@return the integer value of the parsed digit, or -1 on failure. | [
"Reads",
"a",
"single",
"decimal",
"digit",
"either",
"localized",
"digits",
"used",
"by",
"this",
"object",
"or",
"any",
"Unicode",
"numeric",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2618-L2641 |
33,460 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseZoneID | private static String parseZoneID(String text, ParsePosition pos) {
String resolvedID = null;
if (ZONE_ID_TRIE == null) {
synchronized (TimeZoneFormat.class) {
if (ZONE_ID_TRIE == null) {
// Build zone ID trie
TextTrieMap<String> trie = new TextTrieMap<String>(true);
String[] ids = TimeZone.getAvailableIDs();
for (String id : ids) {
trie.put(id, id);
}
ZONE_ID_TRIE = trie;
}
}
}
int[] matchLen = new int[] {0};
Iterator<String> itr = ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen);
if (itr != null) {
resolvedID = itr.next();
pos.setIndex(pos.getIndex() + matchLen[0]);
} else {
// TODO
// We many need to handle rule based custom zone ID (See ZoneMeta.parseCustomID),
// such as GM+05:00. However, the public parse method in this class also calls
// parseOffsetLocalizedGMT and custom zone IDs are likely supported by the parser,
// so we might not need to handle them here.
pos.setErrorIndex(pos.getIndex());
}
return resolvedID;
} | java | private static String parseZoneID(String text, ParsePosition pos) {
String resolvedID = null;
if (ZONE_ID_TRIE == null) {
synchronized (TimeZoneFormat.class) {
if (ZONE_ID_TRIE == null) {
// Build zone ID trie
TextTrieMap<String> trie = new TextTrieMap<String>(true);
String[] ids = TimeZone.getAvailableIDs();
for (String id : ids) {
trie.put(id, id);
}
ZONE_ID_TRIE = trie;
}
}
}
int[] matchLen = new int[] {0};
Iterator<String> itr = ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen);
if (itr != null) {
resolvedID = itr.next();
pos.setIndex(pos.getIndex() + matchLen[0]);
} else {
// TODO
// We many need to handle rule based custom zone ID (See ZoneMeta.parseCustomID),
// such as GM+05:00. However, the public parse method in this class also calls
// parseOffsetLocalizedGMT and custom zone IDs are likely supported by the parser,
// so we might not need to handle them here.
pos.setErrorIndex(pos.getIndex());
}
return resolvedID;
} | [
"private",
"static",
"String",
"parseZoneID",
"(",
"String",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"String",
"resolvedID",
"=",
"null",
";",
"if",
"(",
"ZONE_ID_TRIE",
"==",
"null",
")",
"{",
"synchronized",
"(",
"TimeZoneFormat",
".",
"class",
")",... | Parse a zone ID.
@param text the text contains a time zone ID string at the position.
@param pos the position.
@return The zone ID parsed. | [
"Parse",
"a",
"zone",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2928-L2958 |
33,461 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseShortZoneID | private static String parseShortZoneID(String text, ParsePosition pos) {
String resolvedID = null;
if (SHORT_ZONE_ID_TRIE == null) {
synchronized (TimeZoneFormat.class) {
if (SHORT_ZONE_ID_TRIE == null) {
// Build short zone ID trie
TextTrieMap<String> trie = new TextTrieMap<String>(true);
Set<String> canonicalIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null);
for (String id : canonicalIDs) {
String shortID = ZoneMeta.getShortID(id);
if (shortID != null) {
trie.put(shortID, id);
}
}
// Canonical list does not contain Etc/Unknown
trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID);
SHORT_ZONE_ID_TRIE = trie;
}
}
}
int[] matchLen = new int[] {0};
Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen);
if (itr != null) {
resolvedID = itr.next();
pos.setIndex(pos.getIndex() + matchLen[0]);
} else {
pos.setErrorIndex(pos.getIndex());
}
return resolvedID;
} | java | private static String parseShortZoneID(String text, ParsePosition pos) {
String resolvedID = null;
if (SHORT_ZONE_ID_TRIE == null) {
synchronized (TimeZoneFormat.class) {
if (SHORT_ZONE_ID_TRIE == null) {
// Build short zone ID trie
TextTrieMap<String> trie = new TextTrieMap<String>(true);
Set<String> canonicalIDs = TimeZone.getAvailableIDs(SystemTimeZoneType.CANONICAL, null, null);
for (String id : canonicalIDs) {
String shortID = ZoneMeta.getShortID(id);
if (shortID != null) {
trie.put(shortID, id);
}
}
// Canonical list does not contain Etc/Unknown
trie.put(UNKNOWN_SHORT_ZONE_ID, UNKNOWN_ZONE_ID);
SHORT_ZONE_ID_TRIE = trie;
}
}
}
int[] matchLen = new int[] {0};
Iterator<String> itr = SHORT_ZONE_ID_TRIE.get(text, pos.getIndex(), matchLen);
if (itr != null) {
resolvedID = itr.next();
pos.setIndex(pos.getIndex() + matchLen[0]);
} else {
pos.setErrorIndex(pos.getIndex());
}
return resolvedID;
} | [
"private",
"static",
"String",
"parseShortZoneID",
"(",
"String",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"String",
"resolvedID",
"=",
"null",
";",
"if",
"(",
"SHORT_ZONE_ID_TRIE",
"==",
"null",
")",
"{",
"synchronized",
"(",
"TimeZoneFormat",
".",
"cla... | Parse a short zone ID.
@param text the text contains a time zone ID string at the position.
@param pos the position.
@return The zone ID for the parsed short zone ID. | [
"Parse",
"a",
"short",
"zone",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L2966-L2997 |
33,462 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java | TimeZoneFormat.parseExemplarLocation | private String parseExemplarLocation(String text, ParsePosition pos) {
int startIdx = pos.getIndex();
int parsedPos = -1;
String tzID = null;
EnumSet<NameType> nameTypes = EnumSet.of(NameType.EXEMPLAR_LOCATION);
Collection<MatchInfo> exemplarMatches = _tznames.find(text, startIdx, nameTypes);
if (exemplarMatches != null) {
MatchInfo exemplarMatch = null;
for (MatchInfo match : exemplarMatches) {
if (startIdx + match.matchLength() > parsedPos) {
exemplarMatch = match;
parsedPos = startIdx + match.matchLength();
}
}
if (exemplarMatch != null) {
tzID = getTimeZoneID(exemplarMatch.tzID(), exemplarMatch.mzID());
pos.setIndex(parsedPos);
}
}
if (tzID == null) {
pos.setErrorIndex(startIdx);
}
return tzID;
} | java | private String parseExemplarLocation(String text, ParsePosition pos) {
int startIdx = pos.getIndex();
int parsedPos = -1;
String tzID = null;
EnumSet<NameType> nameTypes = EnumSet.of(NameType.EXEMPLAR_LOCATION);
Collection<MatchInfo> exemplarMatches = _tznames.find(text, startIdx, nameTypes);
if (exemplarMatches != null) {
MatchInfo exemplarMatch = null;
for (MatchInfo match : exemplarMatches) {
if (startIdx + match.matchLength() > parsedPos) {
exemplarMatch = match;
parsedPos = startIdx + match.matchLength();
}
}
if (exemplarMatch != null) {
tzID = getTimeZoneID(exemplarMatch.tzID(), exemplarMatch.mzID());
pos.setIndex(parsedPos);
}
}
if (tzID == null) {
pos.setErrorIndex(startIdx);
}
return tzID;
} | [
"private",
"String",
"parseExemplarLocation",
"(",
"String",
"text",
",",
"ParsePosition",
"pos",
")",
"{",
"int",
"startIdx",
"=",
"pos",
".",
"getIndex",
"(",
")",
";",
"int",
"parsedPos",
"=",
"-",
"1",
";",
"String",
"tzID",
"=",
"null",
";",
"EnumSe... | Parse an exemplar location string.
@param text the text contains an exemplar location string at the position.
@param pos the position.
@return The zone ID for the parsed exemplar location. | [
"Parse",
"an",
"exemplar",
"location",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeZoneFormat.java#L3005-L3030 |
33,463 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.initLabels | private List<String> initLabels() {
Normalizer2 nfkdNormalizer = Normalizer2.getNFKDInstance();
List<String> indexCharacters = new ArrayList<String>();
String firstScriptBoundary = firstCharsInScripts.get(0);
String overflowBoundary = firstCharsInScripts.get(firstCharsInScripts.size() - 1);
// We make a sorted array of elements.
// Some of the input may be redundant.
// That is, we might have c, ch, d, where "ch" sorts just like "c", "h".
// We filter out those cases.
for (String item : initialLabels) {
boolean checkDistinct;
if (!UTF16.hasMoreCodePointsThan(item, 1)) {
checkDistinct = false;
} else if(item.charAt(item.length() - 1) == '*' &&
item.charAt(item.length() - 2) != '*') {
// Use a label if it is marked with one trailing star,
// even if the label string sorts the same when all contractions are suppressed.
item = item.substring(0, item.length() - 1);
checkDistinct = false;
} else {
checkDistinct = true;
}
if (collatorPrimaryOnly.compare(item, firstScriptBoundary) < 0) {
// Ignore a primary-ignorable or non-alphabetic index character.
} else if (collatorPrimaryOnly.compare(item, overflowBoundary) >= 0) {
// Ignore an index character that will land in the overflow bucket.
} else if (checkDistinct && collatorPrimaryOnly.compare(item, separated(item)) == 0) {
// Ignore a multi-code point index character that does not sort distinctly
// from the sequence of its separate characters.
} else {
int insertionPoint = Collections.binarySearch(indexCharacters, item, collatorPrimaryOnly);
if (insertionPoint < 0) {
indexCharacters.add(~insertionPoint, item);
} else {
String itemAlreadyIn = indexCharacters.get(insertionPoint);
if (isOneLabelBetterThanOther(nfkdNormalizer, item, itemAlreadyIn)) {
indexCharacters.set(insertionPoint, item);
}
}
}
}
// if the result is still too large, cut down to maxLabelCount elements, by removing every nth element
final int size = indexCharacters.size() - 1;
if (size > maxLabelCount) {
int count = 0;
int old = -1;
for (Iterator<String> it = indexCharacters.iterator(); it.hasNext();) {
++count;
it.next();
final int bump = count * maxLabelCount / size;
if (bump == old) {
it.remove();
} else {
old = bump;
}
}
}
return indexCharacters;
} | java | private List<String> initLabels() {
Normalizer2 nfkdNormalizer = Normalizer2.getNFKDInstance();
List<String> indexCharacters = new ArrayList<String>();
String firstScriptBoundary = firstCharsInScripts.get(0);
String overflowBoundary = firstCharsInScripts.get(firstCharsInScripts.size() - 1);
// We make a sorted array of elements.
// Some of the input may be redundant.
// That is, we might have c, ch, d, where "ch" sorts just like "c", "h".
// We filter out those cases.
for (String item : initialLabels) {
boolean checkDistinct;
if (!UTF16.hasMoreCodePointsThan(item, 1)) {
checkDistinct = false;
} else if(item.charAt(item.length() - 1) == '*' &&
item.charAt(item.length() - 2) != '*') {
// Use a label if it is marked with one trailing star,
// even if the label string sorts the same when all contractions are suppressed.
item = item.substring(0, item.length() - 1);
checkDistinct = false;
} else {
checkDistinct = true;
}
if (collatorPrimaryOnly.compare(item, firstScriptBoundary) < 0) {
// Ignore a primary-ignorable or non-alphabetic index character.
} else if (collatorPrimaryOnly.compare(item, overflowBoundary) >= 0) {
// Ignore an index character that will land in the overflow bucket.
} else if (checkDistinct && collatorPrimaryOnly.compare(item, separated(item)) == 0) {
// Ignore a multi-code point index character that does not sort distinctly
// from the sequence of its separate characters.
} else {
int insertionPoint = Collections.binarySearch(indexCharacters, item, collatorPrimaryOnly);
if (insertionPoint < 0) {
indexCharacters.add(~insertionPoint, item);
} else {
String itemAlreadyIn = indexCharacters.get(insertionPoint);
if (isOneLabelBetterThanOther(nfkdNormalizer, item, itemAlreadyIn)) {
indexCharacters.set(insertionPoint, item);
}
}
}
}
// if the result is still too large, cut down to maxLabelCount elements, by removing every nth element
final int size = indexCharacters.size() - 1;
if (size > maxLabelCount) {
int count = 0;
int old = -1;
for (Iterator<String> it = indexCharacters.iterator(); it.hasNext();) {
++count;
it.next();
final int bump = count * maxLabelCount / size;
if (bump == old) {
it.remove();
} else {
old = bump;
}
}
}
return indexCharacters;
} | [
"private",
"List",
"<",
"String",
">",
"initLabels",
"(",
")",
"{",
"Normalizer2",
"nfkdNormalizer",
"=",
"Normalizer2",
".",
"getNFKDInstance",
"(",
")",
";",
"List",
"<",
"String",
">",
"indexCharacters",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
... | Determine the best labels to use. This is based on the exemplars, but we also process to make sure that they are unique,
and sort differently, and that the overall list is small enough. | [
"Determine",
"the",
"best",
"labels",
"to",
"use",
".",
"This",
"is",
"based",
"on",
"the",
"exemplars",
"but",
"we",
"also",
"process",
"to",
"make",
"sure",
"that",
"they",
"are",
"unique",
"and",
"sort",
"differently",
"and",
"that",
"the",
"overall",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L425-L488 |
33,464 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.addIndexExemplars | private void addIndexExemplars(ULocale locale) {
UnicodeSet exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_INDEX);
if (exemplars != null) {
initialLabels.addAll(exemplars);
return;
}
// The locale data did not include explicit Index characters.
// Synthesize a set of them from the locale's standard exemplar characters.
exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_STANDARD);
exemplars = exemplars.cloneAsThawed();
// question: should we add auxiliary exemplars?
if (exemplars.containsSome('a', 'z') || exemplars.size() == 0) {
exemplars.addAll('a', 'z');
}
if (exemplars.containsSome(0xAC00, 0xD7A3)) { // Hangul syllables
// cut down to small list
exemplars.remove(0xAC00, 0xD7A3).
add(0xAC00).add(0xB098).add(0xB2E4).add(0xB77C).
add(0xB9C8).add(0xBC14).add(0xC0AC).add(0xC544).
add(0xC790).add(0xCC28).add(0xCE74).add(0xD0C0).
add(0xD30C).add(0xD558);
}
if (exemplars.containsSome(0x1200, 0x137F)) { // Ethiopic block
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8's, where
// the base is 0 mod 8.
UnicodeSet ethiopic = new UnicodeSet("[[:Block=Ethiopic:]&[:Script=Ethiopic:]]");
UnicodeSetIterator it = new UnicodeSetIterator(ethiopic);
while (it.next() && it.codepoint != UnicodeSetIterator.IS_STRING) {
if ((it.codepoint & 0x7) != 0) {
exemplars.remove(it.codepoint);
}
}
}
// Upper-case any that aren't already so.
// (We only do this for synthesized index characters.)
for (String item : exemplars) {
initialLabels.add(UCharacter.toUpperCase(locale, item));
}
} | java | private void addIndexExemplars(ULocale locale) {
UnicodeSet exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_INDEX);
if (exemplars != null) {
initialLabels.addAll(exemplars);
return;
}
// The locale data did not include explicit Index characters.
// Synthesize a set of them from the locale's standard exemplar characters.
exemplars = LocaleData.getExemplarSet(locale, 0, LocaleData.ES_STANDARD);
exemplars = exemplars.cloneAsThawed();
// question: should we add auxiliary exemplars?
if (exemplars.containsSome('a', 'z') || exemplars.size() == 0) {
exemplars.addAll('a', 'z');
}
if (exemplars.containsSome(0xAC00, 0xD7A3)) { // Hangul syllables
// cut down to small list
exemplars.remove(0xAC00, 0xD7A3).
add(0xAC00).add(0xB098).add(0xB2E4).add(0xB77C).
add(0xB9C8).add(0xBC14).add(0xC0AC).add(0xC544).
add(0xC790).add(0xCC28).add(0xCE74).add(0xD0C0).
add(0xD30C).add(0xD558);
}
if (exemplars.containsSome(0x1200, 0x137F)) { // Ethiopic block
// cut down to small list
// make use of the fact that Ethiopic is allocated in 8's, where
// the base is 0 mod 8.
UnicodeSet ethiopic = new UnicodeSet("[[:Block=Ethiopic:]&[:Script=Ethiopic:]]");
UnicodeSetIterator it = new UnicodeSetIterator(ethiopic);
while (it.next() && it.codepoint != UnicodeSetIterator.IS_STRING) {
if ((it.codepoint & 0x7) != 0) {
exemplars.remove(it.codepoint);
}
}
}
// Upper-case any that aren't already so.
// (We only do this for synthesized index characters.)
for (String item : exemplars) {
initialLabels.add(UCharacter.toUpperCase(locale, item));
}
} | [
"private",
"void",
"addIndexExemplars",
"(",
"ULocale",
"locale",
")",
"{",
"UnicodeSet",
"exemplars",
"=",
"LocaleData",
".",
"getExemplarSet",
"(",
"locale",
",",
"0",
",",
"LocaleData",
".",
"ES_INDEX",
")",
";",
"if",
"(",
"exemplars",
"!=",
"null",
")",... | This method is called to get the index exemplars. Normally these come from the locale directly,
but if they aren't available, we have to synthesize them. | [
"This",
"method",
"is",
"called",
"to",
"get",
"the",
"index",
"exemplars",
".",
"Normally",
"these",
"come",
"from",
"the",
"locale",
"directly",
"but",
"if",
"they",
"aren",
"t",
"available",
"we",
"have",
"to",
"synthesize",
"them",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L505-L547 |
33,465 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.addChineseIndexCharacters | private boolean addChineseIndexCharacters() {
UnicodeSet contractions = new UnicodeSet();
try {
collatorPrimaryOnly.internalAddContractions(BASE.charAt(0), contractions);
} catch (Exception e) {
return false;
}
if (contractions.isEmpty()) { return false; }
initialLabels.addAll(contractions);
for (String s : contractions) {
assert(s.startsWith(BASE));
char c = s.charAt(s.length() - 1);
if (0x41 <= c && c <= 0x5A) { // A-Z
// There are Pinyin labels, add ASCII A-Z labels as well.
initialLabels.add(0x41, 0x5A); // A-Z
break;
}
}
return true;
} | java | private boolean addChineseIndexCharacters() {
UnicodeSet contractions = new UnicodeSet();
try {
collatorPrimaryOnly.internalAddContractions(BASE.charAt(0), contractions);
} catch (Exception e) {
return false;
}
if (contractions.isEmpty()) { return false; }
initialLabels.addAll(contractions);
for (String s : contractions) {
assert(s.startsWith(BASE));
char c = s.charAt(s.length() - 1);
if (0x41 <= c && c <= 0x5A) { // A-Z
// There are Pinyin labels, add ASCII A-Z labels as well.
initialLabels.add(0x41, 0x5A); // A-Z
break;
}
}
return true;
} | [
"private",
"boolean",
"addChineseIndexCharacters",
"(",
")",
"{",
"UnicodeSet",
"contractions",
"=",
"new",
"UnicodeSet",
"(",
")",
";",
"try",
"{",
"collatorPrimaryOnly",
".",
"internalAddContractions",
"(",
"BASE",
".",
"charAt",
"(",
"0",
")",
",",
"contracti... | Add Chinese index characters from the tailoring. | [
"Add",
"Chinese",
"index",
"characters",
"from",
"the",
"tailoring",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L552-L571 |
33,466 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.buildImmutableIndex | public ImmutableIndex<V> buildImmutableIndex() {
// The current AlphabeticIndex Java code never modifies the bucket list once built.
// If it contains no records, we can use it.
// addRecord() sets buckets=null rather than inserting the new record into it.
BucketList<V> immutableBucketList;
if (inputList != null && !inputList.isEmpty()) {
// We need a bucket list with no records.
immutableBucketList = createBucketList();
} else {
if (buckets == null) {
buckets = createBucketList();
}
immutableBucketList = buckets;
}
return new ImmutableIndex<V>(immutableBucketList, collatorPrimaryOnly);
} | java | public ImmutableIndex<V> buildImmutableIndex() {
// The current AlphabeticIndex Java code never modifies the bucket list once built.
// If it contains no records, we can use it.
// addRecord() sets buckets=null rather than inserting the new record into it.
BucketList<V> immutableBucketList;
if (inputList != null && !inputList.isEmpty()) {
// We need a bucket list with no records.
immutableBucketList = createBucketList();
} else {
if (buckets == null) {
buckets = createBucketList();
}
immutableBucketList = buckets;
}
return new ImmutableIndex<V>(immutableBucketList, collatorPrimaryOnly);
} | [
"public",
"ImmutableIndex",
"<",
"V",
">",
"buildImmutableIndex",
"(",
")",
"{",
"// The current AlphabeticIndex Java code never modifies the bucket list once built.",
"// If it contains no records, we can use it.",
"// addRecord() sets buckets=null rather than inserting the new record into it... | Builds an immutable, thread-safe version of this instance, without data records.
@return an immutable index instance | [
"Builds",
"an",
"immutable",
"thread",
"-",
"safe",
"version",
"of",
"this",
"instance",
"without",
"data",
"records",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L598-L613 |
33,467 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.getBucketLabels | public List<String> getBucketLabels() {
initBuckets();
ArrayList<String> result = new ArrayList<String>();
for (Bucket<V> bucket : buckets) {
result.add(bucket.getLabel());
}
return result;
} | java | public List<String> getBucketLabels() {
initBuckets();
ArrayList<String> result = new ArrayList<String>();
for (Bucket<V> bucket : buckets) {
result.add(bucket.getLabel());
}
return result;
} | [
"public",
"List",
"<",
"String",
">",
"getBucketLabels",
"(",
")",
"{",
"initBuckets",
"(",
")",
";",
"ArrayList",
"<",
"String",
">",
"result",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"for",
"(",
"Bucket",
"<",
"V",
">",
"bucket"... | Get the labels.
@return The list of bucket labels, after processing. | [
"Get",
"the",
"labels",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L620-L627 |
33,468 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.clearRecords | public AlphabeticIndex<V> clearRecords() {
if (inputList != null && !inputList.isEmpty()) {
inputList.clear();
buckets = null;
}
return this;
} | java | public AlphabeticIndex<V> clearRecords() {
if (inputList != null && !inputList.isEmpty()) {
inputList.clear();
buckets = null;
}
return this;
} | [
"public",
"AlphabeticIndex",
"<",
"V",
">",
"clearRecords",
"(",
")",
"{",
"if",
"(",
"inputList",
"!=",
"null",
"&&",
"!",
"inputList",
".",
"isEmpty",
"(",
")",
")",
"{",
"inputList",
".",
"clear",
"(",
")",
";",
"buckets",
"=",
"null",
";",
"}",
... | Clear the index.
@return this, for chaining | [
"Clear",
"the",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L695-L701 |
33,469 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.initBuckets | private void initBuckets() {
if (buckets != null) {
return;
}
buckets = createBucketList();
if (inputList == null || inputList.isEmpty()) {
return;
}
// Sort the records by name.
// Stable sort preserves input order of collation duplicates.
Collections.sort(inputList, recordComparator);
// Now, we traverse all of the input, which is now sorted.
// If the item doesn't go in the current bucket, we find the next bucket that contains it.
// This makes the process order n*log(n), since we just sort the list and then do a linear process.
// However, if the user adds an item at a time and then gets the buckets, this isn't efficient, so
// we need to improve it for that case.
Iterator<Bucket<V>> bucketIterator = buckets.fullIterator();
Bucket<V> currentBucket = bucketIterator.next();
Bucket<V> nextBucket;
String upperBoundary;
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
nextBucket = null;
upperBoundary = null;
}
for (Record<V> r : inputList) {
// if the current bucket isn't the right one, find the one that is
// We have a special flag for the last bucket so that we don't look any further
while (upperBoundary != null &&
collatorPrimaryOnly.compare(r.name, upperBoundary) >= 0) {
currentBucket = nextBucket;
// now reset the boundary that we compare against
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
upperBoundary = null;
}
}
// now put the record into the bucket.
Bucket<V> bucket = currentBucket;
if (bucket.displayBucket != null) {
bucket = bucket.displayBucket;
}
if (bucket.records == null) {
bucket.records = new ArrayList<Record<V>>();
}
bucket.records.add(r);
}
} | java | private void initBuckets() {
if (buckets != null) {
return;
}
buckets = createBucketList();
if (inputList == null || inputList.isEmpty()) {
return;
}
// Sort the records by name.
// Stable sort preserves input order of collation duplicates.
Collections.sort(inputList, recordComparator);
// Now, we traverse all of the input, which is now sorted.
// If the item doesn't go in the current bucket, we find the next bucket that contains it.
// This makes the process order n*log(n), since we just sort the list and then do a linear process.
// However, if the user adds an item at a time and then gets the buckets, this isn't efficient, so
// we need to improve it for that case.
Iterator<Bucket<V>> bucketIterator = buckets.fullIterator();
Bucket<V> currentBucket = bucketIterator.next();
Bucket<V> nextBucket;
String upperBoundary;
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
nextBucket = null;
upperBoundary = null;
}
for (Record<V> r : inputList) {
// if the current bucket isn't the right one, find the one that is
// We have a special flag for the last bucket so that we don't look any further
while (upperBoundary != null &&
collatorPrimaryOnly.compare(r.name, upperBoundary) >= 0) {
currentBucket = nextBucket;
// now reset the boundary that we compare against
if (bucketIterator.hasNext()) {
nextBucket = bucketIterator.next();
upperBoundary = nextBucket.lowerBoundary;
} else {
upperBoundary = null;
}
}
// now put the record into the bucket.
Bucket<V> bucket = currentBucket;
if (bucket.displayBucket != null) {
bucket = bucket.displayBucket;
}
if (bucket.records == null) {
bucket.records = new ArrayList<Record<V>>();
}
bucket.records.add(r);
}
} | [
"private",
"void",
"initBuckets",
"(",
")",
"{",
"if",
"(",
"buckets",
"!=",
"null",
")",
"{",
"return",
";",
"}",
"buckets",
"=",
"createBucketList",
"(",
")",
";",
"if",
"(",
"inputList",
"==",
"null",
"||",
"inputList",
".",
"isEmpty",
"(",
")",
"... | Creates an index, and buckets and sorts the list of records into the index. | [
"Creates",
"an",
"index",
"and",
"buckets",
"and",
"sorts",
"the",
"list",
"of",
"records",
"into",
"the",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L736-L790 |
33,470 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.isOneLabelBetterThanOther | private static boolean isOneLabelBetterThanOther(Normalizer2 nfkdNormalizer, String one, String other) {
// This is called with primary-equal strings, but never with one.equals(other).
String n1 = nfkdNormalizer.normalize(one);
String n2 = nfkdNormalizer.normalize(other);
int result = n1.codePointCount(0, n1.length()) - n2.codePointCount(0, n2.length());
if (result != 0) {
return result < 0;
}
result = binaryCmp.compare(n1, n2);
if (result != 0) {
return result < 0;
}
return binaryCmp.compare(one, other) < 0;
} | java | private static boolean isOneLabelBetterThanOther(Normalizer2 nfkdNormalizer, String one, String other) {
// This is called with primary-equal strings, but never with one.equals(other).
String n1 = nfkdNormalizer.normalize(one);
String n2 = nfkdNormalizer.normalize(other);
int result = n1.codePointCount(0, n1.length()) - n2.codePointCount(0, n2.length());
if (result != 0) {
return result < 0;
}
result = binaryCmp.compare(n1, n2);
if (result != 0) {
return result < 0;
}
return binaryCmp.compare(one, other) < 0;
} | [
"private",
"static",
"boolean",
"isOneLabelBetterThanOther",
"(",
"Normalizer2",
"nfkdNormalizer",
",",
"String",
"one",
",",
"String",
"other",
")",
"{",
"// This is called with primary-equal strings, but never with one.equals(other).",
"String",
"n1",
"=",
"nfkdNormalizer",
... | Returns true if one index character string is "better" than the other.
Shorter NFKD is better, and otherwise NFKD-binary-less-than is
better, and otherwise binary-less-than is better. | [
"Returns",
"true",
"if",
"one",
"index",
"character",
"string",
"is",
"better",
"than",
"the",
"other",
".",
"Shorter",
"NFKD",
"is",
"better",
"and",
"otherwise",
"NFKD",
"-",
"binary",
"-",
"less",
"-",
"than",
"is",
"better",
"and",
"otherwise",
"binary... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L799-L812 |
33,471 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java | AlphabeticIndex.getFirstCharactersInScripts | @Deprecated
public List<String> getFirstCharactersInScripts() {
List<String> dest = new ArrayList<String>(200);
// Fetch the script-first-primary contractions which are defined in the root collator.
// They all start with U+FDD1.
UnicodeSet set = new UnicodeSet();
collatorPrimaryOnly.internalAddContractions(0xFDD1, set);
if (set.isEmpty()) {
throw new UnsupportedOperationException(
"AlphabeticIndex requires script-first-primary contractions");
}
for (String boundary : set) {
int gcMask = 1 << UCharacter.getType(boundary.codePointAt(1));
if ((gcMask & (GC_L_MASK | GC_CN_MASK)) == 0) {
// Ignore boundaries for the special reordering groups.
// Take only those for "real scripts" (where the sample character is a Letter,
// and the one for unassigned implicit weights (Cn).
continue;
}
dest.add(boundary);
}
return dest;
} | java | @Deprecated
public List<String> getFirstCharactersInScripts() {
List<String> dest = new ArrayList<String>(200);
// Fetch the script-first-primary contractions which are defined in the root collator.
// They all start with U+FDD1.
UnicodeSet set = new UnicodeSet();
collatorPrimaryOnly.internalAddContractions(0xFDD1, set);
if (set.isEmpty()) {
throw new UnsupportedOperationException(
"AlphabeticIndex requires script-first-primary contractions");
}
for (String boundary : set) {
int gcMask = 1 << UCharacter.getType(boundary.codePointAt(1));
if ((gcMask & (GC_L_MASK | GC_CN_MASK)) == 0) {
// Ignore boundaries for the special reordering groups.
// Take only those for "real scripts" (where the sample character is a Letter,
// and the one for unassigned implicit weights (Cn).
continue;
}
dest.add(boundary);
}
return dest;
} | [
"@",
"Deprecated",
"public",
"List",
"<",
"String",
">",
"getFirstCharactersInScripts",
"(",
")",
"{",
"List",
"<",
"String",
">",
"dest",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"200",
")",
";",
"// Fetch the script-first-primary contractions which are ... | Return a list of the first character in each script. Only exposed for testing.
@return list of first characters in each script
@deprecated This API is ICU internal, only for testing.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Return",
"a",
"list",
"of",
"the",
"first",
"character",
"in",
"each",
"script",
".",
"Only",
"exposed",
"for",
"testing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AlphabeticIndex.java#L1192-L1214 |
33,472 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedInputStream.java | PipedInputStream.establishConnection | synchronized void establishConnection() throws IOException {
if (isConnected) {
throw new IOException("Pipe already connected");
}
if (buffer == null) { // We may already have allocated the buffer.
buffer = new byte[PipedInputStream.PIPE_SIZE];
}
isConnected = true;
} | java | synchronized void establishConnection() throws IOException {
if (isConnected) {
throw new IOException("Pipe already connected");
}
if (buffer == null) { // We may already have allocated the buffer.
buffer = new byte[PipedInputStream.PIPE_SIZE];
}
isConnected = true;
} | [
"synchronized",
"void",
"establishConnection",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"isConnected",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Pipe already connected\"",
")",
";",
"}",
"if",
"(",
"buffer",
"==",
"null",
")",
"{",
"// We may ... | Establishes the connection to the PipedOutputStream.
@throws IOException
If this Reader is already connected. | [
"Establishes",
"the",
"connection",
"to",
"the",
"PipedOutputStream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedInputStream.java#L181-L189 |
33,473 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.encodeRelay | static Object encodeRelay(Object r) {
Throwable x;
return (((r instanceof AltResult) &&
(x = ((AltResult)r).ex) != null &&
!(x instanceof CompletionException)) ?
new AltResult(new CompletionException(x)) : r);
} | java | static Object encodeRelay(Object r) {
Throwable x;
return (((r instanceof AltResult) &&
(x = ((AltResult)r).ex) != null &&
!(x instanceof CompletionException)) ?
new AltResult(new CompletionException(x)) : r);
} | [
"static",
"Object",
"encodeRelay",
"(",
"Object",
"r",
")",
"{",
"Throwable",
"x",
";",
"return",
"(",
"(",
"(",
"r",
"instanceof",
"AltResult",
")",
"&&",
"(",
"x",
"=",
"(",
"(",
"AltResult",
")",
"r",
")",
".",
"ex",
")",
"!=",
"null",
"&&",
"... | Returns the encoding of a copied outcome; if exceptional,
rewraps as a CompletionException, else returns argument. | [
"Returns",
"the",
"encoding",
"of",
"a",
"copied",
"outcome",
";",
"if",
"exceptional",
"rewraps",
"as",
"a",
"CompletionException",
"else",
"returns",
"argument",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L326-L332 |
33,474 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.postComplete | final void postComplete() {
/*
* On each step, variable f holds current dependents to pop
* and run. It is extended along only one path at a time,
* pushing others to avoid unbounded recursion.
*/
CompletableFuture<?> f = this; Completion h;
while ((h = f.stack) != null ||
(f != this && (h = (f = this).stack) != null)) {
CompletableFuture<?> d; Completion t;
if (f.casStack(h, t = h.next)) {
if (t != null) {
if (f != this) {
pushStack(h);
continue;
}
h.next = null; // detach
}
f = (d = h.tryFire(NESTED)) == null ? this : d;
}
}
} | java | final void postComplete() {
/*
* On each step, variable f holds current dependents to pop
* and run. It is extended along only one path at a time,
* pushing others to avoid unbounded recursion.
*/
CompletableFuture<?> f = this; Completion h;
while ((h = f.stack) != null ||
(f != this && (h = (f = this).stack) != null)) {
CompletableFuture<?> d; Completion t;
if (f.casStack(h, t = h.next)) {
if (t != null) {
if (f != this) {
pushStack(h);
continue;
}
h.next = null; // detach
}
f = (d = h.tryFire(NESTED)) == null ? this : d;
}
}
} | [
"final",
"void",
"postComplete",
"(",
")",
"{",
"/*\n * On each step, variable f holds current dependents to pop\n * and run. It is extended along only one path at a time,\n * pushing others to avoid unbounded recursion.\n */",
"CompletableFuture",
"<",
"?",
">",... | Pops and tries to trigger all reachable dependents. Call only
when known to be done. | [
"Pops",
"and",
"tries",
"to",
"trigger",
"all",
"reachable",
"dependents",
".",
"Call",
"only",
"when",
"known",
"to",
"be",
"done",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L464-L485 |
33,475 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.cleanStack | final void cleanStack() {
for (Completion p = null, q = stack; q != null;) {
Completion s = q.next;
if (q.isLive()) {
p = q;
q = s;
}
else if (p == null) {
casStack(q, s);
q = stack;
}
else {
p.next = s;
if (p.isLive())
q = s;
else {
p = null; // restart
q = stack;
}
}
}
} | java | final void cleanStack() {
for (Completion p = null, q = stack; q != null;) {
Completion s = q.next;
if (q.isLive()) {
p = q;
q = s;
}
else if (p == null) {
casStack(q, s);
q = stack;
}
else {
p.next = s;
if (p.isLive())
q = s;
else {
p = null; // restart
q = stack;
}
}
}
} | [
"final",
"void",
"cleanStack",
"(",
")",
"{",
"for",
"(",
"Completion",
"p",
"=",
"null",
",",
"q",
"=",
"stack",
";",
"q",
"!=",
"null",
";",
")",
"{",
"Completion",
"s",
"=",
"q",
".",
"next",
";",
"if",
"(",
"q",
".",
"isLive",
"(",
")",
"... | Traverses stack and unlinks dead Completions. | [
"Traverses",
"stack",
"and",
"unlinks",
"dead",
"Completions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L488-L509 |
33,476 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.postFire | final CompletableFuture<T> postFire(CompletableFuture<?> a, int mode) {
if (a != null && a.stack != null) {
if (mode < 0 || a.result == null)
a.cleanStack();
else
a.postComplete();
}
if (result != null && stack != null) {
if (mode < 0)
return this;
else
postComplete();
}
return null;
} | java | final CompletableFuture<T> postFire(CompletableFuture<?> a, int mode) {
if (a != null && a.stack != null) {
if (mode < 0 || a.result == null)
a.cleanStack();
else
a.postComplete();
}
if (result != null && stack != null) {
if (mode < 0)
return this;
else
postComplete();
}
return null;
} | [
"final",
"CompletableFuture",
"<",
"T",
">",
"postFire",
"(",
"CompletableFuture",
"<",
"?",
">",
"a",
",",
"int",
"mode",
")",
"{",
"if",
"(",
"a",
"!=",
"null",
"&&",
"a",
".",
"stack",
"!=",
"null",
")",
"{",
"if",
"(",
"mode",
"<",
"0",
"||",... | Post-processing by dependent after successful UniCompletion
tryFire. Tries to clean stack of source a, and then either runs
postComplete or returns this to caller, depending on mode. | [
"Post",
"-",
"processing",
"by",
"dependent",
"after",
"successful",
"UniCompletion",
"tryFire",
".",
"Tries",
"to",
"clean",
"stack",
"of",
"source",
"a",
"and",
"then",
"either",
"runs",
"postComplete",
"or",
"returns",
"this",
"to",
"caller",
"depending",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L560-L574 |
33,477 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.bipush | final void bipush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
if (c != null) {
Object r;
while ((r = result) == null && !tryPushStack(c))
lazySetNext(c, null); // clear on failure
if (b != null && b != this && b.result == null) {
Completion q = (r != null) ? c : new CoCompletion(c);
while (b.result == null && !b.tryPushStack(q))
lazySetNext(q, null); // clear on failure
}
}
} | java | final void bipush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
if (c != null) {
Object r;
while ((r = result) == null && !tryPushStack(c))
lazySetNext(c, null); // clear on failure
if (b != null && b != this && b.result == null) {
Completion q = (r != null) ? c : new CoCompletion(c);
while (b.result == null && !b.tryPushStack(q))
lazySetNext(q, null); // clear on failure
}
}
} | [
"final",
"void",
"bipush",
"(",
"CompletableFuture",
"<",
"?",
">",
"b",
",",
"BiCompletion",
"<",
"?",
",",
"?",
",",
"?",
">",
"c",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"Object",
"r",
";",
"while",
"(",
"(",
"r",
"=",
"result",
... | Pushes completion to this and b unless both done. | [
"Pushes",
"completion",
"to",
"this",
"and",
"b",
"unless",
"both",
"done",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L1069-L1080 |
33,478 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.orpush | final void orpush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
if (c != null) {
while ((b == null || b.result == null) && result == null) {
if (tryPushStack(c)) {
if (b != null && b != this && b.result == null) {
Completion q = new CoCompletion(c);
while (result == null && b.result == null &&
!b.tryPushStack(q))
lazySetNext(q, null); // clear on failure
}
break;
}
lazySetNext(c, null); // clear on failure
}
}
} | java | final void orpush(CompletableFuture<?> b, BiCompletion<?,?,?> c) {
if (c != null) {
while ((b == null || b.result == null) && result == null) {
if (tryPushStack(c)) {
if (b != null && b != this && b.result == null) {
Completion q = new CoCompletion(c);
while (result == null && b.result == null &&
!b.tryPushStack(q))
lazySetNext(q, null); // clear on failure
}
break;
}
lazySetNext(c, null); // clear on failure
}
}
} | [
"final",
"void",
"orpush",
"(",
"CompletableFuture",
"<",
"?",
">",
"b",
",",
"BiCompletion",
"<",
"?",
",",
"?",
",",
"?",
">",
"c",
")",
"{",
"if",
"(",
"c",
"!=",
"null",
")",
"{",
"while",
"(",
"(",
"b",
"==",
"null",
"||",
"b",
".",
"res... | Pushes completion to this and b unless either done. | [
"Pushes",
"completion",
"to",
"this",
"and",
"b",
"unless",
"either",
"done",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L1356-L1371 |
33,479 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.timedGet | private Object timedGet(long nanos) throws TimeoutException {
if (Thread.interrupted())
return null;
if (nanos > 0L) {
long d = System.nanoTime() + nanos;
long deadline = (d == 0L) ? 1L : d; // avoid 0
Signaller q = null;
boolean queued = false;
Object r;
while ((r = result) == null) { // similar to untimed, without spins
if (q == null)
q = new Signaller(true, nanos, deadline);
else if (!queued)
queued = tryPushStack(q);
else if (q.nanos <= 0L)
break;
else {
try {
ForkJoinPool.managedBlock(q);
} catch (InterruptedException ie) {
q.interrupted = true;
}
if (q.interrupted)
break;
}
}
if (q != null)
q.thread = null;
if (r != null)
postComplete();
else
cleanStack();
if (r != null || (q != null && q.interrupted))
return r;
}
throw new TimeoutException();
} | java | private Object timedGet(long nanos) throws TimeoutException {
if (Thread.interrupted())
return null;
if (nanos > 0L) {
long d = System.nanoTime() + nanos;
long deadline = (d == 0L) ? 1L : d; // avoid 0
Signaller q = null;
boolean queued = false;
Object r;
while ((r = result) == null) { // similar to untimed, without spins
if (q == null)
q = new Signaller(true, nanos, deadline);
else if (!queued)
queued = tryPushStack(q);
else if (q.nanos <= 0L)
break;
else {
try {
ForkJoinPool.managedBlock(q);
} catch (InterruptedException ie) {
q.interrupted = true;
}
if (q.interrupted)
break;
}
}
if (q != null)
q.thread = null;
if (r != null)
postComplete();
else
cleanStack();
if (r != null || (q != null && q.interrupted))
return r;
}
throw new TimeoutException();
} | [
"private",
"Object",
"timedGet",
"(",
"long",
"nanos",
")",
"throws",
"TimeoutException",
"{",
"if",
"(",
"Thread",
".",
"interrupted",
"(",
")",
")",
"return",
"null",
";",
"if",
"(",
"nanos",
">",
"0L",
")",
"{",
"long",
"d",
"=",
"System",
".",
"n... | Returns raw result after waiting, or null if interrupted, or
throws TimeoutException on timeout. | [
"Returns",
"raw",
"result",
"after",
"waiting",
"or",
"null",
"if",
"interrupted",
"or",
"throws",
"TimeoutException",
"on",
"timeout",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L1778-L1814 |
33,480 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java | CompletableFuture.get | public T get() throws InterruptedException, ExecutionException {
Object r;
return reportGet((r = result) == null ? waitingGet(true) : r);
} | java | public T get() throws InterruptedException, ExecutionException {
Object r;
return reportGet((r = result) == null ? waitingGet(true) : r);
} | [
"public",
"T",
"get",
"(",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
"{",
"Object",
"r",
";",
"return",
"reportGet",
"(",
"(",
"r",
"=",
"result",
")",
"==",
"null",
"?",
"waitingGet",
"(",
"true",
")",
":",
"r",
")",
";",
"}"
] | Waits if necessary for this future to complete, and then
returns its result.
@return the result value
@throws CancellationException if this future was cancelled
@throws ExecutionException if this future completed exceptionally
@throws InterruptedException if the current thread was interrupted
while waiting | [
"Waits",
"if",
"necessary",
"for",
"this",
"future",
"to",
"complete",
"and",
"then",
"returns",
"its",
"result",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/CompletableFuture.java#L1921-L1924 |
33,481 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Handler.java | Handler.reportError | protected void reportError(String msg, Exception ex, int code) {
try {
errorManager.error(msg, ex, code);
} catch (Exception ex2) {
System.err.println("Handler.reportError caught:");
ex2.printStackTrace();
}
} | java | protected void reportError(String msg, Exception ex, int code) {
try {
errorManager.error(msg, ex, code);
} catch (Exception ex2) {
System.err.println("Handler.reportError caught:");
ex2.printStackTrace();
}
} | [
"protected",
"void",
"reportError",
"(",
"String",
"msg",
",",
"Exception",
"ex",
",",
"int",
"code",
")",
"{",
"try",
"{",
"errorManager",
".",
"error",
"(",
"msg",
",",
"ex",
",",
"code",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex2",
")",
"{",
... | Protected convenience method to report an error to this Handler's
ErrorManager. Note that this method retrieves and uses the ErrorManager
without doing a security check. It can therefore be used in
environments where the caller may be non-privileged.
@param msg a descriptive string (may be null)
@param ex an exception (may be null)
@param code an error code defined in ErrorManager | [
"Protected",
"convenience",
"method",
"to",
"report",
"an",
"error",
"to",
"this",
"Handler",
"s",
"ErrorManager",
".",
"Note",
"that",
"this",
"method",
"retrieves",
"and",
"uses",
"the",
"ErrorManager",
"without",
"doing",
"a",
"security",
"check",
".",
"It"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Handler.java#L239-L246 |
33,482 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java | AbstractShortCircuitTask.compute | @Override
public void compute() {
Spliterator<P_IN> rs = spliterator, ls;
long sizeEstimate = rs.estimateSize();
long sizeThreshold = getTargetSize(sizeEstimate);
boolean forkRight = false;
@SuppressWarnings("unchecked") K task = (K) this;
AtomicReference<R> sr = sharedResult;
R result;
while ((result = sr.get()) == null) {
if (task.taskCanceled()) {
result = task.getEmptyResult();
break;
}
if (sizeEstimate <= sizeThreshold || (ls = rs.trySplit()) == null) {
result = task.doLeaf();
break;
}
K leftChild, rightChild, taskToFork;
task.leftChild = leftChild = task.makeChild(ls);
task.rightChild = rightChild = task.makeChild(rs);
task.setPendingCount(1);
if (forkRight) {
forkRight = false;
rs = ls;
task = leftChild;
taskToFork = rightChild;
}
else {
forkRight = true;
task = rightChild;
taskToFork = leftChild;
}
taskToFork.fork();
sizeEstimate = rs.estimateSize();
}
task.setLocalResult(result);
task.tryComplete();
} | java | @Override
public void compute() {
Spliterator<P_IN> rs = spliterator, ls;
long sizeEstimate = rs.estimateSize();
long sizeThreshold = getTargetSize(sizeEstimate);
boolean forkRight = false;
@SuppressWarnings("unchecked") K task = (K) this;
AtomicReference<R> sr = sharedResult;
R result;
while ((result = sr.get()) == null) {
if (task.taskCanceled()) {
result = task.getEmptyResult();
break;
}
if (sizeEstimate <= sizeThreshold || (ls = rs.trySplit()) == null) {
result = task.doLeaf();
break;
}
K leftChild, rightChild, taskToFork;
task.leftChild = leftChild = task.makeChild(ls);
task.rightChild = rightChild = task.makeChild(rs);
task.setPendingCount(1);
if (forkRight) {
forkRight = false;
rs = ls;
task = leftChild;
taskToFork = rightChild;
}
else {
forkRight = true;
task = rightChild;
taskToFork = leftChild;
}
taskToFork.fork();
sizeEstimate = rs.estimateSize();
}
task.setLocalResult(result);
task.tryComplete();
} | [
"@",
"Override",
"public",
"void",
"compute",
"(",
")",
"{",
"Spliterator",
"<",
"P_IN",
">",
"rs",
"=",
"spliterator",
",",
"ls",
";",
"long",
"sizeEstimate",
"=",
"rs",
".",
"estimateSize",
"(",
")",
";",
"long",
"sizeThreshold",
"=",
"getTargetSize",
... | Overrides AbstractTask version to include checks for early
exits while splitting or computing. | [
"Overrides",
"AbstractTask",
"version",
"to",
"include",
"checks",
"for",
"early",
"exits",
"while",
"splitting",
"or",
"computing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java#L100-L138 |
33,483 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java | AbstractShortCircuitTask.getLocalResult | @Override
public R getLocalResult() {
if (isRoot()) {
R answer = sharedResult.get();
return (answer == null) ? getEmptyResult() : answer;
}
else
return super.getLocalResult();
} | java | @Override
public R getLocalResult() {
if (isRoot()) {
R answer = sharedResult.get();
return (answer == null) ? getEmptyResult() : answer;
}
else
return super.getLocalResult();
} | [
"@",
"Override",
"public",
"R",
"getLocalResult",
"(",
")",
"{",
"if",
"(",
"isRoot",
"(",
")",
")",
"{",
"R",
"answer",
"=",
"sharedResult",
".",
"get",
"(",
")",
";",
"return",
"(",
"answer",
"==",
"null",
")",
"?",
"getEmptyResult",
"(",
")",
":... | Retrieves the local result for this task. If this task is the root,
retrieves the shared result instead. | [
"Retrieves",
"the",
"local",
"result",
"for",
"this",
"task",
".",
"If",
"this",
"task",
"is",
"the",
"root",
"retrieves",
"the",
"shared",
"result",
"instead",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java#L183-L191 |
33,484 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java | AbstractShortCircuitTask.taskCanceled | protected boolean taskCanceled() {
boolean cancel = canceled;
if (!cancel) {
for (K parent = getParent(); !cancel && parent != null; parent = parent.getParent())
cancel = parent.canceled;
}
return cancel;
} | java | protected boolean taskCanceled() {
boolean cancel = canceled;
if (!cancel) {
for (K parent = getParent(); !cancel && parent != null; parent = parent.getParent())
cancel = parent.canceled;
}
return cancel;
} | [
"protected",
"boolean",
"taskCanceled",
"(",
")",
"{",
"boolean",
"cancel",
"=",
"canceled",
";",
"if",
"(",
"!",
"cancel",
")",
"{",
"for",
"(",
"K",
"parent",
"=",
"getParent",
"(",
")",
";",
"!",
"cancel",
"&&",
"parent",
"!=",
"null",
";",
"paren... | Queries whether this task is canceled. A task is considered canceled if
it or any of its parents have been canceled.
@return {@code true} if this task or any parent is canceled. | [
"Queries",
"whether",
"this",
"task",
"is",
"canceled",
".",
"A",
"task",
"is",
"considered",
"canceled",
"if",
"it",
"or",
"any",
"of",
"its",
"parents",
"have",
"been",
"canceled",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java#L206-L214 |
33,485 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java | AbstractShortCircuitTask.cancelLaterNodes | protected void cancelLaterNodes() {
// Go up the tree, cancel right siblings of this node and all parents
for (@SuppressWarnings("unchecked") K parent = getParent(), node = (K) this;
parent != null;
node = parent, parent = parent.getParent()) {
// If node is a left child of parent, then has a right sibling
if (parent.leftChild == node) {
K rightSibling = parent.rightChild;
if (!rightSibling.canceled)
rightSibling.cancel();
}
}
} | java | protected void cancelLaterNodes() {
// Go up the tree, cancel right siblings of this node and all parents
for (@SuppressWarnings("unchecked") K parent = getParent(), node = (K) this;
parent != null;
node = parent, parent = parent.getParent()) {
// If node is a left child of parent, then has a right sibling
if (parent.leftChild == node) {
K rightSibling = parent.rightChild;
if (!rightSibling.canceled)
rightSibling.cancel();
}
}
} | [
"protected",
"void",
"cancelLaterNodes",
"(",
")",
"{",
"// Go up the tree, cancel right siblings of this node and all parents",
"for",
"(",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"K",
"parent",
"=",
"getParent",
"(",
")",
",",
"node",
"=",
"(",
"K",
")... | Cancels all tasks which succeed this one in the encounter order. This
includes canceling all the current task's right sibling, as well as the
later right siblings of all its parents. | [
"Cancels",
"all",
"tasks",
"which",
"succeed",
"this",
"one",
"in",
"the",
"encounter",
"order",
".",
"This",
"includes",
"canceling",
"all",
"the",
"current",
"task",
"s",
"right",
"sibling",
"as",
"well",
"as",
"the",
"later",
"right",
"siblings",
"of",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractShortCircuitTask.java#L221-L233 |
33,486 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java | AnnotationRewriter.createMemberFields | private Map<ExecutableElement, VariableElement> createMemberFields(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members) {
TypeElement type = node.getTypeElement();
Map<ExecutableElement, VariableElement> fieldElements = new HashMap<>();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
String propName = NameTable.getAnnotationPropertyName(memberElement);
VariableElement field = GeneratedVariableElement.newField(
propName, memberElement.getReturnType(), type);
node.addBodyDeclaration(new FieldDeclaration(field, null));
fieldElements.put(memberElement, field);
}
return fieldElements;
} | java | private Map<ExecutableElement, VariableElement> createMemberFields(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members) {
TypeElement type = node.getTypeElement();
Map<ExecutableElement, VariableElement> fieldElements = new HashMap<>();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
String propName = NameTable.getAnnotationPropertyName(memberElement);
VariableElement field = GeneratedVariableElement.newField(
propName, memberElement.getReturnType(), type);
node.addBodyDeclaration(new FieldDeclaration(field, null));
fieldElements.put(memberElement, field);
}
return fieldElements;
} | [
"private",
"Map",
"<",
"ExecutableElement",
",",
"VariableElement",
">",
"createMemberFields",
"(",
"AnnotationTypeDeclaration",
"node",
",",
"List",
"<",
"AnnotationTypeMemberDeclaration",
">",
"members",
")",
"{",
"TypeElement",
"type",
"=",
"node",
".",
"getTypeEle... | Create an instance field for each member. | [
"Create",
"an",
"instance",
"field",
"for",
"each",
"member",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java#L82-L95 |
33,487 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java | AnnotationRewriter.addMemberProperties | private void addMemberProperties(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members,
Map<ExecutableElement, VariableElement> fieldElements) {
if (members.isEmpty()) {
return;
}
StringBuilder propertyDecls = new StringBuilder();
StringBuilder propertyImpls = new StringBuilder();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
String propName = NameTable.getAnnotationPropertyName(memberElement);
String memberTypeStr = nameTable.getObjCType(memberElement.getReturnType());
String fieldName = nameTable.getVariableShortName(fieldElements.get(memberElement));
propertyDecls.append(UnicodeUtils.format("@property (readonly) %s%s%s;\n",
memberTypeStr, memberTypeStr.endsWith("*") ? "" : " ", propName));
if (NameTable.needsObjcMethodFamilyNoneAttribute(propName)) {
propertyDecls.append(UnicodeUtils.format(
"- (%s)%s OBJC_METHOD_FAMILY_NONE;\n", memberTypeStr, propName));
}
propertyImpls.append(UnicodeUtils.format("@synthesize %s = %s;\n", propName, fieldName));
}
node.addBodyDeclaration(NativeDeclaration.newInnerDeclaration(
propertyDecls.toString(), propertyImpls.toString()));
} | java | private void addMemberProperties(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members,
Map<ExecutableElement, VariableElement> fieldElements) {
if (members.isEmpty()) {
return;
}
StringBuilder propertyDecls = new StringBuilder();
StringBuilder propertyImpls = new StringBuilder();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
String propName = NameTable.getAnnotationPropertyName(memberElement);
String memberTypeStr = nameTable.getObjCType(memberElement.getReturnType());
String fieldName = nameTable.getVariableShortName(fieldElements.get(memberElement));
propertyDecls.append(UnicodeUtils.format("@property (readonly) %s%s%s;\n",
memberTypeStr, memberTypeStr.endsWith("*") ? "" : " ", propName));
if (NameTable.needsObjcMethodFamilyNoneAttribute(propName)) {
propertyDecls.append(UnicodeUtils.format(
"- (%s)%s OBJC_METHOD_FAMILY_NONE;\n", memberTypeStr, propName));
}
propertyImpls.append(UnicodeUtils.format("@synthesize %s = %s;\n", propName, fieldName));
}
node.addBodyDeclaration(NativeDeclaration.newInnerDeclaration(
propertyDecls.toString(), propertyImpls.toString()));
} | [
"private",
"void",
"addMemberProperties",
"(",
"AnnotationTypeDeclaration",
"node",
",",
"List",
"<",
"AnnotationTypeMemberDeclaration",
">",
"members",
",",
"Map",
"<",
"ExecutableElement",
",",
"VariableElement",
">",
"fieldElements",
")",
"{",
"if",
"(",
"members",... | Generate the property declarations and synthesize statements. | [
"Generate",
"the",
"property",
"declarations",
"and",
"synthesize",
"statements",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java#L98-L122 |
33,488 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java | AnnotationRewriter.addDefaultAccessors | private void addDefaultAccessors(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members) {
TypeElement type = node.getTypeElement();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
AnnotationValue defaultValue = memberElement.getDefaultValue();
if (defaultValue == null || defaultValue.getValue() == null) {
continue;
}
TypeMirror memberType = memberElement.getReturnType();
String propName = NameTable.getAnnotationPropertyName(memberElement);
ExecutableElement defaultGetterElement = GeneratedExecutableElement.newMethodWithSelector(
propName + "Default", memberType, type)
.addModifiers(Modifier.STATIC);
MethodDeclaration defaultGetter = new MethodDeclaration(defaultGetterElement);
defaultGetter.setHasDeclaration(false);
Block defaultGetterBody = new Block();
defaultGetter.setBody(defaultGetterBody);
defaultGetterBody.addStatement(new ReturnStatement(
translationUtil.createAnnotationValue(memberType, defaultValue)));
node.addBodyDeclaration(defaultGetter);
}
} | java | private void addDefaultAccessors(
AnnotationTypeDeclaration node, List<AnnotationTypeMemberDeclaration> members) {
TypeElement type = node.getTypeElement();
for (AnnotationTypeMemberDeclaration member : members) {
ExecutableElement memberElement = member.getExecutableElement();
AnnotationValue defaultValue = memberElement.getDefaultValue();
if (defaultValue == null || defaultValue.getValue() == null) {
continue;
}
TypeMirror memberType = memberElement.getReturnType();
String propName = NameTable.getAnnotationPropertyName(memberElement);
ExecutableElement defaultGetterElement = GeneratedExecutableElement.newMethodWithSelector(
propName + "Default", memberType, type)
.addModifiers(Modifier.STATIC);
MethodDeclaration defaultGetter = new MethodDeclaration(defaultGetterElement);
defaultGetter.setHasDeclaration(false);
Block defaultGetterBody = new Block();
defaultGetter.setBody(defaultGetterBody);
defaultGetterBody.addStatement(new ReturnStatement(
translationUtil.createAnnotationValue(memberType, defaultValue)));
node.addBodyDeclaration(defaultGetter);
}
} | [
"private",
"void",
"addDefaultAccessors",
"(",
"AnnotationTypeDeclaration",
"node",
",",
"List",
"<",
"AnnotationTypeMemberDeclaration",
">",
"members",
")",
"{",
"TypeElement",
"type",
"=",
"node",
".",
"getTypeElement",
"(",
")",
";",
"for",
"(",
"AnnotationTypeMe... | Create accessors for properties that have default values. | [
"Create",
"accessors",
"for",
"properties",
"that",
"have",
"default",
"values",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/AnnotationRewriter.java#L125-L149 |
33,489 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipEntry.java | ZipEntry.setComment | public void setComment(String comment) {
// Android-changed: Explicitly allow null comments (or allow comments to be
// cleared).
if (comment == null) {
this.comment = null;
return;
}
// Android-changed: Explicitly use UTF-8.
if (comment.getBytes(StandardCharsets.UTF_8).length > 0xffff) {
throw new IllegalArgumentException(comment + " too long: " +
comment.getBytes(StandardCharsets.UTF_8).length);
}
this.comment = comment;
} | java | public void setComment(String comment) {
// Android-changed: Explicitly allow null comments (or allow comments to be
// cleared).
if (comment == null) {
this.comment = null;
return;
}
// Android-changed: Explicitly use UTF-8.
if (comment.getBytes(StandardCharsets.UTF_8).length > 0xffff) {
throw new IllegalArgumentException(comment + " too long: " +
comment.getBytes(StandardCharsets.UTF_8).length);
}
this.comment = comment;
} | [
"public",
"void",
"setComment",
"(",
"String",
"comment",
")",
"{",
"// Android-changed: Explicitly allow null comments (or allow comments to be",
"// cleared).",
"if",
"(",
"comment",
"==",
"null",
")",
"{",
"this",
".",
"comment",
"=",
"null",
";",
"return",
";",
... | Sets the optional comment string for the entry.
<p>ZIP entry comments have maximum length of 0xffff. If the length of the
specified comment string is greater than 0xFFFF bytes after encoding, only
the first 0xFFFF bytes are output to the ZIP file entry.
@param comment the comment string
@see #getComment() | [
"Sets",
"the",
"optional",
"comment",
"string",
"for",
"the",
"entry",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipEntry.java#L280-L294 |
33,490 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionDecl.java | ElemExtensionDecl.getFunction | public String getFunction(int i) throws ArrayIndexOutOfBoundsException
{
if (null == m_functions)
throw new ArrayIndexOutOfBoundsException();
return (String) m_functions.elementAt(i);
} | java | public String getFunction(int i) throws ArrayIndexOutOfBoundsException
{
if (null == m_functions)
throw new ArrayIndexOutOfBoundsException();
return (String) m_functions.elementAt(i);
} | [
"public",
"String",
"getFunction",
"(",
"int",
"i",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"null",
"==",
"m_functions",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
")",
";",
"return",
"(",
"String",
")",
"m_functions",
"... | Get a function at a given index in this extension element
@param i Index of function to get
@return Name of Function at given index
@throws ArrayIndexOutOfBoundsException | [
"Get",
"a",
"function",
"at",
"a",
"given",
"index",
"in",
"this",
"extension",
"element"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionDecl.java#L112-L119 |
33,491 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionDecl.java | ElemExtensionDecl.getElement | public String getElement(int i) throws ArrayIndexOutOfBoundsException
{
if (null == m_elements)
throw new ArrayIndexOutOfBoundsException();
return (String) m_elements.elementAt(i);
} | java | public String getElement(int i) throws ArrayIndexOutOfBoundsException
{
if (null == m_elements)
throw new ArrayIndexOutOfBoundsException();
return (String) m_elements.elementAt(i);
} | [
"public",
"String",
"getElement",
"(",
"int",
"i",
")",
"throws",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"null",
"==",
"m_elements",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
")",
";",
"return",
"(",
"String",
")",
"m_elements",
".",... | Get the element at the given index
@param i Index of element to get
@return The element at the given index
@throws ArrayIndexOutOfBoundsException | [
"Get",
"the",
"element",
"at",
"the",
"given",
"index"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemExtensionDecl.java#L168-L175 |
33,492 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java | CompactDecimalFormat.getInstance | public static CompactDecimalFormat getInstance(Locale locale, CompactStyle style) {
return new CompactDecimalFormat(ULocale.forLocale(locale), style);
} | java | public static CompactDecimalFormat getInstance(Locale locale, CompactStyle style) {
return new CompactDecimalFormat(ULocale.forLocale(locale), style);
} | [
"public",
"static",
"CompactDecimalFormat",
"getInstance",
"(",
"Locale",
"locale",
",",
"CompactStyle",
"style",
")",
"{",
"return",
"new",
"CompactDecimalFormat",
"(",
"ULocale",
".",
"forLocale",
"(",
"locale",
")",
",",
"style",
")",
";",
"}"
] | Create a CompactDecimalFormat appropriate for a locale. The result may
be affected by the number system in the locale, such as ar-u-nu-latn.
@param locale the desired locale
@param style the compact style | [
"Create",
"a",
"CompactDecimalFormat",
"appropriate",
"for",
"a",
"locale",
".",
"The",
"result",
"may",
"be",
"affected",
"by",
"the",
"number",
"system",
"in",
"the",
"locale",
"such",
"as",
"ar",
"-",
"u",
"-",
"nu",
"-",
"latn",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java#L112-L114 |
33,493 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java | CompactDecimalFormat.getData | private Data getData(ULocale locale, CompactStyle style) {
CompactDecimalDataCache.DataBundle bundle = cache.get(locale);
switch (style) {
case SHORT:
return bundle.shortData;
case LONG:
return bundle.longData;
default:
return bundle.shortData;
}
} | java | private Data getData(ULocale locale, CompactStyle style) {
CompactDecimalDataCache.DataBundle bundle = cache.get(locale);
switch (style) {
case SHORT:
return bundle.shortData;
case LONG:
return bundle.longData;
default:
return bundle.shortData;
}
} | [
"private",
"Data",
"getData",
"(",
"ULocale",
"locale",
",",
"CompactStyle",
"style",
")",
"{",
"CompactDecimalDataCache",
".",
"DataBundle",
"bundle",
"=",
"cache",
".",
"get",
"(",
"locale",
")",
";",
"switch",
"(",
"style",
")",
"{",
"case",
"SHORT",
":... | Gets the data for a particular locale and style. If style is unrecognized,
we just return data for CompactStyle.SHORT.
@param locale The locale.
@param style The style.
@return The data which must not be modified. | [
"Gets",
"the",
"data",
"for",
"a",
"particular",
"locale",
"and",
"style",
".",
"If",
"style",
"is",
"unrecognized",
"we",
"just",
"return",
"data",
"for",
"CompactStyle",
".",
"SHORT",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java#L523-L533 |
33,494 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java | CompactDecimalFormat.getCurrencyData | private Data getCurrencyData(ULocale locale) {
CompactDecimalDataCache.DataBundle bundle = cache.get(locale);
return bundle.shortCurrencyData;
} | java | private Data getCurrencyData(ULocale locale) {
CompactDecimalDataCache.DataBundle bundle = cache.get(locale);
return bundle.shortCurrencyData;
} | [
"private",
"Data",
"getCurrencyData",
"(",
"ULocale",
"locale",
")",
"{",
"CompactDecimalDataCache",
".",
"DataBundle",
"bundle",
"=",
"cache",
".",
"get",
"(",
"locale",
")",
";",
"return",
"bundle",
".",
"shortCurrencyData",
";",
"}"
] | Gets the currency data for a particular locale.
Currently only short currency format is supported, since that is
the only form in CLDR.
@param locale The locale.
@return The data which must not be modified. | [
"Gets",
"the",
"currency",
"data",
"for",
"a",
"particular",
"locale",
".",
"Currently",
"only",
"short",
"currency",
"format",
"is",
"supported",
"since",
"that",
"is",
"the",
"only",
"form",
"in",
"CLDR",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CompactDecimalFormat.java#L541-L544 |
33,495 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.getNumberFromNode | public double getNumberFromNode(int n)
{
XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n);
return xstr.toDouble();
} | java | public double getNumberFromNode(int n)
{
XMLString xstr = m_dtmMgr.getDTM(n).getStringValue(n);
return xstr.toDouble();
} | [
"public",
"double",
"getNumberFromNode",
"(",
"int",
"n",
")",
"{",
"XMLString",
"xstr",
"=",
"m_dtmMgr",
".",
"getDTM",
"(",
"n",
")",
".",
"getStringValue",
"(",
"n",
")",
";",
"return",
"xstr",
".",
"toDouble",
"(",
")",
";",
"}"
] | Get numeric value of the string conversion from a single node.
@param n Node to convert
@return numeric value of the string conversion from a single node. | [
"Get",
"numeric",
"value",
"of",
"the",
"string",
"conversion",
"from",
"a",
"single",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L148-L152 |
33,496 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.numWithSideEffects | public double numWithSideEffects()
{
int node = nextNode();
return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN;
} | java | public double numWithSideEffects()
{
int node = nextNode();
return (node != DTM.NULL) ? getNumberFromNode(node) : Double.NaN;
} | [
"public",
"double",
"numWithSideEffects",
"(",
")",
"{",
"int",
"node",
"=",
"nextNode",
"(",
")",
";",
"return",
"(",
"node",
"!=",
"DTM",
".",
"NULL",
")",
"?",
"getNumberFromNode",
"(",
"node",
")",
":",
"Double",
".",
"NaN",
";",
"}"
] | Cast result object to a number, but allow side effects, such as the
incrementing of an iterator.
@return numeric value of the string conversion from the
next node in the NodeSetDTM, or NAN if no node was found | [
"Cast",
"result",
"object",
"to",
"a",
"number",
"but",
"allow",
"side",
"effects",
"such",
"as",
"the",
"incrementing",
"of",
"an",
"iterator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L174-L179 |
33,497 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.getStringFromNode | public XMLString getStringFromNode(int n)
{
// %OPT%
// I guess we'll have to get a static instance of the DTM manager...
if(DTM.NULL != n)
{
return m_dtmMgr.getDTM(n).getStringValue(n);
}
else
{
return org.apache.xpath.objects.XString.EMPTYSTRING;
}
} | java | public XMLString getStringFromNode(int n)
{
// %OPT%
// I guess we'll have to get a static instance of the DTM manager...
if(DTM.NULL != n)
{
return m_dtmMgr.getDTM(n).getStringValue(n);
}
else
{
return org.apache.xpath.objects.XString.EMPTYSTRING;
}
} | [
"public",
"XMLString",
"getStringFromNode",
"(",
"int",
"n",
")",
"{",
"// %OPT%",
"// I guess we'll have to get a static instance of the DTM manager...",
"if",
"(",
"DTM",
".",
"NULL",
"!=",
"n",
")",
"{",
"return",
"m_dtmMgr",
".",
"getDTM",
"(",
"n",
")",
".",
... | Get the string conversion from a single node.
@param n Node to convert
@return the string conversion from a single node. | [
"Get",
"the",
"string",
"conversion",
"from",
"a",
"single",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L211-L223 |
33,498 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.getFresh | public XObject getFresh()
{
try
{
if(hasCache())
return (XObject)cloneWithReset();
else
return this; // don't bother to clone... won't do any good!
}
catch (CloneNotSupportedException cnse)
{
throw new RuntimeException(cnse.getMessage());
}
} | java | public XObject getFresh()
{
try
{
if(hasCache())
return (XObject)cloneWithReset();
else
return this; // don't bother to clone... won't do any good!
}
catch (CloneNotSupportedException cnse)
{
throw new RuntimeException(cnse.getMessage());
}
} | [
"public",
"XObject",
"getFresh",
"(",
")",
"{",
"try",
"{",
"if",
"(",
"hasCache",
"(",
")",
")",
"return",
"(",
"XObject",
")",
"cloneWithReset",
"(",
")",
";",
"else",
"return",
"this",
";",
"// don't bother to clone... won't do any good!",
"}",
"catch",
"... | Get a fresh copy of the object. For use with variables.
@return A fresh nodelist. | [
"Get",
"a",
"fresh",
"copy",
"of",
"the",
"object",
".",
"For",
"use",
"with",
"variables",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L405-L418 |
33,499 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java | XNodeSet.mutableNodeset | public NodeSetDTM mutableNodeset()
{
NodeSetDTM mnl;
if(m_obj instanceof NodeSetDTM)
{
mnl = (NodeSetDTM) m_obj;
}
else
{
mnl = new NodeSetDTM(iter());
setObject(mnl);
setCurrentPos(0);
}
return mnl;
} | java | public NodeSetDTM mutableNodeset()
{
NodeSetDTM mnl;
if(m_obj instanceof NodeSetDTM)
{
mnl = (NodeSetDTM) m_obj;
}
else
{
mnl = new NodeSetDTM(iter());
setObject(mnl);
setCurrentPos(0);
}
return mnl;
} | [
"public",
"NodeSetDTM",
"mutableNodeset",
"(",
")",
"{",
"NodeSetDTM",
"mnl",
";",
"if",
"(",
"m_obj",
"instanceof",
"NodeSetDTM",
")",
"{",
"mnl",
"=",
"(",
"NodeSetDTM",
")",
"m_obj",
";",
"}",
"else",
"{",
"mnl",
"=",
"new",
"NodeSetDTM",
"(",
"iter",... | Cast result object to a mutableNodeset.
@return The nodeset as a mutableNodeset | [
"Cast",
"result",
"object",
"to",
"a",
"mutableNodeset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XNodeSet.java#L425-L441 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.