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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,700 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.hasNoMajorSolarTerm | private boolean hasNoMajorSolarTerm(int newMoon) {
int mst = majorSolarTerm(newMoon);
int nmn = newMoonNear(newMoon + SYNODIC_GAP, true);
int mstt = majorSolarTerm(nmn);
return mst == mstt;
/*
return majorSolarTerm(newMoon) ==
majorSolarTerm(newMoonNear(newMoon + SYNODIC_GAP, true));
*/
} | java | private boolean hasNoMajorSolarTerm(int newMoon) {
int mst = majorSolarTerm(newMoon);
int nmn = newMoonNear(newMoon + SYNODIC_GAP, true);
int mstt = majorSolarTerm(nmn);
return mst == mstt;
/*
return majorSolarTerm(newMoon) ==
majorSolarTerm(newMoonNear(newMoon + SYNODIC_GAP, true));
*/
} | [
"private",
"boolean",
"hasNoMajorSolarTerm",
"(",
"int",
"newMoon",
")",
"{",
"int",
"mst",
"=",
"majorSolarTerm",
"(",
"newMoon",
")",
";",
"int",
"nmn",
"=",
"newMoonNear",
"(",
"newMoon",
"+",
"SYNODIC_GAP",
",",
"true",
")",
";",
"int",
"mstt",
"=",
... | Return true if the given month lacks a major solar term.
@param newMoon days after January 1, 1970 0:00 Asia/Shanghai of a new
moon | [
"Return",
"true",
"if",
"the",
"given",
"month",
"lacks",
"a",
"major",
"solar",
"term",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L754-L764 |
34,701 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.isLeapMonthBetween | private boolean isLeapMonthBetween(int newMoon1, int newMoon2) {
// This is only needed to debug the timeOfAngle divergence bug.
// Remove this later. Liu 11/9/00
// DEBUG
if (synodicMonthsBetween(newMoon1, newMoon2) >= 50) {
throw new IllegalArgumentException("isLeapMonthBetween(" + newMoon1 +
", " + newMoon2 +
"): Invalid parameters");
}
return (newMoon2 >= newMoon1) &&
(isLeapMonthBetween(newMoon1, newMoonNear(newMoon2 - SYNODIC_GAP, false)) ||
hasNoMajorSolarTerm(newMoon2));
} | java | private boolean isLeapMonthBetween(int newMoon1, int newMoon2) {
// This is only needed to debug the timeOfAngle divergence bug.
// Remove this later. Liu 11/9/00
// DEBUG
if (synodicMonthsBetween(newMoon1, newMoon2) >= 50) {
throw new IllegalArgumentException("isLeapMonthBetween(" + newMoon1 +
", " + newMoon2 +
"): Invalid parameters");
}
return (newMoon2 >= newMoon1) &&
(isLeapMonthBetween(newMoon1, newMoonNear(newMoon2 - SYNODIC_GAP, false)) ||
hasNoMajorSolarTerm(newMoon2));
} | [
"private",
"boolean",
"isLeapMonthBetween",
"(",
"int",
"newMoon1",
",",
"int",
"newMoon2",
")",
"{",
"// This is only needed to debug the timeOfAngle divergence bug.",
"// Remove this later. Liu 11/9/00",
"// DEBUG",
"if",
"(",
"synodicMonthsBetween",
"(",
"newMoon1",
",",
"... | Return true if there is a leap month on or after month newMoon1 and
at or before month newMoon2.
@param newMoon1 days after January 1, 1970 0:00 astronomical base zone of a
new moon
@param newMoon2 days after January 1, 1970 0:00 astronomical base zone of a
new moon | [
"Return",
"true",
"if",
"there",
"is",
"a",
"leap",
"month",
"on",
"or",
"after",
"month",
"newMoon1",
"and",
"at",
"or",
"before",
"month",
"newMoon2",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L778-L792 |
34,702 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.newYear | private int newYear(int gyear) {
long cacheValue = newYearCache.get(gyear);
if (cacheValue == CalendarCache.EMPTY) {
int solsticeBefore= winterSolstice(gyear - 1);
int solsticeAfter = winterSolstice(gyear);
int newMoon1 = newMoonNear(solsticeBefore + 1, true);
int newMoon2 = newMoonNear(newMoon1 + SYNODIC_GAP, true);
int newMoon11 = newMoonNear(solsticeAfter + 1, false);
if (synodicMonthsBetween(newMoon1, newMoon11) == 12 &&
(hasNoMajorSolarTerm(newMoon1) || hasNoMajorSolarTerm(newMoon2))) {
cacheValue = newMoonNear(newMoon2 + SYNODIC_GAP, true);
} else {
cacheValue = newMoon2;
}
newYearCache.put(gyear, cacheValue);
}
return (int) cacheValue;
} | java | private int newYear(int gyear) {
long cacheValue = newYearCache.get(gyear);
if (cacheValue == CalendarCache.EMPTY) {
int solsticeBefore= winterSolstice(gyear - 1);
int solsticeAfter = winterSolstice(gyear);
int newMoon1 = newMoonNear(solsticeBefore + 1, true);
int newMoon2 = newMoonNear(newMoon1 + SYNODIC_GAP, true);
int newMoon11 = newMoonNear(solsticeAfter + 1, false);
if (synodicMonthsBetween(newMoon1, newMoon11) == 12 &&
(hasNoMajorSolarTerm(newMoon1) || hasNoMajorSolarTerm(newMoon2))) {
cacheValue = newMoonNear(newMoon2 + SYNODIC_GAP, true);
} else {
cacheValue = newMoon2;
}
newYearCache.put(gyear, cacheValue);
}
return (int) cacheValue;
} | [
"private",
"int",
"newYear",
"(",
"int",
"gyear",
")",
"{",
"long",
"cacheValue",
"=",
"newYearCache",
".",
"get",
"(",
"gyear",
")",
";",
"if",
"(",
"cacheValue",
"==",
"CalendarCache",
".",
"EMPTY",
")",
"{",
"int",
"solsticeBefore",
"=",
"winterSolstice... | Return the Chinese new year of the given Gregorian year.
@param gyear a Gregorian year
@return days after January 1, 1970 0:00 astronomical base zone of the
Chinese new year of the given year (this will be a new moon) | [
"Return",
"the",
"Chinese",
"new",
"year",
"of",
"the",
"given",
"Gregorian",
"year",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L918-L940 |
34,703 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.handleComputeMonthStart | protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
// If the month is out of range, adjust it into range, and
// modify the extended year value accordingly.
if (month < 0 || month > 11) {
int[] rem = new int[1];
eyear += floorDivide(month, 12, rem);
month = rem[0];
}
int gyear = eyear + epochYear - 1; // Gregorian year
int newYear = newYear(gyear);
int newMoon = newMoonNear(newYear + month * 29, true);
int julianDay = newMoon + EPOCH_JULIAN_DAY;
// Save fields for later restoration
int saveMonth = internalGet(MONTH);
int saveIsLeapMonth = internalGet(IS_LEAP_MONTH);
// Ignore IS_LEAP_MONTH field if useMonth is false
int isLeapMonth = useMonth ? saveIsLeapMonth : 0;
computeGregorianFields(julianDay);
// This will modify the MONTH and IS_LEAP_MONTH fields (only)
computeChineseFields(newMoon, getGregorianYear(),
getGregorianMonth(), false);
if (month != internalGet(MONTH) ||
isLeapMonth != internalGet(IS_LEAP_MONTH)) {
newMoon = newMoonNear(newMoon + SYNODIC_GAP, true);
julianDay = newMoon + EPOCH_JULIAN_DAY;
}
internalSet(MONTH, saveMonth);
internalSet(IS_LEAP_MONTH, saveIsLeapMonth);
return julianDay - 1;
} | java | protected int handleComputeMonthStart(int eyear, int month, boolean useMonth) {
// If the month is out of range, adjust it into range, and
// modify the extended year value accordingly.
if (month < 0 || month > 11) {
int[] rem = new int[1];
eyear += floorDivide(month, 12, rem);
month = rem[0];
}
int gyear = eyear + epochYear - 1; // Gregorian year
int newYear = newYear(gyear);
int newMoon = newMoonNear(newYear + month * 29, true);
int julianDay = newMoon + EPOCH_JULIAN_DAY;
// Save fields for later restoration
int saveMonth = internalGet(MONTH);
int saveIsLeapMonth = internalGet(IS_LEAP_MONTH);
// Ignore IS_LEAP_MONTH field if useMonth is false
int isLeapMonth = useMonth ? saveIsLeapMonth : 0;
computeGregorianFields(julianDay);
// This will modify the MONTH and IS_LEAP_MONTH fields (only)
computeChineseFields(newMoon, getGregorianYear(),
getGregorianMonth(), false);
if (month != internalGet(MONTH) ||
isLeapMonth != internalGet(IS_LEAP_MONTH)) {
newMoon = newMoonNear(newMoon + SYNODIC_GAP, true);
julianDay = newMoon + EPOCH_JULIAN_DAY;
}
internalSet(MONTH, saveMonth);
internalSet(IS_LEAP_MONTH, saveIsLeapMonth);
return julianDay - 1;
} | [
"protected",
"int",
"handleComputeMonthStart",
"(",
"int",
"eyear",
",",
"int",
"month",
",",
"boolean",
"useMonth",
")",
"{",
"// If the month is out of range, adjust it into range, and",
"// modify the extended year value accordingly.",
"if",
"(",
"month",
"<",
"0",
"||",... | Return the Julian day number of day before the first day of the
given month in the given extended year.
<p>Note: This method reads the IS_LEAP_MONTH field to determine
whether the given month is a leap month.
@param eyear the extended year
@param month the zero-based month. The month is also determined
by reading the IS_LEAP_MONTH field.
@return the Julian day number of the day before the first
day of the given month and year | [
"Return",
"the",
"Julian",
"day",
"number",
"of",
"day",
"before",
"the",
"first",
"day",
"of",
"the",
"given",
"month",
"in",
"the",
"given",
"extended",
"year",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L954-L993 |
34,704 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java | ChineseCalendar.readObject | private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
epochYear = CHINESE_EPOCH_YEAR;
zoneAstro = CHINA_ZONE;
stream.defaultReadObject();
/* set up the transient caches... */
astro = new CalendarAstronomer();
winterSolsticeCache = new CalendarCache();
newYearCache = new CalendarCache();
} | java | private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException
{
epochYear = CHINESE_EPOCH_YEAR;
zoneAstro = CHINA_ZONE;
stream.defaultReadObject();
/* set up the transient caches... */
astro = new CalendarAstronomer();
winterSolsticeCache = new CalendarCache();
newYearCache = new CalendarCache();
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"epochYear",
"=",
"CHINESE_EPOCH_YEAR",
";",
"zoneAstro",
"=",
"CHINA_ZONE",
";",
"stream",
".",
"defaultReadObject",
"(",
")",
";"... | Override readObject. | [
"Override",
"readObject",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ChineseCalendar.java#L1016-L1028 |
34,705 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDUTF16CollationIterator.java | FCDUTF16CollationIterator.nextSegment | private void nextSegment() {
assert(checkDir > 0 && seq == rawSeq && pos != limit);
// The input text [segmentStart..pos[ passes the FCD check.
int p = pos;
int prevCC = 0;
for(;;) {
// Fetch the next character's fcd16 value.
int q = p;
int c = Character.codePointAt(seq, p);
p += Character.charCount(c);
int fcd16 = nfcImpl.getFCD16(c);
int leadCC = fcd16 >> 8;
if(leadCC == 0 && q != pos) {
// FCD boundary before the [q, p[ character.
limit = segmentLimit = q;
break;
}
if(leadCC != 0 && (prevCC > leadCC || CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the next FCD boundary and normalize.
do {
q = p;
if(p == rawLimit) { break; }
c = Character.codePointAt(seq, p);
p += Character.charCount(c);
} while(nfcImpl.getFCD16(c) > 0xff);
normalize(pos, q);
pos = start;
break;
}
prevCC = fcd16 & 0xff;
if(p == rawLimit || prevCC == 0) {
// FCD boundary after the last character.
limit = segmentLimit = p;
break;
}
}
assert(pos != limit);
checkDir = 0;
} | java | private void nextSegment() {
assert(checkDir > 0 && seq == rawSeq && pos != limit);
// The input text [segmentStart..pos[ passes the FCD check.
int p = pos;
int prevCC = 0;
for(;;) {
// Fetch the next character's fcd16 value.
int q = p;
int c = Character.codePointAt(seq, p);
p += Character.charCount(c);
int fcd16 = nfcImpl.getFCD16(c);
int leadCC = fcd16 >> 8;
if(leadCC == 0 && q != pos) {
// FCD boundary before the [q, p[ character.
limit = segmentLimit = q;
break;
}
if(leadCC != 0 && (prevCC > leadCC || CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the next FCD boundary and normalize.
do {
q = p;
if(p == rawLimit) { break; }
c = Character.codePointAt(seq, p);
p += Character.charCount(c);
} while(nfcImpl.getFCD16(c) > 0xff);
normalize(pos, q);
pos = start;
break;
}
prevCC = fcd16 & 0xff;
if(p == rawLimit || prevCC == 0) {
// FCD boundary after the last character.
limit = segmentLimit = p;
break;
}
}
assert(pos != limit);
checkDir = 0;
} | [
"private",
"void",
"nextSegment",
"(",
")",
"{",
"assert",
"(",
"checkDir",
">",
"0",
"&&",
"seq",
"==",
"rawSeq",
"&&",
"pos",
"!=",
"limit",
")",
";",
"// The input text [segmentStart..pos[ passes the FCD check.",
"int",
"p",
"=",
"pos",
";",
"int",
"prevCC"... | Extend the FCD text segment forward or normalize around pos.
To be called when checkDir > 0 && pos != limit.
Returns with checkDir == 0 and pos != limit. | [
"Extend",
"the",
"FCD",
"text",
"segment",
"forward",
"or",
"normalize",
"around",
"pos",
".",
"To",
"be",
"called",
"when",
"checkDir",
">",
"0",
"&&",
"pos",
"!",
"=",
"limit",
".",
"Returns",
"with",
"checkDir",
"==",
"0",
"and",
"pos",
"!",
"=",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDUTF16CollationIterator.java#L260-L298 |
34,706 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDUTF16CollationIterator.java | FCDUTF16CollationIterator.previousSegment | private void previousSegment() {
assert(checkDir < 0 && seq == rawSeq && pos != start);
// The input text [pos..segmentLimit[ passes the FCD check.
int p = pos;
int nextCC = 0;
for(;;) {
// Fetch the previous character's fcd16 value.
int q = p;
int c = Character.codePointBefore(seq, p);
p -= Character.charCount(c);
int fcd16 = nfcImpl.getFCD16(c);
int trailCC = fcd16 & 0xff;
if(trailCC == 0 && q != pos) {
// FCD boundary after the [p, q[ character.
start = segmentStart = q;
break;
}
if(trailCC != 0 && ((nextCC != 0 && trailCC > nextCC) ||
CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the previous FCD boundary and normalize.
do {
q = p;
if(fcd16 <= 0xff || p == rawStart) { break; }
c = Character.codePointBefore(seq, p);
p -= Character.charCount(c);
} while((fcd16 = nfcImpl.getFCD16(c)) != 0);
normalize(q, pos);
pos = limit;
break;
}
nextCC = fcd16 >> 8;
if(p == rawStart || nextCC == 0) {
// FCD boundary before the following character.
start = segmentStart = p;
break;
}
}
assert(pos != start);
checkDir = 0;
} | java | private void previousSegment() {
assert(checkDir < 0 && seq == rawSeq && pos != start);
// The input text [pos..segmentLimit[ passes the FCD check.
int p = pos;
int nextCC = 0;
for(;;) {
// Fetch the previous character's fcd16 value.
int q = p;
int c = Character.codePointBefore(seq, p);
p -= Character.charCount(c);
int fcd16 = nfcImpl.getFCD16(c);
int trailCC = fcd16 & 0xff;
if(trailCC == 0 && q != pos) {
// FCD boundary after the [p, q[ character.
start = segmentStart = q;
break;
}
if(trailCC != 0 && ((nextCC != 0 && trailCC > nextCC) ||
CollationFCD.isFCD16OfTibetanCompositeVowel(fcd16))) {
// Fails FCD check. Find the previous FCD boundary and normalize.
do {
q = p;
if(fcd16 <= 0xff || p == rawStart) { break; }
c = Character.codePointBefore(seq, p);
p -= Character.charCount(c);
} while((fcd16 = nfcImpl.getFCD16(c)) != 0);
normalize(q, pos);
pos = limit;
break;
}
nextCC = fcd16 >> 8;
if(p == rawStart || nextCC == 0) {
// FCD boundary before the following character.
start = segmentStart = p;
break;
}
}
assert(pos != start);
checkDir = 0;
} | [
"private",
"void",
"previousSegment",
"(",
")",
"{",
"assert",
"(",
"checkDir",
"<",
"0",
"&&",
"seq",
"==",
"rawSeq",
"&&",
"pos",
"!=",
"start",
")",
";",
"// The input text [pos..segmentLimit[ passes the FCD check.",
"int",
"p",
"=",
"pos",
";",
"int",
"nex... | Extend the FCD text segment backward or normalize around pos.
To be called when checkDir < 0 && pos != start.
Returns with checkDir == 0 and pos != start. | [
"Extend",
"the",
"FCD",
"text",
"segment",
"backward",
"or",
"normalize",
"around",
"pos",
".",
"To",
"be",
"called",
"when",
"checkDir",
"<",
"0",
"&&",
"pos",
"!",
"=",
"start",
".",
"Returns",
"with",
"checkDir",
"==",
"0",
"and",
"pos",
"!",
"=",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/FCDUTF16CollationIterator.java#L336-L375 |
34,707 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java | LockSupport.setBlocker | private static void setBlocker(Thread t, Object arg) {
// Even though volatile, hotspot doesn't need a write barrier here.
U.putObject(t, PARKBLOCKER, arg);
} | java | private static void setBlocker(Thread t, Object arg) {
// Even though volatile, hotspot doesn't need a write barrier here.
U.putObject(t, PARKBLOCKER, arg);
} | [
"private",
"static",
"void",
"setBlocker",
"(",
"Thread",
"t",
",",
"Object",
"arg",
")",
"{",
"// Even though volatile, hotspot doesn't need a write barrier here.",
"U",
".",
"putObject",
"(",
"t",
",",
"PARKBLOCKER",
",",
"arg",
")",
";",
"}"
] | Cannot be instantiated. | [
"Cannot",
"be",
"instantiated",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java#L141-L144 |
34,708 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java | LockSupport.park | public static void park(Object blocker) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(false, 0L);
setBlocker(t, null);
} | java | public static void park(Object blocker) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(false, 0L);
setBlocker(t, null);
} | [
"public",
"static",
"void",
"park",
"(",
"Object",
"blocker",
")",
"{",
"Thread",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"setBlocker",
"(",
"t",
",",
"blocker",
")",
";",
"U",
".",
"park",
"(",
"false",
",",
"0L",
")",
";",
"setBl... | Disables the current thread for thread scheduling purposes unless the
permit is available.
<p>If the permit is available then it is consumed and the call returns
immediately; otherwise
the current thread becomes disabled for thread scheduling
purposes and lies dormant until one of three things happens:
<ul>
<li>Some other thread invokes {@link #unpark unpark} with the
current thread as the target; or
<li>Some other thread {@linkplain Thread#interrupt interrupts}
the current thread; or
<li>The call spuriously (that is, for no reason) returns.
</ul>
<p>This method does <em>not</em> report which of these caused the
method to return. Callers should re-check the conditions which caused
the thread to park in the first place. Callers may also determine,
for example, the interrupt status of the thread upon return.
@param blocker the synchronization object responsible for this
thread parking
@since 1.6 | [
"Disables",
"the",
"current",
"thread",
"for",
"thread",
"scheduling",
"purposes",
"unless",
"the",
"permit",
"is",
"available",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java#L190-L195 |
34,709 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java | LockSupport.parkUntil | public static void parkUntil(Object blocker, long deadline) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(true, deadline);
setBlocker(t, null);
} | java | public static void parkUntil(Object blocker, long deadline) {
Thread t = Thread.currentThread();
setBlocker(t, blocker);
U.park(true, deadline);
setBlocker(t, null);
} | [
"public",
"static",
"void",
"parkUntil",
"(",
"Object",
"blocker",
",",
"long",
"deadline",
")",
"{",
"Thread",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
"setBlocker",
"(",
"t",
",",
"blocker",
")",
";",
"U",
".",
"park",
"(",
"true",
... | Disables the current thread for thread scheduling purposes, until
the specified deadline, unless the permit is available.
<p>If the permit is available then it is consumed and the call
returns immediately; otherwise the current thread becomes disabled
for thread scheduling purposes and lies dormant until one of four
things happens:
<ul>
<li>Some other thread invokes {@link #unpark unpark} with the
current thread as the target; or
<li>Some other thread {@linkplain Thread#interrupt interrupts} the
current thread; or
<li>The specified deadline passes; or
<li>The call spuriously (that is, for no reason) returns.
</ul>
<p>This method does <em>not</em> report which of these caused the
method to return. Callers should re-check the conditions which caused
the thread to park in the first place. Callers may also determine,
for example, the interrupt status of the thread, or the current time
upon return.
@param blocker the synchronization object responsible for this
thread parking
@param deadline the absolute time, in milliseconds from the Epoch,
to wait until
@since 1.6 | [
"Disables",
"the",
"current",
"thread",
"for",
"thread",
"scheduling",
"purposes",
"until",
"the",
"specified",
"deadline",
"unless",
"the",
"permit",
"is",
"available",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/LockSupport.java#L271-L276 |
34,710 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.writeFullyImpl | private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
while (bb.remaining() > 0) {
int n = ch.write(bb);
if (n <= 0)
throw new RuntimeException("no bytes written");
}
} | java | private static void writeFullyImpl(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
while (bb.remaining() > 0) {
int n = ch.write(bb);
if (n <= 0)
throw new RuntimeException("no bytes written");
}
} | [
"private",
"static",
"void",
"writeFullyImpl",
"(",
"WritableByteChannel",
"ch",
",",
"ByteBuffer",
"bb",
")",
"throws",
"IOException",
"{",
"while",
"(",
"bb",
".",
"remaining",
"(",
")",
">",
"0",
")",
"{",
"int",
"n",
"=",
"ch",
".",
"write",
"(",
"... | Write all remaining bytes in buffer to the given channel.
If the channel is selectable then it must be configured blocking. | [
"Write",
"all",
"remaining",
"bytes",
"in",
"buffer",
"to",
"the",
"given",
"channel",
".",
"If",
"the",
"channel",
"is",
"selectable",
"then",
"it",
"must",
"be",
"configured",
"blocking",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L75-L83 |
34,711 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.writeFully | private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
if (ch instanceof SelectableChannel) {
SelectableChannel sc = (SelectableChannel)ch;
synchronized (sc.blockingLock()) {
if (!sc.isBlocking())
throw new IllegalBlockingModeException();
writeFullyImpl(ch, bb);
}
} else {
writeFullyImpl(ch, bb);
}
} | java | private static void writeFully(WritableByteChannel ch, ByteBuffer bb)
throws IOException
{
if (ch instanceof SelectableChannel) {
SelectableChannel sc = (SelectableChannel)ch;
synchronized (sc.blockingLock()) {
if (!sc.isBlocking())
throw new IllegalBlockingModeException();
writeFullyImpl(ch, bb);
}
} else {
writeFullyImpl(ch, bb);
}
} | [
"private",
"static",
"void",
"writeFully",
"(",
"WritableByteChannel",
"ch",
",",
"ByteBuffer",
"bb",
")",
"throws",
"IOException",
"{",
"if",
"(",
"ch",
"instanceof",
"SelectableChannel",
")",
"{",
"SelectableChannel",
"sc",
"=",
"(",
"SelectableChannel",
")",
... | Write all remaining bytes in buffer to the given channel.
@throws IllegalBlockingException
If the channel is selectable and configured non-blocking. | [
"Write",
"all",
"remaining",
"bytes",
"in",
"buffer",
"to",
"the",
"given",
"channel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L91-L104 |
34,712 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newInputStream | public static InputStream newInputStream(ReadableByteChannel ch) {
checkNotNull(ch, "ch");
return new sun.nio.ch.ChannelInputStream(ch);
} | java | public static InputStream newInputStream(ReadableByteChannel ch) {
checkNotNull(ch, "ch");
return new sun.nio.ch.ChannelInputStream(ch);
} | [
"public",
"static",
"InputStream",
"newInputStream",
"(",
"ReadableByteChannel",
"ch",
")",
"{",
"checkNotNull",
"(",
"ch",
",",
"\"ch\"",
")",
";",
"return",
"new",
"sun",
".",
"nio",
".",
"ch",
".",
"ChannelInputStream",
"(",
"ch",
")",
";",
"}"
] | Constructs a stream that reads bytes from the given channel.
<p> The <tt>read</tt> methods of the resulting stream will throw an
{@link IllegalBlockingModeException} if invoked while the underlying
channel is in non-blocking mode. The stream will not be buffered, and
it will not support the {@link InputStream#mark mark} or {@link
InputStream#reset reset} methods. The stream will be safe for access by
multiple concurrent threads. Closing the stream will in turn cause the
channel to be closed. </p>
@param ch
The channel from which bytes will be read
@return A new input stream | [
"Constructs",
"a",
"stream",
"that",
"reads",
"bytes",
"from",
"the",
"given",
"channel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L124-L127 |
34,713 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newOutputStream | public static OutputStream newOutputStream(final WritableByteChannel ch) {
checkNotNull(ch, "ch");
return new OutputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
public synchronized void write(int b) throws IOException {
if (b1 == null)
b1 = new byte[1];
b1[0] = (byte)b;
this.write(b1);
}
public synchronized void write(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.limit(Math.min(off + len, bb.capacity()));
bb.position(off);
this.bb = bb;
this.bs = bs;
Channels.writeFully(ch, bb);
}
public void close() throws IOException {
ch.close();
}
};
} | java | public static OutputStream newOutputStream(final WritableByteChannel ch) {
checkNotNull(ch, "ch");
return new OutputStream() {
private ByteBuffer bb = null;
private byte[] bs = null; // Invoker's previous array
private byte[] b1 = null;
public synchronized void write(int b) throws IOException {
if (b1 == null)
b1 = new byte[1];
b1[0] = (byte)b;
this.write(b1);
}
public synchronized void write(byte[] bs, int off, int len)
throws IOException
{
if ((off < 0) || (off > bs.length) || (len < 0) ||
((off + len) > bs.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
ByteBuffer bb = ((this.bs == bs)
? this.bb
: ByteBuffer.wrap(bs));
bb.limit(Math.min(off + len, bb.capacity()));
bb.position(off);
this.bb = bb;
this.bs = bs;
Channels.writeFully(ch, bb);
}
public void close() throws IOException {
ch.close();
}
};
} | [
"public",
"static",
"OutputStream",
"newOutputStream",
"(",
"final",
"WritableByteChannel",
"ch",
")",
"{",
"checkNotNull",
"(",
"ch",
",",
"\"ch\"",
")",
";",
"return",
"new",
"OutputStream",
"(",
")",
"{",
"private",
"ByteBuffer",
"bb",
"=",
"null",
";",
"... | Constructs a stream that writes bytes to the given channel.
<p> The <tt>write</tt> methods of the resulting stream will throw an
{@link IllegalBlockingModeException} if invoked while the underlying
channel is in non-blocking mode. The stream will not be buffered. The
stream will be safe for access by multiple concurrent threads. Closing
the stream will in turn cause the channel to be closed. </p>
@param ch
The channel to which bytes will be written
@return A new output stream | [
"Constructs",
"a",
"stream",
"that",
"writes",
"bytes",
"to",
"the",
"given",
"channel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L143-L183 |
34,714 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newChannel | public static ReadableByteChannel newChannel(final InputStream in) {
checkNotNull(in, "in");
if (in instanceof FileInputStream &&
FileInputStream.class.equals(in.getClass())) {
return ((FileInputStream)in).getChannel();
}
return new ReadableByteChannelImpl(in);
} | java | public static ReadableByteChannel newChannel(final InputStream in) {
checkNotNull(in, "in");
if (in instanceof FileInputStream &&
FileInputStream.class.equals(in.getClass())) {
return ((FileInputStream)in).getChannel();
}
return new ReadableByteChannelImpl(in);
} | [
"public",
"static",
"ReadableByteChannel",
"newChannel",
"(",
"final",
"InputStream",
"in",
")",
"{",
"checkNotNull",
"(",
"in",
",",
"\"in\"",
")",
";",
"if",
"(",
"in",
"instanceof",
"FileInputStream",
"&&",
"FileInputStream",
".",
"class",
".",
"equals",
"(... | Constructs a channel that reads bytes from the given stream.
<p> The resulting channel will not be buffered; it will simply redirect
its I/O operations to the given stream. Closing the channel will in
turn cause the stream to be closed. </p>
@param in
The stream from which bytes are to be read
@return A new readable byte channel | [
"Constructs",
"a",
"channel",
"that",
"reads",
"bytes",
"from",
"the",
"given",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L198-L207 |
34,715 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newReader | public static Reader newReader(ReadableByteChannel ch,
CharsetDecoder dec,
int minBufferCap)
{
checkNotNull(ch, "ch");
return StreamDecoder.forDecoder(ch, dec.reset(), minBufferCap);
} | java | public static Reader newReader(ReadableByteChannel ch,
CharsetDecoder dec,
int minBufferCap)
{
checkNotNull(ch, "ch");
return StreamDecoder.forDecoder(ch, dec.reset(), minBufferCap);
} | [
"public",
"static",
"Reader",
"newReader",
"(",
"ReadableByteChannel",
"ch",
",",
"CharsetDecoder",
"dec",
",",
"int",
"minBufferCap",
")",
"{",
"checkNotNull",
"(",
"ch",
",",
"\"ch\"",
")",
";",
"return",
"StreamDecoder",
".",
"forDecoder",
"(",
"ch",
",",
... | Constructs a reader that decodes bytes from the given channel using the
given decoder.
<p> The resulting stream will contain an internal input buffer of at
least <tt>minBufferCap</tt> bytes. The stream's <tt>read</tt> methods
will, as needed, fill the buffer by reading bytes from the underlying
channel; if the channel is in non-blocking mode when bytes are to be
read then an {@link IllegalBlockingModeException} will be thrown. The
resulting stream will not otherwise be buffered, and it will not support
the {@link Reader#mark mark} or {@link Reader#reset reset} methods.
Closing the stream will in turn cause the channel to be closed. </p>
@param ch
The channel from which bytes will be read
@param dec
The charset decoder to be used
@param minBufferCap
The minimum capacity of the internal byte buffer,
or <tt>-1</tt> if an implementation-dependent
default capacity is to be used
@return A new reader | [
"Constructs",
"a",
"reader",
"that",
"decodes",
"bytes",
"from",
"the",
"given",
"channel",
"using",
"the",
"given",
"decoder",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L349-L355 |
34,716 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newReader | public static Reader newReader(ReadableByteChannel ch,
String csName)
{
checkNotNull(csName, "csName");
return newReader(ch, Charset.forName(csName).newDecoder(), -1);
} | java | public static Reader newReader(ReadableByteChannel ch,
String csName)
{
checkNotNull(csName, "csName");
return newReader(ch, Charset.forName(csName).newDecoder(), -1);
} | [
"public",
"static",
"Reader",
"newReader",
"(",
"ReadableByteChannel",
"ch",
",",
"String",
"csName",
")",
"{",
"checkNotNull",
"(",
"csName",
",",
"\"csName\"",
")",
";",
"return",
"newReader",
"(",
"ch",
",",
"Charset",
".",
"forName",
"(",
"csName",
")",
... | Constructs a reader that decodes bytes from the given channel according
to the named charset.
<p> An invocation of this method of the form
<blockquote><pre>
Channels.newReader(ch, csname)</pre></blockquote>
behaves in exactly the same way as the expression
<blockquote><pre>
Channels.newReader(ch,
Charset.forName(csName)
.newDecoder(),
-1);</pre></blockquote>
@param ch
The channel from which bytes will be read
@param csName
The name of the charset to be used
@return A new reader
@throws UnsupportedCharsetException
If no support for the named charset is available
in this instance of the Java virtual machine | [
"Constructs",
"a",
"reader",
"that",
"decodes",
"bytes",
"from",
"the",
"given",
"channel",
"according",
"to",
"the",
"named",
"charset",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L386-L391 |
34,717 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newWriter | public static Writer newWriter(final WritableByteChannel ch,
final CharsetEncoder enc,
final int minBufferCap)
{
checkNotNull(ch, "ch");
return StreamEncoder.forEncoder(ch, enc.reset(), minBufferCap);
} | java | public static Writer newWriter(final WritableByteChannel ch,
final CharsetEncoder enc,
final int minBufferCap)
{
checkNotNull(ch, "ch");
return StreamEncoder.forEncoder(ch, enc.reset(), minBufferCap);
} | [
"public",
"static",
"Writer",
"newWriter",
"(",
"final",
"WritableByteChannel",
"ch",
",",
"final",
"CharsetEncoder",
"enc",
",",
"final",
"int",
"minBufferCap",
")",
"{",
"checkNotNull",
"(",
"ch",
",",
"\"ch\"",
")",
";",
"return",
"StreamEncoder",
".",
"for... | Constructs a writer that encodes characters using the given encoder and
writes the resulting bytes to the given channel.
<p> The resulting stream will contain an internal output buffer of at
least <tt>minBufferCap</tt> bytes. The stream's <tt>write</tt> methods
will, as needed, flush the buffer by writing bytes to the underlying
channel; if the channel is in non-blocking mode when bytes are to be
written then an {@link IllegalBlockingModeException} will be thrown.
The resulting stream will not otherwise be buffered. Closing the stream
will in turn cause the channel to be closed. </p>
@param ch
The channel to which bytes will be written
@param enc
The charset encoder to be used
@param minBufferCap
The minimum capacity of the internal byte buffer,
or <tt>-1</tt> if an implementation-dependent
default capacity is to be used
@return A new writer | [
"Constructs",
"a",
"writer",
"that",
"encodes",
"characters",
"using",
"the",
"given",
"encoder",
"and",
"writes",
"the",
"resulting",
"bytes",
"to",
"the",
"given",
"channel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L418-L424 |
34,718 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java | Channels.newWriter | public static Writer newWriter(WritableByteChannel ch,
String csName)
{
checkNotNull(csName, "csName");
return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
} | java | public static Writer newWriter(WritableByteChannel ch,
String csName)
{
checkNotNull(csName, "csName");
return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
} | [
"public",
"static",
"Writer",
"newWriter",
"(",
"WritableByteChannel",
"ch",
",",
"String",
"csName",
")",
"{",
"checkNotNull",
"(",
"csName",
",",
"\"csName\"",
")",
";",
"return",
"newWriter",
"(",
"ch",
",",
"Charset",
".",
"forName",
"(",
"csName",
")",
... | Constructs a writer that encodes characters according to the named
charset and writes the resulting bytes to the given channel.
<p> An invocation of this method of the form
<blockquote><pre>
Channels.newWriter(ch, csname)</pre></blockquote>
behaves in exactly the same way as the expression
<blockquote><pre>
Channels.newWriter(ch,
Charset.forName(csName)
.newEncoder(),
-1);</pre></blockquote>
@param ch
The channel to which bytes will be written
@param csName
The name of the charset to be used
@return A new writer
@throws UnsupportedCharsetException
If no support for the named charset is available
in this instance of the Java virtual machine | [
"Constructs",
"a",
"writer",
"that",
"encodes",
"characters",
"according",
"to",
"the",
"named",
"charset",
"and",
"writes",
"the",
"resulting",
"bytes",
"to",
"the",
"given",
"channel",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/nio/channels/Channels.java#L455-L460 |
34,719 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarFile.java | JarFile.entries | public Enumeration<JarEntry> entries() {
final Enumeration enum_ = super.entries();
return new Enumeration<JarEntry>() {
public boolean hasMoreElements() {
return enum_.hasMoreElements();
}
public JarFileEntry nextElement() {
ZipEntry ze = (ZipEntry)enum_.nextElement();
return new JarFileEntry(ze);
}
};
} | java | public Enumeration<JarEntry> entries() {
final Enumeration enum_ = super.entries();
return new Enumeration<JarEntry>() {
public boolean hasMoreElements() {
return enum_.hasMoreElements();
}
public JarFileEntry nextElement() {
ZipEntry ze = (ZipEntry)enum_.nextElement();
return new JarFileEntry(ze);
}
};
} | [
"public",
"Enumeration",
"<",
"JarEntry",
">",
"entries",
"(",
")",
"{",
"final",
"Enumeration",
"enum_",
"=",
"super",
".",
"entries",
"(",
")",
";",
"return",
"new",
"Enumeration",
"<",
"JarEntry",
">",
"(",
")",
"{",
"public",
"boolean",
"hasMoreElement... | Returns an enumeration of the zip file entries. | [
"Returns",
"an",
"enumeration",
"of",
"the",
"zip",
"file",
"entries",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarFile.java#L247-L258 |
34,720 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/Options.java | Options.checkMemoryManagementOption | private void checkMemoryManagementOption(MemoryManagementOption option) {
if (memoryManagementOption != null && memoryManagementOption != option) {
usage("Multiple memory management options cannot be set.");
}
setMemoryManagementOption(option);
} | java | private void checkMemoryManagementOption(MemoryManagementOption option) {
if (memoryManagementOption != null && memoryManagementOption != option) {
usage("Multiple memory management options cannot be set.");
}
setMemoryManagementOption(option);
} | [
"private",
"void",
"checkMemoryManagementOption",
"(",
"MemoryManagementOption",
"option",
")",
"{",
"if",
"(",
"memoryManagementOption",
"!=",
"null",
"&&",
"memoryManagementOption",
"!=",
"option",
")",
"{",
"usage",
"(",
"\"Multiple memory management options cannot be se... | Check that the memory management option wasn't previously set to a
different value. If okay, then set the option. | [
"Check",
"that",
"the",
"memory",
"management",
"option",
"wasn",
"t",
"previously",
"set",
"to",
"a",
"different",
"value",
".",
"If",
"okay",
"then",
"set",
"the",
"option",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/Options.java#L609-L614 |
34,721 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/CaptureInfo.java | CaptureInfo.getImplicitPrefixParams | public Iterable<VariableElement> getImplicitPrefixParams(TypeElement type) {
return Iterables.transform(getCaptures(type), Capture::getParam);
} | java | public Iterable<VariableElement> getImplicitPrefixParams(TypeElement type) {
return Iterables.transform(getCaptures(type), Capture::getParam);
} | [
"public",
"Iterable",
"<",
"VariableElement",
">",
"getImplicitPrefixParams",
"(",
"TypeElement",
"type",
")",
"{",
"return",
"Iterables",
".",
"transform",
"(",
"getCaptures",
"(",
"type",
")",
",",
"Capture",
"::",
"getParam",
")",
";",
"}"
] | Returns all the implicit params that come before explicit params in a constructor. | [
"Returns",
"all",
"the",
"implicit",
"params",
"that",
"come",
"before",
"explicit",
"params",
"in",
"a",
"constructor",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/CaptureInfo.java#L156-L158 |
34,722 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/CaptureInfo.java | CaptureInfo.getImplicitPostfixParams | public Iterable<VariableElement> getImplicitPostfixParams(TypeElement type) {
if (ElementUtil.isEnum(type)) {
return implicitEnumParams;
}
return Collections.emptyList();
} | java | public Iterable<VariableElement> getImplicitPostfixParams(TypeElement type) {
if (ElementUtil.isEnum(type)) {
return implicitEnumParams;
}
return Collections.emptyList();
} | [
"public",
"Iterable",
"<",
"VariableElement",
">",
"getImplicitPostfixParams",
"(",
"TypeElement",
"type",
")",
"{",
"if",
"(",
"ElementUtil",
".",
"isEnum",
"(",
"type",
")",
")",
"{",
"return",
"implicitEnumParams",
";",
"}",
"return",
"Collections",
".",
"e... | returns all the implicit params that come after explicit params in a constructor. | [
"returns",
"all",
"the",
"implicit",
"params",
"that",
"come",
"after",
"explicit",
"params",
"in",
"a",
"constructor",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/CaptureInfo.java#L163-L168 |
34,723 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/FactoryFinder.java | FactoryFinder.find | static Object find(String factoryId, String fallbackClassName) throws ConfigurationError {
ClassLoader classLoader = findClassLoader();
// Use the system property first
String systemProp = System.getProperty(factoryId);
if (systemProp != null && systemProp.length() > 0) {
if (debug) debugPrintln("found " + systemProp + " in the system property " + factoryId);
return newInstance(systemProp, classLoader);
}
// try to read from $java.home/lib/jaxp.properties
try {
String factoryClassName = CacheHolder.cacheProps.getProperty(factoryId);
if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
if (factoryClassName != null) {
return newInstance(factoryClassName, classLoader);
}
} catch (Exception ex) {
if (debug) {
ex.printStackTrace();
}
}
// Try Jar Service Provider Mechanism
Object provider = findJarServiceProvider(factoryId);
if (provider != null) {
return provider;
}
if (fallbackClassName == null) {
throw new ConfigurationError(
"Provider for " + factoryId + " cannot be found", null);
}
if (debug) debugPrintln("loaded from fallback value: " + fallbackClassName);
return newInstance(fallbackClassName, classLoader);
} | java | static Object find(String factoryId, String fallbackClassName) throws ConfigurationError {
ClassLoader classLoader = findClassLoader();
// Use the system property first
String systemProp = System.getProperty(factoryId);
if (systemProp != null && systemProp.length() > 0) {
if (debug) debugPrintln("found " + systemProp + " in the system property " + factoryId);
return newInstance(systemProp, classLoader);
}
// try to read from $java.home/lib/jaxp.properties
try {
String factoryClassName = CacheHolder.cacheProps.getProperty(factoryId);
if (debug) debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
if (factoryClassName != null) {
return newInstance(factoryClassName, classLoader);
}
} catch (Exception ex) {
if (debug) {
ex.printStackTrace();
}
}
// Try Jar Service Provider Mechanism
Object provider = findJarServiceProvider(factoryId);
if (provider != null) {
return provider;
}
if (fallbackClassName == null) {
throw new ConfigurationError(
"Provider for " + factoryId + " cannot be found", null);
}
if (debug) debugPrintln("loaded from fallback value: " + fallbackClassName);
return newInstance(fallbackClassName, classLoader);
} | [
"static",
"Object",
"find",
"(",
"String",
"factoryId",
",",
"String",
"fallbackClassName",
")",
"throws",
"ConfigurationError",
"{",
"ClassLoader",
"classLoader",
"=",
"findClassLoader",
"(",
")",
";",
"// Use the system property first",
"String",
"systemProp",
"=",
... | Finds the implementation Class object in the specified order. Main
entry point.
Package private so this code can be shared.
@param factoryId Name of the factory to find, same as a property name
@param fallbackClassName Implementation class name, if nothing else is found. Use null to mean no fallback.
@return Class Object of factory, never null
@throws ConfigurationError If Class cannot be found. | [
"Finds",
"the",
"implementation",
"Class",
"object",
"in",
"the",
"specified",
"order",
".",
"Main",
"entry",
"point",
".",
"Package",
"private",
"so",
"this",
"code",
"can",
"be",
"shared",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/FactoryFinder.java#L186-L224 |
34,724 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/FactoryFinder.java | FactoryFinder.which | private static String which(Class clazz) {
try {
String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
ClassLoader loader = clazz.getClassLoader();
URL it;
if (loader != null) {
it = loader.getResource(classnameAsResource);
} else {
it = ClassLoader.getSystemResource(classnameAsResource);
}
if (it != null) {
return it.toString();
}
}
// The VM ran out of memory or there was some other serious problem. Re-throw.
catch (VirtualMachineError vme) {
throw vme;
}
// ThreadDeath should always be re-thrown
catch (ThreadDeath td) {
throw td;
}
catch (Throwable t) {
// work defensively.
if (debug) {
t.printStackTrace();
}
}
return "unknown location";
} | java | private static String which(Class clazz) {
try {
String classnameAsResource = clazz.getName().replace('.', '/') + ".class";
ClassLoader loader = clazz.getClassLoader();
URL it;
if (loader != null) {
it = loader.getResource(classnameAsResource);
} else {
it = ClassLoader.getSystemResource(classnameAsResource);
}
if (it != null) {
return it.toString();
}
}
// The VM ran out of memory or there was some other serious problem. Re-throw.
catch (VirtualMachineError vme) {
throw vme;
}
// ThreadDeath should always be re-thrown
catch (ThreadDeath td) {
throw td;
}
catch (Throwable t) {
// work defensively.
if (debug) {
t.printStackTrace();
}
}
return "unknown location";
} | [
"private",
"static",
"String",
"which",
"(",
"Class",
"clazz",
")",
"{",
"try",
"{",
"String",
"classnameAsResource",
"=",
"clazz",
".",
"getName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".class\"",
";",
"ClassLoader",
"loa... | Returns the location where the given Class is loaded from. | [
"Returns",
"the",
"location",
"where",
"the",
"given",
"Class",
"is",
"loaded",
"from",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/datatype/FactoryFinder.java#L321-L354 |
34,725 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/StringTokenizer.java | StringTokenizer.getNextDelimiter | private int getNextDelimiter(int offset)
{
if (offset >= 0) {
int result = offset;
int c = 0;
if (delims == null) {
do {
c = UTF16.charAt(m_source_, result);
if (m_delimiters_.contains(c)) {
break;
}
result ++;
} while (result < m_length_);
} else {
do {
c = UTF16.charAt(m_source_, result);
if (c < delims.length && delims[c]) {
break;
}
result ++;
} while (result < m_length_);
}
if (result < m_length_) {
return result;
}
}
return -1 - m_length_;
} | java | private int getNextDelimiter(int offset)
{
if (offset >= 0) {
int result = offset;
int c = 0;
if (delims == null) {
do {
c = UTF16.charAt(m_source_, result);
if (m_delimiters_.contains(c)) {
break;
}
result ++;
} while (result < m_length_);
} else {
do {
c = UTF16.charAt(m_source_, result);
if (c < delims.length && delims[c]) {
break;
}
result ++;
} while (result < m_length_);
}
if (result < m_length_) {
return result;
}
}
return -1 - m_length_;
} | [
"private",
"int",
"getNextDelimiter",
"(",
"int",
"offset",
")",
"{",
"if",
"(",
"offset",
">=",
"0",
")",
"{",
"int",
"result",
"=",
"offset",
";",
"int",
"c",
"=",
"0",
";",
"if",
"(",
"delims",
"==",
"null",
")",
"{",
"do",
"{",
"c",
"=",
"U... | Gets the index of the next delimiter after offset
@param offset to the source string
@return offset of the immediate next delimiter, otherwise
(- source string length - 1) if there
are no more delimiters after m_nextOffset | [
"Gets",
"the",
"index",
"of",
"the",
"next",
"delimiter",
"after",
"offset"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/StringTokenizer.java#L596-L623 |
34,726 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.getSetterMethodName | public String getSetterMethodName()
{
if (null == m_setterString)
{
if (m_foreignAttr == this)
{
return S_FOREIGNATTR_SETTER;
}
else if (m_name.equals("*"))
{
m_setterString = "addLiteralResultAttribute";
return m_setterString;
}
StringBuffer outBuf = new StringBuffer();
outBuf.append("set");
if ((m_namespace != null)
&& m_namespace.equals(Constants.S_XMLNAMESPACEURI))
{
outBuf.append("Xml");
}
int n = m_name.length();
for (int i = 0; i < n; i++)
{
char c = m_name.charAt(i);
if ('-' == c)
{
i++;
c = m_name.charAt(i);
c = Character.toUpperCase(c);
}
else if (0 == i)
{
c = Character.toUpperCase(c);
}
outBuf.append(c);
}
m_setterString = outBuf.toString();
}
return m_setterString;
} | java | public String getSetterMethodName()
{
if (null == m_setterString)
{
if (m_foreignAttr == this)
{
return S_FOREIGNATTR_SETTER;
}
else if (m_name.equals("*"))
{
m_setterString = "addLiteralResultAttribute";
return m_setterString;
}
StringBuffer outBuf = new StringBuffer();
outBuf.append("set");
if ((m_namespace != null)
&& m_namespace.equals(Constants.S_XMLNAMESPACEURI))
{
outBuf.append("Xml");
}
int n = m_name.length();
for (int i = 0; i < n; i++)
{
char c = m_name.charAt(i);
if ('-' == c)
{
i++;
c = m_name.charAt(i);
c = Character.toUpperCase(c);
}
else if (0 == i)
{
c = Character.toUpperCase(c);
}
outBuf.append(c);
}
m_setterString = outBuf.toString();
}
return m_setterString;
} | [
"public",
"String",
"getSetterMethodName",
"(",
")",
"{",
"if",
"(",
"null",
"==",
"m_setterString",
")",
"{",
"if",
"(",
"m_foreignAttr",
"==",
"this",
")",
"{",
"return",
"S_FOREIGNATTR_SETTER",
";",
"}",
"else",
"if",
"(",
"m_name",
".",
"equals",
"(",
... | Return a string that should represent the setter method.
The setter method name will be created algorithmically the
first time this method is accessed, and then cached for return
by subsequent invocations of this method.
@return String that should represent the setter method which which
may be used on objects to set a value that represents this attribute,
of null if no setter method should be called. | [
"Return",
"a",
"string",
"that",
"should",
"represent",
"the",
"setter",
"method",
".",
"The",
"setter",
"method",
"name",
"will",
"be",
"created",
"algorithmically",
"the",
"first",
"time",
"this",
"method",
"is",
"accessed",
"and",
"then",
"cached",
"for",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L443-L494 |
34,727 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processAVT | AVT processAVT(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | AVT processAVT(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"AVT",
"processAVT",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"... | Process an attribute string of type T_AVT into
a AVT value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value Should be an Attribute Value Template string.
@return An AVT object that may be used to evaluate the Attribute Value Template.
@throws org.xml.sax.SAXException which will wrap a
{@link javax.xml.transform.TransformerException}, if there is a syntax error
in the attribute value template string. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_AVT",
"into",
"a",
"AVT",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L512-L528 |
34,728 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processCHAR | Object processCHAR(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT()) {
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (value.length() != 1)) {
handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} else {
if (value.length() != 1)
{
handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null);
return null;
}
return new Character(value.charAt(0));
}
} | java | Object processCHAR(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT()) {
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (value.length() != 1)) {
handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} else {
if (value.length() != 1)
{
handleError(handler, XSLTErrorResources.INVALID_TCHAR, new Object[] {name, value},null);
return null;
}
return new Character(value.charAt(0));
}
} | [
"Object",
"processCHAR",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",... | Process an attribute string of type T_CHAR into
a Character value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value Should be a string with a length of 1.
@return Character object.
@throws org.xml.sax.SAXException if the string is not a length of 1. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_CHAR",
"into",
"a",
"Character",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L577-L606 |
34,729 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processENUM | Object processENUM(StylesheetHandler handler, String uri, String name,
String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
AVT avt = null;
if (getSupportsAVT()) {
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (!avt.isSimple()) return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
int retVal = this.getEnum(value);
if (retVal == StringToIntTable.INVALID_KEY)
{
StringBuffer enumNamesList = getListOfEnums();
handleError(handler, XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null);
return null;
}
if (getSupportsAVT()) return avt;
else return new Integer(retVal);
} | java | Object processENUM(StylesheetHandler handler, String uri, String name,
String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
AVT avt = null;
if (getSupportsAVT()) {
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (!avt.isSimple()) return avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
int retVal = this.getEnum(value);
if (retVal == StringToIntTable.INVALID_KEY)
{
StringBuffer enumNamesList = getListOfEnums();
handleError(handler, XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null);
return null;
}
if (getSupportsAVT()) return avt;
else return new Integer(retVal);
} | [
"Object",
"processENUM",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",... | Process an attribute string of type T_ENUM into a int value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value non-null string that represents an enumerated value that is
valid for this element.
@param owner
@return An Integer representation of the enumerated value if this attribute does not support
AVT. Otherwise, and AVT is returned. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_ENUM",
"into",
"a",
"int",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L622-L654 |
34,730 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processENUM_OR_PQNAME | Object processENUM_OR_PQNAME(StylesheetHandler handler, String uri, String name,
String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
Object objToReturn = null;
if (getSupportsAVT()) {
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
if (!avt.isSimple()) return avt;
else objToReturn = avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
// An avt wasn't used.
int key = this.getEnum(value);
if (key != StringToIntTable.INVALID_KEY)
{
if (objToReturn == null) objToReturn = new Integer(key);
}
// enum not used. Validate qname-but-not-ncname.
else
{
try
{
QName qname = new QName(value, handler, true);
if (objToReturn == null) objToReturn = qname;
if (qname.getPrefix() == null) {
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null);
return null;
}
}
catch (IllegalArgumentException ie)
{
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },ie);
return null;
}
catch (RuntimeException re)
{
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },re);
return null;
}
}
return objToReturn;
} | java | Object processENUM_OR_PQNAME(StylesheetHandler handler, String uri, String name,
String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
Object objToReturn = null;
if (getSupportsAVT()) {
try
{
AVT avt = new AVT(handler, uri, name, rawName, value, owner);
if (!avt.isSimple()) return avt;
else objToReturn = avt;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
}
// An avt wasn't used.
int key = this.getEnum(value);
if (key != StringToIntTable.INVALID_KEY)
{
if (objToReturn == null) objToReturn = new Integer(key);
}
// enum not used. Validate qname-but-not-ncname.
else
{
try
{
QName qname = new QName(value, handler, true);
if (objToReturn == null) objToReturn = qname;
if (qname.getPrefix() == null) {
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },null);
return null;
}
}
catch (IllegalArgumentException ie)
{
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },ie);
return null;
}
catch (RuntimeException re)
{
StringBuffer enumNamesList = getListOfEnums();
enumNamesList.append(" <qname-but-not-ncname>");
handleError(handler,XSLTErrorResources.INVALID_ENUM,new Object[]{name, value, enumNamesList.toString() },re);
return null;
}
}
return objToReturn;
} | [
"Object",
"processENUM_OR_PQNAME",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXE... | Process an attribute string of that is either an enumerated value or a qname-but-not-ncname.
Returns an AVT, if this attribute support AVT; otherwise returns int or qname.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value non-null string that represents an enumerated value that is
valid for this element.
@param owner
@return AVT if attribute supports AVT. An Integer representation of the enumerated value if
attribute does not support AVT and an enumerated value was used. Otherwise a qname
is returned. | [
"Process",
"an",
"attribute",
"string",
"of",
"that",
"is",
"either",
"an",
"enumerated",
"value",
"or",
"a",
"qname",
"-",
"but",
"-",
"not",
"-",
"ncname",
".",
"Returns",
"an",
"AVT",
"if",
"this",
"attribute",
"support",
"AVT",
";",
"otherwise",
"ret... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L672-L737 |
34,731 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processEXPR | Object processEXPR(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath expr = handler.createXPath(value, owner);
return expr;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | Object processEXPR(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath expr = handler.createXPath(value, owner);
return expr;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"Object",
"processEXPR",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",... | Process an attribute string of type T_EXPR into
an XPath value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value An XSLT expression string.
@return an XPath object that may be used for evaluation.
@throws org.xml.sax.SAXException that wraps a
{@link javax.xml.transform.TransformerException} if the expression
string contains a syntax error. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_EXPR",
"into",
"an",
"XPath",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L755-L771 |
34,732 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processPATTERN | Object processPATTERN(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath pattern = handler.createMatchPatternXPath(value, owner);
return pattern;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | Object processPATTERN(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
XPath pattern = handler.createMatchPatternXPath(value, owner);
return pattern;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"Object",
"processPATTERN",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXExceptio... | Process an attribute string of type T_PATTERN into
an XPath match pattern value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A match pattern string.
@return An XPath pattern that may be used to evaluate the XPath.
@throws org.xml.sax.SAXException that wraps a
{@link javax.xml.transform.TransformerException} if the match pattern
string contains a syntax error. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_PATTERN",
"into",
"an",
"XPath",
"match",
"pattern",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L833-L849 |
34,733 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processNUMBER | Object processNUMBER(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
Double val;
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (avt.isSimple())
{
val = Double.valueOf(value);
}
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
return avt;
}
else
{
try
{
return Double.valueOf(value);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
}
} | java | Object processNUMBER(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
Double val;
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If this attribute used an avt, then we can't validate at this time.
if (avt.isSimple())
{
val = Double.valueOf(value);
}
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
return avt;
}
else
{
try
{
return Double.valueOf(value);
}
catch (NumberFormatException nfe)
{
handleError(handler,XSLTErrorResources.INVALID_NUMBER, new Object[] {name, value}, nfe);
return null;
}
}
} | [
"Object",
"processNUMBER",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException... | Process an attribute string of type T_NUMBER into
a double value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that can be parsed into a double value.
@param number
@return A Double object.
@throws org.xml.sax.SAXException that wraps a
{@link javax.xml.transform.TransformerException}
if the string does not contain a parsable number. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_NUMBER",
"into",
"a",
"double",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L868-L912 |
34,734 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processNCNAME | Object processNCNAME(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
// thrown by AVT constructor
throw new org.xml.sax.SAXException(te);
}
} else {
if (!XML11Char.isXML11ValidNCName(value))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return value;
}
} | java | Object processNCNAME(
StylesheetHandler handler, String uri, String name, String rawName, String value, ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
if (getSupportsAVT())
{
AVT avt = null;
try
{
avt = new AVT(handler, uri, name, rawName, value, owner);
// If an AVT wasn't used, validate the value
if ((avt.isSimple()) && (!XML11Char.isXML11ValidNCName(value)))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return avt;
}
catch (TransformerException te)
{
// thrown by AVT constructor
throw new org.xml.sax.SAXException(te);
}
} else {
if (!XML11Char.isXML11ValidNCName(value))
{
handleError(handler,XSLTErrorResources.INVALID_NCNAME,new Object[] {name,value},null);
return null;
}
return value;
}
} | [
"Object",
"processNCNAME",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException... | Process an attribute string of type NCName into a String
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that represents a potentially prefix qualified name.
@param owner
@return A String object if this attribute does not support AVT's. Otherwise, an AVT
is returned.
@throws org.xml.sax.SAXException if the string contains a prefix that can not be
resolved, or the string contains syntax that is invalid for a NCName. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"NCName",
"into",
"a",
"String"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1030-L1064 |
34,735 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processSIMPLEPATTERNLIST | Vector processSIMPLEPATTERNLIST(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nPatterns = tokenizer.countTokens();
Vector patterns = new Vector(nPatterns);
for (int i = 0; i < nPatterns; i++)
{
XPath pattern =
handler.createMatchPatternXPath(tokenizer.nextToken(), owner);
patterns.addElement(pattern);
}
return patterns;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | java | Vector processSIMPLEPATTERNLIST(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
try
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nPatterns = tokenizer.countTokens();
Vector patterns = new Vector(nPatterns);
for (int i = 0; i < nPatterns; i++)
{
XPath pattern =
handler.createMatchPatternXPath(tokenizer.nextToken(), owner);
patterns.addElement(pattern);
}
return patterns;
}
catch (TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
} | [
"Vector",
"processSIMPLEPATTERNLIST",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"S... | Process an attribute string of type T_SIMPLEPATTERNLIST into
a vector of XPath match patterns.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A whitespace delimited list of simple match patterns.
@return A Vector of XPath objects.
@throws org.xml.sax.SAXException that wraps a
{@link javax.xml.transform.TransformerException} if one of the match pattern
strings contains a syntax error. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_SIMPLEPATTERNLIST",
"into",
"a",
"vector",
"of",
"XPath",
"match",
"patterns",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1158-L1184 |
34,736 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processSTRINGLIST | StringVector processSTRINGLIST(StylesheetHandler handler, String uri,
String name, String rawName, String value)
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
strings.addElement(tokenizer.nextToken());
}
return strings;
} | java | StringVector processSTRINGLIST(StylesheetHandler handler, String uri,
String name, String rawName, String value)
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
strings.addElement(tokenizer.nextToken());
}
return strings;
} | [
"StringVector",
"processSTRINGLIST",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
")",
"{",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
"(",
"value",
",",
"... | Process an attribute string of type T_STRINGLIST into
a vector of XPath match patterns.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value a whitespace delimited list of string values.
@return A StringVector of the tokenized strings. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_STRINGLIST",
"into",
"a",
"vector",
"of",
"XPath",
"match",
"patterns",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1198-L1212 |
34,737 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processPREFIX_URLLIST | StringVector processPREFIX_URLLIST(
StylesheetHandler handler, String uri, String name, String rawName, String value)
throws org.xml.sax.SAXException
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
String prefix = tokenizer.nextToken();
String url = handler.getNamespaceForPrefix(prefix);
if (url != null)
strings.addElement(url);
else
throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix}));
}
return strings;
} | java | StringVector processPREFIX_URLLIST(
StylesheetHandler handler, String uri, String name, String rawName, String value)
throws org.xml.sax.SAXException
{
StringTokenizer tokenizer = new StringTokenizer(value, " \t\n\r\f");
int nStrings = tokenizer.countTokens();
StringVector strings = new StringVector(nStrings);
for (int i = 0; i < nStrings; i++)
{
String prefix = tokenizer.nextToken();
String url = handler.getNamespaceForPrefix(prefix);
if (url != null)
strings.addElement(url);
else
throw new org.xml.sax.SAXException(XSLMessages.createMessage(XSLTErrorResources.ER_CANT_RESOLVE_NSPREFIX, new Object[] {prefix}));
}
return strings;
} | [
"StringVector",
"processPREFIX_URLLIST",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"StringTokenizer"... | Process an attribute string of type T_URLLIST into
a vector of prefixes that may be resolved to URLs.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A list of whitespace delimited prefixes.
@return A vector of strings that may be resolved to URLs.
@throws org.xml.sax.SAXException if one of the prefixes can not be resolved. | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_URLLIST",
"into",
"a",
"vector",
"of",
"prefixes",
"that",
"may",
"be",
"resolved",
"to",
"URLs",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1228-L1250 |
34,738 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processYESNO | private Boolean processYESNO(
StylesheetHandler handler, String uri, String name, String rawName, String value)
throws org.xml.sax.SAXException
{
// Is this already checked somewhere else? -sb
if (!(value.equals("yes") || value.equals("no")))
{
handleError(handler, XSLTErrorResources.INVALID_BOOLEAN, new Object[] {name,value}, null);
return null;
}
return new Boolean(value.equals("yes") ? true : false);
} | java | private Boolean processYESNO(
StylesheetHandler handler, String uri, String name, String rawName, String value)
throws org.xml.sax.SAXException
{
// Is this already checked somewhere else? -sb
if (!(value.equals("yes") || value.equals("no")))
{
handleError(handler, XSLTErrorResources.INVALID_BOOLEAN, new Object[] {name,value}, null);
return null;
}
return new Boolean(value.equals("yes") ? true : false);
} | [
"private",
"Boolean",
"processYESNO",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"// Is this alread... | Process an attribute string of type T_YESNO into
a Boolean value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value A string that should be "yes" or "no".
@return Boolean object representation of the value.
@throws org.xml.sax.SAXException | [
"Process",
"an",
"attribute",
"string",
"of",
"type",
"T_YESNO",
"into",
"a",
"Boolean",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1353-L1366 |
34,739 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.processValue | Object processValue(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
int type = getType();
Object processedValue = null;
switch (type)
{
case T_AVT :
processedValue = processAVT(handler, uri, name, rawName, value, owner);
break;
case T_CDATA :
processedValue = processCDATA(handler, uri, name, rawName, value, owner);
break;
case T_CHAR :
processedValue = processCHAR(handler, uri, name, rawName, value, owner);
break;
case T_ENUM :
processedValue = processENUM(handler, uri, name, rawName, value, owner);
break;
case T_EXPR :
processedValue = processEXPR(handler, uri, name, rawName, value, owner);
break;
case T_NMTOKEN :
processedValue = processNMTOKEN(handler, uri, name, rawName, value, owner);
break;
case T_PATTERN :
processedValue = processPATTERN(handler, uri, name, rawName, value, owner);
break;
case T_NUMBER :
processedValue = processNUMBER(handler, uri, name, rawName, value, owner);
break;
case T_QNAME :
processedValue = processQNAME(handler, uri, name, rawName, value, owner);
break;
case T_QNAMES :
processedValue = processQNAMES(handler, uri, name, rawName, value);
break;
case T_QNAMES_RESOLVE_NULL:
processedValue = processQNAMESRNU(handler, uri, name, rawName, value);
break;
case T_SIMPLEPATTERNLIST :
processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName,
value, owner);
break;
case T_URL :
processedValue = processURL(handler, uri, name, rawName, value, owner);
break;
case T_YESNO :
processedValue = processYESNO(handler, uri, name, rawName, value);
break;
case T_STRINGLIST :
processedValue = processSTRINGLIST(handler, uri, name, rawName, value);
break;
case T_PREFIX_URLLIST :
processedValue = processPREFIX_URLLIST(handler, uri, name, rawName,
value);
break;
case T_ENUM_OR_PQNAME :
processedValue = processENUM_OR_PQNAME(handler, uri, name, rawName, value, owner);
break;
case T_NCNAME :
processedValue = processNCNAME(handler, uri, name, rawName, value, owner);
break;
case T_AVT_QNAME :
processedValue = processAVT_QNAME(handler, uri, name, rawName, value, owner);
break;
case T_PREFIXLIST :
processedValue = processPREFIX_LIST(handler, uri, name, rawName,
value);
break;
default :
}
return processedValue;
} | java | Object processValue(
StylesheetHandler handler, String uri, String name, String rawName, String value,
ElemTemplateElement owner)
throws org.xml.sax.SAXException
{
int type = getType();
Object processedValue = null;
switch (type)
{
case T_AVT :
processedValue = processAVT(handler, uri, name, rawName, value, owner);
break;
case T_CDATA :
processedValue = processCDATA(handler, uri, name, rawName, value, owner);
break;
case T_CHAR :
processedValue = processCHAR(handler, uri, name, rawName, value, owner);
break;
case T_ENUM :
processedValue = processENUM(handler, uri, name, rawName, value, owner);
break;
case T_EXPR :
processedValue = processEXPR(handler, uri, name, rawName, value, owner);
break;
case T_NMTOKEN :
processedValue = processNMTOKEN(handler, uri, name, rawName, value, owner);
break;
case T_PATTERN :
processedValue = processPATTERN(handler, uri, name, rawName, value, owner);
break;
case T_NUMBER :
processedValue = processNUMBER(handler, uri, name, rawName, value, owner);
break;
case T_QNAME :
processedValue = processQNAME(handler, uri, name, rawName, value, owner);
break;
case T_QNAMES :
processedValue = processQNAMES(handler, uri, name, rawName, value);
break;
case T_QNAMES_RESOLVE_NULL:
processedValue = processQNAMESRNU(handler, uri, name, rawName, value);
break;
case T_SIMPLEPATTERNLIST :
processedValue = processSIMPLEPATTERNLIST(handler, uri, name, rawName,
value, owner);
break;
case T_URL :
processedValue = processURL(handler, uri, name, rawName, value, owner);
break;
case T_YESNO :
processedValue = processYESNO(handler, uri, name, rawName, value);
break;
case T_STRINGLIST :
processedValue = processSTRINGLIST(handler, uri, name, rawName, value);
break;
case T_PREFIX_URLLIST :
processedValue = processPREFIX_URLLIST(handler, uri, name, rawName,
value);
break;
case T_ENUM_OR_PQNAME :
processedValue = processENUM_OR_PQNAME(handler, uri, name, rawName, value, owner);
break;
case T_NCNAME :
processedValue = processNCNAME(handler, uri, name, rawName, value, owner);
break;
case T_AVT_QNAME :
processedValue = processAVT_QNAME(handler, uri, name, rawName, value, owner);
break;
case T_PREFIXLIST :
processedValue = processPREFIX_LIST(handler, uri, name, rawName,
value);
break;
default :
}
return processedValue;
} | [
"Object",
"processValue",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"name",
",",
"String",
"rawName",
",",
"String",
"value",
",",
"ElemTemplateElement",
"owner",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException"... | Process an attribute value.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param uri The Namespace URI, or an empty string.
@param name The local name (without prefix), or empty string if not namespace processing.
@param rawName The qualified name (with prefix).
@param value The unprocessed string value of the attribute.
@return The processed Object representation of the attribute.
@throws org.xml.sax.SAXException if the attribute value can not be processed. | [
"Process",
"an",
"attribute",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1381-L1460 |
34,740 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.setDefAttrValue | void setDefAttrValue(StylesheetHandler handler, ElemTemplateElement elem)
throws org.xml.sax.SAXException
{
setAttrValue(handler, this.getNamespace(), this.getName(),
this.getName(), this.getDefault(), elem);
} | java | void setDefAttrValue(StylesheetHandler handler, ElemTemplateElement elem)
throws org.xml.sax.SAXException
{
setAttrValue(handler, this.getNamespace(), this.getName(),
this.getName(), this.getDefault(), elem);
} | [
"void",
"setDefAttrValue",
"(",
"StylesheetHandler",
"handler",
",",
"ElemTemplateElement",
"elem",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"setAttrValue",
"(",
"handler",
",",
"this",
".",
"getNamespace",
"(",
")",
",",
"this",... | Set the default value of an attribute.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param elem The object on which the property will be set.
@throws org.xml.sax.SAXException wraps an invocation exception if the
setter method can not be invoked on the object. | [
"Set",
"the",
"default",
"value",
"of",
"an",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1471-L1476 |
34,741 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.getPrimativeClass | private Class getPrimativeClass(Object obj)
{
if (obj instanceof XPath)
return XPath.class;
Class cl = obj.getClass();
if (cl == Double.class)
{
cl = double.class;
}
if (cl == Float.class)
{
cl = float.class;
}
else if (cl == Boolean.class)
{
cl = boolean.class;
}
else if (cl == Byte.class)
{
cl = byte.class;
}
else if (cl == Character.class)
{
cl = char.class;
}
else if (cl == Short.class)
{
cl = short.class;
}
else if (cl == Integer.class)
{
cl = int.class;
}
else if (cl == Long.class)
{
cl = long.class;
}
return cl;
} | java | private Class getPrimativeClass(Object obj)
{
if (obj instanceof XPath)
return XPath.class;
Class cl = obj.getClass();
if (cl == Double.class)
{
cl = double.class;
}
if (cl == Float.class)
{
cl = float.class;
}
else if (cl == Boolean.class)
{
cl = boolean.class;
}
else if (cl == Byte.class)
{
cl = byte.class;
}
else if (cl == Character.class)
{
cl = char.class;
}
else if (cl == Short.class)
{
cl = short.class;
}
else if (cl == Integer.class)
{
cl = int.class;
}
else if (cl == Long.class)
{
cl = long.class;
}
return cl;
} | [
"private",
"Class",
"getPrimativeClass",
"(",
"Object",
"obj",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"XPath",
")",
"return",
"XPath",
".",
"class",
";",
"Class",
"cl",
"=",
"obj",
".",
"getClass",
"(",
")",
";",
"if",
"(",
"cl",
"==",
"Double",
"... | Get the primative type for the class, if there
is one. If the class is a Double, for instance,
this will return double.class. If the class is not one
of the 9 primative types, it will return the same
class that was passed in.
@param obj The object which will be resolved to a primative class object if possible.
@return The most primative class representation possible for the object, never null. | [
"Get",
"the",
"primative",
"type",
"for",
"the",
"class",
"if",
"there",
"is",
"one",
".",
"If",
"the",
"class",
"is",
"a",
"Double",
"for",
"instance",
"this",
"will",
"return",
"double",
".",
"class",
".",
"If",
"the",
"class",
"is",
"not",
"one",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1489-L1532 |
34,742 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.getListOfEnums | private StringBuffer getListOfEnums()
{
StringBuffer enumNamesList = new StringBuffer();
String [] enumValues = this.getEnumNames();
for (int i = 0; i < enumValues.length; i++)
{
if (i > 0)
{
enumNamesList.append(' ');
}
enumNamesList.append(enumValues[i]);
}
return enumNamesList;
} | java | private StringBuffer getListOfEnums()
{
StringBuffer enumNamesList = new StringBuffer();
String [] enumValues = this.getEnumNames();
for (int i = 0; i < enumValues.length; i++)
{
if (i > 0)
{
enumNamesList.append(' ');
}
enumNamesList.append(enumValues[i]);
}
return enumNamesList;
} | [
"private",
"StringBuffer",
"getListOfEnums",
"(",
")",
"{",
"StringBuffer",
"enumNamesList",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"String",
"[",
"]",
"enumValues",
"=",
"this",
".",
"getEnumNames",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
"... | StringBuffer containing comma delimited list of valid values for ENUM type.
Used to build error message. | [
"StringBuffer",
"containing",
"comma",
"delimited",
"list",
"of",
"valid",
"values",
"for",
"ENUM",
"type",
".",
"Used",
"to",
"build",
"error",
"message",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1538-L1552 |
34,743 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java | XSLTAttributeDef.setAttrValue | boolean setAttrValue(
StylesheetHandler handler, String attrUri, String attrLocalName,
String attrRawName, String attrValue, ElemTemplateElement elem)
throws org.xml.sax.SAXException
{
if(attrRawName.equals("xmlns") || attrRawName.startsWith("xmlns:"))
return true;
String setterString = getSetterMethodName();
// If this is null, then it is a foreign namespace and we
// do not process it.
if (null != setterString)
{
try
{
Method meth;
Object[] args;
if(setterString.equals(S_FOREIGNATTR_SETTER))
{
// workaround for possible crimson bug
if( attrUri==null) attrUri="";
// First try to match with the primative value.
Class sclass = attrUri.getClass();
Class[] argTypes = new Class[]{ sclass, sclass,
sclass, sclass };
meth = elem.getClass().getMethod(setterString, argTypes);
args = new Object[]{ attrUri, attrLocalName,
attrRawName, attrValue };
}
else
{
Object value = processValue(handler, attrUri, attrLocalName,
attrRawName, attrValue, elem);
// If a warning was issued because the value for this attribute was
// invalid, then the value will be null. Just return
if (null == value) return false;
// First try to match with the primative value.
Class[] argTypes = new Class[]{ getPrimativeClass(value) };
try
{
meth = elem.getClass().getMethod(setterString, argTypes);
}
catch (NoSuchMethodException nsme)
{
Class cl = ((Object) value).getClass();
// If this doesn't work, try it with the non-primative value;
argTypes[0] = cl;
meth = elem.getClass().getMethod(setterString, argTypes);
}
args = new Object[]{ value };
}
meth.invoke(elem, args);
}
catch (NoSuchMethodException nsme)
{
if (!setterString.equals(S_FOREIGNATTR_SETTER))
{
handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, nsme);//"Failed calling " + setterString + " method!", nsme);
return false;
}
}
catch (IllegalAccessException iae)
{
handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, iae);//"Failed calling " + setterString + " method!", iae);
return false;
}
catch (InvocationTargetException nsme)
{
handleError(handler, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_NAME, getName()}, nsme);
return false;
}
}
return true;
} | java | boolean setAttrValue(
StylesheetHandler handler, String attrUri, String attrLocalName,
String attrRawName, String attrValue, ElemTemplateElement elem)
throws org.xml.sax.SAXException
{
if(attrRawName.equals("xmlns") || attrRawName.startsWith("xmlns:"))
return true;
String setterString = getSetterMethodName();
// If this is null, then it is a foreign namespace and we
// do not process it.
if (null != setterString)
{
try
{
Method meth;
Object[] args;
if(setterString.equals(S_FOREIGNATTR_SETTER))
{
// workaround for possible crimson bug
if( attrUri==null) attrUri="";
// First try to match with the primative value.
Class sclass = attrUri.getClass();
Class[] argTypes = new Class[]{ sclass, sclass,
sclass, sclass };
meth = elem.getClass().getMethod(setterString, argTypes);
args = new Object[]{ attrUri, attrLocalName,
attrRawName, attrValue };
}
else
{
Object value = processValue(handler, attrUri, attrLocalName,
attrRawName, attrValue, elem);
// If a warning was issued because the value for this attribute was
// invalid, then the value will be null. Just return
if (null == value) return false;
// First try to match with the primative value.
Class[] argTypes = new Class[]{ getPrimativeClass(value) };
try
{
meth = elem.getClass().getMethod(setterString, argTypes);
}
catch (NoSuchMethodException nsme)
{
Class cl = ((Object) value).getClass();
// If this doesn't work, try it with the non-primative value;
argTypes[0] = cl;
meth = elem.getClass().getMethod(setterString, argTypes);
}
args = new Object[]{ value };
}
meth.invoke(elem, args);
}
catch (NoSuchMethodException nsme)
{
if (!setterString.equals(S_FOREIGNATTR_SETTER))
{
handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, nsme);//"Failed calling " + setterString + " method!", nsme);
return false;
}
}
catch (IllegalAccessException iae)
{
handler.error(XSLTErrorResources.ER_FAILED_CALLING_METHOD, new Object[]{setterString}, iae);//"Failed calling " + setterString + " method!", iae);
return false;
}
catch (InvocationTargetException nsme)
{
handleError(handler, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_NAME, getName()}, nsme);
return false;
}
}
return true;
} | [
"boolean",
"setAttrValue",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"attrUri",
",",
"String",
"attrLocalName",
",",
"String",
"attrRawName",
",",
"String",
"attrValue",
",",
"ElemTemplateElement",
"elem",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
... | Set a value on an attribute.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates.
@param attrUri The Namespace URI of the attribute, or an empty string.
@param attrLocalName The local name (without prefix), or empty string if not namespace processing.
@param attrRawName The raw name of the attribute, including possible prefix.
@param attrValue The attribute's value.
@param elem The object that should contain a property that represents the attribute.
@throws org.xml.sax.SAXException | [
"Set",
"a",
"value",
"on",
"an",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/XSLTAttributeDef.java#L1566-L1650 |
34,744 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StylesheetPIHandler.java | StylesheetPIHandler.getAssociatedStylesheet | public Source getAssociatedStylesheet()
{
int sz = m_stylesheets.size();
if (sz > 0)
{
Source source = (Source) m_stylesheets.elementAt(sz-1);
return source;
}
else
return null;
} | java | public Source getAssociatedStylesheet()
{
int sz = m_stylesheets.size();
if (sz > 0)
{
Source source = (Source) m_stylesheets.elementAt(sz-1);
return source;
}
else
return null;
} | [
"public",
"Source",
"getAssociatedStylesheet",
"(",
")",
"{",
"int",
"sz",
"=",
"m_stylesheets",
".",
"size",
"(",
")",
";",
"if",
"(",
"sz",
">",
"0",
")",
"{",
"Source",
"source",
"=",
"(",
"Source",
")",
"m_stylesheets",
".",
"elementAt",
"(",
"sz",... | Return the last stylesheet found that match the constraints.
@return Source object that references the last stylesheet reference
that matches the constraints. | [
"Return",
"the",
"last",
"stylesheet",
"found",
"that",
"match",
"the",
"constraints",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StylesheetPIHandler.java#L115-L127 |
34,745 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StylesheetPIHandler.java | StylesheetPIHandler.startElement | public void startElement(
String namespaceURI, String localName, String qName, Attributes atts)
throws org.xml.sax.SAXException
{
throw new StopParseException();
} | java | public void startElement(
String namespaceURI, String localName, String qName, Attributes atts)
throws org.xml.sax.SAXException
{
throw new StopParseException();
} | [
"public",
"void",
"startElement",
"(",
"String",
"namespaceURI",
",",
"String",
"localName",
",",
"String",
"qName",
",",
"Attributes",
"atts",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"throw",
"new",
"StopParseException",
"(",
... | The spec notes that "The xml-stylesheet processing instruction is allowed only in the prolog of an XML document.",
so, at least for right now, I'm going to go ahead an throw a TransformerException
in order to stop the parse.
@param namespaceURI The Namespace URI, or an empty string.
@param localName The local name (without prefix), or empty string if not namespace processing.
@param qName The qualified name (with prefix).
@param atts The specified or defaulted attributes.
@throws StopParseException since there can be no valid xml-stylesheet processing
instructions past the first element. | [
"The",
"spec",
"notes",
"that",
"The",
"xml",
"-",
"stylesheet",
"processing",
"instruction",
"is",
"allowed",
"only",
"in",
"the",
"prolog",
"of",
"an",
"XML",
"document",
".",
"so",
"at",
"least",
"for",
"right",
"now",
"I",
"m",
"going",
"to",
"go",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/StylesheetPIHandler.java#L320-L325 |
34,746 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/LocaleUtils.java | LocaleUtils.caseIgnoreMatch | public static boolean caseIgnoreMatch(String s1, String s2) {
if (s1 == s2) {
return true;
}
int len = s1.length();
if (len != s2.length()) {
return false;
}
for (int i = 0; i < len; i++) {
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if (c1 != c2 && toLower(c1) != toLower(c2)) {
return false;
}
}
return true;
} | java | public static boolean caseIgnoreMatch(String s1, String s2) {
if (s1 == s2) {
return true;
}
int len = s1.length();
if (len != s2.length()) {
return false;
}
for (int i = 0; i < len; i++) {
char c1 = s1.charAt(i);
char c2 = s2.charAt(i);
if (c1 != c2 && toLower(c1) != toLower(c2)) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"caseIgnoreMatch",
"(",
"String",
"s1",
",",
"String",
"s2",
")",
"{",
"if",
"(",
"s1",
"==",
"s2",
")",
"{",
"return",
"true",
";",
"}",
"int",
"len",
"=",
"s1",
".",
"length",
"(",
")",
";",
"if",
"(",
"len",
"!="... | Compares two ASCII Strings s1 and s2, ignoring case. | [
"Compares",
"two",
"ASCII",
"Strings",
"s1",
"and",
"s2",
"ignoring",
"case",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/LocaleUtils.java#L50-L68 |
34,747 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/LocaleUtils.java | LocaleUtils.toLowerString | public static String toLowerString(String s) {
int len = s.length();
int idx = 0;
for (; idx < len; idx++) {
if (isUpper(s.charAt(idx))) {
break;
}
}
if (idx == len) {
return s;
}
char[] buf = new char[len];
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
buf[i] = (i < idx) ? c : toLower(c);
}
return new String(buf);
} | java | public static String toLowerString(String s) {
int len = s.length();
int idx = 0;
for (; idx < len; idx++) {
if (isUpper(s.charAt(idx))) {
break;
}
}
if (idx == len) {
return s;
}
char[] buf = new char[len];
for (int i = 0; i < len; i++) {
char c = s.charAt(i);
buf[i] = (i < idx) ? c : toLower(c);
}
return new String(buf);
} | [
"public",
"static",
"String",
"toLowerString",
"(",
"String",
"s",
")",
"{",
"int",
"len",
"=",
"s",
".",
"length",
"(",
")",
";",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
";",
"idx",
"<",
"len",
";",
"idx",
"++",
")",
"{",
"if",
"(",
"isUpper"... | Converts the given ASCII String to lower-case. | [
"Converts",
"the",
"given",
"ASCII",
"String",
"to",
"lower",
"-",
"case",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/util/locale/LocaleUtils.java#L88-L106 |
34,748 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncSystemProperty.java | FuncSystemProperty.loadPropertyFile | public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this
bis.close(); // close out after reading
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
}
} | java | public void loadPropertyFile(String file, Properties target)
{
try
{
// Use SecuritySupport class to provide priveleged access to property file
SecuritySupport ss = SecuritySupport.getInstance();
InputStream is = ss.getResourceAsStream(ObjectFactory.findClassLoader(),
file);
// get a buffered version
BufferedInputStream bis = new BufferedInputStream(is);
target.load(bis); // and load up the property bag from this
bis.close(); // close out after reading
}
catch (Exception ex)
{
// ex.printStackTrace();
throw new org.apache.xml.utils.WrappedRuntimeException(ex);
}
} | [
"public",
"void",
"loadPropertyFile",
"(",
"String",
"file",
",",
"Properties",
"target",
")",
"{",
"try",
"{",
"// Use SecuritySupport class to provide priveleged access to property file",
"SecuritySupport",
"ss",
"=",
"SecuritySupport",
".",
"getInstance",
"(",
")",
";"... | Retrieve a propery bundle from a specified file
@param file The string name of the property file. The name
should already be fully qualified as path/filename
@param target The target property bag the file will be placed into. | [
"Retrieve",
"a",
"propery",
"bundle",
"from",
"a",
"specified",
"file"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FuncSystemProperty.java#L176-L197 |
34,749 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java | Operation.setLeftRight | public void setLeftRight(Expression l, Expression r)
{
m_left = l;
m_right = r;
l.exprSetParent(this);
r.exprSetParent(this);
} | java | public void setLeftRight(Expression l, Expression r)
{
m_left = l;
m_right = r;
l.exprSetParent(this);
r.exprSetParent(this);
} | [
"public",
"void",
"setLeftRight",
"(",
"Expression",
"l",
",",
"Expression",
"r",
")",
"{",
"m_left",
"=",
"l",
";",
"m_right",
"=",
"r",
";",
"l",
".",
"exprSetParent",
"(",
"this",
")",
";",
"r",
".",
"exprSetParent",
"(",
"this",
")",
";",
"}"
] | Set the left and right operand expressions for this operation.
@param l The left expression operand.
@param r The right expression operand. | [
"Set",
"the",
"left",
"and",
"right",
"operand",
"expressions",
"for",
"this",
"operation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Operation.java#L86-L92 |
34,750 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java | Builder.distance | static int distance(GeneralNameInterface base,
GeneralNameInterface test, int incomparable)
{
switch (base.constrains(test)) {
case GeneralNameInterface.NAME_DIFF_TYPE:
if (debug != null) {
debug.println("Builder.distance(): Names are different types");
}
return incomparable;
case GeneralNameInterface.NAME_SAME_TYPE:
if (debug != null) {
debug.println("Builder.distance(): Names are same type but " +
"in different subtrees");
}
return incomparable;
case GeneralNameInterface.NAME_MATCH:
return 0;
case GeneralNameInterface.NAME_WIDENS:
break;
case GeneralNameInterface.NAME_NARROWS:
break;
default: // should never occur
return incomparable;
}
/* names are in same subtree */
return test.subtreeDepth() - base.subtreeDepth();
} | java | static int distance(GeneralNameInterface base,
GeneralNameInterface test, int incomparable)
{
switch (base.constrains(test)) {
case GeneralNameInterface.NAME_DIFF_TYPE:
if (debug != null) {
debug.println("Builder.distance(): Names are different types");
}
return incomparable;
case GeneralNameInterface.NAME_SAME_TYPE:
if (debug != null) {
debug.println("Builder.distance(): Names are same type but " +
"in different subtrees");
}
return incomparable;
case GeneralNameInterface.NAME_MATCH:
return 0;
case GeneralNameInterface.NAME_WIDENS:
break;
case GeneralNameInterface.NAME_NARROWS:
break;
default: // should never occur
return incomparable;
}
/* names are in same subtree */
return test.subtreeDepth() - base.subtreeDepth();
} | [
"static",
"int",
"distance",
"(",
"GeneralNameInterface",
"base",
",",
"GeneralNameInterface",
"test",
",",
"int",
"incomparable",
")",
"{",
"switch",
"(",
"base",
".",
"constrains",
"(",
"test",
")",
")",
"{",
"case",
"GeneralNameInterface",
".",
"NAME_DIFF_TYP... | get distance of one GeneralName from another
@param base GeneralName at base of subtree
@param test GeneralName to be tested against base
@param incomparable the value to return if the names are
incomparable
@return distance of test name from base, where 0
means exact match, 1 means test is an immediate
child of base, 2 means test is a grandchild, etc.
-1 means test is a parent of base, -2 means test
is a grandparent, etc. | [
"get",
"distance",
"of",
"one",
"GeneralName",
"from",
"another"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java#L143-L170 |
34,751 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java | Builder.targetDistance | static int targetDistance(NameConstraintsExtension constraints,
X509Certificate cert, GeneralNameInterface target)
throws IOException
{
/* ensure that certificate satisfies existing name constraints */
if (constraints != null && !constraints.verify(cert)) {
throw new IOException("certificate does not satisfy existing name "
+ "constraints");
}
X509CertImpl certImpl;
try {
certImpl = X509CertImpl.toImpl(cert);
} catch (CertificateException e) {
throw new IOException("Invalid certificate", e);
}
/* see if certificate subject matches target */
X500Name subject = X500Name.asX500Name(certImpl.getSubjectX500Principal());
if (subject.equals(target)) {
/* match! */
return 0;
}
SubjectAlternativeNameExtension altNameExt =
certImpl.getSubjectAlternativeNameExtension();
if (altNameExt != null) {
GeneralNames altNames = altNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
/* see if any alternative name matches target */
if (altNames != null) {
for (int j = 0, n = altNames.size(); j < n; j++) {
GeneralNameInterface altName = altNames.get(j).getName();
if (altName.equals(target)) {
return 0;
}
}
}
}
/* no exact match; see if certificate can get us to target */
/* first, get NameConstraints out of certificate */
NameConstraintsExtension ncExt = certImpl.getNameConstraintsExtension();
if (ncExt == null) {
return -1;
}
/* merge certificate's NameConstraints with current NameConstraints */
if (constraints != null) {
constraints.merge(ncExt);
} else {
// Make sure we do a clone here, because we're probably
// going to modify this object later and we don't want to
// be sharing it with a Certificate object!
constraints = (NameConstraintsExtension) ncExt.clone();
}
if (debug != null) {
debug.println("Builder.targetDistance() merged constraints: "
+ String.valueOf(constraints));
}
/* reduce permitted by excluded */
GeneralSubtrees permitted =
constraints.get(NameConstraintsExtension.PERMITTED_SUBTREES);
GeneralSubtrees excluded =
constraints.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
if (permitted != null) {
permitted.reduce(excluded);
}
if (debug != null) {
debug.println("Builder.targetDistance() reduced constraints: "
+ permitted);
}
/* see if new merged constraints allow target */
if (!constraints.verify(target)) {
throw new IOException("New certificate not allowed to sign "
+ "certificate for target");
}
/* find distance to target, if any, in permitted */
if (permitted == null) {
/* certificate is unconstrained; could sign for anything */
return -1;
}
for (int i = 0, n = permitted.size(); i < n; i++) {
GeneralNameInterface perName = permitted.get(i).getName().getName();
int distance = distance(perName, target, -1);
if (distance >= 0) {
return (distance + 1);
}
}
/* no matching type in permitted; cert holder could certify target */
return -1;
} | java | static int targetDistance(NameConstraintsExtension constraints,
X509Certificate cert, GeneralNameInterface target)
throws IOException
{
/* ensure that certificate satisfies existing name constraints */
if (constraints != null && !constraints.verify(cert)) {
throw new IOException("certificate does not satisfy existing name "
+ "constraints");
}
X509CertImpl certImpl;
try {
certImpl = X509CertImpl.toImpl(cert);
} catch (CertificateException e) {
throw new IOException("Invalid certificate", e);
}
/* see if certificate subject matches target */
X500Name subject = X500Name.asX500Name(certImpl.getSubjectX500Principal());
if (subject.equals(target)) {
/* match! */
return 0;
}
SubjectAlternativeNameExtension altNameExt =
certImpl.getSubjectAlternativeNameExtension();
if (altNameExt != null) {
GeneralNames altNames = altNameExt.get(
SubjectAlternativeNameExtension.SUBJECT_NAME);
/* see if any alternative name matches target */
if (altNames != null) {
for (int j = 0, n = altNames.size(); j < n; j++) {
GeneralNameInterface altName = altNames.get(j).getName();
if (altName.equals(target)) {
return 0;
}
}
}
}
/* no exact match; see if certificate can get us to target */
/* first, get NameConstraints out of certificate */
NameConstraintsExtension ncExt = certImpl.getNameConstraintsExtension();
if (ncExt == null) {
return -1;
}
/* merge certificate's NameConstraints with current NameConstraints */
if (constraints != null) {
constraints.merge(ncExt);
} else {
// Make sure we do a clone here, because we're probably
// going to modify this object later and we don't want to
// be sharing it with a Certificate object!
constraints = (NameConstraintsExtension) ncExt.clone();
}
if (debug != null) {
debug.println("Builder.targetDistance() merged constraints: "
+ String.valueOf(constraints));
}
/* reduce permitted by excluded */
GeneralSubtrees permitted =
constraints.get(NameConstraintsExtension.PERMITTED_SUBTREES);
GeneralSubtrees excluded =
constraints.get(NameConstraintsExtension.EXCLUDED_SUBTREES);
if (permitted != null) {
permitted.reduce(excluded);
}
if (debug != null) {
debug.println("Builder.targetDistance() reduced constraints: "
+ permitted);
}
/* see if new merged constraints allow target */
if (!constraints.verify(target)) {
throw new IOException("New certificate not allowed to sign "
+ "certificate for target");
}
/* find distance to target, if any, in permitted */
if (permitted == null) {
/* certificate is unconstrained; could sign for anything */
return -1;
}
for (int i = 0, n = permitted.size(); i < n; i++) {
GeneralNameInterface perName = permitted.get(i).getName().getName();
int distance = distance(perName, target, -1);
if (distance >= 0) {
return (distance + 1);
}
}
/* no matching type in permitted; cert holder could certify target */
return -1;
} | [
"static",
"int",
"targetDistance",
"(",
"NameConstraintsExtension",
"constraints",
",",
"X509Certificate",
"cert",
",",
"GeneralNameInterface",
"target",
")",
"throws",
"IOException",
"{",
"/* ensure that certificate satisfies existing name constraints */",
"if",
"(",
"constrai... | Determine how close a given certificate gets you toward
a given target.
@param constraints Current NameConstraints; if null,
then caller must verify NameConstraints
independently, realizing that this certificate
may not actually lead to the target at all.
@param cert Candidate certificate for chain
@param target GeneralNameInterface name of target
@return distance from this certificate to target:
<ul>
<li>-1 means certificate could be CA for target, but
there are no NameConstraints limiting how close
<li> 0 means certificate subject or subjectAltName
matches target
<li> 1 means certificate is permitted to be CA for
target.
<li> 2 means certificate is permitted to be CA for
parent of target.
<li>>0 in general, means certificate is permitted
to be a CA for this distance higher in the naming
hierarchy than the target, plus 1.
</ul>
<p>Note that the subject and/or subjectAltName of the
candidate cert does not have to be an ancestor of the
target in order to be a CA that can issue a certificate to
the target. In these cases, the target distance is calculated
by inspecting the NameConstraints extension in the candidate
certificate. For example, suppose the target is an X.500 DN with
a value of "CN=mullan,OU=ireland,O=sun,C=us" and the
NameConstraints extension in the candidate certificate
includes a permitted component of "O=sun,C=us", which implies
that the candidate certificate is allowed to issue certs in
the "O=sun,C=us" namespace. The target distance is 3
((distance of permitted NC from target) + 1).
The (+1) is added to distinguish the result from the case
which returns (0).
@throws IOException if certificate does not get closer | [
"Determine",
"how",
"close",
"a",
"given",
"certificate",
"gets",
"you",
"toward",
"a",
"given",
"target",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java#L280-L373 |
34,752 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java | Builder.addMatchingCerts | boolean addMatchingCerts(X509CertSelector selector,
Collection<CertStore> certStores,
Collection<X509Certificate> resultCerts,
boolean checkAll)
{
X509Certificate targetCert = selector.getCertificate();
if (targetCert != null) {
// no need to search CertStores
if (selector.match(targetCert) && !X509CertImpl.isSelfSigned
(targetCert, buildParams.sigProvider())) {
if (debug != null) {
debug.println("Builder.addMatchingCerts: adding target cert");
}
return resultCerts.add(targetCert);
}
return false;
}
boolean add = false;
for (CertStore store : certStores) {
try {
Collection<? extends Certificate> certs =
store.getCertificates(selector);
for (Certificate cert : certs) {
if (!X509CertImpl.isSelfSigned
((X509Certificate)cert, buildParams.sigProvider())) {
if (resultCerts.add((X509Certificate)cert)) {
add = true;
}
}
}
if (!checkAll && add) {
return true;
}
} catch (CertStoreException cse) {
// if getCertificates throws a CertStoreException, we ignore
// it and move on to the next CertStore
if (debug != null) {
debug.println("Builder.addMatchingCerts, non-fatal " +
"exception retrieving certs: " + cse);
cse.printStackTrace();
}
}
}
return add;
} | java | boolean addMatchingCerts(X509CertSelector selector,
Collection<CertStore> certStores,
Collection<X509Certificate> resultCerts,
boolean checkAll)
{
X509Certificate targetCert = selector.getCertificate();
if (targetCert != null) {
// no need to search CertStores
if (selector.match(targetCert) && !X509CertImpl.isSelfSigned
(targetCert, buildParams.sigProvider())) {
if (debug != null) {
debug.println("Builder.addMatchingCerts: adding target cert");
}
return resultCerts.add(targetCert);
}
return false;
}
boolean add = false;
for (CertStore store : certStores) {
try {
Collection<? extends Certificate> certs =
store.getCertificates(selector);
for (Certificate cert : certs) {
if (!X509CertImpl.isSelfSigned
((X509Certificate)cert, buildParams.sigProvider())) {
if (resultCerts.add((X509Certificate)cert)) {
add = true;
}
}
}
if (!checkAll && add) {
return true;
}
} catch (CertStoreException cse) {
// if getCertificates throws a CertStoreException, we ignore
// it and move on to the next CertStore
if (debug != null) {
debug.println("Builder.addMatchingCerts, non-fatal " +
"exception retrieving certs: " + cse);
cse.printStackTrace();
}
}
}
return add;
} | [
"boolean",
"addMatchingCerts",
"(",
"X509CertSelector",
"selector",
",",
"Collection",
"<",
"CertStore",
">",
"certStores",
",",
"Collection",
"<",
"X509Certificate",
">",
"resultCerts",
",",
"boolean",
"checkAll",
")",
"{",
"X509Certificate",
"targetCert",
"=",
"se... | Search the specified CertStores and add all certificates matching
selector to resultCerts. Self-signed certs are not useful here
and therefore ignored.
If the targetCert criterion of the selector is set, only that cert
is examined and the CertStores are not searched.
If checkAll is true, all CertStores are searched for matching certs.
If false, the method returns as soon as the first CertStore returns
a matching cert(s).
Returns true iff resultCerts changed (a cert was added to the collection) | [
"Search",
"the",
"specified",
"CertStores",
"and",
"add",
"all",
"certificates",
"matching",
"selector",
"to",
"resultCerts",
".",
"Self",
"-",
"signed",
"certs",
"are",
"not",
"useful",
"here",
"and",
"therefore",
"ignored",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/Builder.java#L427-L471 |
34,753 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedHashMap.java | LinkedHashMap.linkNodeLast | private void linkNodeLast(LinkedHashMapEntry<K,V> p) {
LinkedHashMapEntry<K,V> last = tail;
tail = p;
if (last == null)
head = p;
else {
p.before = last;
last.after = p;
}
} | java | private void linkNodeLast(LinkedHashMapEntry<K,V> p) {
LinkedHashMapEntry<K,V> last = tail;
tail = p;
if (last == null)
head = p;
else {
p.before = last;
last.after = p;
}
} | [
"private",
"void",
"linkNodeLast",
"(",
"LinkedHashMapEntry",
"<",
"K",
",",
"V",
">",
"p",
")",
"{",
"LinkedHashMapEntry",
"<",
"K",
",",
"V",
">",
"last",
"=",
"tail",
";",
"tail",
"=",
"p",
";",
"if",
"(",
"last",
"==",
"null",
")",
"head",
"=",... | link at the end of list | [
"link",
"at",
"the",
"end",
"of",
"list"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedHashMap.java#L249-L258 |
34,754 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedHashMap.java | LinkedHashMap.transferLinks | private void transferLinks(LinkedHashMapEntry<K,V> src,
LinkedHashMapEntry<K,V> dst) {
LinkedHashMapEntry<K,V> b = dst.before = src.before;
LinkedHashMapEntry<K,V> a = dst.after = src.after;
if (b == null)
head = dst;
else
b.after = dst;
if (a == null)
tail = dst;
else
a.before = dst;
} | java | private void transferLinks(LinkedHashMapEntry<K,V> src,
LinkedHashMapEntry<K,V> dst) {
LinkedHashMapEntry<K,V> b = dst.before = src.before;
LinkedHashMapEntry<K,V> a = dst.after = src.after;
if (b == null)
head = dst;
else
b.after = dst;
if (a == null)
tail = dst;
else
a.before = dst;
} | [
"private",
"void",
"transferLinks",
"(",
"LinkedHashMapEntry",
"<",
"K",
",",
"V",
">",
"src",
",",
"LinkedHashMapEntry",
"<",
"K",
",",
"V",
">",
"dst",
")",
"{",
"LinkedHashMapEntry",
"<",
"K",
",",
"V",
">",
"b",
"=",
"dst",
".",
"before",
"=",
"s... | apply src's links to dst | [
"apply",
"src",
"s",
"links",
"to",
"dst"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/LinkedHashMap.java#L261-L273 |
34,755 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java | Collator.getAvailableLocales | public static Locale[] getAvailableLocales() {
// TODO make this wrap getAvailableULocales later
if (shim == null) {
return ICUResourceBundle.getAvailableLocales(
ICUData.ICU_COLLATION_BASE_NAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
}
return shim.getAvailableLocales();
} | java | public static Locale[] getAvailableLocales() {
// TODO make this wrap getAvailableULocales later
if (shim == null) {
return ICUResourceBundle.getAvailableLocales(
ICUData.ICU_COLLATION_BASE_NAME, ICUResourceBundle.ICU_DATA_CLASS_LOADER);
}
return shim.getAvailableLocales();
} | [
"public",
"static",
"Locale",
"[",
"]",
"getAvailableLocales",
"(",
")",
"{",
"// TODO make this wrap getAvailableULocales later",
"if",
"(",
"shim",
"==",
"null",
")",
"{",
"return",
"ICUResourceBundle",
".",
"getAvailableLocales",
"(",
"ICUData",
".",
"ICU_COLLATION... | Returns the set of locales, as Locale objects, for which collators
are installed. Note that Locale objects do not support RFC 3066.
@return the list of locales in which collators are installed.
This list includes any that have been registered, in addition to
those that are installed with ICU4J. | [
"Returns",
"the",
"set",
"of",
"locales",
"as",
"Locale",
"objects",
"for",
"which",
"collators",
"are",
"installed",
".",
"Note",
"that",
"Locale",
"objects",
"do",
"not",
"support",
"RFC",
"3066",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L883-L890 |
34,756 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java | Collator.compare | @Override
public int compare(Object source, Object target) {
return doCompare((CharSequence)source, (CharSequence)target);
} | java | @Override
public int compare(Object source, Object target) {
return doCompare((CharSequence)source, (CharSequence)target);
} | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"Object",
"source",
",",
"Object",
"target",
")",
"{",
"return",
"doCompare",
"(",
"(",
"CharSequence",
")",
"source",
",",
"(",
"CharSequence",
")",
"target",
")",
";",
"}"
] | Compares the source Object to the target Object.
@param source the source Object.
@param target the target Object.
@return Returns an integer value. Value is less than zero if source is
less than target, value is zero if source and target are equal,
value is greater than zero if source is greater than target.
@throws ClassCastException thrown if either arguments cannot be cast to CharSequence. | [
"Compares",
"the",
"source",
"Object",
"to",
"the",
"target",
"Object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Collator.java#L1197-L1200 |
34,757 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.getName | public String getName() {
String algName = nameTable.get(algid);
if (algName != null) {
return algName;
}
if ((params != null) && algid.equals(specifiedWithECDSA_oid)) {
try {
AlgorithmId paramsId =
AlgorithmId.parse(new DerValue(getEncodedParams()));
String paramsName = paramsId.getName();
if (paramsName.equals("SHA")) {
paramsName = "SHA1";
}
algName = paramsName + "withECDSA";
} catch (IOException e) {
// ignore
}
}
// Try to update the name <-> OID mapping table.
synchronized (oidTable) {
reinitializeMappingTableLocked();
algName = nameTable.get(algid);
}
return (algName == null) ? algid.toString() : algName;
} | java | public String getName() {
String algName = nameTable.get(algid);
if (algName != null) {
return algName;
}
if ((params != null) && algid.equals(specifiedWithECDSA_oid)) {
try {
AlgorithmId paramsId =
AlgorithmId.parse(new DerValue(getEncodedParams()));
String paramsName = paramsId.getName();
if (paramsName.equals("SHA")) {
paramsName = "SHA1";
}
algName = paramsName + "withECDSA";
} catch (IOException e) {
// ignore
}
}
// Try to update the name <-> OID mapping table.
synchronized (oidTable) {
reinitializeMappingTableLocked();
algName = nameTable.get(algid);
}
return (algName == null) ? algid.toString() : algName;
} | [
"public",
"String",
"getName",
"(",
")",
"{",
"String",
"algName",
"=",
"nameTable",
".",
"get",
"(",
"algid",
")",
";",
"if",
"(",
"algName",
"!=",
"null",
")",
"{",
"return",
"algName",
";",
"}",
"if",
"(",
"(",
"params",
"!=",
"null",
")",
"&&",... | Returns a name for the algorithm which may be more intelligible
to humans than the algorithm's OID, but which won't necessarily
be comprehensible on other systems. For example, this might
return a name such as "MD5withRSA" for a signature algorithm on
some systems. It also returns names like "OID.1.2.3.4", when
no particular name for the algorithm is known. | [
"Returns",
"a",
"name",
"for",
"the",
"algorithm",
"which",
"may",
"be",
"more",
"intelligible",
"to",
"humans",
"than",
"the",
"algorithm",
"s",
"OID",
"but",
"which",
"won",
"t",
"necessarily",
"be",
"comprehensible",
"on",
"other",
"systems",
".",
"For",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L236-L262 |
34,758 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.get | public static AlgorithmId get(String algname)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid);
} | java | public static AlgorithmId get(String algname)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid);
} | [
"public",
"static",
"AlgorithmId",
"get",
"(",
"String",
"algname",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"ObjectIdentifier",
"oid",
";",
"try",
"{",
"oid",
"=",
"algOID",
"(",
"algname",
")",
";",
"}",
"catch",
"(",
"IOException",
"ioe",
")",
"{",... | Returns one of the algorithm IDs most commonly associated
with this algorithm name.
@param algname the name being used
@exception NoSuchAlgorithmException on error. | [
"Returns",
"one",
"of",
"the",
"algorithm",
"IDs",
"most",
"commonly",
"associated",
"with",
"this",
"algorithm",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L414-L429 |
34,759 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.get | public static AlgorithmId get(AlgorithmParameters algparams)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
String algname = algparams.getAlgorithm();
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid, algparams);
} | java | public static AlgorithmId get(AlgorithmParameters algparams)
throws NoSuchAlgorithmException {
ObjectIdentifier oid;
String algname = algparams.getAlgorithm();
try {
oid = algOID(algname);
} catch (IOException ioe) {
throw new NoSuchAlgorithmException
("Invalid ObjectIdentifier " + algname);
}
if (oid == null) {
throw new NoSuchAlgorithmException
("unrecognized algorithm name: " + algname);
}
return new AlgorithmId(oid, algparams);
} | [
"public",
"static",
"AlgorithmId",
"get",
"(",
"AlgorithmParameters",
"algparams",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"ObjectIdentifier",
"oid",
";",
"String",
"algname",
"=",
"algparams",
".",
"getAlgorithm",
"(",
")",
";",
"try",
"{",
"oid",
"=",
... | Returns one of the algorithm IDs most commonly associated
with this algorithm parameters.
@param algparams the associated algorithm parameters.
@exception NoSuchAlgorithmException on error. | [
"Returns",
"one",
"of",
"the",
"algorithm",
"IDs",
"most",
"commonly",
"associated",
"with",
"this",
"algorithm",
"parameters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L438-L453 |
34,760 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.makeSigAlg | public static String makeSigAlg(String digAlg, String encAlg) {
digAlg = digAlg.replace("-", "").toUpperCase(Locale.ENGLISH);
if (digAlg.equalsIgnoreCase("SHA")) digAlg = "SHA1";
encAlg = encAlg.toUpperCase(Locale.ENGLISH);
if (encAlg.equals("EC")) encAlg = "ECDSA";
return digAlg + "with" + encAlg;
} | java | public static String makeSigAlg(String digAlg, String encAlg) {
digAlg = digAlg.replace("-", "").toUpperCase(Locale.ENGLISH);
if (digAlg.equalsIgnoreCase("SHA")) digAlg = "SHA1";
encAlg = encAlg.toUpperCase(Locale.ENGLISH);
if (encAlg.equals("EC")) encAlg = "ECDSA";
return digAlg + "with" + encAlg;
} | [
"public",
"static",
"String",
"makeSigAlg",
"(",
"String",
"digAlg",
",",
"String",
"encAlg",
")",
"{",
"digAlg",
"=",
"digAlg",
".",
"replace",
"(",
"\"-\"",
",",
"\"\"",
")",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"if",
"(",
"di... | Creates a signature algorithm name from a digest algorithm
name and a encryption algorithm name. | [
"Creates",
"a",
"signature",
"algorithm",
"name",
"from",
"a",
"digest",
"algorithm",
"name",
"and",
"a",
"encryption",
"algorithm",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L947-L955 |
34,761 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.getEncAlgFromSigAlg | public static String getEncAlgFromSigAlg(String signatureAlgorithm) {
signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
int with = signatureAlgorithm.indexOf("WITH");
String keyAlgorithm = null;
if (with > 0) {
int and = signatureAlgorithm.indexOf("AND", with + 4);
if (and > 0) {
keyAlgorithm = signatureAlgorithm.substring(with + 4, and);
} else {
keyAlgorithm = signatureAlgorithm.substring(with + 4);
}
if (keyAlgorithm.equalsIgnoreCase("ECDSA")) {
keyAlgorithm = "EC";
}
}
return keyAlgorithm;
} | java | public static String getEncAlgFromSigAlg(String signatureAlgorithm) {
signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
int with = signatureAlgorithm.indexOf("WITH");
String keyAlgorithm = null;
if (with > 0) {
int and = signatureAlgorithm.indexOf("AND", with + 4);
if (and > 0) {
keyAlgorithm = signatureAlgorithm.substring(with + 4, and);
} else {
keyAlgorithm = signatureAlgorithm.substring(with + 4);
}
if (keyAlgorithm.equalsIgnoreCase("ECDSA")) {
keyAlgorithm = "EC";
}
}
return keyAlgorithm;
} | [
"public",
"static",
"String",
"getEncAlgFromSigAlg",
"(",
"String",
"signatureAlgorithm",
")",
"{",
"signatureAlgorithm",
"=",
"signatureAlgorithm",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"int",
"with",
"=",
"signatureAlgorithm",
".",
"indexOf"... | Extracts the encryption algorithm name from a signature
algorithm name. | [
"Extracts",
"the",
"encryption",
"algorithm",
"name",
"from",
"a",
"signature",
"algorithm",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L961-L977 |
34,762 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java | AlgorithmId.getDigAlgFromSigAlg | public static String getDigAlgFromSigAlg(String signatureAlgorithm) {
signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
int with = signatureAlgorithm.indexOf("WITH");
if (with > 0) {
return signatureAlgorithm.substring(0, with);
}
return null;
} | java | public static String getDigAlgFromSigAlg(String signatureAlgorithm) {
signatureAlgorithm = signatureAlgorithm.toUpperCase(Locale.ENGLISH);
int with = signatureAlgorithm.indexOf("WITH");
if (with > 0) {
return signatureAlgorithm.substring(0, with);
}
return null;
} | [
"public",
"static",
"String",
"getDigAlgFromSigAlg",
"(",
"String",
"signatureAlgorithm",
")",
"{",
"signatureAlgorithm",
"=",
"signatureAlgorithm",
".",
"toUpperCase",
"(",
"Locale",
".",
"ENGLISH",
")",
";",
"int",
"with",
"=",
"signatureAlgorithm",
".",
"indexOf"... | Extracts the digest algorithm name from a signature
algorithm name. | [
"Extracts",
"the",
"digest",
"algorithm",
"name",
"from",
"a",
"signature",
"algorithm",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AlgorithmId.java#L983-L990 |
34,763 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java | SAX2RTFDTM._documentRoot | protected int _documentRoot(int nodeIdentifier)
{
if(nodeIdentifier==NULL) return NULL;
for (int parent=_parent(nodeIdentifier);
parent!=NULL;
nodeIdentifier=parent,parent=_parent(nodeIdentifier))
;
return nodeIdentifier;
} | java | protected int _documentRoot(int nodeIdentifier)
{
if(nodeIdentifier==NULL) return NULL;
for (int parent=_parent(nodeIdentifier);
parent!=NULL;
nodeIdentifier=parent,parent=_parent(nodeIdentifier))
;
return nodeIdentifier;
} | [
"protected",
"int",
"_documentRoot",
"(",
"int",
"nodeIdentifier",
")",
"{",
"if",
"(",
"nodeIdentifier",
"==",
"NULL",
")",
"return",
"NULL",
";",
"for",
"(",
"int",
"parent",
"=",
"_parent",
"(",
"nodeIdentifier",
")",
";",
"parent",
"!=",
"NULL",
";",
... | Given a node identifier, find the owning document node. Unlike the DOM,
this considers the owningDocument of a Document to be itself. Note that
in shared DTMs this may not be zero.
@param nodeIdentifier the id of the starting node.
@return int Node identifier of the root of this DTM tree | [
"Given",
"a",
"node",
"identifier",
"find",
"the",
"owning",
"document",
"node",
".",
"Unlike",
"the",
"DOM",
"this",
"considers",
"the",
"owningDocument",
"of",
"a",
"Document",
"to",
"be",
"itself",
".",
"Note",
"that",
"in",
"shared",
"DTMs",
"this",
"m... | 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/SAX2RTFDTM.java#L199-L209 |
34,764 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/sax2dtm/SAX2RTFDTM.java | SAX2RTFDTM.startDocument | public void startDocument() throws SAXException
{
// Re-initialize the tree append process
m_endDocumentOccured = false;
m_prefixMappings = new java.util.Vector();
m_contextIndexes = new IntStack();
m_parents = new IntStack();
m_currentDocumentNode=m_size;
super.startDocument();
} | java | public void startDocument() throws SAXException
{
// Re-initialize the tree append process
m_endDocumentOccured = false;
m_prefixMappings = new java.util.Vector();
m_contextIndexes = new IntStack();
m_parents = new IntStack();
m_currentDocumentNode=m_size;
super.startDocument();
} | [
"public",
"void",
"startDocument",
"(",
")",
"throws",
"SAXException",
"{",
"// Re-initialize the tree append process",
"m_endDocumentOccured",
"=",
"false",
";",
"m_prefixMappings",
"=",
"new",
"java",
".",
"util",
".",
"Vector",
"(",
")",
";",
"m_contextIndexes",
... | Receive notification of the beginning of a new RTF document.
%REVIEW% Y'know, this isn't all that much of a deoptimization. We
might want to consider folding the start/endDocument changes back
into the main SAX2DTM so we don't have to expose so many fields
(even as Protected) and carry the additional code.
@throws SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.ContentHandler#startDocument | [
"Receive",
"notification",
"of",
"the",
"beginning",
"of",
"a",
"new",
"RTF",
"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/sax2dtm/SAX2RTFDTM.java#L223-L233 |
34,765 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.unaryNumericPromotion | public TypeMirror unaryNumericPromotion(TypeMirror type) {
TypeKind t = type.getKind();
if (t == TypeKind.DECLARED) {
type = javacTypes.unboxedType(type);
t = type.getKind();
}
if (t == TypeKind.BYTE || t == TypeKind.SHORT || t == TypeKind.CHAR) {
return getInt();
} else {
return type;
}
} | java | public TypeMirror unaryNumericPromotion(TypeMirror type) {
TypeKind t = type.getKind();
if (t == TypeKind.DECLARED) {
type = javacTypes.unboxedType(type);
t = type.getKind();
}
if (t == TypeKind.BYTE || t == TypeKind.SHORT || t == TypeKind.CHAR) {
return getInt();
} else {
return type;
}
} | [
"public",
"TypeMirror",
"unaryNumericPromotion",
"(",
"TypeMirror",
"type",
")",
"{",
"TypeKind",
"t",
"=",
"type",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"t",
"==",
"TypeKind",
".",
"DECLARED",
")",
"{",
"type",
"=",
"javacTypes",
".",
"unboxedType",
... | If type is a byte TypeMirror, short TypeMirror, or char TypeMirror, an int TypeMirror is
returned. Otherwise, type is returned. See jls-5.6.1.
@param type a numeric type
@return the result of unary numeric promotion applied to type | [
"If",
"type",
"is",
"a",
"byte",
"TypeMirror",
"short",
"TypeMirror",
"or",
"char",
"TypeMirror",
"an",
"int",
"TypeMirror",
"is",
"returned",
".",
"Otherwise",
"type",
"is",
"returned",
".",
"See",
"jls",
"-",
"5",
".",
"6",
".",
"1",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L297-L308 |
34,766 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.binaryNumericPromotion | public TypeMirror binaryNumericPromotion(TypeMirror type1, TypeMirror type2) {
TypeKind t1 = type1.getKind();
TypeKind t2 = type2.getKind();
if (t1 == TypeKind.DECLARED) {
t1 = javacTypes.unboxedType(type1).getKind();
}
if (t2 == TypeKind.DECLARED) {
t2 = javacTypes.unboxedType(type2).getKind();
}
if (t1 == TypeKind.DOUBLE || t2 == TypeKind.DOUBLE) {
return getDouble();
} else if (t1 == TypeKind.FLOAT || t2 == TypeKind.FLOAT) {
return getFloat();
} else if (t1 == TypeKind.LONG || t2 == TypeKind.LONG) {
return getLong();
} else {
return getInt();
}
} | java | public TypeMirror binaryNumericPromotion(TypeMirror type1, TypeMirror type2) {
TypeKind t1 = type1.getKind();
TypeKind t2 = type2.getKind();
if (t1 == TypeKind.DECLARED) {
t1 = javacTypes.unboxedType(type1).getKind();
}
if (t2 == TypeKind.DECLARED) {
t2 = javacTypes.unboxedType(type2).getKind();
}
if (t1 == TypeKind.DOUBLE || t2 == TypeKind.DOUBLE) {
return getDouble();
} else if (t1 == TypeKind.FLOAT || t2 == TypeKind.FLOAT) {
return getFloat();
} else if (t1 == TypeKind.LONG || t2 == TypeKind.LONG) {
return getLong();
} else {
return getInt();
}
} | [
"public",
"TypeMirror",
"binaryNumericPromotion",
"(",
"TypeMirror",
"type1",
",",
"TypeMirror",
"type2",
")",
"{",
"TypeKind",
"t1",
"=",
"type1",
".",
"getKind",
"(",
")",
";",
"TypeKind",
"t2",
"=",
"type2",
".",
"getKind",
"(",
")",
";",
"if",
"(",
"... | If either type is a double TypeMirror, a double TypeMirror is returned.
Otherwise, if either type is a float TypeMirror, a float TypeMirror is returned.
Otherwise, if either type is a long TypeMirror, a long TypeMirror is returned.
Otherwise, an int TypeMirror is returned. See jls-5.6.2.
@param type1 a numeric type
@param type2 a numeric type
@return the result of binary numeric promotion applied to type1 and type2 | [
"If",
"either",
"type",
"is",
"a",
"double",
"TypeMirror",
"a",
"double",
"TypeMirror",
"is",
"returned",
".",
"Otherwise",
"if",
"either",
"type",
"is",
"a",
"float",
"TypeMirror",
"a",
"float",
"TypeMirror",
"is",
"returned",
".",
"Otherwise",
"if",
"eithe... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L319-L337 |
34,767 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.getObjcClass | public TypeElement getObjcClass(TypeMirror t) {
if (isArray(t)) {
return getIosArray(((ArrayType) t).getComponentType());
} else if (isDeclaredType(t)) {
return getObjcClass((TypeElement) ((DeclaredType) t).asElement());
}
return null;
} | java | public TypeElement getObjcClass(TypeMirror t) {
if (isArray(t)) {
return getIosArray(((ArrayType) t).getComponentType());
} else if (isDeclaredType(t)) {
return getObjcClass((TypeElement) ((DeclaredType) t).asElement());
}
return null;
} | [
"public",
"TypeElement",
"getObjcClass",
"(",
"TypeMirror",
"t",
")",
"{",
"if",
"(",
"isArray",
"(",
"t",
")",
")",
"{",
"return",
"getIosArray",
"(",
"(",
"(",
"ArrayType",
")",
"t",
")",
".",
"getComponentType",
"(",
")",
")",
";",
"}",
"else",
"i... | Maps the given type to it's Objective-C equivalent. Array types are mapped to their equivalent
IOSArray type and common Java classes like String and Object are mapped to NSString and
NSObject. | [
"Maps",
"the",
"given",
"type",
"to",
"it",
"s",
"Objective",
"-",
"C",
"equivalent",
".",
"Array",
"types",
"are",
"mapped",
"to",
"their",
"equivalent",
"IOSArray",
"type",
"and",
"common",
"Java",
"classes",
"like",
"String",
"and",
"Object",
"are",
"ma... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L444-L451 |
34,768 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.findSupertype | public DeclaredType findSupertype(TypeMirror type, String qualifiedName) {
TypeElement element = asTypeElement(type);
if (element != null && element.getQualifiedName().toString().equals(qualifiedName)) {
return (DeclaredType) type;
}
for (TypeMirror t : directSupertypes(type)) {
DeclaredType result = findSupertype(t, qualifiedName);
if (result != null) {
return result;
}
}
return null;
} | java | public DeclaredType findSupertype(TypeMirror type, String qualifiedName) {
TypeElement element = asTypeElement(type);
if (element != null && element.getQualifiedName().toString().equals(qualifiedName)) {
return (DeclaredType) type;
}
for (TypeMirror t : directSupertypes(type)) {
DeclaredType result = findSupertype(t, qualifiedName);
if (result != null) {
return result;
}
}
return null;
} | [
"public",
"DeclaredType",
"findSupertype",
"(",
"TypeMirror",
"type",
",",
"String",
"qualifiedName",
")",
"{",
"TypeElement",
"element",
"=",
"asTypeElement",
"(",
"type",
")",
";",
"if",
"(",
"element",
"!=",
"null",
"&&",
"element",
".",
"getQualifiedName",
... | Find a supertype matching the given qualified name. | [
"Find",
"a",
"supertype",
"matching",
"the",
"given",
"qualified",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L461-L473 |
34,769 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.visitTypeHierarchy | public boolean visitTypeHierarchy(TypeMirror type, TypeVisitor visitor) {
boolean result = true;
if (type == null) {
return result;
}
if (type.getKind() == TypeKind.DECLARED) {
result = visitor.accept((DeclaredType) type);
}
for (TypeMirror superType : directSupertypes(type)) {
if (!result) {
return false;
}
result = visitTypeHierarchy(superType, visitor);
}
return result;
} | java | public boolean visitTypeHierarchy(TypeMirror type, TypeVisitor visitor) {
boolean result = true;
if (type == null) {
return result;
}
if (type.getKind() == TypeKind.DECLARED) {
result = visitor.accept((DeclaredType) type);
}
for (TypeMirror superType : directSupertypes(type)) {
if (!result) {
return false;
}
result = visitTypeHierarchy(superType, visitor);
}
return result;
} | [
"public",
"boolean",
"visitTypeHierarchy",
"(",
"TypeMirror",
"type",
",",
"TypeVisitor",
"visitor",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"result",
";",
"}",
"if",
"(",
"type",
".",
"getKin... | Visit all declared types in the hierarchy using a depth-first traversal, visiting classes
before interfaces. | [
"Visit",
"all",
"declared",
"types",
"in",
"the",
"hierarchy",
"using",
"a",
"depth",
"-",
"first",
"traversal",
"visiting",
"classes",
"before",
"interfaces",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L505-L520 |
34,770 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.visitTypeHierarchyObjcOrder | public boolean visitTypeHierarchyObjcOrder(TypeMirror type, TypeVisitor visitor) {
boolean result = true;
if (type == null) {
return result;
}
if (type.getKind() == TypeKind.DECLARED) {
result = visitor.accept((DeclaredType) type);
}
// Visit the class type after interface types which is the order the ObjC compiler visits the
// hierarchy.
TypeMirror classType = null;
for (TypeMirror superType : directSupertypes(type)) {
if (!result) {
return false;
}
if (isClass(superType)) {
classType = superType;
} else {
visitTypeHierarchyObjcOrder(superType, visitor);
}
}
if (classType != null && result) {
result = visitTypeHierarchyObjcOrder(classType, visitor);
}
return result;
} | java | public boolean visitTypeHierarchyObjcOrder(TypeMirror type, TypeVisitor visitor) {
boolean result = true;
if (type == null) {
return result;
}
if (type.getKind() == TypeKind.DECLARED) {
result = visitor.accept((DeclaredType) type);
}
// Visit the class type after interface types which is the order the ObjC compiler visits the
// hierarchy.
TypeMirror classType = null;
for (TypeMirror superType : directSupertypes(type)) {
if (!result) {
return false;
}
if (isClass(superType)) {
classType = superType;
} else {
visitTypeHierarchyObjcOrder(superType, visitor);
}
}
if (classType != null && result) {
result = visitTypeHierarchyObjcOrder(classType, visitor);
}
return result;
} | [
"public",
"boolean",
"visitTypeHierarchyObjcOrder",
"(",
"TypeMirror",
"type",
",",
"TypeVisitor",
"visitor",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"result",
";",
"}",
"if",
"(",
"type",
".",
... | Visit all declared types in the order that Objective-C compilation will visit when resolving
the type signature of a method. Uses a depth-first traversal, visiting interfaces before
classes. | [
"Visit",
"all",
"declared",
"types",
"in",
"the",
"order",
"that",
"Objective",
"-",
"C",
"compilation",
"will",
"visit",
"when",
"resolving",
"the",
"type",
"signature",
"of",
"a",
"method",
".",
"Uses",
"a",
"depth",
"-",
"first",
"traversal",
"visiting",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L527-L552 |
34,771 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.getBinaryName | public static String getBinaryName(TypeMirror t) {
switch (t.getKind()) {
case BOOLEAN: return "Z";
case BYTE: return "B";
case CHAR: return "C";
case DOUBLE: return "D";
case FLOAT: return "F";
case INT: return "I";
case LONG: return "J";
case SHORT: return "S";
case VOID: return "V";
default:
throw new AssertionError("Cannot resolve binary name for type: " + t);
}
} | java | public static String getBinaryName(TypeMirror t) {
switch (t.getKind()) {
case BOOLEAN: return "Z";
case BYTE: return "B";
case CHAR: return "C";
case DOUBLE: return "D";
case FLOAT: return "F";
case INT: return "I";
case LONG: return "J";
case SHORT: return "S";
case VOID: return "V";
default:
throw new AssertionError("Cannot resolve binary name for type: " + t);
}
} | [
"public",
"static",
"String",
"getBinaryName",
"(",
"TypeMirror",
"t",
")",
"{",
"switch",
"(",
"t",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"BOOLEAN",
":",
"return",
"\"Z\"",
";",
"case",
"BYTE",
":",
"return",
"\"B\"",
";",
"case",
"CHAR",
":",
... | Returns the binary name for a primitive or void type. | [
"Returns",
"the",
"binary",
"name",
"for",
"a",
"primitive",
"or",
"void",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L804-L818 |
34,772 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java | TypeUtil.getReferenceSignature | public String getReferenceSignature(ExecutableElement element) {
StringBuilder sb = new StringBuilder("(");
// If the method is an inner class constructor, prepend the outer class type.
if (ElementUtil.isConstructor(element)) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
if (ElementUtil.hasOuterContext(declaringClass)) {
TypeElement outerClass = ElementUtil.getDeclaringClass(declaringClass);
sb.append(getSignatureName(outerClass.asType()));
}
}
for (VariableElement param : element.getParameters()) {
sb.append(getSignatureName(param.asType()));
}
sb.append(')');
TypeMirror returnType = element.getReturnType();
if (returnType != null) {
sb.append(getSignatureName(returnType));
}
return sb.toString();
} | java | public String getReferenceSignature(ExecutableElement element) {
StringBuilder sb = new StringBuilder("(");
// If the method is an inner class constructor, prepend the outer class type.
if (ElementUtil.isConstructor(element)) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(element);
if (ElementUtil.hasOuterContext(declaringClass)) {
TypeElement outerClass = ElementUtil.getDeclaringClass(declaringClass);
sb.append(getSignatureName(outerClass.asType()));
}
}
for (VariableElement param : element.getParameters()) {
sb.append(getSignatureName(param.asType()));
}
sb.append(')');
TypeMirror returnType = element.getReturnType();
if (returnType != null) {
sb.append(getSignatureName(returnType));
}
return sb.toString();
} | [
"public",
"String",
"getReferenceSignature",
"(",
"ExecutableElement",
"element",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
"\"(\"",
")",
";",
"// If the method is an inner class constructor, prepend the outer class type.",
"if",
"(",
"ElementUtil",
... | Get the "Reference" signature of a method. | [
"Get",
"the",
"Reference",
"signature",
"of",
"a",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TypeUtil.java#L883-L905 |
34,773 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java | RandomAccessFile.getFilePointer | public long getFilePointer() throws IOException {
try {
return Libcore.os.lseek(fd, 0L, SEEK_CUR);
} catch (ErrnoException errnoException) {
throw errnoException.rethrowAsIOException();
}
} | java | public long getFilePointer() throws IOException {
try {
return Libcore.os.lseek(fd, 0L, SEEK_CUR);
} catch (ErrnoException errnoException) {
throw errnoException.rethrowAsIOException();
}
} | [
"public",
"long",
"getFilePointer",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"Libcore",
".",
"os",
".",
"lseek",
"(",
"fd",
",",
"0L",
",",
"SEEK_CUR",
")",
";",
"}",
"catch",
"(",
"ErrnoException",
"errnoException",
")",
"{",
"throw... | Gets the current position within this file. All reads and
writes take place at the current file pointer position.
@return the current offset in bytes from the beginning of the file.
@throws IOException
if an error occurs while getting the file pointer of this
file. | [
"Gets",
"the",
"current",
"position",
"within",
"this",
"file",
".",
"All",
"reads",
"and",
"writes",
"take",
"place",
"at",
"the",
"current",
"file",
"pointer",
"position",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java#L231-L237 |
34,774 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java | RandomAccessFile.length | public long length() throws IOException {
try {
return Libcore.os.fstat(fd).st_size;
} catch (ErrnoException errnoException) {
throw errnoException.rethrowAsIOException();
}
} | java | public long length() throws IOException {
try {
return Libcore.os.fstat(fd).st_size;
} catch (ErrnoException errnoException) {
throw errnoException.rethrowAsIOException();
}
} | [
"public",
"long",
"length",
"(",
")",
"throws",
"IOException",
"{",
"try",
"{",
"return",
"Libcore",
".",
"os",
".",
"fstat",
"(",
"fd",
")",
".",
"st_size",
";",
"}",
"catch",
"(",
"ErrnoException",
"errnoException",
")",
"{",
"throw",
"errnoException",
... | Returns the length of this file in bytes.
@return the file's length in bytes.
@throws IOException
if this file is closed or some other I/O error occurs. | [
"Returns",
"the",
"length",
"of",
"this",
"file",
"in",
"bytes",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java#L246-L252 |
34,775 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java | RandomAccessFile.readInt | public final int readInt() throws IOException {
readFully(scratch, 0, SizeOf.INT);
return Memory.peekInt(scratch, 0, ByteOrder.BIG_ENDIAN);
} | java | public final int readInt() throws IOException {
readFully(scratch, 0, SizeOf.INT);
return Memory.peekInt(scratch, 0, ByteOrder.BIG_ENDIAN);
} | [
"public",
"final",
"int",
"readInt",
"(",
")",
"throws",
"IOException",
"{",
"readFully",
"(",
"scratch",
",",
"0",
",",
"SizeOf",
".",
"INT",
")",
";",
"return",
"Memory",
".",
"peekInt",
"(",
"scratch",
",",
"0",
",",
"ByteOrder",
".",
"BIG_ENDIAN",
... | Reads a big-endian 32-bit integer from the current position in this file. Blocks
until four bytes have been read, the end of the file is reached or an
exception is thrown.
@return the next int value from this file.
@throws EOFException
if the end of this file is detected.
@throws IOException
if this file is closed or another I/O error occurs.
@see #writeInt(int) | [
"Reads",
"a",
"big",
"-",
"endian",
"32",
"-",
"bit",
"integer",
"from",
"the",
"current",
"position",
"in",
"this",
"file",
".",
"Blocks",
"until",
"four",
"bytes",
"have",
"been",
"read",
"the",
"end",
"of",
"the",
"file",
"is",
"reached",
"or",
"an"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/RandomAccessFile.java#L445-L448 |
34,776 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Timestamp.java | Timestamp.readObject | private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
ois.defaultReadObject();
myhash = -1;
timestamp = new Date(timestamp.getTime());
} | java | private void readObject(ObjectInputStream ois)
throws IOException, ClassNotFoundException {
ois.defaultReadObject();
myhash = -1;
timestamp = new Date(timestamp.getTime());
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"ois",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"ois",
".",
"defaultReadObject",
"(",
")",
";",
"myhash",
"=",
"-",
"1",
";",
"timestamp",
"=",
"new",
"Date",
"(",
"timestamp",... | Explicitly reset hash code value to -1 | [
"Explicitly",
"reset",
"hash",
"code",
"value",
"to",
"-",
"1"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Timestamp.java#L158-L163 |
34,777 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java | ReflectUtil.checkPackageAccess | public static void checkPackageAccess(Class<?> clazz) {
checkPackageAccess(clazz.getName());
if (isNonPublicProxyClass(clazz)) {
checkProxyPackageAccess(clazz);
}
} | java | public static void checkPackageAccess(Class<?> clazz) {
checkPackageAccess(clazz.getName());
if (isNonPublicProxyClass(clazz)) {
checkProxyPackageAccess(clazz);
}
} | [
"public",
"static",
"void",
"checkPackageAccess",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"checkPackageAccess",
"(",
"clazz",
".",
"getName",
"(",
")",
")",
";",
"if",
"(",
"isNonPublicProxyClass",
"(",
"clazz",
")",
")",
"{",
"checkProxyPackageAcces... | Checks package access on the given class.
If it is a {@link Proxy#isProxyClass(java.lang.Class)} that implements
a non-public interface (i.e. may be in a non-restricted package),
also check the package access on the proxy interfaces. | [
"Checks",
"package",
"access",
"on",
"the",
"given",
"class",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java#L67-L72 |
34,778 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java | ReflectUtil.isAncestor | private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
ClassLoader acl = cl;
do {
acl = acl.getParent();
if (p == acl) {
return true;
}
} while (acl != null);
return false;
} | java | private static boolean isAncestor(ClassLoader p, ClassLoader cl) {
ClassLoader acl = cl;
do {
acl = acl.getParent();
if (p == acl) {
return true;
}
} while (acl != null);
return false;
} | [
"private",
"static",
"boolean",
"isAncestor",
"(",
"ClassLoader",
"p",
",",
"ClassLoader",
"cl",
")",
"{",
"ClassLoader",
"acl",
"=",
"cl",
";",
"do",
"{",
"acl",
"=",
"acl",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"p",
"==",
"acl",
")",
"{",
"... | be found in the cl's delegation chain | [
"be",
"found",
"in",
"the",
"cl",
"s",
"delegation",
"chain"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java#L108-L117 |
34,779 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java | ReflectUtil.needsPackageAccessCheck | public static boolean needsPackageAccessCheck(ClassLoader from, ClassLoader to) {
if (from == null || from == to)
return false;
if (to == null)
return true;
return !isAncestor(from, to);
} | java | public static boolean needsPackageAccessCheck(ClassLoader from, ClassLoader to) {
if (from == null || from == to)
return false;
if (to == null)
return true;
return !isAncestor(from, to);
} | [
"public",
"static",
"boolean",
"needsPackageAccessCheck",
"(",
"ClassLoader",
"from",
",",
"ClassLoader",
"to",
")",
"{",
"if",
"(",
"from",
"==",
"null",
"||",
"from",
"==",
"to",
")",
"return",
"false",
";",
"if",
"(",
"to",
"==",
"null",
")",
"return"... | Returns true if package access check is needed for reflective
access from a class loader 'from' to classes or members in
a class defined by class loader 'to'. This method returns true
if 'from' is not the same as or an ancestor of 'to'. All code
in a system domain are granted with all permission and so this
method returns false if 'from' class loader is a class loader
loading system classes. On the other hand, if a class loader
attempts to access system domain classes, it requires package
access check and this method will return true. | [
"Returns",
"true",
"if",
"package",
"access",
"check",
"is",
"needed",
"for",
"reflective",
"access",
"from",
"a",
"class",
"loader",
"from",
"to",
"classes",
"or",
"members",
"in",
"a",
"class",
"defined",
"by",
"class",
"loader",
"to",
".",
"This",
"meth... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java#L130-L138 |
34,780 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java | ReflectUtil.checkProxyPackageAccess | public static void checkProxyPackageAccess(Class<?> clazz) {
SecurityManager s = System.getSecurityManager();
if (s != null) {
// check proxy interfaces if the given class is a proxy class
if (Proxy.isProxyClass(clazz)) {
for (Class<?> intf : clazz.getInterfaces()) {
checkPackageAccess(intf);
}
}
}
} | java | public static void checkProxyPackageAccess(Class<?> clazz) {
SecurityManager s = System.getSecurityManager();
if (s != null) {
// check proxy interfaces if the given class is a proxy class
if (Proxy.isProxyClass(clazz)) {
for (Class<?> intf : clazz.getInterfaces()) {
checkPackageAccess(intf);
}
}
}
} | [
"public",
"static",
"void",
"checkProxyPackageAccess",
"(",
"Class",
"<",
"?",
">",
"clazz",
")",
"{",
"SecurityManager",
"s",
"=",
"System",
".",
"getSecurityManager",
"(",
")",
";",
"if",
"(",
"s",
"!=",
"null",
")",
"{",
"// check proxy interfaces if the gi... | Check package access on the proxy interfaces that the given proxy class
implements.
@param clazz Proxy class object | [
"Check",
"package",
"access",
"on",
"the",
"proxy",
"interfaces",
"that",
"the",
"given",
"proxy",
"class",
"implements",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java#L146-L156 |
34,781 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java | ReflectUtil.isNonPublicProxyClass | public static boolean isNonPublicProxyClass(Class<?> cls) {
String name = cls.getName();
int i = name.lastIndexOf('.');
String pkg = (i != -1) ? name.substring(0, i) : "";
// NOTE: Android creates proxies in the "default" package (and not com.sun.proxy), which
// makes this check imprecise. However, this function is only ever called if there's
// a security manager installed (which is the never case on android).
return Proxy.isProxyClass(cls) && !pkg.isEmpty();
} | java | public static boolean isNonPublicProxyClass(Class<?> cls) {
String name = cls.getName();
int i = name.lastIndexOf('.');
String pkg = (i != -1) ? name.substring(0, i) : "";
// NOTE: Android creates proxies in the "default" package (and not com.sun.proxy), which
// makes this check imprecise. However, this function is only ever called if there's
// a security manager installed (which is the never case on android).
return Proxy.isProxyClass(cls) && !pkg.isEmpty();
} | [
"public",
"static",
"boolean",
"isNonPublicProxyClass",
"(",
"Class",
"<",
"?",
">",
"cls",
")",
"{",
"String",
"name",
"=",
"cls",
".",
"getName",
"(",
")",
";",
"int",
"i",
"=",
"name",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";",
"String",
"pkg",
... | Test if the given class is a proxy class that implements
non-public interface. Such proxy class may be in a non-restricted
package that bypasses checkPackageAccess. | [
"Test",
"if",
"the",
"given",
"class",
"is",
"a",
"proxy",
"class",
"that",
"implements",
"non",
"-",
"public",
"interface",
".",
"Such",
"proxy",
"class",
"may",
"be",
"in",
"a",
"non",
"-",
"restricted",
"package",
"that",
"bypasses",
"checkPackageAccess",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/reflect/misc/ReflectUtil.java#L185-L194 |
34,782 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java | TranslationUtil.retainResult | public static Expression retainResult(Expression node) {
switch (node.getKind()) {
case ARRAY_CREATION:
((ArrayCreation) node).setHasRetainedResult(true);
return TreeUtil.remove(node);
case CLASS_INSTANCE_CREATION:
((ClassInstanceCreation) node).setHasRetainedResult(true);
return TreeUtil.remove(node);
case FUNCTION_INVOCATION: {
FunctionInvocation invocation = (FunctionInvocation) node;
if (invocation.getFunctionElement().getRetainedResultName() != null) {
invocation.setHasRetainedResult(true);
return TreeUtil.remove(node);
}
return null;
}
default:
return null;
}
} | java | public static Expression retainResult(Expression node) {
switch (node.getKind()) {
case ARRAY_CREATION:
((ArrayCreation) node).setHasRetainedResult(true);
return TreeUtil.remove(node);
case CLASS_INSTANCE_CREATION:
((ClassInstanceCreation) node).setHasRetainedResult(true);
return TreeUtil.remove(node);
case FUNCTION_INVOCATION: {
FunctionInvocation invocation = (FunctionInvocation) node;
if (invocation.getFunctionElement().getRetainedResultName() != null) {
invocation.setHasRetainedResult(true);
return TreeUtil.remove(node);
}
return null;
}
default:
return null;
}
} | [
"public",
"static",
"Expression",
"retainResult",
"(",
"Expression",
"node",
")",
"{",
"switch",
"(",
"node",
".",
"getKind",
"(",
")",
")",
"{",
"case",
"ARRAY_CREATION",
":",
"(",
"(",
"ArrayCreation",
")",
"node",
")",
".",
"setHasRetainedResult",
"(",
... | If possible give this expression an unbalanced extra retain. If a non-null
result is returned, then the returned expression has an unbalanced extra
retain and the passed in expression is removed from the tree and must be
discarded. If null is returned then the passed in expression is left
untouched. The caller must ensure the result is eventually consumed. | [
"If",
"possible",
"give",
"this",
"expression",
"an",
"unbalanced",
"extra",
"retain",
".",
"If",
"a",
"non",
"-",
"null",
"result",
"is",
"returned",
"then",
"the",
"returned",
"expression",
"has",
"an",
"unbalanced",
"extra",
"retain",
"and",
"the",
"passe... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java#L197-L216 |
34,783 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java | TranslationUtil.hasSideEffect | public static boolean hasSideEffect(Expression expr) {
VariableElement var = TreeUtil.getVariableElement(expr);
if (var != null && ElementUtil.isVolatile(var)) {
return true;
}
switch (expr.getKind()) {
case BOOLEAN_LITERAL:
case CHARACTER_LITERAL:
case NULL_LITERAL:
case NUMBER_LITERAL:
case QUALIFIED_NAME:
case SIMPLE_NAME:
case STRING_LITERAL:
case SUPER_FIELD_ACCESS:
case THIS_EXPRESSION:
return false;
case CAST_EXPRESSION:
return hasSideEffect(((CastExpression) expr).getExpression());
case CONDITIONAL_EXPRESSION:
{
ConditionalExpression condExpr = (ConditionalExpression) expr;
return hasSideEffect(condExpr.getExpression())
|| hasSideEffect(condExpr.getThenExpression())
|| hasSideEffect(condExpr.getElseExpression());
}
case FIELD_ACCESS:
return hasSideEffect(((FieldAccess) expr).getExpression());
case INFIX_EXPRESSION:
for (Expression operand : ((InfixExpression) expr).getOperands()) {
if (hasSideEffect(operand)) {
return true;
}
}
return false;
case PARENTHESIZED_EXPRESSION:
return hasSideEffect(((ParenthesizedExpression) expr).getExpression());
case PREFIX_EXPRESSION:
{
PrefixExpression preExpr = (PrefixExpression) expr;
PrefixExpression.Operator op = preExpr.getOperator();
return op == PrefixExpression.Operator.INCREMENT
|| op == PrefixExpression.Operator.DECREMENT
|| hasSideEffect(preExpr.getOperand());
}
default:
return true;
}
} | java | public static boolean hasSideEffect(Expression expr) {
VariableElement var = TreeUtil.getVariableElement(expr);
if (var != null && ElementUtil.isVolatile(var)) {
return true;
}
switch (expr.getKind()) {
case BOOLEAN_LITERAL:
case CHARACTER_LITERAL:
case NULL_LITERAL:
case NUMBER_LITERAL:
case QUALIFIED_NAME:
case SIMPLE_NAME:
case STRING_LITERAL:
case SUPER_FIELD_ACCESS:
case THIS_EXPRESSION:
return false;
case CAST_EXPRESSION:
return hasSideEffect(((CastExpression) expr).getExpression());
case CONDITIONAL_EXPRESSION:
{
ConditionalExpression condExpr = (ConditionalExpression) expr;
return hasSideEffect(condExpr.getExpression())
|| hasSideEffect(condExpr.getThenExpression())
|| hasSideEffect(condExpr.getElseExpression());
}
case FIELD_ACCESS:
return hasSideEffect(((FieldAccess) expr).getExpression());
case INFIX_EXPRESSION:
for (Expression operand : ((InfixExpression) expr).getOperands()) {
if (hasSideEffect(operand)) {
return true;
}
}
return false;
case PARENTHESIZED_EXPRESSION:
return hasSideEffect(((ParenthesizedExpression) expr).getExpression());
case PREFIX_EXPRESSION:
{
PrefixExpression preExpr = (PrefixExpression) expr;
PrefixExpression.Operator op = preExpr.getOperator();
return op == PrefixExpression.Operator.INCREMENT
|| op == PrefixExpression.Operator.DECREMENT
|| hasSideEffect(preExpr.getOperand());
}
default:
return true;
}
} | [
"public",
"static",
"boolean",
"hasSideEffect",
"(",
"Expression",
"expr",
")",
"{",
"VariableElement",
"var",
"=",
"TreeUtil",
".",
"getVariableElement",
"(",
"expr",
")",
";",
"if",
"(",
"var",
"!=",
"null",
"&&",
"ElementUtil",
".",
"isVolatile",
"(",
"va... | Reterns whether the expression might have any side effects. If true, it
would be unsafe to prune the given node from the tree. | [
"Reterns",
"whether",
"the",
"expression",
"might",
"have",
"any",
"side",
"effects",
".",
"If",
"true",
"it",
"would",
"be",
"unsafe",
"to",
"prune",
"the",
"given",
"node",
"from",
"the",
"tree",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java#L247-L294 |
34,784 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java | TranslationUtil.getOperatorFunctionModifier | public String getOperatorFunctionModifier(Expression expr) {
VariableElement var = TreeUtil.getVariableElement(expr);
if (var == null) {
assert TreeUtil.trimParentheses(expr) instanceof ArrayAccess
: "Expression cannot be resolved to a variable or array access.";
return "Array";
}
String modifier = "";
if (ElementUtil.isVolatile(var)) {
modifier += "Volatile";
}
if (!ElementUtil.isWeakReference(var) && (var.getKind().isField() || options.useARC())) {
modifier += "Strong";
}
return modifier;
} | java | public String getOperatorFunctionModifier(Expression expr) {
VariableElement var = TreeUtil.getVariableElement(expr);
if (var == null) {
assert TreeUtil.trimParentheses(expr) instanceof ArrayAccess
: "Expression cannot be resolved to a variable or array access.";
return "Array";
}
String modifier = "";
if (ElementUtil.isVolatile(var)) {
modifier += "Volatile";
}
if (!ElementUtil.isWeakReference(var) && (var.getKind().isField() || options.useARC())) {
modifier += "Strong";
}
return modifier;
} | [
"public",
"String",
"getOperatorFunctionModifier",
"(",
"Expression",
"expr",
")",
"{",
"VariableElement",
"var",
"=",
"TreeUtil",
".",
"getVariableElement",
"(",
"expr",
")",
";",
"if",
"(",
"var",
"==",
"null",
")",
"{",
"assert",
"TreeUtil",
".",
"trimParen... | Returns the modifier for an assignment expression being converted to a
function. The result will be "Array" if the lhs is an array access,
"Strong" if the lhs is a field with a strong reference, and an empty string
for local variables and weak fields. | [
"Returns",
"the",
"modifier",
"for",
"an",
"assignment",
"expression",
"being",
"converted",
"to",
"a",
"function",
".",
"The",
"result",
"will",
"be",
"Array",
"if",
"the",
"lhs",
"is",
"an",
"array",
"access",
"Strong",
"if",
"the",
"lhs",
"is",
"a",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/TranslationUtil.java#L302-L317 |
34,785 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.at | public static Period at(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.NOLIMIT, false, count, unit);
} | java | public static Period at(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.NOLIMIT, false, count, unit);
} | [
"public",
"static",
"Period",
"at",
"(",
"float",
"count",
",",
"TimeUnit",
"unit",
")",
"{",
"checkCount",
"(",
"count",
")",
";",
"return",
"new",
"Period",
"(",
"ETimeLimit",
".",
"NOLIMIT",
",",
"false",
",",
"count",
",",
"unit",
")",
";",
"}"
] | Constructs a Period representing a duration of
count units extending into the past.
@param count the number of units, must be non-negative
@param unit the unit
@return the new Period | [
"Constructs",
"a",
"Period",
"representing",
"a",
"duration",
"of",
"count",
"units",
"extending",
"into",
"the",
"past",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L43-L46 |
34,786 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.moreThan | public static Period moreThan(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.MT, false, count, unit);
} | java | public static Period moreThan(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.MT, false, count, unit);
} | [
"public",
"static",
"Period",
"moreThan",
"(",
"float",
"count",
",",
"TimeUnit",
"unit",
")",
"{",
"checkCount",
"(",
"count",
")",
";",
"return",
"new",
"Period",
"(",
"ETimeLimit",
".",
"MT",
",",
"false",
",",
"count",
",",
"unit",
")",
";",
"}"
] | Constructs a Period representing a duration more than
count units extending into the past.
@param count the number of units. must be non-negative
@param unit the unit
@return the new Period | [
"Constructs",
"a",
"Period",
"representing",
"a",
"duration",
"more",
"than",
"count",
"units",
"extending",
"into",
"the",
"past",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L55-L58 |
34,787 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.lessThan | public static Period lessThan(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.LT, false, count, unit);
} | java | public static Period lessThan(float count, TimeUnit unit) {
checkCount(count);
return new Period(ETimeLimit.LT, false, count, unit);
} | [
"public",
"static",
"Period",
"lessThan",
"(",
"float",
"count",
",",
"TimeUnit",
"unit",
")",
"{",
"checkCount",
"(",
"count",
")",
";",
"return",
"new",
"Period",
"(",
"ETimeLimit",
".",
"LT",
",",
"false",
",",
"count",
",",
"unit",
")",
";",
"}"
] | Constructs a Period representing a duration
less than count units extending into the past.
@param count the number of units. must be non-negative
@param unit the unit
@return the new Period | [
"Constructs",
"a",
"Period",
"representing",
"a",
"duration",
"less",
"than",
"count",
"units",
"extending",
"into",
"the",
"past",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L67-L70 |
34,788 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.isSet | public boolean isSet() {
for (int i = 0; i < counts.length; ++i) {
if (counts[i] != 0) {
return true;
}
}
return false;
} | java | public boolean isSet() {
for (int i = 0; i < counts.length; ++i) {
if (counts[i] != 0) {
return true;
}
}
return false;
} | [
"public",
"boolean",
"isSet",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"counts",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"counts",
"[",
"i",
"]",
"!=",
"0",
")",
"{",
"return",
"true",
";",
"}",
"}",
"retu... | Returns true if any unit is set.
@return true if any unit is set | [
"Returns",
"true",
"if",
"any",
"unit",
"is",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L169-L176 |
34,789 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.getCount | public float getCount(TimeUnit unit) {
int ord = unit.ordinal;
if (counts[ord] == 0) {
return 0;
}
return (counts[ord] - 1)/1000f;
} | java | public float getCount(TimeUnit unit) {
int ord = unit.ordinal;
if (counts[ord] == 0) {
return 0;
}
return (counts[ord] - 1)/1000f;
} | [
"public",
"float",
"getCount",
"(",
"TimeUnit",
"unit",
")",
"{",
"int",
"ord",
"=",
"unit",
".",
"ordinal",
";",
"if",
"(",
"counts",
"[",
"ord",
"]",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"return",
"(",
"counts",
"[",
"ord",
"]",
"-",
... | Returns the count for the specified unit. If the
unit is not set, returns 0.
@param unit the unit to test
@return the count | [
"Returns",
"the",
"count",
"for",
"the",
"specified",
"unit",
".",
"If",
"the",
"unit",
"is",
"not",
"set",
"returns",
"0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L193-L199 |
34,790 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java | Period.setTimeUnitValue | private Period setTimeUnitValue(TimeUnit unit, float value) {
if (value < 0) {
throw new IllegalArgumentException("value: " + value);
}
return setTimeUnitInternalValue(unit, (int)(value * 1000) + 1);
} | java | private Period setTimeUnitValue(TimeUnit unit, float value) {
if (value < 0) {
throw new IllegalArgumentException("value: " + value);
}
return setTimeUnitInternalValue(unit, (int)(value * 1000) + 1);
} | [
"private",
"Period",
"setTimeUnitValue",
"(",
"TimeUnit",
"unit",
",",
"float",
"value",
")",
"{",
"if",
"(",
"value",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"value: \"",
"+",
"value",
")",
";",
"}",
"return",
"setTimeUnitInte... | Set the unit's internal value, converting from float to int. | [
"Set",
"the",
"unit",
"s",
"internal",
"value",
"converting",
"from",
"float",
"to",
"int",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/Period.java#L316-L321 |
34,791 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java | AlgorithmParameterGenerator.init | public final void init(AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException {
paramGenSpi.engineInit(genParamSpec, random);
} | java | public final void init(AlgorithmParameterSpec genParamSpec,
SecureRandom random)
throws InvalidAlgorithmParameterException {
paramGenSpi.engineInit(genParamSpec, random);
} | [
"public",
"final",
"void",
"init",
"(",
"AlgorithmParameterSpec",
"genParamSpec",
",",
"SecureRandom",
"random",
")",
"throws",
"InvalidAlgorithmParameterException",
"{",
"paramGenSpi",
".",
"engineInit",
"(",
"genParamSpec",
",",
"random",
")",
";",
"}"
] | Initializes this parameter generator with a set of algorithm-specific
parameter generation values.
@param genParamSpec the set of algorithm-specific parameter generation values.
@param random the source of randomness.
@exception InvalidAlgorithmParameterException if the given parameter
generation values are inappropriate for this parameter generator. | [
"Initializes",
"this",
"parameter",
"generator",
"with",
"a",
"set",
"of",
"algorithm",
"-",
"specific",
"parameter",
"generation",
"values",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/AlgorithmParameterGenerator.java#L352-L356 |
34,792 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java | ArrayMap.containsKey | @Override
public boolean containsKey(Object key) {
return key == null ? (indexOfNull() >= 0) : (indexOf(key, key.hashCode()) >= 0);
} | java | @Override
public boolean containsKey(Object key) {
return key == null ? (indexOfNull() >= 0) : (indexOf(key, key.hashCode()) >= 0);
} | [
"@",
"Override",
"public",
"boolean",
"containsKey",
"(",
"Object",
"key",
")",
"{",
"return",
"key",
"==",
"null",
"?",
"(",
"indexOfNull",
"(",
")",
">=",
"0",
")",
":",
"(",
"indexOf",
"(",
"key",
",",
"key",
".",
"hashCode",
"(",
")",
")",
">="... | Check whether a key exists in the array.
@param key The key to search for.
@return Returns true if the key exists, else false. | [
"Check",
"whether",
"a",
"key",
"exists",
"in",
"the",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java#L324-L327 |
34,793 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java | ArrayMap.setValueAt | public V setValueAt(int index, V value) {
index = (index << 1) + 1;
V old = (V)mArray[index];
mArray[index] = value;
return old;
} | java | public V setValueAt(int index, V value) {
index = (index << 1) + 1;
V old = (V)mArray[index];
mArray[index] = value;
return old;
} | [
"public",
"V",
"setValueAt",
"(",
"int",
"index",
",",
"V",
"value",
")",
"{",
"index",
"=",
"(",
"index",
"<<",
"1",
")",
"+",
"1",
";",
"V",
"old",
"=",
"(",
"V",
")",
"mArray",
"[",
"index",
"]",
";",
"mArray",
"[",
"index",
"]",
"=",
"val... | Set the value at a given index in the array.
@param index The desired index, must be between 0 and {@link #size()}-1.
@param value The new value to store at this index.
@return Returns the previous value at the given index. | [
"Set",
"the",
"value",
"at",
"a",
"given",
"index",
"in",
"the",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java#L396-L401 |
34,794 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java | ArrayMap.append | public void append(K key, V value) {
int index = mSize;
final int hash = key == null ? 0 : key.hashCode();
if (index >= mHashes.length) {
throw new IllegalStateException("Array is full");
}
if (index > 0 && mHashes[index-1] > hash) {
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
Log.w(TAG, "New hash " + hash
+ " is before end of array hash " + mHashes[index-1]
+ " at index " + index + " key " + key, e);
put(key, value);
return;
}
mSize = index+1;
mHashes[index] = hash;
index <<= 1;
mArray[index] = key;
mArray[index+1] = value;
} | java | public void append(K key, V value) {
int index = mSize;
final int hash = key == null ? 0 : key.hashCode();
if (index >= mHashes.length) {
throw new IllegalStateException("Array is full");
}
if (index > 0 && mHashes[index-1] > hash) {
RuntimeException e = new RuntimeException("here");
e.fillInStackTrace();
Log.w(TAG, "New hash " + hash
+ " is before end of array hash " + mHashes[index-1]
+ " at index " + index + " key " + key, e);
put(key, value);
return;
}
mSize = index+1;
mHashes[index] = hash;
index <<= 1;
mArray[index] = key;
mArray[index+1] = value;
} | [
"public",
"void",
"append",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"int",
"index",
"=",
"mSize",
";",
"final",
"int",
"hash",
"=",
"key",
"==",
"null",
"?",
"0",
":",
"key",
".",
"hashCode",
"(",
")",
";",
"if",
"(",
"index",
">=",
"mHas... | Special fast path for appending items to the end of the array without validation.
The array must already be large enough to contain the item.
@hide | [
"Special",
"fast",
"path",
"for",
"appending",
"items",
"to",
"the",
"end",
"of",
"the",
"array",
"without",
"validation",
".",
"The",
"array",
"must",
"already",
"be",
"large",
"enough",
"to",
"contain",
"the",
"item",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/ArrayMap.java#L476-L496 |
34,795 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java | X509CertSelector.setPathToNamesInternal | void setPathToNamesInternal(Set<GeneralNameInterface> names) {
// set names to non-null dummy value
// this breaks getPathToNames()
pathToNames = Collections.<List<?>>emptySet();
pathToGeneralNames = names;
} | java | void setPathToNamesInternal(Set<GeneralNameInterface> names) {
// set names to non-null dummy value
// this breaks getPathToNames()
pathToNames = Collections.<List<?>>emptySet();
pathToGeneralNames = names;
} | [
"void",
"setPathToNamesInternal",
"(",
"Set",
"<",
"GeneralNameInterface",
">",
"names",
")",
"{",
"// set names to non-null dummy value",
"// this breaks getPathToNames()",
"pathToNames",
"=",
"Collections",
".",
"<",
"List",
"<",
"?",
">",
">",
"emptySet",
"(",
")",... | called from CertPathHelper | [
"called",
"from",
"CertPathHelper"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/X509CertSelector.java#L1182-L1187 |
34,796 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java | HandshakeCompletedEvent.getPeerPrincipal | public Principal getPeerPrincipal()
throws SSLPeerUnverifiedException
{
Principal principal;
try {
principal = session.getPeerPrincipal();
} catch (AbstractMethodError e) {
// if the provider does not support it, fallback to peer certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getPeerCertificates();
principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
}
return principal;
} | java | public Principal getPeerPrincipal()
throws SSLPeerUnverifiedException
{
Principal principal;
try {
principal = session.getPeerPrincipal();
} catch (AbstractMethodError e) {
// if the provider does not support it, fallback to peer certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getPeerCertificates();
principal = ((X509Certificate)certs[0]).getSubjectX500Principal();
}
return principal;
} | [
"public",
"Principal",
"getPeerPrincipal",
"(",
")",
"throws",
"SSLPeerUnverifiedException",
"{",
"Principal",
"principal",
";",
"try",
"{",
"principal",
"=",
"session",
".",
"getPeerPrincipal",
"(",
")",
";",
"}",
"catch",
"(",
"AbstractMethodError",
"e",
")",
... | Returns the identity of the peer which was established as part of
defining the session.
@return the peer's principal. Returns an X500Principal of the
end-entity certiticate for X509-based cipher suites, and
KerberosPrincipal for Kerberos cipher suites.
@throws SSLPeerUnverifiedException if the peer's identity has not
been verified
@see #getPeerCertificates()
@see #getLocalPrincipal()
@since 1.5 | [
"Returns",
"the",
"identity",
"of",
"the",
"peer",
"which",
"was",
"established",
"as",
"part",
"of",
"defining",
"the",
"session",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java#L178-L191 |
34,797 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java | HandshakeCompletedEvent.getLocalPrincipal | public Principal getLocalPrincipal()
{
Principal principal;
try {
principal = session.getLocalPrincipal();
} catch (AbstractMethodError e) {
principal = null;
// if the provider does not support it, fallback to local certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getLocalCertificates();
if (certs != null) {
principal =
((X509Certificate)certs[0]).getSubjectX500Principal();
}
}
return principal;
} | java | public Principal getLocalPrincipal()
{
Principal principal;
try {
principal = session.getLocalPrincipal();
} catch (AbstractMethodError e) {
principal = null;
// if the provider does not support it, fallback to local certs.
// return the X500Principal of the end-entity cert.
Certificate[] certs = getLocalCertificates();
if (certs != null) {
principal =
((X509Certificate)certs[0]).getSubjectX500Principal();
}
}
return principal;
} | [
"public",
"Principal",
"getLocalPrincipal",
"(",
")",
"{",
"Principal",
"principal",
";",
"try",
"{",
"principal",
"=",
"session",
".",
"getLocalPrincipal",
"(",
")",
";",
"}",
"catch",
"(",
"AbstractMethodError",
"e",
")",
"{",
"principal",
"=",
"null",
";"... | Returns the principal that was sent to the peer during handshaking.
@return the principal sent to the peer. Returns an X500Principal
of the end-entity certificate for X509-based cipher suites, and
KerberosPrincipal for Kerberos cipher suites. If no principal was
sent, then null is returned.
@see #getLocalCertificates()
@see #getPeerPrincipal()
@since 1.5 | [
"Returns",
"the",
"principal",
"that",
"was",
"sent",
"to",
"the",
"peer",
"during",
"handshaking",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/HandshakeCompletedEvent.java#L206-L222 |
34,798 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java | PKIXRevocationChecker.setOcspExtensions | public void setOcspExtensions(List<Extension> extensions)
{
this.ocspExtensions = (extensions == null)
? Collections.<Extension>emptyList()
: new ArrayList<Extension>(extensions);
} | java | public void setOcspExtensions(List<Extension> extensions)
{
this.ocspExtensions = (extensions == null)
? Collections.<Extension>emptyList()
: new ArrayList<Extension>(extensions);
} | [
"public",
"void",
"setOcspExtensions",
"(",
"List",
"<",
"Extension",
">",
"extensions",
")",
"{",
"this",
".",
"ocspExtensions",
"=",
"(",
"extensions",
"==",
"null",
")",
"?",
"Collections",
".",
"<",
"Extension",
">",
"emptyList",
"(",
")",
":",
"new",
... | Sets the optional OCSP request extensions.
@param extensions a list of extensions. The list is copied to protect
against subsequent modification. | [
"Sets",
"the",
"optional",
"OCSP",
"request",
"extensions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java#L168-L173 |
34,799 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java | PKIXRevocationChecker.setOcspResponses | public void setOcspResponses(Map<X509Certificate, byte[]> responses)
{
if (responses == null) {
this.ocspResponses = Collections.<X509Certificate, byte[]>emptyMap();
} else {
Map<X509Certificate, byte[]> copy = new HashMap<>(responses.size());
for (Map.Entry<X509Certificate, byte[]> e : responses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
this.ocspResponses = copy;
}
} | java | public void setOcspResponses(Map<X509Certificate, byte[]> responses)
{
if (responses == null) {
this.ocspResponses = Collections.<X509Certificate, byte[]>emptyMap();
} else {
Map<X509Certificate, byte[]> copy = new HashMap<>(responses.size());
for (Map.Entry<X509Certificate, byte[]> e : responses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
this.ocspResponses = copy;
}
} | [
"public",
"void",
"setOcspResponses",
"(",
"Map",
"<",
"X509Certificate",
",",
"byte",
"[",
"]",
">",
"responses",
")",
"{",
"if",
"(",
"responses",
"==",
"null",
")",
"{",
"this",
".",
"ocspResponses",
"=",
"Collections",
".",
"<",
"X509Certificate",
",",... | Sets the OCSP responses. These responses are used to determine
the revocation status of the specified certificates when OCSP is used.
@param responses a map of OCSP responses. Each key is an
{@code X509Certificate} that maps to the corresponding
DER-encoded OCSP response for that certificate. A deep copy of
the map is performed to protect against subsequent modification. | [
"Sets",
"the",
"OCSP",
"responses",
".",
"These",
"responses",
"are",
"used",
"to",
"determine",
"the",
"revocation",
"status",
"of",
"the",
"specified",
"certificates",
"when",
"OCSP",
"is",
"used",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java#L194-L205 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.