id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,000 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getFunctionName | public String getFunctionName(ExecutableElement method) {
String name = ElementUtil.getSelector(method);
if (name == null) {
name = getRenamedMethodName(method);
}
if (name != null) {
return name.replaceAll(":", "_");
} else {
return addParamNames(method, getMethodName(method), '_');
}
} | java | public String getFunctionName(ExecutableElement method) {
String name = ElementUtil.getSelector(method);
if (name == null) {
name = getRenamedMethodName(method);
}
if (name != null) {
return name.replaceAll(":", "_");
} else {
return addParamNames(method, getMethodName(method), '_');
}
} | [
"public",
"String",
"getFunctionName",
"(",
"ExecutableElement",
"method",
")",
"{",
"String",
"name",
"=",
"ElementUtil",
".",
"getSelector",
"(",
"method",
")",
";",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"name",
"=",
"getRenamedMethodName",
"(",
"meth... | Returns an appropriate name to use for this method as a function. This name
is guaranteed to be unique within the declaring class, if no methods in the
class have a renaming. The returned name should be given an appropriate
prefix to avoid collisions with methods from other classes. | [
"Returns",
"an",
"appropriate",
"name",
"to",
"use",
"for",
"this",
"method",
"as",
"a",
"function",
".",
"This",
"name",
"is",
"guaranteed",
"to",
"be",
"unique",
"within",
"the",
"declaring",
"class",
"if",
"no",
"methods",
"in",
"the",
"class",
"have",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L439-L449 |
33,001 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getPrimitiveObjCType | public static String getPrimitiveObjCType(TypeMirror type) {
return TypeUtil.isVoid(type) ? "void"
: type.getKind().isPrimitive() ? "j" + TypeUtil.getName(type) : "id";
} | java | public static String getPrimitiveObjCType(TypeMirror type) {
return TypeUtil.isVoid(type) ? "void"
: type.getKind().isPrimitive() ? "j" + TypeUtil.getName(type) : "id";
} | [
"public",
"static",
"String",
"getPrimitiveObjCType",
"(",
"TypeMirror",
"type",
")",
"{",
"return",
"TypeUtil",
".",
"isVoid",
"(",
"type",
")",
"?",
"\"void\"",
":",
"type",
".",
"getKind",
"(",
")",
".",
"isPrimitive",
"(",
")",
"?",
"\"j\"",
"+",
"Ty... | Converts a Java type to an equivalent Objective-C type, returning "id" for an object type. | [
"Converts",
"a",
"Java",
"type",
"to",
"an",
"equivalent",
"Objective",
"-",
"C",
"type",
"returning",
"id",
"for",
"an",
"object",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L505-L508 |
33,002 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getJniType | public String getJniType(TypeMirror type) {
if (TypeUtil.isPrimitiveOrVoid(type)) {
return getPrimitiveObjCType(type);
} else if (TypeUtil.isArray(type)) {
return "jarray";
} else if (typeUtil.isString(type)) {
return "jstring";
} else if (typeUtil.isClassType(type)) {
return "jclass";
}
return "jobject";
} | java | public String getJniType(TypeMirror type) {
if (TypeUtil.isPrimitiveOrVoid(type)) {
return getPrimitiveObjCType(type);
} else if (TypeUtil.isArray(type)) {
return "jarray";
} else if (typeUtil.isString(type)) {
return "jstring";
} else if (typeUtil.isClassType(type)) {
return "jclass";
}
return "jobject";
} | [
"public",
"String",
"getJniType",
"(",
"TypeMirror",
"type",
")",
"{",
"if",
"(",
"TypeUtil",
".",
"isPrimitiveOrVoid",
"(",
"type",
")",
")",
"{",
"return",
"getPrimitiveObjCType",
"(",
"type",
")",
";",
"}",
"else",
"if",
"(",
"TypeUtil",
".",
"isArray",... | Convert a Java type into the equivalent JNI type. | [
"Convert",
"a",
"Java",
"type",
"into",
"the",
"equivalent",
"JNI",
"type",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L525-L536 |
33,003 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getFullName | public String getFullName(TypeElement element) {
element = typeUtil.getObjcClass(element);
String fullName = fullNameCache.get(element);
if (fullName == null) {
fullName = getFullNameImpl(element);
fullNameCache.put(element, fullName);
}
return fullName;
} | java | public String getFullName(TypeElement element) {
element = typeUtil.getObjcClass(element);
String fullName = fullNameCache.get(element);
if (fullName == null) {
fullName = getFullNameImpl(element);
fullNameCache.put(element, fullName);
}
return fullName;
} | [
"public",
"String",
"getFullName",
"(",
"TypeElement",
"element",
")",
"{",
"element",
"=",
"typeUtil",
".",
"getObjcClass",
"(",
"element",
")",
";",
"String",
"fullName",
"=",
"fullNameCache",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"fullName",
... | Return the full name of a type, including its package. For outer types,
is the type's full name; for example, java.lang.Object's full name is
"JavaLangObject". For inner classes, the full name is their outer class'
name plus the inner class name; for example, java.util.ArrayList.ListItr's
name is "JavaUtilArrayList_ListItr". | [
"Return",
"the",
"full",
"name",
"of",
"a",
"type",
"including",
"its",
"package",
".",
"For",
"outer",
"types",
"is",
"the",
"type",
"s",
"full",
"name",
";",
"for",
"example",
"java",
".",
"lang",
".",
"Object",
"s",
"full",
"name",
"is",
"JavaLangOb... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L593-L601 |
33,004 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java | NameTable.getDefaultObjectiveCName | private String getDefaultObjectiveCName(TypeElement element) {
String binaryName = elementUtil.getBinaryName(element);
return camelCaseQualifiedName(binaryName).replace('$', '_');
} | java | private String getDefaultObjectiveCName(TypeElement element) {
String binaryName = elementUtil.getBinaryName(element);
return camelCaseQualifiedName(binaryName).replace('$', '_');
} | [
"private",
"String",
"getDefaultObjectiveCName",
"(",
"TypeElement",
"element",
")",
"{",
"String",
"binaryName",
"=",
"elementUtil",
".",
"getBinaryName",
"(",
"element",
")",
";",
"return",
"camelCaseQualifiedName",
"(",
"binaryName",
")",
".",
"replace",
"(",
"... | Ignores the ObjectiveCName annotation. | [
"Ignores",
"the",
"ObjectiveCName",
"annotation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/NameTable.java#L656-L659 |
33,005 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java | NodeVector.pushPair | public final void pushPair(int v1, int v2)
{
if (null == m_map)
{
m_map = new int[m_blocksize];
m_mapSize = m_blocksize;
}
else
{
if ((m_firstFree + 2) >= m_mapSize)
{
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
m_map = newMap;
}
}
m_map[m_firstFree] = v1;
m_map[m_firstFree + 1] = v2;
m_firstFree += 2;
} | java | public final void pushPair(int v1, int v2)
{
if (null == m_map)
{
m_map = new int[m_blocksize];
m_mapSize = m_blocksize;
}
else
{
if ((m_firstFree + 2) >= m_mapSize)
{
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
m_map = newMap;
}
}
m_map[m_firstFree] = v1;
m_map[m_firstFree + 1] = v2;
m_firstFree += 2;
} | [
"public",
"final",
"void",
"pushPair",
"(",
"int",
"v1",
",",
"int",
"v2",
")",
"{",
"if",
"(",
"null",
"==",
"m_map",
")",
"{",
"m_map",
"=",
"new",
"int",
"[",
"m_blocksize",
"]",
";",
"m_mapSize",
"=",
"m_blocksize",
";",
"}",
"else",
"{",
"if",... | Push a pair of nodes into the stack.
Special purpose method for TransformerImpl, pushElemTemplateElement.
Performance critical.
@param v1 First node to add to vector
@param v2 Second node to add to vector | [
"Push",
"a",
"pair",
"of",
"nodes",
"into",
"the",
"stack",
".",
"Special",
"purpose",
"method",
"for",
"TransformerImpl",
"pushElemTemplateElement",
".",
"Performance",
"critical",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L244-L269 |
33,006 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java | NodeVector.popPair | public final void popPair()
{
m_firstFree -= 2;
m_map[m_firstFree] = DTM.NULL;
m_map[m_firstFree + 1] = DTM.NULL;
} | java | public final void popPair()
{
m_firstFree -= 2;
m_map[m_firstFree] = DTM.NULL;
m_map[m_firstFree + 1] = DTM.NULL;
} | [
"public",
"final",
"void",
"popPair",
"(",
")",
"{",
"m_firstFree",
"-=",
"2",
";",
"m_map",
"[",
"m_firstFree",
"]",
"=",
"DTM",
".",
"NULL",
";",
"m_map",
"[",
"m_firstFree",
"+",
"1",
"]",
"=",
"DTM",
".",
"NULL",
";",
"}"
] | Pop a pair of nodes from the tail of the stack.
Special purpose method for TransformerImpl, pushElemTemplateElement.
Performance critical. | [
"Pop",
"a",
"pair",
"of",
"nodes",
"from",
"the",
"tail",
"of",
"the",
"stack",
".",
"Special",
"purpose",
"method",
"for",
"TransformerImpl",
"pushElemTemplateElement",
".",
"Performance",
"critical",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L276-L282 |
33,007 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java | NodeVector.insertInOrder | public void insertInOrder(int value)
{
for (int i = 0; i < m_firstFree; i++)
{
if (value < m_map[i])
{
insertElementAt(value, i);
return;
}
}
addElement(value);
} | java | public void insertInOrder(int value)
{
for (int i = 0; i < m_firstFree; i++)
{
if (value < m_map[i])
{
insertElementAt(value, i);
return;
}
}
addElement(value);
} | [
"public",
"void",
"insertInOrder",
"(",
"int",
"value",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_firstFree",
";",
"i",
"++",
")",
"{",
"if",
"(",
"value",
"<",
"m_map",
"[",
"i",
"]",
")",
"{",
"insertElementAt",
"(",
"value"... | Insert a node in order in the list.
@param value Node to insert | [
"Insert",
"a",
"node",
"in",
"order",
"in",
"the",
"list",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L337-L351 |
33,008 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java | NodeVector.sort | public void sort(int a[], int lo0, int hi0) throws Exception
{
int lo = lo0;
int hi = hi0;
// pause(lo, hi);
if (lo >= hi)
{
return;
}
else if (lo == hi - 1)
{
/*
* sort a two element list by swapping if necessary
*/
if (a[lo] > a[hi])
{
int T = a[lo];
a[lo] = a[hi];
a[hi] = T;
}
return;
}
/*
* Pick a pivot and move it out of the way
*/
int pivot = a[(lo + hi) / 2];
a[(lo + hi) / 2] = a[hi];
a[hi] = pivot;
while (lo < hi)
{
/*
* Search forward from a[lo] until an element is found that
* is greater than the pivot or lo >= hi
*/
while (a[lo] <= pivot && lo < hi)
{
lo++;
}
/*
* Search backward from a[hi] until element is found that
* is less than the pivot, or lo >= hi
*/
while (pivot <= a[hi] && lo < hi)
{
hi--;
}
/*
* Swap elements a[lo] and a[hi]
*/
if (lo < hi)
{
int T = a[lo];
a[lo] = a[hi];
a[hi] = T;
// pause();
}
// if (stopRequested) {
// return;
// }
}
/*
* Put the median in the "center" of the list
*/
a[hi0] = a[hi];
a[hi] = pivot;
/*
* Recursive calls, elements a[lo0] to a[lo-1] are less than or
* equal to pivot, elements a[hi+1] to a[hi0] are greater than
* pivot.
*/
sort(a, lo0, lo - 1);
sort(a, hi + 1, hi0);
} | java | public void sort(int a[], int lo0, int hi0) throws Exception
{
int lo = lo0;
int hi = hi0;
// pause(lo, hi);
if (lo >= hi)
{
return;
}
else if (lo == hi - 1)
{
/*
* sort a two element list by swapping if necessary
*/
if (a[lo] > a[hi])
{
int T = a[lo];
a[lo] = a[hi];
a[hi] = T;
}
return;
}
/*
* Pick a pivot and move it out of the way
*/
int pivot = a[(lo + hi) / 2];
a[(lo + hi) / 2] = a[hi];
a[hi] = pivot;
while (lo < hi)
{
/*
* Search forward from a[lo] until an element is found that
* is greater than the pivot or lo >= hi
*/
while (a[lo] <= pivot && lo < hi)
{
lo++;
}
/*
* Search backward from a[hi] until element is found that
* is less than the pivot, or lo >= hi
*/
while (pivot <= a[hi] && lo < hi)
{
hi--;
}
/*
* Swap elements a[lo] and a[hi]
*/
if (lo < hi)
{
int T = a[lo];
a[lo] = a[hi];
a[hi] = T;
// pause();
}
// if (stopRequested) {
// return;
// }
}
/*
* Put the median in the "center" of the list
*/
a[hi0] = a[hi];
a[hi] = pivot;
/*
* Recursive calls, elements a[lo0] to a[lo-1] are less than or
* equal to pivot, elements a[hi+1] to a[hi0] are greater than
* pivot.
*/
sort(a, lo0, lo - 1);
sort(a, hi + 1, hi0);
} | [
"public",
"void",
"sort",
"(",
"int",
"a",
"[",
"]",
",",
"int",
"lo0",
",",
"int",
"hi0",
")",
"throws",
"Exception",
"{",
"int",
"lo",
"=",
"lo0",
";",
"int",
"hi",
"=",
"hi0",
";",
"// pause(lo, hi);",
"if",
"(",
"lo",
">=",
"hi",
")",
"{",
... | Sort an array using a quicksort algorithm.
@param a The array to be sorted.
@param lo0 The low index.
@param hi0 The high index.
@throws Exception | [
"Sort",
"an",
"array",
"using",
"a",
"quicksort",
"algorithm",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NodeVector.java#L640-L728 |
33,009 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getInstance | public static RelativeDateTimeFormatter getInstance(ULocale locale) {
return getInstance(locale, null, Style.LONG, DisplayContext.CAPITALIZATION_NONE);
} | java | public static RelativeDateTimeFormatter getInstance(ULocale locale) {
return getInstance(locale, null, Style.LONG, DisplayContext.CAPITALIZATION_NONE);
} | [
"public",
"static",
"RelativeDateTimeFormatter",
"getInstance",
"(",
"ULocale",
"locale",
")",
"{",
"return",
"getInstance",
"(",
"locale",
",",
"null",
",",
"Style",
".",
"LONG",
",",
"DisplayContext",
".",
"CAPITALIZATION_NONE",
")",
";",
"}"
] | Returns a RelativeDateTimeFormatter for a particular locale.
@param locale the locale.
@return An instance of RelativeDateTimeFormatter. | [
"Returns",
"a",
"RelativeDateTimeFormatter",
"for",
"a",
"particular",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L370-L372 |
33,010 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getInstance | public static RelativeDateTimeFormatter getInstance(ULocale locale, NumberFormat nf) {
return getInstance(locale, nf, Style.LONG, DisplayContext.CAPITALIZATION_NONE);
} | java | public static RelativeDateTimeFormatter getInstance(ULocale locale, NumberFormat nf) {
return getInstance(locale, nf, Style.LONG, DisplayContext.CAPITALIZATION_NONE);
} | [
"public",
"static",
"RelativeDateTimeFormatter",
"getInstance",
"(",
"ULocale",
"locale",
",",
"NumberFormat",
"nf",
")",
"{",
"return",
"getInstance",
"(",
"locale",
",",
"nf",
",",
"Style",
".",
"LONG",
",",
"DisplayContext",
".",
"CAPITALIZATION_NONE",
")",
"... | Returns a RelativeDateTimeFormatter for a particular locale that uses a particular
NumberFormat object.
@param locale the locale
@param nf the number format object. It is defensively copied to ensure thread-safety
and immutability of this class.
@return An instance of RelativeDateTimeFormatter. | [
"Returns",
"a",
"RelativeDateTimeFormatter",
"for",
"a",
"particular",
"locale",
"that",
"uses",
"a",
"particular",
"NumberFormat",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L393-L395 |
33,011 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getInstance | public static RelativeDateTimeFormatter getInstance(
ULocale locale,
NumberFormat nf,
Style style,
DisplayContext capitalizationContext) {
RelativeDateTimeFormatterData data = cache.get(locale);
if (nf == null) {
nf = NumberFormat.getInstance(locale);
} else {
nf = (NumberFormat) nf.clone();
}
return new RelativeDateTimeFormatter(
data.qualitativeUnitMap,
data.relUnitPatternMap,
SimpleFormatterImpl.compileToStringMinMaxArguments(
data.dateTimePattern, new StringBuilder(), 2, 2),
PluralRules.forLocale(locale),
nf,
style,
capitalizationContext,
capitalizationContext == DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ?
BreakIterator.getSentenceInstance(locale) : null,
locale);
} | java | public static RelativeDateTimeFormatter getInstance(
ULocale locale,
NumberFormat nf,
Style style,
DisplayContext capitalizationContext) {
RelativeDateTimeFormatterData data = cache.get(locale);
if (nf == null) {
nf = NumberFormat.getInstance(locale);
} else {
nf = (NumberFormat) nf.clone();
}
return new RelativeDateTimeFormatter(
data.qualitativeUnitMap,
data.relUnitPatternMap,
SimpleFormatterImpl.compileToStringMinMaxArguments(
data.dateTimePattern, new StringBuilder(), 2, 2),
PluralRules.forLocale(locale),
nf,
style,
capitalizationContext,
capitalizationContext == DisplayContext.CAPITALIZATION_FOR_BEGINNING_OF_SENTENCE ?
BreakIterator.getSentenceInstance(locale) : null,
locale);
} | [
"public",
"static",
"RelativeDateTimeFormatter",
"getInstance",
"(",
"ULocale",
"locale",
",",
"NumberFormat",
"nf",
",",
"Style",
"style",
",",
"DisplayContext",
"capitalizationContext",
")",
"{",
"RelativeDateTimeFormatterData",
"data",
"=",
"cache",
".",
"get",
"("... | Returns a RelativeDateTimeFormatter for a particular locale that uses a particular
NumberFormat object, style, and capitalization context
@param locale the locale
@param nf the number format object. It is defensively copied to ensure thread-safety
and immutability of this class. May be null.
@param style the style.
@param capitalizationContext the capitalization context. | [
"Returns",
"a",
"RelativeDateTimeFormatter",
"for",
"a",
"particular",
"locale",
"that",
"uses",
"a",
"particular",
"NumberFormat",
"object",
"style",
"and",
"capitalization",
"context"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L407-L430 |
33,012 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.format | public String format(double quantity, Direction direction, RelativeUnit unit) {
if (direction != Direction.LAST && direction != Direction.NEXT) {
throw new IllegalArgumentException("direction must be NEXT or LAST");
}
String result;
int pastFutureIndex = (direction == Direction.NEXT ? 1 : 0);
// This class is thread-safe, yet numberFormat is not. To ensure thread-safety of this
// class we must guarantee that only one thread at a time uses our numberFormat.
synchronized (numberFormat) {
StringBuffer formatStr = new StringBuffer();
DontCareFieldPosition fieldPosition = DontCareFieldPosition.INSTANCE;
StandardPlural pluralForm = QuantityFormatter.selectPlural(quantity,
numberFormat, pluralRules, formatStr, fieldPosition);
String formatter = getRelativeUnitPluralPattern(style, unit, pastFutureIndex, pluralForm);
result = SimpleFormatterImpl.formatCompiledPattern(formatter, formatStr);
}
return adjustForContext(result);
} | java | public String format(double quantity, Direction direction, RelativeUnit unit) {
if (direction != Direction.LAST && direction != Direction.NEXT) {
throw new IllegalArgumentException("direction must be NEXT or LAST");
}
String result;
int pastFutureIndex = (direction == Direction.NEXT ? 1 : 0);
// This class is thread-safe, yet numberFormat is not. To ensure thread-safety of this
// class we must guarantee that only one thread at a time uses our numberFormat.
synchronized (numberFormat) {
StringBuffer formatStr = new StringBuffer();
DontCareFieldPosition fieldPosition = DontCareFieldPosition.INSTANCE;
StandardPlural pluralForm = QuantityFormatter.selectPlural(quantity,
numberFormat, pluralRules, formatStr, fieldPosition);
String formatter = getRelativeUnitPluralPattern(style, unit, pastFutureIndex, pluralForm);
result = SimpleFormatterImpl.formatCompiledPattern(formatter, formatStr);
}
return adjustForContext(result);
} | [
"public",
"String",
"format",
"(",
"double",
"quantity",
",",
"Direction",
"direction",
",",
"RelativeUnit",
"unit",
")",
"{",
"if",
"(",
"direction",
"!=",
"Direction",
".",
"LAST",
"&&",
"direction",
"!=",
"Direction",
".",
"NEXT",
")",
"{",
"throw",
"ne... | Formats a relative date with a quantity such as "in 5 days" or
"3 months ago"
@param quantity The numerical amount e.g 5. This value is formatted
according to this object's {@link NumberFormat} object.
@param direction NEXT means a future relative date; LAST means a past
relative date.
@param unit the unit e.g day? month? year?
@return the formatted string
@throws IllegalArgumentException if direction is something other than
NEXT or LAST. | [
"Formats",
"a",
"relative",
"date",
"with",
"a",
"quantity",
"such",
"as",
"in",
"5",
"days",
"or",
"3",
"months",
"ago"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L457-L477 |
33,013 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.format | public String format(Direction direction, AbsoluteUnit unit) {
if (unit == AbsoluteUnit.NOW && direction != Direction.PLAIN) {
throw new IllegalArgumentException("NOW can only accept direction PLAIN.");
}
String result;
// Get plain day of week names from DateFormatSymbols.
if ((direction == Direction.PLAIN) && (AbsoluteUnit.SUNDAY.ordinal() <= unit.ordinal() &&
unit.ordinal() <= AbsoluteUnit.SATURDAY.ordinal())) {
// Convert from AbsoluteUnit days to Calendar class indexing.
int dateSymbolsDayOrdinal = (unit.ordinal() - AbsoluteUnit.SUNDAY.ordinal()) + Calendar.SUNDAY;
String[] dayNames =
dateFormatSymbols.getWeekdays(DateFormatSymbols.STANDALONE,
styleToDateFormatSymbolsWidth[style.ordinal()]);
result = dayNames[dateSymbolsDayOrdinal];
} else {
// Not PLAIN, or not a weekday.
result = getAbsoluteUnitString(style, unit, direction);
}
return result != null ? adjustForContext(result) : null;
} | java | public String format(Direction direction, AbsoluteUnit unit) {
if (unit == AbsoluteUnit.NOW && direction != Direction.PLAIN) {
throw new IllegalArgumentException("NOW can only accept direction PLAIN.");
}
String result;
// Get plain day of week names from DateFormatSymbols.
if ((direction == Direction.PLAIN) && (AbsoluteUnit.SUNDAY.ordinal() <= unit.ordinal() &&
unit.ordinal() <= AbsoluteUnit.SATURDAY.ordinal())) {
// Convert from AbsoluteUnit days to Calendar class indexing.
int dateSymbolsDayOrdinal = (unit.ordinal() - AbsoluteUnit.SUNDAY.ordinal()) + Calendar.SUNDAY;
String[] dayNames =
dateFormatSymbols.getWeekdays(DateFormatSymbols.STANDALONE,
styleToDateFormatSymbolsWidth[style.ordinal()]);
result = dayNames[dateSymbolsDayOrdinal];
} else {
// Not PLAIN, or not a weekday.
result = getAbsoluteUnitString(style, unit, direction);
}
return result != null ? adjustForContext(result) : null;
} | [
"public",
"String",
"format",
"(",
"Direction",
"direction",
",",
"AbsoluteUnit",
"unit",
")",
"{",
"if",
"(",
"unit",
"==",
"AbsoluteUnit",
".",
"NOW",
"&&",
"direction",
"!=",
"Direction",
".",
"PLAIN",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
... | Formats a relative date without a quantity.
@param direction NEXT, LAST, THIS, etc.
@param unit e.g SATURDAY, DAY, MONTH
@return the formatted string. If direction has a value that is documented as not being
fully supported in every locale (for example NEXT_2 or LAST_2) then this function may
return null to signal that no formatted string is available.
@throws IllegalArgumentException if the direction is incompatible with
unit this can occur with NOW which can only take PLAIN. | [
"Formats",
"a",
"relative",
"date",
"without",
"a",
"quantity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L537-L556 |
33,014 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.getAbsoluteUnitString | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | java | private String getAbsoluteUnitString(Style style, AbsoluteUnit unit, Direction direction) {
EnumMap<AbsoluteUnit, EnumMap<Direction, String>> unitMap;
EnumMap<Direction, String> dirMap;
do {
unitMap = qualitativeUnitMap.get(style);
if (unitMap != null) {
dirMap = unitMap.get(unit);
if (dirMap != null) {
String result = dirMap.get(direction);
if (result != null) {
return result;
}
}
}
// Consider other styles from alias fallback.
// Data loading guaranteed no endless loops.
} while ((style = fallbackCache[style.ordinal()]) != null);
return null;
} | [
"private",
"String",
"getAbsoluteUnitString",
"(",
"Style",
"style",
",",
"AbsoluteUnit",
"unit",
",",
"Direction",
"direction",
")",
"{",
"EnumMap",
"<",
"AbsoluteUnit",
",",
"EnumMap",
"<",
"Direction",
",",
"String",
">",
">",
"unitMap",
";",
"EnumMap",
"<"... | Gets the string value from qualitativeUnitMap with fallback based on style. | [
"Gets",
"the",
"string",
"value",
"from",
"qualitativeUnitMap",
"with",
"fallback",
"based",
"on",
"style",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L636-L657 |
33,015 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java | RelativeDateTimeFormatter.combineDateAndTime | public String combineDateAndTime(String relativeDateString, String timeString) {
return SimpleFormatterImpl.formatCompiledPattern(
combinedDateAndTime, timeString, relativeDateString);
} | java | public String combineDateAndTime(String relativeDateString, String timeString) {
return SimpleFormatterImpl.formatCompiledPattern(
combinedDateAndTime, timeString, relativeDateString);
} | [
"public",
"String",
"combineDateAndTime",
"(",
"String",
"relativeDateString",
",",
"String",
"timeString",
")",
"{",
"return",
"SimpleFormatterImpl",
".",
"formatCompiledPattern",
"(",
"combinedDateAndTime",
",",
"timeString",
",",
"relativeDateString",
")",
";",
"}"
] | Combines a relative date string and a time string in this object's
locale. This is done with the same date-time separator used for the
default calendar in this locale.
@param relativeDateString the relative date e.g 'yesterday'
@param timeString the time e.g '3:45'
@return the date and time concatenated according to the default
calendar in this locale e.g 'yesterday, 3:45' | [
"Combines",
"a",
"relative",
"date",
"string",
"and",
"a",
"time",
"string",
"in",
"this",
"object",
"s",
"locale",
".",
"This",
"is",
"done",
"with",
"the",
"same",
"date",
"-",
"time",
"separator",
"used",
"for",
"the",
"default",
"calendar",
"in",
"th... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RelativeDateTimeFormatter.java#L668-L671 |
33,016 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java | NilCheckResolver.handleThrows | private void handleThrows() {
Scope curScope = scope;
while (curScope != null) {
if (curScope.kind == Scope.Kind.TRY) {
scope.mergeInto(curScope.next);
}
curScope = curScope.next;
}
} | java | private void handleThrows() {
Scope curScope = scope;
while (curScope != null) {
if (curScope.kind == Scope.Kind.TRY) {
scope.mergeInto(curScope.next);
}
curScope = curScope.next;
}
} | [
"private",
"void",
"handleThrows",
"(",
")",
"{",
"Scope",
"curScope",
"=",
"scope",
";",
"while",
"(",
"curScope",
"!=",
"null",
")",
"{",
"if",
"(",
"curScope",
".",
"kind",
"==",
"Scope",
".",
"Kind",
".",
"TRY",
")",
"{",
"scope",
".",
"mergeInto... | scope of each try block. | [
"scope",
"of",
"each",
"try",
"block",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java#L328-L336 |
33,017 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java | NilCheckResolver.isBoxingMethod | private boolean isBoxingMethod(ExecutableElement method) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(method);
// Autoboxing methods.
if (typeUtil.isBoxedType(declaringClass.asType())) {
String name = ElementUtil.getName(method);
TypeMirror returnType = method.getReturnType();
List<? extends VariableElement> params = method.getParameters();
if (name.equals("valueOf") && params.size() == 1
&& params.get(0).asType().getKind().isPrimitive()) {
return true;
}
if (params.isEmpty() && returnType.getKind().isPrimitive()
&& name.equals(TypeUtil.getName(returnType) + "Value")) {
return true;
}
}
return false;
} | java | private boolean isBoxingMethod(ExecutableElement method) {
TypeElement declaringClass = ElementUtil.getDeclaringClass(method);
// Autoboxing methods.
if (typeUtil.isBoxedType(declaringClass.asType())) {
String name = ElementUtil.getName(method);
TypeMirror returnType = method.getReturnType();
List<? extends VariableElement> params = method.getParameters();
if (name.equals("valueOf") && params.size() == 1
&& params.get(0).asType().getKind().isPrimitive()) {
return true;
}
if (params.isEmpty() && returnType.getKind().isPrimitive()
&& name.equals(TypeUtil.getName(returnType) + "Value")) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"isBoxingMethod",
"(",
"ExecutableElement",
"method",
")",
"{",
"TypeElement",
"declaringClass",
"=",
"ElementUtil",
".",
"getDeclaringClass",
"(",
"method",
")",
";",
"// Autoboxing methods.",
"if",
"(",
"typeUtil",
".",
"isBoxedType",
"(",
"d... | Checks if the given method is a primitive boxing or unboxing method. | [
"Checks",
"if",
"the",
"given",
"method",
"is",
"a",
"primitive",
"boxing",
"or",
"unboxing",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java#L370-L387 |
33,018 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java | NilCheckResolver.endVisit | @Override
public void endVisit(FunctionInvocation node) {
if (Objects.equals(node.getFunctionElement(), NIL_CHK_ELEM)) {
VariableElement var = TreeUtil.getVariableElement(node.getArgument(0));
if (var != null) {
addSafeVar(var);
}
}
} | java | @Override
public void endVisit(FunctionInvocation node) {
if (Objects.equals(node.getFunctionElement(), NIL_CHK_ELEM)) {
VariableElement var = TreeUtil.getVariableElement(node.getArgument(0));
if (var != null) {
addSafeVar(var);
}
}
} | [
"@",
"Override",
"public",
"void",
"endVisit",
"(",
"FunctionInvocation",
"node",
")",
"{",
"if",
"(",
"Objects",
".",
"equals",
"(",
"node",
".",
"getFunctionElement",
"(",
")",
",",
"NIL_CHK_ELEM",
")",
")",
"{",
"VariableElement",
"var",
"=",
"TreeUtil",
... | added nil_chk's. | [
"added",
"nil_chk",
"s",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/NilCheckResolver.java#L814-L822 |
33,019 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.setRequestProperty | public void setRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
if (requests == null)
requests = new MessageHeader();
requests.set(key, value);
} | java | public void setRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
if (requests == null)
requests = new MessageHeader();
requests.set(key, value);
} | [
"public",
"void",
"setRequestProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"connected",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",... | Sets the general request property. If a property with the key already
exists, overwrite its value with the new value.
<p> NOTE: HTTP requires all request properties which can
legally have multiple instances with the same key
to use a comma-seperated list syntax which enables multiple
properties to be appended into a single property.
@param key the keyword by which the request is known
(e.g., "<code>Accept</code>").
@param value the value associated with it.
@throws IllegalStateException if already connected
@throws NullPointerException if key is <CODE>null</CODE>
@see #getRequestProperty(java.lang.String) | [
"Sets",
"the",
"general",
"request",
"property",
".",
"If",
"a",
"property",
"with",
"the",
"key",
"already",
"exists",
"overwrite",
"its",
"value",
"with",
"the",
"new",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1068-L1078 |
33,020 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.addRequestProperty | public void addRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
if (requests == null)
requests = new MessageHeader();
requests.add(key, value);
} | java | public void addRequestProperty(String key, String value) {
if (connected)
throw new IllegalStateException("Already connected");
if (key == null)
throw new NullPointerException ("key is null");
if (requests == null)
requests = new MessageHeader();
requests.add(key, value);
} | [
"public",
"void",
"addRequestProperty",
"(",
"String",
"key",
",",
"String",
"value",
")",
"{",
"if",
"(",
"connected",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"if",
"(",
"key",
"==",
"null",
")",
"throw",
"new",... | Adds a general request property specified by a
key-value pair. This method will not overwrite
existing values associated with the same key.
@param key the keyword by which the request is known
(e.g., "<code>Accept</code>").
@param value the value associated with it.
@throws IllegalStateException if already connected
@throws NullPointerException if key is null
@see #getRequestProperties()
@since 1.4 | [
"Adds",
"a",
"general",
"request",
"property",
"specified",
"by",
"a",
"key",
"-",
"value",
"pair",
".",
"This",
"method",
"will",
"not",
"overwrite",
"existing",
"values",
"associated",
"with",
"the",
"same",
"key",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1093-L1103 |
33,021 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.getRequestProperty | public String getRequestProperty(String key) {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
return null;
return requests.findValue(key);
} | java | public String getRequestProperty(String key) {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
return null;
return requests.findValue(key);
} | [
"public",
"String",
"getRequestProperty",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"connected",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"if",
"(",
"requests",
"==",
"null",
")",
"return",
"null",
";",
"return",
... | Returns the value of the named general request property for this
connection.
@param key the keyword by which the request is known (e.g., "Accept").
@return the value of the named general request property for this
connection. If key is null, then null is returned.
@throws IllegalStateException if already connected
@see #setRequestProperty(java.lang.String, java.lang.String) | [
"Returns",
"the",
"value",
"of",
"the",
"named",
"general",
"request",
"property",
"for",
"this",
"connection",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1116-L1124 |
33,022 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.getRequestProperties | public Map<String,List<String>> getRequestProperties() {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
return Collections.EMPTY_MAP;
return requests.getHeaders(null);
} | java | public Map<String,List<String>> getRequestProperties() {
if (connected)
throw new IllegalStateException("Already connected");
if (requests == null)
return Collections.EMPTY_MAP;
return requests.getHeaders(null);
} | [
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"getRequestProperties",
"(",
")",
"{",
"if",
"(",
"connected",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Already connected\"",
")",
";",
"if",
"(",
"requests",
"==",
"null",
... | Returns an unmodifiable Map of general request
properties for this connection. The Map keys
are Strings that represent the request-header
field names. Each Map value is a unmodifiable List
of Strings that represents the corresponding
field values.
@return a Map of the general request properties for this connection.
@throws IllegalStateException if already connected
@since 1.4 | [
"Returns",
"an",
"unmodifiable",
"Map",
"of",
"general",
"request",
"properties",
"for",
"this",
"connection",
".",
"The",
"Map",
"keys",
"are",
"Strings",
"that",
"represent",
"the",
"request",
"-",
"header",
"field",
"names",
".",
"Each",
"Map",
"value",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1138-L1146 |
33,023 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.getContentHandler | synchronized ContentHandler getContentHandler()
throws IOException
{
String contentType = stripOffParameters(getContentType());
ContentHandler handler = null;
if (contentType == null) {
if ((contentType = guessContentTypeFromName(url.getFile())) == null) {
contentType = guessContentTypeFromStream(getInputStream());
}
}
if (contentType == null) {
return UnknownContentHandler.INSTANCE;
}
try {
handler = (ContentHandler) handlers.get(contentType);
if (handler != null)
return handler;
} catch(Exception e) {
}
if (factory != null)
handler = factory.createContentHandler(contentType);
if (handler == null) {
try {
handler = lookupContentHandlerClassFor(contentType);
} catch(Exception e) {
e.printStackTrace();
handler = UnknownContentHandler.INSTANCE;
}
handlers.put(contentType, handler);
}
return handler;
} | java | synchronized ContentHandler getContentHandler()
throws IOException
{
String contentType = stripOffParameters(getContentType());
ContentHandler handler = null;
if (contentType == null) {
if ((contentType = guessContentTypeFromName(url.getFile())) == null) {
contentType = guessContentTypeFromStream(getInputStream());
}
}
if (contentType == null) {
return UnknownContentHandler.INSTANCE;
}
try {
handler = (ContentHandler) handlers.get(contentType);
if (handler != null)
return handler;
} catch(Exception e) {
}
if (factory != null)
handler = factory.createContentHandler(contentType);
if (handler == null) {
try {
handler = lookupContentHandlerClassFor(contentType);
} catch(Exception e) {
e.printStackTrace();
handler = UnknownContentHandler.INSTANCE;
}
handlers.put(contentType, handler);
}
return handler;
} | [
"synchronized",
"ContentHandler",
"getContentHandler",
"(",
")",
"throws",
"IOException",
"{",
"String",
"contentType",
"=",
"stripOffParameters",
"(",
"getContentType",
"(",
")",
")",
";",
"ContentHandler",
"handler",
"=",
"null",
";",
"if",
"(",
"contentType",
"... | Gets the Content Handler appropriate for this connection.
@param connection the connection to use. | [
"Gets",
"the",
"Content",
"Handler",
"appropriate",
"for",
"this",
"connection",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1232-L1265 |
33,024 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.getContentHandlerPkgPrefixes | private String getContentHandlerPkgPrefixes() {
String packagePrefixList = System.getProperty(contentPathProp, "");
if (packagePrefixList != "") {
packagePrefixList += "|";
}
return packagePrefixList + contentClassPrefix;
} | java | private String getContentHandlerPkgPrefixes() {
String packagePrefixList = System.getProperty(contentPathProp, "");
if (packagePrefixList != "") {
packagePrefixList += "|";
}
return packagePrefixList + contentClassPrefix;
} | [
"private",
"String",
"getContentHandlerPkgPrefixes",
"(",
")",
"{",
"String",
"packagePrefixList",
"=",
"System",
".",
"getProperty",
"(",
"contentPathProp",
",",
"\"\"",
")",
";",
"if",
"(",
"packagePrefixList",
"!=",
"\"\"",
")",
"{",
"packagePrefixList",
"+=",
... | Returns a vertical bar separated list of package prefixes for potential
content handlers. Tries to get the java.content.handler.pkgs property
to use as a set of package prefixes to search. Whether or not
that property has been defined, the sun.net.www.content is always
the last one on the returned package list. | [
"Returns",
"a",
"vertical",
"bar",
"separated",
"list",
"of",
"package",
"prefixes",
"for",
"potential",
"content",
"handlers",
".",
"Tries",
"to",
"get",
"the",
"java",
".",
"content",
".",
"handler",
".",
"pkgs",
"property",
"to",
"use",
"as",
"a",
"set"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1366-L1374 |
33,025 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.readBytes | static private int readBytes(int c[], int len, InputStream is)
throws IOException {
byte buf[] = new byte[len];
if (is.read(buf, 0, len) < len) {
return -1;
}
// fill the passed in int array
for (int i = 0; i < len; i++) {
c[i] = buf[i] & 0xff;
}
return 0;
} | java | static private int readBytes(int c[], int len, InputStream is)
throws IOException {
byte buf[] = new byte[len];
if (is.read(buf, 0, len) < len) {
return -1;
}
// fill the passed in int array
for (int i = 0; i < len; i++) {
c[i] = buf[i] & 0xff;
}
return 0;
} | [
"static",
"private",
"int",
"readBytes",
"(",
"int",
"c",
"[",
"]",
",",
"int",
"len",
",",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"buf",
"[",
"]",
"=",
"new",
"byte",
"[",
"len",
"]",
";",
"if",
"(",
"is",
".",
"read",
"... | Tries to read the specified number of bytes from the stream
Returns -1, If EOF is reached before len bytes are read, returns 0
otherwise | [
"Tries",
"to",
"read",
"the",
"specified",
"number",
"of",
"bytes",
"from",
"the",
"stream",
"Returns",
"-",
"1",
"If",
"EOF",
"is",
"reached",
"before",
"len",
"bytes",
"are",
"read",
"returns",
"0",
"otherwise"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1738-L1751 |
33,026 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java | URLConnection.skipForward | static private long skipForward(InputStream is, long toSkip)
throws IOException {
long eachSkip = 0;
long skipped = 0;
while (skipped != toSkip) {
eachSkip = is.skip(toSkip - skipped);
// check if EOF is reached
if (eachSkip <= 0) {
if (is.read() == -1) {
return skipped ;
} else {
skipped++;
}
}
skipped += eachSkip;
}
return skipped;
} | java | static private long skipForward(InputStream is, long toSkip)
throws IOException {
long eachSkip = 0;
long skipped = 0;
while (skipped != toSkip) {
eachSkip = is.skip(toSkip - skipped);
// check if EOF is reached
if (eachSkip <= 0) {
if (is.read() == -1) {
return skipped ;
} else {
skipped++;
}
}
skipped += eachSkip;
}
return skipped;
} | [
"static",
"private",
"long",
"skipForward",
"(",
"InputStream",
"is",
",",
"long",
"toSkip",
")",
"throws",
"IOException",
"{",
"long",
"eachSkip",
"=",
"0",
";",
"long",
"skipped",
"=",
"0",
";",
"while",
"(",
"skipped",
"!=",
"toSkip",
")",
"{",
"eachS... | Skips through the specified number of bytes from the stream
until either EOF is reached, or the specified
number of bytes have been skipped | [
"Skips",
"through",
"the",
"specified",
"number",
"of",
"bytes",
"from",
"the",
"stream",
"until",
"either",
"EOF",
"is",
"reached",
"or",
"the",
"specified",
"number",
"of",
"bytes",
"have",
"been",
"skipped"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URLConnection.java#L1759-L1779 |
33,027 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.getElemDesc | public static final ElemDesc getElemDesc(String name)
{
/* this method used to return m_dummy when name was null
* but now it doesn't check and and requires non-null name.
*/
Object obj = m_elementFlags.get(name);
if (null != obj)
return (ElemDesc)obj;
return m_dummy;
} | java | public static final ElemDesc getElemDesc(String name)
{
/* this method used to return m_dummy when name was null
* but now it doesn't check and and requires non-null name.
*/
Object obj = m_elementFlags.get(name);
if (null != obj)
return (ElemDesc)obj;
return m_dummy;
} | [
"public",
"static",
"final",
"ElemDesc",
"getElemDesc",
"(",
"String",
"name",
")",
"{",
"/* this method used to return m_dummy when name was null\n * but now it doesn't check and and requires non-null name.\n */",
"Object",
"obj",
"=",
"m_elementFlags",
".",
"get",
... | Get a description of the given element.
@param name non-null name of element, case insensitive.
@return non-null reference to ElemDesc, which may be m_dummy if no
element description matches the given name. | [
"Get",
"a",
"description",
"of",
"the",
"given",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L626-L635 |
33,028 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.outputDocTypeDecl | private void outputDocTypeDecl(String name) throws SAXException {
if (true == m_needToOutputDocTypeDecl)
{
String doctypeSystem = getDoctypeSystem();
String doctypePublic = getDoctypePublic();
if ((null != doctypeSystem) || (null != doctypePublic))
{
final java.io.Writer writer = m_writer;
try
{
writer.write("<!DOCTYPE ");
writer.write(name);
if (null != doctypePublic)
{
writer.write(" PUBLIC \"");
writer.write(doctypePublic);
writer.write('"');
}
if (null != doctypeSystem)
{
if (null == doctypePublic)
writer.write(" SYSTEM \"");
else
writer.write(" \"");
writer.write(doctypeSystem);
writer.write('"');
}
writer.write('>');
outputLineSep();
}
catch(IOException e)
{
throw new SAXException(e);
}
}
}
m_needToOutputDocTypeDecl = false;
} | java | private void outputDocTypeDecl(String name) throws SAXException {
if (true == m_needToOutputDocTypeDecl)
{
String doctypeSystem = getDoctypeSystem();
String doctypePublic = getDoctypePublic();
if ((null != doctypeSystem) || (null != doctypePublic))
{
final java.io.Writer writer = m_writer;
try
{
writer.write("<!DOCTYPE ");
writer.write(name);
if (null != doctypePublic)
{
writer.write(" PUBLIC \"");
writer.write(doctypePublic);
writer.write('"');
}
if (null != doctypeSystem)
{
if (null == doctypePublic)
writer.write(" SYSTEM \"");
else
writer.write(" \"");
writer.write(doctypeSystem);
writer.write('"');
}
writer.write('>');
outputLineSep();
}
catch(IOException e)
{
throw new SAXException(e);
}
}
}
m_needToOutputDocTypeDecl = false;
} | [
"private",
"void",
"outputDocTypeDecl",
"(",
"String",
"name",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"true",
"==",
"m_needToOutputDocTypeDecl",
")",
"{",
"String",
"doctypeSystem",
"=",
"getDoctypeSystem",
"(",
")",
";",
"String",
"doctypePublic",
"=",
... | This method should only get called once.
If a DOCTYPE declaration needs to get written out, it will
be written out. If it doesn't need to be written out, then
the call to this method has no effect. | [
"This",
"method",
"should",
"only",
"get",
"called",
"once",
".",
"If",
"a",
"DOCTYPE",
"declaration",
"needs",
"to",
"get",
"written",
"out",
"it",
"will",
"be",
"written",
"out",
".",
"If",
"it",
"doesn",
"t",
"need",
"to",
"be",
"written",
"out",
"t... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L700-L742 |
33,029 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.makeHHString | private static String makeHHString(int i)
{
String s = Integer.toHexString(i).toUpperCase();
if (s.length() == 1)
{
s = "0" + s;
}
return s;
} | java | private static String makeHHString(int i)
{
String s = Integer.toHexString(i).toUpperCase();
if (s.length() == 1)
{
s = "0" + s;
}
return s;
} | [
"private",
"static",
"String",
"makeHHString",
"(",
"int",
"i",
")",
"{",
"String",
"s",
"=",
"Integer",
".",
"toHexString",
"(",
"i",
")",
".",
"toUpperCase",
"(",
")",
";",
"if",
"(",
"s",
".",
"length",
"(",
")",
"==",
"1",
")",
"{",
"s",
"=",... | Make an integer into an HH hex value.
Does no checking on the size of the input, since this
is only meant to be used locally by writeAttrURI.
@param i must be a value less than 255.
@return should be a two character string. | [
"Make",
"an",
"integer",
"into",
"an",
"HH",
"hex",
"value",
".",
"Does",
"no",
"checking",
"on",
"the",
"size",
"of",
"the",
"input",
"since",
"this",
"is",
"only",
"meant",
"to",
"be",
"used",
"locally",
"by",
"writeAttrURI",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1108-L1116 |
33,030 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.closeStartTag | protected void closeStartTag() throws SAXException
{
try
{
// finish processing attributes, time to fire off the start element event
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs>0)
{
processAttributes(m_writer, nAttrs);
// clear attributes object for re-use with next element
m_attributes.clear();
}
m_writer.write('>');
/* At this point we have the prefix mappings now, so
* lets determine if the current element is specified in the cdata-
* section-elements list.
*/
if (m_CdataElems != null) // if there are any cdata sections
m_elemContext.m_isCdataSection = isCdataSection();
if (m_doIndent)
{
m_isprevtext = false;
m_preserves.push(m_ispreserve);
}
}
catch(IOException e)
{
throw new SAXException(e);
}
} | java | protected void closeStartTag() throws SAXException
{
try
{
// finish processing attributes, time to fire off the start element event
if (m_tracer != null)
super.fireStartElem(m_elemContext.m_elementName);
int nAttrs = m_attributes.getLength();
if (nAttrs>0)
{
processAttributes(m_writer, nAttrs);
// clear attributes object for re-use with next element
m_attributes.clear();
}
m_writer.write('>');
/* At this point we have the prefix mappings now, so
* lets determine if the current element is specified in the cdata-
* section-elements list.
*/
if (m_CdataElems != null) // if there are any cdata sections
m_elemContext.m_isCdataSection = isCdataSection();
if (m_doIndent)
{
m_isprevtext = false;
m_preserves.push(m_ispreserve);
}
}
catch(IOException e)
{
throw new SAXException(e);
}
} | [
"protected",
"void",
"closeStartTag",
"(",
")",
"throws",
"SAXException",
"{",
"try",
"{",
"// finish processing attributes, time to fire off the start element event",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"super",
".",
"fireStartElem",
"(",
"m_elemContext",
".",
"m... | For the enclosing elements starting tag write out out any attributes
followed by ">". At this point we also mark if this element is
a cdata-section-element.
@throws org.xml.sax.SAXException | [
"For",
"the",
"enclosing",
"elements",
"starting",
"tag",
"write",
"out",
"out",
"any",
"attributes",
"followed",
"by",
">",
".",
"At",
"this",
"point",
"we",
"also",
"mark",
"if",
"this",
"element",
"is",
"a",
"cdata",
"-",
"section",
"-",
"element",
".... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1790-L1826 |
33,031 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java | ToHTMLStream.attributeDecl | public void attributeDecl(
String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
{
// The internal DTD subset is not serialized by the ToHTMLStream serializer
} | java | public void attributeDecl(
String eName,
String aName,
String type,
String valueDefault,
String value)
throws SAXException
{
// The internal DTD subset is not serialized by the ToHTMLStream serializer
} | [
"public",
"void",
"attributeDecl",
"(",
"String",
"eName",
",",
"String",
"aName",
",",
"String",
"type",
",",
"String",
"valueDefault",
",",
"String",
"value",
")",
"throws",
"SAXException",
"{",
"// The internal DTD subset is not serialized by the ToHTMLStream serialize... | This method does nothing. | [
"This",
"method",
"does",
"nothing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToHTMLStream.java#L1882-L1891 |
33,032 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.getEncodedInfo | public byte[] getEncodedInfo() throws CertificateEncodingException {
try {
if (rawCertInfo == null) {
DerOutputStream tmp = new DerOutputStream();
emit(tmp);
rawCertInfo = tmp.toByteArray();
}
return rawCertInfo.clone();
} catch (IOException e) {
throw new CertificateEncodingException(e.toString());
} catch (CertificateException e) {
throw new CertificateEncodingException(e.toString());
}
} | java | public byte[] getEncodedInfo() throws CertificateEncodingException {
try {
if (rawCertInfo == null) {
DerOutputStream tmp = new DerOutputStream();
emit(tmp);
rawCertInfo = tmp.toByteArray();
}
return rawCertInfo.clone();
} catch (IOException e) {
throw new CertificateEncodingException(e.toString());
} catch (CertificateException e) {
throw new CertificateEncodingException(e.toString());
}
} | [
"public",
"byte",
"[",
"]",
"getEncodedInfo",
"(",
")",
"throws",
"CertificateEncodingException",
"{",
"try",
"{",
"if",
"(",
"rawCertInfo",
"==",
"null",
")",
"{",
"DerOutputStream",
"tmp",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"emit",
"(",
"tmp",
... | Returns the encoded certificate info.
@exception CertificateEncodingException on encoding information errors. | [
"Returns",
"the",
"encoded",
"certificate",
"info",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L222-L235 |
33,033 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.set | public void set(String name, Object val)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateException("Attribute name not recognized: "
+ name);
}
// set rawCertInfo to null, so that we are forced to re-encode
rawCertInfo = null;
String suffix = attrName.getSuffix();
switch (attr) {
case ATTR_VERSION:
if (suffix == null) {
setVersion(val);
} else {
version.set(suffix, val);
}
break;
case ATTR_SERIAL:
if (suffix == null) {
setSerialNumber(val);
} else {
serialNum.set(suffix, val);
}
break;
case ATTR_ALGORITHM:
if (suffix == null) {
setAlgorithmId(val);
} else {
algId.set(suffix, val);
}
break;
case ATTR_ISSUER:
setIssuer(val);
break;
case ATTR_VALIDITY:
if (suffix == null) {
setValidity(val);
} else {
interval.set(suffix, val);
}
break;
case ATTR_SUBJECT:
setSubject(val);
break;
case ATTR_KEY:
if (suffix == null) {
setKey(val);
} else {
pubKey.set(suffix, val);
}
break;
case ATTR_ISSUER_ID:
setIssuerUniqueId(val);
break;
case ATTR_SUBJECT_ID:
setSubjectUniqueId(val);
break;
case ATTR_EXTENSIONS:
if (suffix == null) {
setExtensions(val);
} else {
if (extensions == null)
extensions = new CertificateExtensions();
extensions.set(suffix, val);
}
break;
}
} | java | public void set(String name, Object val)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateException("Attribute name not recognized: "
+ name);
}
// set rawCertInfo to null, so that we are forced to re-encode
rawCertInfo = null;
String suffix = attrName.getSuffix();
switch (attr) {
case ATTR_VERSION:
if (suffix == null) {
setVersion(val);
} else {
version.set(suffix, val);
}
break;
case ATTR_SERIAL:
if (suffix == null) {
setSerialNumber(val);
} else {
serialNum.set(suffix, val);
}
break;
case ATTR_ALGORITHM:
if (suffix == null) {
setAlgorithmId(val);
} else {
algId.set(suffix, val);
}
break;
case ATTR_ISSUER:
setIssuer(val);
break;
case ATTR_VALIDITY:
if (suffix == null) {
setValidity(val);
} else {
interval.set(suffix, val);
}
break;
case ATTR_SUBJECT:
setSubject(val);
break;
case ATTR_KEY:
if (suffix == null) {
setKey(val);
} else {
pubKey.set(suffix, val);
}
break;
case ATTR_ISSUER_ID:
setIssuerUniqueId(val);
break;
case ATTR_SUBJECT_ID:
setSubjectUniqueId(val);
break;
case ATTR_EXTENSIONS:
if (suffix == null) {
setExtensions(val);
} else {
if (extensions == null)
extensions = new CertificateExtensions();
extensions.set(suffix, val);
}
break;
}
} | [
"public",
"void",
"set",
"(",
"String",
"name",
",",
"Object",
"val",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"X509AttributeName",
"attrName",
"=",
"new",
"X509AttributeName",
"(",
"name",
")",
";",
"int",
"attr",
"=",
"attributeMap",
"... | Set the certificate attribute.
@params name the name of the Certificate attribute.
@params val the value of the Certificate attribute.
@exception CertificateException on invalid attributes.
@exception IOException on other errors. | [
"Set",
"the",
"certificate",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L364-L444 |
33,034 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.delete | public void delete(String name)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateException("Attribute name not recognized: "
+ name);
}
// set rawCertInfo to null, so that we are forced to re-encode
rawCertInfo = null;
String suffix = attrName.getSuffix();
switch (attr) {
case ATTR_VERSION:
if (suffix == null) {
version = null;
} else {
version.delete(suffix);
}
break;
case (ATTR_SERIAL):
if (suffix == null) {
serialNum = null;
} else {
serialNum.delete(suffix);
}
break;
case (ATTR_ALGORITHM):
if (suffix == null) {
algId = null;
} else {
algId.delete(suffix);
}
break;
case (ATTR_ISSUER):
issuer = null;
break;
case (ATTR_VALIDITY):
if (suffix == null) {
interval = null;
} else {
interval.delete(suffix);
}
break;
case (ATTR_SUBJECT):
subject = null;
break;
case (ATTR_KEY):
if (suffix == null) {
pubKey = null;
} else {
pubKey.delete(suffix);
}
break;
case (ATTR_ISSUER_ID):
issuerUniqueId = null;
break;
case (ATTR_SUBJECT_ID):
subjectUniqueId = null;
break;
case (ATTR_EXTENSIONS):
if (suffix == null) {
extensions = null;
} else {
if (extensions != null)
extensions.delete(suffix);
}
break;
}
} | java | public void delete(String name)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateException("Attribute name not recognized: "
+ name);
}
// set rawCertInfo to null, so that we are forced to re-encode
rawCertInfo = null;
String suffix = attrName.getSuffix();
switch (attr) {
case ATTR_VERSION:
if (suffix == null) {
version = null;
} else {
version.delete(suffix);
}
break;
case (ATTR_SERIAL):
if (suffix == null) {
serialNum = null;
} else {
serialNum.delete(suffix);
}
break;
case (ATTR_ALGORITHM):
if (suffix == null) {
algId = null;
} else {
algId.delete(suffix);
}
break;
case (ATTR_ISSUER):
issuer = null;
break;
case (ATTR_VALIDITY):
if (suffix == null) {
interval = null;
} else {
interval.delete(suffix);
}
break;
case (ATTR_SUBJECT):
subject = null;
break;
case (ATTR_KEY):
if (suffix == null) {
pubKey = null;
} else {
pubKey.delete(suffix);
}
break;
case (ATTR_ISSUER_ID):
issuerUniqueId = null;
break;
case (ATTR_SUBJECT_ID):
subjectUniqueId = null;
break;
case (ATTR_EXTENSIONS):
if (suffix == null) {
extensions = null;
} else {
if (extensions != null)
extensions.delete(suffix);
}
break;
}
} | [
"public",
"void",
"delete",
"(",
"String",
"name",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"X509AttributeName",
"attrName",
"=",
"new",
"X509AttributeName",
"(",
"name",
")",
";",
"int",
"attr",
"=",
"attributeMap",
"(",
"attrName",
".",
... | Delete the certificate attribute.
@params name the name of the Certificate attribute.
@exception CertificateException on invalid attributes.
@exception IOException on other errors. | [
"Delete",
"the",
"certificate",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L453-L523 |
33,035 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.get | public Object get(String name)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateParsingException(
"Attribute name not recognized: " + name);
}
String suffix = attrName.getSuffix();
switch (attr) { // frequently used attributes first
case (ATTR_EXTENSIONS):
if (suffix == null) {
return(extensions);
} else {
if (extensions == null) {
return null;
} else {
return(extensions.get(suffix));
}
}
case (ATTR_SUBJECT):
if (suffix == null) {
return(subject);
} else {
return(getX500Name(suffix, false));
}
case (ATTR_ISSUER):
if (suffix == null) {
return(issuer);
} else {
return(getX500Name(suffix, true));
}
case (ATTR_KEY):
if (suffix == null) {
return(pubKey);
} else {
return(pubKey.get(suffix));
}
case (ATTR_ALGORITHM):
if (suffix == null) {
return(algId);
} else {
return(algId.get(suffix));
}
case (ATTR_VALIDITY):
if (suffix == null) {
return(interval);
} else {
return(interval.get(suffix));
}
case (ATTR_VERSION):
if (suffix == null) {
return(version);
} else {
return(version.get(suffix));
}
case (ATTR_SERIAL):
if (suffix == null) {
return(serialNum);
} else {
return(serialNum.get(suffix));
}
case (ATTR_ISSUER_ID):
return(issuerUniqueId);
case (ATTR_SUBJECT_ID):
return(subjectUniqueId);
}
return null;
} | java | public Object get(String name)
throws CertificateException, IOException {
X509AttributeName attrName = new X509AttributeName(name);
int attr = attributeMap(attrName.getPrefix());
if (attr == 0) {
throw new CertificateParsingException(
"Attribute name not recognized: " + name);
}
String suffix = attrName.getSuffix();
switch (attr) { // frequently used attributes first
case (ATTR_EXTENSIONS):
if (suffix == null) {
return(extensions);
} else {
if (extensions == null) {
return null;
} else {
return(extensions.get(suffix));
}
}
case (ATTR_SUBJECT):
if (suffix == null) {
return(subject);
} else {
return(getX500Name(suffix, false));
}
case (ATTR_ISSUER):
if (suffix == null) {
return(issuer);
} else {
return(getX500Name(suffix, true));
}
case (ATTR_KEY):
if (suffix == null) {
return(pubKey);
} else {
return(pubKey.get(suffix));
}
case (ATTR_ALGORITHM):
if (suffix == null) {
return(algId);
} else {
return(algId.get(suffix));
}
case (ATTR_VALIDITY):
if (suffix == null) {
return(interval);
} else {
return(interval.get(suffix));
}
case (ATTR_VERSION):
if (suffix == null) {
return(version);
} else {
return(version.get(suffix));
}
case (ATTR_SERIAL):
if (suffix == null) {
return(serialNum);
} else {
return(serialNum.get(suffix));
}
case (ATTR_ISSUER_ID):
return(issuerUniqueId);
case (ATTR_SUBJECT_ID):
return(subjectUniqueId);
}
return null;
} | [
"public",
"Object",
"get",
"(",
"String",
"name",
")",
"throws",
"CertificateException",
",",
"IOException",
"{",
"X509AttributeName",
"attrName",
"=",
"new",
"X509AttributeName",
"(",
"name",
")",
";",
"int",
"attr",
"=",
"attributeMap",
"(",
"attrName",
".",
... | Get the certificate attribute.
@params name the name of the Certificate attribute.
@exception CertificateException on invalid attributes.
@exception IOException on other errors. | [
"Get",
"the",
"certificate",
"attribute",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L533-L603 |
33,036 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.attributeMap | private int attributeMap(String name) {
Integer num = map.get(name);
if (num == null) {
return 0;
}
return num.intValue();
} | java | private int attributeMap(String name) {
Integer num = map.get(name);
if (num == null) {
return 0;
}
return num.intValue();
} | [
"private",
"int",
"attributeMap",
"(",
"String",
"name",
")",
"{",
"Integer",
"num",
"=",
"map",
".",
"get",
"(",
"name",
")",
";",
"if",
"(",
"num",
"==",
"null",
")",
"{",
"return",
"0",
";",
"}",
"return",
"num",
".",
"intValue",
"(",
")",
";"... | Returns the integer attribute number for the passed attribute name. | [
"Returns",
"the",
"integer",
"attribute",
"number",
"for",
"the",
"passed",
"attribute",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L804-L810 |
33,037 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setVersion | private void setVersion(Object val) throws CertificateException {
if (!(val instanceof CertificateVersion)) {
throw new CertificateException("Version class type invalid.");
}
version = (CertificateVersion)val;
} | java | private void setVersion(Object val) throws CertificateException {
if (!(val instanceof CertificateVersion)) {
throw new CertificateException("Version class type invalid.");
}
version = (CertificateVersion)val;
} | [
"private",
"void",
"setVersion",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"CertificateVersion",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Version class type invalid.\"",
")",
"... | Set the version number of the certificate.
@params val the Object class value for the Extensions
@exception CertificateException on invalid data. | [
"Set",
"the",
"version",
"number",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L818-L823 |
33,038 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setSerialNumber | private void setSerialNumber(Object val) throws CertificateException {
if (!(val instanceof CertificateSerialNumber)) {
throw new CertificateException("SerialNumber class type invalid.");
}
serialNum = (CertificateSerialNumber)val;
} | java | private void setSerialNumber(Object val) throws CertificateException {
if (!(val instanceof CertificateSerialNumber)) {
throw new CertificateException("SerialNumber class type invalid.");
}
serialNum = (CertificateSerialNumber)val;
} | [
"private",
"void",
"setSerialNumber",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"CertificateSerialNumber",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"SerialNumber class type invalid.... | Set the serial number of the certificate.
@params val the Object class value for the CertificateSerialNumber
@exception CertificateException on invalid data. | [
"Set",
"the",
"serial",
"number",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L831-L836 |
33,039 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setAlgorithmId | private void setAlgorithmId(Object val) throws CertificateException {
if (!(val instanceof CertificateAlgorithmId)) {
throw new CertificateException(
"AlgorithmId class type invalid.");
}
algId = (CertificateAlgorithmId)val;
} | java | private void setAlgorithmId(Object val) throws CertificateException {
if (!(val instanceof CertificateAlgorithmId)) {
throw new CertificateException(
"AlgorithmId class type invalid.");
}
algId = (CertificateAlgorithmId)val;
} | [
"private",
"void",
"setAlgorithmId",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"CertificateAlgorithmId",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"AlgorithmId class type invalid.\""... | Set the algorithm id of the certificate.
@params val the Object class value for the AlgorithmId
@exception CertificateException on invalid data. | [
"Set",
"the",
"algorithm",
"id",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L844-L850 |
33,040 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setIssuer | private void setIssuer(Object val) throws CertificateException {
if (!(val instanceof X500Name)) {
throw new CertificateException(
"Issuer class type invalid.");
}
issuer = (X500Name)val;
} | java | private void setIssuer(Object val) throws CertificateException {
if (!(val instanceof X500Name)) {
throw new CertificateException(
"Issuer class type invalid.");
}
issuer = (X500Name)val;
} | [
"private",
"void",
"setIssuer",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"X500Name",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Issuer class type invalid.\"",
")",
";",
"}",
... | Set the issuer name of the certificate.
@params val the Object class value for the issuer
@exception CertificateException on invalid data. | [
"Set",
"the",
"issuer",
"name",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L858-L864 |
33,041 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setValidity | private void setValidity(Object val) throws CertificateException {
if (!(val instanceof CertificateValidity)) {
throw new CertificateException(
"CertificateValidity class type invalid.");
}
interval = (CertificateValidity)val;
} | java | private void setValidity(Object val) throws CertificateException {
if (!(val instanceof CertificateValidity)) {
throw new CertificateException(
"CertificateValidity class type invalid.");
}
interval = (CertificateValidity)val;
} | [
"private",
"void",
"setValidity",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"CertificateValidity",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"CertificateValidity class type invalid.\... | Set the validity interval of the certificate.
@params val the Object class value for the CertificateValidity
@exception CertificateException on invalid data. | [
"Set",
"the",
"validity",
"interval",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L872-L878 |
33,042 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setSubject | private void setSubject(Object val) throws CertificateException {
if (!(val instanceof X500Name)) {
throw new CertificateException(
"Subject class type invalid.");
}
subject = (X500Name)val;
} | java | private void setSubject(Object val) throws CertificateException {
if (!(val instanceof X500Name)) {
throw new CertificateException(
"Subject class type invalid.");
}
subject = (X500Name)val;
} | [
"private",
"void",
"setSubject",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"X500Name",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Subject class type invalid.\"",
")",
";",
"}",... | Set the subject name of the certificate.
@params val the Object class value for the Subject
@exception CertificateException on invalid data. | [
"Set",
"the",
"subject",
"name",
"of",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L886-L892 |
33,043 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setKey | private void setKey(Object val) throws CertificateException {
if (!(val instanceof CertificateX509Key)) {
throw new CertificateException(
"Key class type invalid.");
}
pubKey = (CertificateX509Key)val;
} | java | private void setKey(Object val) throws CertificateException {
if (!(val instanceof CertificateX509Key)) {
throw new CertificateException(
"Key class type invalid.");
}
pubKey = (CertificateX509Key)val;
} | [
"private",
"void",
"setKey",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"!",
"(",
"val",
"instanceof",
"CertificateX509Key",
")",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Key class type invalid.\"",
")",
";",
"}... | Set the public key in the certificate.
@params val the Object class value for the PublicKey
@exception CertificateException on invalid data. | [
"Set",
"the",
"public",
"key",
"in",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L900-L906 |
33,044 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setIssuerUniqueId | private void setIssuerUniqueId(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V2) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof UniqueIdentity)) {
throw new CertificateException(
"IssuerUniqueId class type invalid.");
}
issuerUniqueId = (UniqueIdentity)val;
} | java | private void setIssuerUniqueId(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V2) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof UniqueIdentity)) {
throw new CertificateException(
"IssuerUniqueId class type invalid.");
}
issuerUniqueId = (UniqueIdentity)val;
} | [
"private",
"void",
"setIssuerUniqueId",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"version",
".",
"compare",
"(",
"CertificateVersion",
".",
"V2",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Inval... | Set the Issuer Unique Identity in the certificate.
@params val the Object class value for the IssuerUniqueId
@exception CertificateException | [
"Set",
"the",
"Issuer",
"Unique",
"Identity",
"in",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L914-L923 |
33,045 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setSubjectUniqueId | private void setSubjectUniqueId(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V2) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof UniqueIdentity)) {
throw new CertificateException(
"SubjectUniqueId class type invalid.");
}
subjectUniqueId = (UniqueIdentity)val;
} | java | private void setSubjectUniqueId(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V2) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof UniqueIdentity)) {
throw new CertificateException(
"SubjectUniqueId class type invalid.");
}
subjectUniqueId = (UniqueIdentity)val;
} | [
"private",
"void",
"setSubjectUniqueId",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"version",
".",
"compare",
"(",
"CertificateVersion",
".",
"V2",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Inva... | Set the Subject Unique Identity in the certificate.
@params val the Object class value for the SubjectUniqueId
@exception CertificateException | [
"Set",
"the",
"Subject",
"Unique",
"Identity",
"in",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L931-L940 |
33,046 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java | X509CertInfo.setExtensions | private void setExtensions(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V3) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof CertificateExtensions)) {
throw new CertificateException(
"Extensions class type invalid.");
}
extensions = (CertificateExtensions)val;
} | java | private void setExtensions(Object val) throws CertificateException {
if (version.compare(CertificateVersion.V3) < 0) {
throw new CertificateException("Invalid version");
}
if (!(val instanceof CertificateExtensions)) {
throw new CertificateException(
"Extensions class type invalid.");
}
extensions = (CertificateExtensions)val;
} | [
"private",
"void",
"setExtensions",
"(",
"Object",
"val",
")",
"throws",
"CertificateException",
"{",
"if",
"(",
"version",
".",
"compare",
"(",
"CertificateVersion",
".",
"V3",
")",
"<",
"0",
")",
"{",
"throw",
"new",
"CertificateException",
"(",
"\"Invalid v... | Set the extensions in the certificate.
@params val the Object class value for the Extensions
@exception CertificateException | [
"Set",
"the",
"extensions",
"in",
"the",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CertInfo.java#L948-L957 |
33,047 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.parseObject | @Override
public final Object parseObject(String source,
ParsePosition parsePosition) {
return parse(source, parsePosition);
} | java | @Override
public final Object parseObject(String source,
ParsePosition parsePosition) {
return parse(source, parsePosition);
} | [
"@",
"Override",
"public",
"final",
"Object",
"parseObject",
"(",
"String",
"source",
",",
"ParsePosition",
"parsePosition",
")",
"{",
"return",
"parse",
"(",
"source",
",",
"parsePosition",
")",
";",
"}"
] | Parses text from a string to produce a number.
@param source the String to parse
@param parsePosition the position at which to start the parse
@return the parsed number, or null
@see java.text.NumberFormat#parseObject(String, ParsePosition) | [
"Parses",
"text",
"from",
"a",
"string",
"to",
"produce",
"a",
"number",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L276-L280 |
33,048 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.format | public final String format(long number) {
StringBuffer buf = new StringBuffer(19);
FieldPosition pos = new FieldPosition(0);
format(number, buf, pos);
return buf.toString();
} | java | public final String format(long number) {
StringBuffer buf = new StringBuffer(19);
FieldPosition pos = new FieldPosition(0);
format(number, buf, pos);
return buf.toString();
} | [
"public",
"final",
"String",
"format",
"(",
"long",
"number",
")",
"{",
"StringBuffer",
"buf",
"=",
"new",
"StringBuffer",
"(",
"19",
")",
";",
"FieldPosition",
"pos",
"=",
"new",
"FieldPosition",
"(",
"0",
")",
";",
"format",
"(",
"number",
",",
"buf",
... | Specialization of format.
@see java.text.Format#format(Object) | [
"Specialization",
"of",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L295-L300 |
33,049 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.format | public final String format(java.math.BigDecimal number) {
return format(number, new StringBuffer(),
new FieldPosition(0)).toString();
} | java | public final String format(java.math.BigDecimal number) {
return format(number, new StringBuffer(),
new FieldPosition(0)).toString();
} | [
"public",
"final",
"String",
"format",
"(",
"java",
".",
"math",
".",
"BigDecimal",
"number",
")",
"{",
"return",
"format",
"(",
"number",
",",
"new",
"StringBuffer",
"(",
")",
",",
"new",
"FieldPosition",
"(",
"0",
")",
")",
".",
"toString",
"(",
")",... | Convenience method to format a BigDecimal. | [
"Convenience",
"method",
"to",
"format",
"a",
"BigDecimal",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L313-L316 |
33,050 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.setMaximumIntegerDigits | public void setMaximumIntegerDigits(int newValue) {
maximumIntegerDigits = Math.max(0,newValue);
if (minimumIntegerDigits > maximumIntegerDigits)
minimumIntegerDigits = maximumIntegerDigits;
} | java | public void setMaximumIntegerDigits(int newValue) {
maximumIntegerDigits = Math.max(0,newValue);
if (minimumIntegerDigits > maximumIntegerDigits)
minimumIntegerDigits = maximumIntegerDigits;
} | [
"public",
"void",
"setMaximumIntegerDigits",
"(",
"int",
"newValue",
")",
"{",
"maximumIntegerDigits",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"newValue",
")",
";",
"if",
"(",
"minimumIntegerDigits",
">",
"maximumIntegerDigits",
")",
"minimumIntegerDigits",
"=",
... | Sets the maximum number of digits allowed in the integer portion of a
number. This must be >= minimumIntegerDigits. If the
new value for maximumIntegerDigits is less than the current value
of minimumIntegerDigits, then minimumIntegerDigits will also be set to
the new value.
@param newValue the maximum number of integer digits to be shown; if
less than zero, then zero is used. Subclasses might enforce an
upper limit to this value appropriate to the numeric type being formatted.
@see #getMaximumIntegerDigits | [
"Sets",
"the",
"maximum",
"number",
"of",
"digits",
"allowed",
"in",
"the",
"integer",
"portion",
"of",
"a",
"number",
".",
"This",
"must",
"be",
">",
";",
"=",
"minimumIntegerDigits",
".",
"If",
"the",
"new",
"value",
"for",
"maximumIntegerDigits",
"is",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1061-L1065 |
33,051 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.setMinimumIntegerDigits | public void setMinimumIntegerDigits(int newValue) {
minimumIntegerDigits = Math.max(0,newValue);
if (minimumIntegerDigits > maximumIntegerDigits)
maximumIntegerDigits = minimumIntegerDigits;
} | java | public void setMinimumIntegerDigits(int newValue) {
minimumIntegerDigits = Math.max(0,newValue);
if (minimumIntegerDigits > maximumIntegerDigits)
maximumIntegerDigits = minimumIntegerDigits;
} | [
"public",
"void",
"setMinimumIntegerDigits",
"(",
"int",
"newValue",
")",
"{",
"minimumIntegerDigits",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"newValue",
")",
";",
"if",
"(",
"minimumIntegerDigits",
">",
"maximumIntegerDigits",
")",
"maximumIntegerDigits",
"=",
... | Sets the minimum number of digits allowed in the integer portion of a
number. This must be <= maximumIntegerDigits. If the
new value for minimumIntegerDigits is more than the current value
of maximumIntegerDigits, then maximumIntegerDigits will also be set to
the new value.
@param newValue the minimum number of integer digits to be shown; if
less than zero, then zero is used. Subclasses might enforce an
upper limit to this value appropriate to the numeric type being formatted.
@see #getMinimumIntegerDigits | [
"Sets",
"the",
"minimum",
"number",
"of",
"digits",
"allowed",
"in",
"the",
"integer",
"portion",
"of",
"a",
"number",
".",
"This",
"must",
"be",
"<",
";",
"=",
"maximumIntegerDigits",
".",
"If",
"the",
"new",
"value",
"for",
"minimumIntegerDigits",
"is",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1091-L1095 |
33,052 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.setMinimumFractionDigits | public void setMinimumFractionDigits(int newValue) {
minimumFractionDigits = Math.max(0,newValue);
if (maximumFractionDigits < minimumFractionDigits)
maximumFractionDigits = minimumFractionDigits;
} | java | public void setMinimumFractionDigits(int newValue) {
minimumFractionDigits = Math.max(0,newValue);
if (maximumFractionDigits < minimumFractionDigits)
maximumFractionDigits = minimumFractionDigits;
} | [
"public",
"void",
"setMinimumFractionDigits",
"(",
"int",
"newValue",
")",
"{",
"minimumFractionDigits",
"=",
"Math",
".",
"max",
"(",
"0",
",",
"newValue",
")",
";",
"if",
"(",
"maximumFractionDigits",
"<",
"minimumFractionDigits",
")",
"maximumFractionDigits",
"... | Sets the minimum number of digits allowed in the fraction portion of a
number. This must be <= maximumFractionDigits. If the
new value for minimumFractionDigits exceeds the current value
of maximumFractionDigits, then maximumFractionDigits will also be set to
the new value.
@param newValue the minimum number of fraction digits to be shown; if
less than zero, then zero is used. Subclasses might enforce an
upper limit to this value appropriate to the numeric type being formatted.
@see #getMinimumFractionDigits | [
"Sets",
"the",
"minimum",
"number",
"of",
"digits",
"allowed",
"in",
"the",
"fraction",
"portion",
"of",
"a",
"number",
".",
"This",
"must",
"be",
"<",
";",
"=",
"maximumFractionDigits",
".",
"If",
"the",
"new",
"value",
"for",
"minimumFractionDigits",
"ex... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1151-L1155 |
33,053 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.getInstance | public static NumberFormat getInstance(ULocale desiredLocale, int choice) {
if (choice < NUMBERSTYLE || choice > STANDARDCURRENCYSTYLE) {
throw new IllegalArgumentException(
"choice should be from NUMBERSTYLE to STANDARDCURRENCYSTYLE");
}
// if (shim == null) {
// return createInstance(desiredLocale, choice);
// } else {
// // TODO: shims must call setLocale() on object they create
// return getShim().createInstance(desiredLocale, choice);
// }
return getShim().createInstance(desiredLocale, choice);
} | java | public static NumberFormat getInstance(ULocale desiredLocale, int choice) {
if (choice < NUMBERSTYLE || choice > STANDARDCURRENCYSTYLE) {
throw new IllegalArgumentException(
"choice should be from NUMBERSTYLE to STANDARDCURRENCYSTYLE");
}
// if (shim == null) {
// return createInstance(desiredLocale, choice);
// } else {
// // TODO: shims must call setLocale() on object they create
// return getShim().createInstance(desiredLocale, choice);
// }
return getShim().createInstance(desiredLocale, choice);
} | [
"public",
"static",
"NumberFormat",
"getInstance",
"(",
"ULocale",
"desiredLocale",
",",
"int",
"choice",
")",
"{",
"if",
"(",
"choice",
"<",
"NUMBERSTYLE",
"||",
"choice",
">",
"STANDARDCURRENCYSTYLE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Returns a specific style number format for a specific locale.
@param desiredLocale the specific locale.
@param choice number format style
@throws IllegalArgumentException if choice is not one of
NUMBERSTYLE, CURRENCYSTYLE,
PERCENTSTYLE, SCIENTIFICSTYLE,
INTEGERSTYLE, ISOCURRENCYSTYLE,
PLURALCURRENCYSTYLE, ACCOUNTINGCURRENCYSTYLE.
CASHCURRENCYSTYLE, STANDARDCURRENCYSTYLE. | [
"Returns",
"a",
"specific",
"style",
"number",
"format",
"for",
"a",
"specific",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1237-L1249 |
33,054 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java | NumberFormat.createInstance | static NumberFormat createInstance(ULocale desiredLocale, int choice) {
// If the choice is PLURALCURRENCYSTYLE, the pattern is not a single
// pattern, it is a pattern set, so we do not need to get them here.
// If the choice is ISOCURRENCYSTYLE, the pattern is the currrency
// pattern in the locale but by replacing the single currency sign
// with double currency sign.
String pattern = getPattern(desiredLocale, choice);
DecimalFormatSymbols symbols = new DecimalFormatSymbols(desiredLocale);
// Here we assume that the locale passed in is in the canonical
// form, e.g: pt_PT_@currency=PTE not pt_PT_PREEURO
// This style wont work for currency plural format.
// For currency plural format, the pattern is get from
// the locale (from CurrencyUnitPatterns) without override.
if (choice == CURRENCYSTYLE || choice == ISOCURRENCYSTYLE || choice == ACCOUNTINGCURRENCYSTYLE
|| choice == CASHCURRENCYSTYLE || choice == STANDARDCURRENCYSTYLE) {
String temp = symbols.getCurrencyPattern();
if(temp!=null){
pattern = temp;
}
}
// replace single currency sign in the pattern with double currency sign
// if the choice is ISOCURRENCYSTYLE.
if (choice == ISOCURRENCYSTYLE) {
pattern = pattern.replace("\u00A4", doubleCurrencyStr);
}
// Get the numbering system
NumberingSystem ns = NumberingSystem.getInstance(desiredLocale);
if ( ns == null ) {
return null;
}
NumberFormat format;
if ( ns != null && ns.isAlgorithmic()) {
String nsDesc;
String nsRuleSetGroup;
String nsRuleSetName;
ULocale nsLoc;
int desiredRulesType = RuleBasedNumberFormat.NUMBERING_SYSTEM;
nsDesc = ns.getDescription();
int firstSlash = nsDesc.indexOf("/");
int lastSlash = nsDesc.lastIndexOf("/");
if ( lastSlash > firstSlash ) {
String nsLocID = nsDesc.substring(0,firstSlash);
nsRuleSetGroup = nsDesc.substring(firstSlash+1,lastSlash);
nsRuleSetName = nsDesc.substring(lastSlash+1);
nsLoc = new ULocale(nsLocID);
if ( nsRuleSetGroup.equals("SpelloutRules")) {
desiredRulesType = RuleBasedNumberFormat.SPELLOUT;
}
} else {
nsLoc = desiredLocale;
nsRuleSetName = nsDesc;
}
RuleBasedNumberFormat r = new RuleBasedNumberFormat(nsLoc,desiredRulesType);
r.setDefaultRuleSet(nsRuleSetName);
format = r;
} else {
DecimalFormat f = new DecimalFormat(pattern, symbols, choice);
// System.out.println("loc: " + desiredLocale + " choice: " + choice + " pat: " + pattern + " sym: " + symbols + " result: " + format);
/*Bug 4408066
Add codes for the new method getIntegerInstance() [Richard/GCL]
*/
// TODO: revisit this -- this is almost certainly not the way we want
// to do this. aliu 1/6/2004
if (choice == INTEGERSTYLE) {
f.setMaximumFractionDigits(0);
f.setDecimalSeparatorAlwaysShown(false);
f.setParseIntegerOnly(true);
}
if (choice == CASHCURRENCYSTYLE) {
f.setCurrencyUsage(CurrencyUsage.CASH);
}
format = f;
}
// TODO: the actual locale of the *pattern* may differ from that
// for the *symbols*. For now, we use the data for the symbols.
// Revisit this.
ULocale valid = symbols.getLocale(ULocale.VALID_LOCALE);
ULocale actual = symbols.getLocale(ULocale.ACTUAL_LOCALE);
format.setLocale(valid, actual);
return format;
} | java | static NumberFormat createInstance(ULocale desiredLocale, int choice) {
// If the choice is PLURALCURRENCYSTYLE, the pattern is not a single
// pattern, it is a pattern set, so we do not need to get them here.
// If the choice is ISOCURRENCYSTYLE, the pattern is the currrency
// pattern in the locale but by replacing the single currency sign
// with double currency sign.
String pattern = getPattern(desiredLocale, choice);
DecimalFormatSymbols symbols = new DecimalFormatSymbols(desiredLocale);
// Here we assume that the locale passed in is in the canonical
// form, e.g: pt_PT_@currency=PTE not pt_PT_PREEURO
// This style wont work for currency plural format.
// For currency plural format, the pattern is get from
// the locale (from CurrencyUnitPatterns) without override.
if (choice == CURRENCYSTYLE || choice == ISOCURRENCYSTYLE || choice == ACCOUNTINGCURRENCYSTYLE
|| choice == CASHCURRENCYSTYLE || choice == STANDARDCURRENCYSTYLE) {
String temp = symbols.getCurrencyPattern();
if(temp!=null){
pattern = temp;
}
}
// replace single currency sign in the pattern with double currency sign
// if the choice is ISOCURRENCYSTYLE.
if (choice == ISOCURRENCYSTYLE) {
pattern = pattern.replace("\u00A4", doubleCurrencyStr);
}
// Get the numbering system
NumberingSystem ns = NumberingSystem.getInstance(desiredLocale);
if ( ns == null ) {
return null;
}
NumberFormat format;
if ( ns != null && ns.isAlgorithmic()) {
String nsDesc;
String nsRuleSetGroup;
String nsRuleSetName;
ULocale nsLoc;
int desiredRulesType = RuleBasedNumberFormat.NUMBERING_SYSTEM;
nsDesc = ns.getDescription();
int firstSlash = nsDesc.indexOf("/");
int lastSlash = nsDesc.lastIndexOf("/");
if ( lastSlash > firstSlash ) {
String nsLocID = nsDesc.substring(0,firstSlash);
nsRuleSetGroup = nsDesc.substring(firstSlash+1,lastSlash);
nsRuleSetName = nsDesc.substring(lastSlash+1);
nsLoc = new ULocale(nsLocID);
if ( nsRuleSetGroup.equals("SpelloutRules")) {
desiredRulesType = RuleBasedNumberFormat.SPELLOUT;
}
} else {
nsLoc = desiredLocale;
nsRuleSetName = nsDesc;
}
RuleBasedNumberFormat r = new RuleBasedNumberFormat(nsLoc,desiredRulesType);
r.setDefaultRuleSet(nsRuleSetName);
format = r;
} else {
DecimalFormat f = new DecimalFormat(pattern, symbols, choice);
// System.out.println("loc: " + desiredLocale + " choice: " + choice + " pat: " + pattern + " sym: " + symbols + " result: " + format);
/*Bug 4408066
Add codes for the new method getIntegerInstance() [Richard/GCL]
*/
// TODO: revisit this -- this is almost certainly not the way we want
// to do this. aliu 1/6/2004
if (choice == INTEGERSTYLE) {
f.setMaximumFractionDigits(0);
f.setDecimalSeparatorAlwaysShown(false);
f.setParseIntegerOnly(true);
}
if (choice == CASHCURRENCYSTYLE) {
f.setCurrencyUsage(CurrencyUsage.CASH);
}
format = f;
}
// TODO: the actual locale of the *pattern* may differ from that
// for the *symbols*. For now, we use the data for the symbols.
// Revisit this.
ULocale valid = symbols.getLocale(ULocale.VALID_LOCALE);
ULocale actual = symbols.getLocale(ULocale.ACTUAL_LOCALE);
format.setLocale(valid, actual);
return format;
} | [
"static",
"NumberFormat",
"createInstance",
"(",
"ULocale",
"desiredLocale",
",",
"int",
"choice",
")",
"{",
"// If the choice is PLURALCURRENCYSTYLE, the pattern is not a single",
"// pattern, it is a pattern set, so we do not need to get them here.",
"// If the choice is ISOCURRENCYSTYLE... | Hook for service | [
"Hook",
"for",
"service"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberFormat.java#L1253-L1345 |
33,055 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/XML11Char.java | XML11Char.isXML11ValidLiteral | public static boolean isXML11ValidLiteral(int c) {
return ((c < 0x10000 && ((XML11CHARS[c] & MASK_XML11_VALID) != 0 && (XML11CHARS[c] & MASK_XML11_CONTROL) == 0))
|| (0x10000 <= c && c <= 0x10FFFF));
} | java | public static boolean isXML11ValidLiteral(int c) {
return ((c < 0x10000 && ((XML11CHARS[c] & MASK_XML11_VALID) != 0 && (XML11CHARS[c] & MASK_XML11_CONTROL) == 0))
|| (0x10000 <= c && c <= 0x10FFFF));
} | [
"public",
"static",
"boolean",
"isXML11ValidLiteral",
"(",
"int",
"c",
")",
"{",
"return",
"(",
"(",
"c",
"<",
"0x10000",
"&&",
"(",
"(",
"XML11CHARS",
"[",
"c",
"]",
"&",
"MASK_XML11_VALID",
")",
"!=",
"0",
"&&",
"(",
"XML11CHARS",
"[",
"c",
"]",
"&... | Returns true if the specified character is valid and permitted outside
of a character reference.
That is, this method will return false for the same set as
isXML11Valid, except it also reports false for "control characters".
@param c The character to check. | [
"Returns",
"true",
"if",
"the",
"specified",
"character",
"is",
"valid",
"and",
"permitted",
"outside",
"of",
"a",
"character",
"reference",
".",
"That",
"is",
"this",
"method",
"will",
"return",
"false",
"for",
"the",
"same",
"set",
"as",
"isXML11Valid",
"e... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/XML11Char.java#L196-L199 |
33,056 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AnyTransliterator.java | AnyTransliterator.scriptNameToCode | private static int scriptNameToCode(String name) {
try{
int[] codes = UScript.getCode(name);
return codes != null ? codes[0] : UScript.INVALID_CODE;
}catch( MissingResourceException e){
///CLOVER:OFF
return UScript.INVALID_CODE;
///CLOVER:ON
}
} | java | private static int scriptNameToCode(String name) {
try{
int[] codes = UScript.getCode(name);
return codes != null ? codes[0] : UScript.INVALID_CODE;
}catch( MissingResourceException e){
///CLOVER:OFF
return UScript.INVALID_CODE;
///CLOVER:ON
}
} | [
"private",
"static",
"int",
"scriptNameToCode",
"(",
"String",
"name",
")",
"{",
"try",
"{",
"int",
"[",
"]",
"codes",
"=",
"UScript",
".",
"getCode",
"(",
"name",
")",
";",
"return",
"codes",
"!=",
"null",
"?",
"codes",
"[",
"0",
"]",
":",
"UScript"... | Return the script code for a given name, or
UScript.INVALID_CODE if not found. | [
"Return",
"the",
"script",
"code",
"for",
"a",
"given",
"name",
"or",
"UScript",
".",
"INVALID_CODE",
"if",
"not",
"found",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/AnyTransliterator.java#L283-L292 |
33,057 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java | ElemElement.resolvePrefix | protected String resolvePrefix(SerializationHandler rhandler,
String prefix, String nodeNamespace)
throws TransformerException
{
// if (null != prefix && prefix.length() == 0)
// {
// String foundPrefix = rhandler.getPrefix(nodeNamespace);
//
// // System.out.println("nsPrefix: "+nsPrefix);
// if (null == foundPrefix)
// foundPrefix = "";
// }
return prefix;
} | java | protected String resolvePrefix(SerializationHandler rhandler,
String prefix, String nodeNamespace)
throws TransformerException
{
// if (null != prefix && prefix.length() == 0)
// {
// String foundPrefix = rhandler.getPrefix(nodeNamespace);
//
// // System.out.println("nsPrefix: "+nsPrefix);
// if (null == foundPrefix)
// foundPrefix = "";
// }
return prefix;
} | [
"protected",
"String",
"resolvePrefix",
"(",
"SerializationHandler",
"rhandler",
",",
"String",
"prefix",
",",
"String",
"nodeNamespace",
")",
"throws",
"TransformerException",
"{",
"// if (null != prefix && prefix.length() == 0)",
"// {",
"// String foundPrefix = rhan... | Resolve the namespace into a prefix. Meant to be
overidded by elemAttribute if this class is derived.
@param rhandler The current result tree handler.
@param prefix The probable prefix if already known.
@param nodeNamespace The namespace.
@return The prefix to be used. | [
"Resolve",
"the",
"namespace",
"into",
"a",
"prefix",
".",
"Meant",
"to",
"be",
"overidded",
"by",
"elemAttribute",
"if",
"this",
"class",
"is",
"derived",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemElement.java#L172-L186 |
33,058 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.mapPatternElemPos | private boolean mapPatternElemPos(int nesting, boolean isStart,
boolean isAttrName)
{
if (0 == nesting)
{
if(m_patternMapSize >= m_patternMap.length)
{
int patternMap[] = m_patternMap;
int len = m_patternMap.length;
m_patternMap = new int[m_patternMapSize + 100];
System.arraycopy(patternMap, 0, m_patternMap, 0, len);
}
if (!isStart)
{
m_patternMap[m_patternMapSize - 1] -= TARGETEXTRA;
}
m_patternMap[m_patternMapSize] =
(m_compiler.getTokenQueueSize() - (isAttrName ? 1 : 0)) + TARGETEXTRA;
m_patternMapSize++;
isStart = false;
}
return isStart;
} | java | private boolean mapPatternElemPos(int nesting, boolean isStart,
boolean isAttrName)
{
if (0 == nesting)
{
if(m_patternMapSize >= m_patternMap.length)
{
int patternMap[] = m_patternMap;
int len = m_patternMap.length;
m_patternMap = new int[m_patternMapSize + 100];
System.arraycopy(patternMap, 0, m_patternMap, 0, len);
}
if (!isStart)
{
m_patternMap[m_patternMapSize - 1] -= TARGETEXTRA;
}
m_patternMap[m_patternMapSize] =
(m_compiler.getTokenQueueSize() - (isAttrName ? 1 : 0)) + TARGETEXTRA;
m_patternMapSize++;
isStart = false;
}
return isStart;
} | [
"private",
"boolean",
"mapPatternElemPos",
"(",
"int",
"nesting",
",",
"boolean",
"isStart",
",",
"boolean",
"isAttrName",
")",
"{",
"if",
"(",
"0",
"==",
"nesting",
")",
"{",
"if",
"(",
"m_patternMapSize",
">=",
"m_patternMap",
".",
"length",
")",
"{",
"i... | Record the current position on the token queue as long as
this is a top-level element. Must be called before the
next token is added to the m_tokenQueue.
@param nesting The nesting count for the pattern element.
@param isStart true if this is the start of a pattern.
@param isAttrName true if we have determined that this is an attribute name.
@return true if this is the start of a pattern. | [
"Record",
"the",
"current",
"position",
"on",
"the",
"token",
"queue",
"as",
"long",
"as",
"this",
"is",
"a",
"top",
"-",
"level",
"element",
".",
"Must",
"be",
"called",
"before",
"the",
"next",
"token",
"is",
"added",
"to",
"the",
"m_tokenQueue",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L396-L422 |
33,059 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.getTokenQueuePosFromMap | private int getTokenQueuePosFromMap(int i)
{
int pos = m_patternMap[i];
return (pos >= TARGETEXTRA) ? (pos - TARGETEXTRA) : pos;
} | java | private int getTokenQueuePosFromMap(int i)
{
int pos = m_patternMap[i];
return (pos >= TARGETEXTRA) ? (pos - TARGETEXTRA) : pos;
} | [
"private",
"int",
"getTokenQueuePosFromMap",
"(",
"int",
"i",
")",
"{",
"int",
"pos",
"=",
"m_patternMap",
"[",
"i",
"]",
";",
"return",
"(",
"pos",
">=",
"TARGETEXTRA",
")",
"?",
"(",
"pos",
"-",
"TARGETEXTRA",
")",
":",
"pos",
";",
"}"
] | Given a map pos, return the corresponding token queue pos.
@param i The index in the m_patternMap.
@return the token queue position. | [
"Given",
"a",
"map",
"pos",
"return",
"the",
"corresponding",
"token",
"queue",
"pos",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L431-L437 |
33,060 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.resetTokenMark | private final void resetTokenMark(int mark)
{
int qsz = m_compiler.getTokenQueueSize();
m_processor.m_queueMark = (mark > 0)
? ((mark <= qsz) ? mark - 1 : mark) : 0;
if (m_processor.m_queueMark < qsz)
{
m_processor.m_token =
(String) m_compiler.getTokenQueue().elementAt(m_processor.m_queueMark++);
m_processor.m_tokenChar = m_processor.m_token.charAt(0);
}
else
{
m_processor.m_token = null;
m_processor.m_tokenChar = 0;
}
} | java | private final void resetTokenMark(int mark)
{
int qsz = m_compiler.getTokenQueueSize();
m_processor.m_queueMark = (mark > 0)
? ((mark <= qsz) ? mark - 1 : mark) : 0;
if (m_processor.m_queueMark < qsz)
{
m_processor.m_token =
(String) m_compiler.getTokenQueue().elementAt(m_processor.m_queueMark++);
m_processor.m_tokenChar = m_processor.m_token.charAt(0);
}
else
{
m_processor.m_token = null;
m_processor.m_tokenChar = 0;
}
} | [
"private",
"final",
"void",
"resetTokenMark",
"(",
"int",
"mark",
")",
"{",
"int",
"qsz",
"=",
"m_compiler",
".",
"getTokenQueueSize",
"(",
")",
";",
"m_processor",
".",
"m_queueMark",
"=",
"(",
"mark",
">",
"0",
")",
"?",
"(",
"(",
"mark",
"<=",
"qsz"... | Reset token queue mark and m_token to a
given position.
@param mark The new position. | [
"Reset",
"token",
"queue",
"mark",
"and",
"m_token",
"to",
"a",
"given",
"position",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L444-L463 |
33,061 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.getKeywordToken | final int getKeywordToken(String key)
{
int tok;
try
{
Integer itok = (Integer) Keywords.getKeyWord(key);
tok = (null != itok) ? itok.intValue() : 0;
}
catch (NullPointerException npe)
{
tok = 0;
}
catch (ClassCastException cce)
{
tok = 0;
}
return tok;
} | java | final int getKeywordToken(String key)
{
int tok;
try
{
Integer itok = (Integer) Keywords.getKeyWord(key);
tok = (null != itok) ? itok.intValue() : 0;
}
catch (NullPointerException npe)
{
tok = 0;
}
catch (ClassCastException cce)
{
tok = 0;
}
return tok;
} | [
"final",
"int",
"getKeywordToken",
"(",
"String",
"key",
")",
"{",
"int",
"tok",
";",
"try",
"{",
"Integer",
"itok",
"=",
"(",
"Integer",
")",
"Keywords",
".",
"getKeyWord",
"(",
"key",
")",
";",
"tok",
"=",
"(",
"null",
"!=",
"itok",
")",
"?",
"it... | Given a string, return the corresponding keyword token.
@param key The keyword.
@return An opcode value. | [
"Given",
"a",
"string",
"return",
"the",
"corresponding",
"keyword",
"token",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L472-L493 |
33,062 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.recordTokenString | private void recordTokenString(Vector targetStrings)
{
int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1);
resetTokenMark(tokPos + 1);
if (m_processor.lookahead('(', 1))
{
int tok = getKeywordToken(m_processor.m_token);
switch (tok)
{
case OpCodes.NODETYPE_COMMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
break;
case OpCodes.NODETYPE_TEXT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
break;
case OpCodes.NODETYPE_NODE :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_ROOT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
break;
case OpCodes.NODETYPE_ANYELEMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_PI :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
default :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
}
}
else
{
if (m_processor.tokenIs('@'))
{
tokPos++;
resetTokenMark(tokPos + 1);
}
if (m_processor.lookahead(':', 1))
{
tokPos += 2;
}
targetStrings.addElement(m_compiler.getTokenQueue().elementAt(tokPos));
}
} | java | private void recordTokenString(Vector targetStrings)
{
int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1);
resetTokenMark(tokPos + 1);
if (m_processor.lookahead('(', 1))
{
int tok = getKeywordToken(m_processor.m_token);
switch (tok)
{
case OpCodes.NODETYPE_COMMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
break;
case OpCodes.NODETYPE_TEXT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
break;
case OpCodes.NODETYPE_NODE :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_ROOT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
break;
case OpCodes.NODETYPE_ANYELEMENT :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
case OpCodes.NODETYPE_PI :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
break;
default :
targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
}
}
else
{
if (m_processor.tokenIs('@'))
{
tokPos++;
resetTokenMark(tokPos + 1);
}
if (m_processor.lookahead(':', 1))
{
tokPos += 2;
}
targetStrings.addElement(m_compiler.getTokenQueue().elementAt(tokPos));
}
} | [
"private",
"void",
"recordTokenString",
"(",
"Vector",
"targetStrings",
")",
"{",
"int",
"tokPos",
"=",
"getTokenQueuePosFromMap",
"(",
"m_patternMapSize",
"-",
"1",
")",
";",
"resetTokenMark",
"(",
"tokPos",
"+",
"1",
")",
";",
"if",
"(",
"m_processor",
".",
... | Record the current token in the passed vector.
@param targetStrings Vector of string. | [
"Record",
"the",
"current",
"token",
"in",
"the",
"passed",
"vector",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L500-L551 |
33,063 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java | Lexer.mapNSTokens | private int mapNSTokens(String pat, int startSubstring, int posOfNSSep,
int posOfScan)
throws javax.xml.transform.TransformerException
{
String prefix = "";
if ((startSubstring >= 0) && (posOfNSSep >= 0))
{
prefix = pat.substring(startSubstring, posOfNSSep);
}
String uName;
if ((null != m_namespaceContext) &&!prefix.equals("*")
&&!prefix.equals("xmlns"))
{
try
{
if (prefix.length() > 0)
uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
prefix);
else
{
// Assume last was wildcard. This is not legal according
// to the draft. Set the below to true to make namespace
// wildcards work.
if (false)
{
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
return -1;
}
else
{
uName =
((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
prefix);
}
}
}
catch (ClassCastException cce)
{
uName = m_namespaceContext.getNamespaceForPrefix(prefix);
}
}
else
{
uName = prefix;
}
if ((null != uName) && (uName.length() > 0))
{
addToTokenQueue(uName);
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
}
else
{
// To older XPath code it doesn't matter if
// error() is called or errorForDOM3().
m_processor.errorForDOM3(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
/** old code commented out 17-Sep-2004
// error("Could not locate namespace for prefix: "+prefix);
// m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
// new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
*/
/*** Old code commented out 10-Jan-2001
addToTokenQueue(prefix);
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
***/
}
return -1;
} | java | private int mapNSTokens(String pat, int startSubstring, int posOfNSSep,
int posOfScan)
throws javax.xml.transform.TransformerException
{
String prefix = "";
if ((startSubstring >= 0) && (posOfNSSep >= 0))
{
prefix = pat.substring(startSubstring, posOfNSSep);
}
String uName;
if ((null != m_namespaceContext) &&!prefix.equals("*")
&&!prefix.equals("xmlns"))
{
try
{
if (prefix.length() > 0)
uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
prefix);
else
{
// Assume last was wildcard. This is not legal according
// to the draft. Set the below to true to make namespace
// wildcards work.
if (false)
{
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
return -1;
}
else
{
uName =
((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
prefix);
}
}
}
catch (ClassCastException cce)
{
uName = m_namespaceContext.getNamespaceForPrefix(prefix);
}
}
else
{
uName = prefix;
}
if ((null != uName) && (uName.length() > 0))
{
addToTokenQueue(uName);
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
}
else
{
// To older XPath code it doesn't matter if
// error() is called or errorForDOM3().
m_processor.errorForDOM3(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
/** old code commented out 17-Sep-2004
// error("Could not locate namespace for prefix: "+prefix);
// m_processor.error(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
// new String[] {prefix}); //"Prefix must resolve to a namespace: {0}";
*/
/*** Old code commented out 10-Jan-2001
addToTokenQueue(prefix);
addToTokenQueue(":");
String s = pat.substring(posOfNSSep + 1, posOfScan);
if (s.length() > 0)
addToTokenQueue(s);
***/
}
return -1;
} | [
"private",
"int",
"mapNSTokens",
"(",
"String",
"pat",
",",
"int",
"startSubstring",
",",
"int",
"posOfNSSep",
",",
"int",
"posOfScan",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"String",
"prefix",
"=",
"\"\"",
"... | When a seperator token is found, see if there's a element name or
the like to map.
@param pat The XPath name string.
@param startSubstring The start of the name string.
@param posOfNSSep The position of the namespace seperator (':').
@param posOfScan The end of the name index.
@throws javax.xml.transform.TransformerException
@return -1 always. | [
"When",
"a",
"seperator",
"token",
"is",
"found",
"see",
"if",
"there",
"s",
"a",
"element",
"name",
"or",
"the",
"like",
"to",
"map",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/compiler/Lexer.java#L577-L668 |
33,064 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.getLocale | public ULocale getLocale(int index) {
List<ULocale> lcls = locales;
if (lcls == null) {
lcls = guessLocales();
}
if (index >= 0 && index < lcls.size()) {
return lcls.get(index);
}
return null;
} | java | public ULocale getLocale(int index) {
List<ULocale> lcls = locales;
if (lcls == null) {
lcls = guessLocales();
}
if (index >= 0 && index < lcls.size()) {
return lcls.get(index);
}
return null;
} | [
"public",
"ULocale",
"getLocale",
"(",
"int",
"index",
")",
"{",
"List",
"<",
"ULocale",
">",
"lcls",
"=",
"locales",
";",
"if",
"(",
"lcls",
"==",
"null",
")",
"{",
"lcls",
"=",
"guessLocales",
"(",
")",
";",
"}",
"if",
"(",
"index",
">=",
"0",
... | Convenience function for getting the locales in priority order
@param index The index (0..n) of the desired item.
@return desired item. null if index is out of range
@hide draft / provisional / internal are hidden on Android | [
"Convenience",
"function",
"for",
"getting",
"the",
"locales",
"in",
"priority",
"order"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L196-L205 |
33,065 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setLocales | public GlobalizationPreferences setLocales(String acceptLanguageString) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
ULocale[] acceptLocales = null;
try {
acceptLocales = ULocale.parseAcceptLanguage(acceptLanguageString, true);
} catch (ParseException pe) {
//TODO: revisit after 3.8
throw new IllegalArgumentException("Invalid Accept-Language string");
}
return setLocales(acceptLocales);
} | java | public GlobalizationPreferences setLocales(String acceptLanguageString) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
ULocale[] acceptLocales = null;
try {
acceptLocales = ULocale.parseAcceptLanguage(acceptLanguageString, true);
} catch (ParseException pe) {
//TODO: revisit after 3.8
throw new IllegalArgumentException("Invalid Accept-Language string");
}
return setLocales(acceptLocales);
} | [
"public",
"GlobalizationPreferences",
"setLocales",
"(",
"String",
"acceptLanguageString",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
"}",
"ULocale",
"[... | Convenience routine for setting the locale priority list from
an Accept-Language string.
@see #setLocales(List locales)
@param acceptLanguageString Accept-Language list, as defined by
Section 14.4 of the RFC 2616 (HTTP 1.1)
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Convenience",
"routine",
"for",
"setting",
"the",
"locale",
"priority",
"list",
"from",
"an",
"Accept",
"-",
"Language",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L248-L260 |
33,066 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setCalendar | public GlobalizationPreferences setCalendar(Calendar calendar) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
this.calendar = (Calendar) calendar.clone(); // clone for safety
return this;
} | java | public GlobalizationPreferences setCalendar(Calendar calendar) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
this.calendar = (Calendar) calendar.clone(); // clone for safety
return this;
} | [
"public",
"GlobalizationPreferences",
"setCalendar",
"(",
"Calendar",
"calendar",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
"}",
"this",
".",
"calend... | Sets the calendar. If this has not been set, uses default for territory.
@param calendar arbitrary calendar
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Sets",
"the",
"calendar",
".",
"If",
"this",
"has",
"not",
"been",
"set",
"uses",
"default",
"for",
"territory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L400-L406 |
33,067 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.getCalendar | public Calendar getCalendar() {
if (calendar == null) {
return guessCalendar();
}
Calendar temp = (Calendar) calendar.clone(); // clone for safety
temp.setTimeZone(getTimeZone());
temp.setTimeInMillis(System.currentTimeMillis());
return temp;
} | java | public Calendar getCalendar() {
if (calendar == null) {
return guessCalendar();
}
Calendar temp = (Calendar) calendar.clone(); // clone for safety
temp.setTimeZone(getTimeZone());
temp.setTimeInMillis(System.currentTimeMillis());
return temp;
} | [
"public",
"Calendar",
"getCalendar",
"(",
")",
"{",
"if",
"(",
"calendar",
"==",
"null",
")",
"{",
"return",
"guessCalendar",
"(",
")",
";",
"}",
"Calendar",
"temp",
"=",
"(",
"Calendar",
")",
"calendar",
".",
"clone",
"(",
")",
";",
"// clone for safety... | Get a copy of the calendar according to the settings.
@return calendar explicit or implicit.
@hide draft / provisional / internal are hidden on Android | [
"Get",
"a",
"copy",
"of",
"the",
"calendar",
"according",
"to",
"the",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L414-L422 |
33,068 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setTimeZone | public GlobalizationPreferences setTimeZone(TimeZone timezone) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
this.timezone = (TimeZone) timezone.clone(); // clone for safety;
return this;
} | java | public GlobalizationPreferences setTimeZone(TimeZone timezone) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
this.timezone = (TimeZone) timezone.clone(); // clone for safety;
return this;
} | [
"public",
"GlobalizationPreferences",
"setTimeZone",
"(",
"TimeZone",
"timezone",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
"}",
"this",
".",
"timezo... | Sets the timezone ID. If this has not been set, uses default for territory.
@param timezone a valid TZID (see UTS#35).
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Sets",
"the",
"timezone",
"ID",
".",
"If",
"this",
"has",
"not",
"been",
"set",
"uses",
"default",
"for",
"territory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L431-L437 |
33,069 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.getCollator | public Collator getCollator() {
if (collator == null) {
return guessCollator();
}
try {
return (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
} | java | public Collator getCollator() {
if (collator == null) {
return guessCollator();
}
try {
return (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
} | [
"public",
"Collator",
"getCollator",
"(",
")",
"{",
"if",
"(",
"collator",
"==",
"null",
")",
"{",
"return",
"guessCollator",
"(",
")",
";",
"}",
"try",
"{",
"return",
"(",
"Collator",
")",
"collator",
".",
"clone",
"(",
")",
";",
"// clone for safety",
... | Get a copy of the collator according to the settings.
@return collator explicit or implicit.
@hide draft / provisional / internal are hidden on Android | [
"Get",
"a",
"copy",
"of",
"the",
"collator",
"according",
"to",
"the",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L459-L468 |
33,070 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setCollator | public GlobalizationPreferences setCollator(Collator collator) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
try {
this.collator = (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
return this;
} | java | public GlobalizationPreferences setCollator(Collator collator) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
try {
this.collator = (Collator) collator.clone(); // clone for safety
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException("Error in cloning collator", e);
}
return this;
} | [
"public",
"GlobalizationPreferences",
"setCollator",
"(",
"Collator",
"collator",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
"}",
"try",
"{",
"this",
... | Explicitly set the collator for this object.
@param collator The collator object to be passed.
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Explicitly",
"set",
"the",
"collator",
"for",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L476-L486 |
33,071 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.getBreakIterator | public BreakIterator getBreakIterator(int type) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
throw new IllegalArgumentException("Illegal break iterator type");
}
if (breakIterators == null || breakIterators[type] == null) {
return guessBreakIterator(type);
}
return (BreakIterator) breakIterators[type].clone(); // clone for safety
} | java | public BreakIterator getBreakIterator(int type) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
throw new IllegalArgumentException("Illegal break iterator type");
}
if (breakIterators == null || breakIterators[type] == null) {
return guessBreakIterator(type);
}
return (BreakIterator) breakIterators[type].clone(); // clone for safety
} | [
"public",
"BreakIterator",
"getBreakIterator",
"(",
"int",
"type",
")",
"{",
"if",
"(",
"type",
"<",
"BI_CHARACTER",
"||",
"type",
">=",
"BI_LIMIT",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal break iterator type\"",
")",
";",
"}",
"if"... | Get a copy of the break iterator for the specified type according to the
settings.
@param type break type - BI_CHARACTER or BI_WORD, BI_LINE, BI_SENTENCE, BI_TITLE
@return break iterator explicit or implicit
@hide draft / provisional / internal are hidden on Android | [
"Get",
"a",
"copy",
"of",
"the",
"break",
"iterator",
"for",
"the",
"specified",
"type",
"according",
"to",
"the",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L496-L504 |
33,072 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setBreakIterator | public GlobalizationPreferences setBreakIterator(int type, BreakIterator iterator) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
throw new IllegalArgumentException("Illegal break iterator type");
}
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (breakIterators == null)
breakIterators = new BreakIterator[BI_LIMIT];
breakIterators[type] = (BreakIterator) iterator.clone(); // clone for safety
return this;
} | java | public GlobalizationPreferences setBreakIterator(int type, BreakIterator iterator) {
if (type < BI_CHARACTER || type >= BI_LIMIT) {
throw new IllegalArgumentException("Illegal break iterator type");
}
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (breakIterators == null)
breakIterators = new BreakIterator[BI_LIMIT];
breakIterators[type] = (BreakIterator) iterator.clone(); // clone for safety
return this;
} | [
"public",
"GlobalizationPreferences",
"setBreakIterator",
"(",
"int",
"type",
",",
"BreakIterator",
"iterator",
")",
"{",
"if",
"(",
"type",
"<",
"BI_CHARACTER",
"||",
"type",
">=",
"BI_LIMIT",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Illegal ... | Explicitly set the break iterator for this object.
@param type break type - BI_CHARACTER or BI_WORD, BI_LINE, BI_SENTENCE, BI_TITLE
@param iterator a break iterator
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Explicitly",
"set",
"the",
"break",
"iterator",
"for",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L514-L525 |
33,073 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setDateFormat | public GlobalizationPreferences setDateFormat(int dateStyle, int timeStyle, DateFormat format) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (dateFormats == null) {
dateFormats = new DateFormat[DF_LIMIT][DF_LIMIT];
}
dateFormats[dateStyle][timeStyle] = (DateFormat) format.clone(); // for safety
return this;
} | java | public GlobalizationPreferences setDateFormat(int dateStyle, int timeStyle, DateFormat format) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (dateFormats == null) {
dateFormats = new DateFormat[DF_LIMIT][DF_LIMIT];
}
dateFormats[dateStyle][timeStyle] = (DateFormat) format.clone(); // for safety
return this;
} | [
"public",
"GlobalizationPreferences",
"setDateFormat",
"(",
"int",
"dateStyle",
",",
"int",
"timeStyle",
",",
"DateFormat",
"format",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immu... | Set an explicit date format. Overrides the locale priority list for
a particular combination of dateStyle and timeStyle. DF_NONE should
be used if for the style, where only the date or time format individually
is being set.
@param dateStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE
@param timeStyle DF_FULL, DF_LONG, DF_MEDIUM, DF_SHORT or DF_NONE
@param format The date format
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Set",
"an",
"explicit",
"date",
"format",
".",
"Overrides",
"the",
"locale",
"priority",
"list",
"for",
"a",
"particular",
"combination",
"of",
"dateStyle",
"and",
"timeStyle",
".",
"DF_NONE",
"should",
"be",
"used",
"if",
"for",
"the",
"style",
"where",
"o... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L639-L648 |
33,074 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.setNumberFormat | public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (numberFormats == null) {
numberFormats = new NumberFormat[NF_LIMIT];
}
numberFormats[style] = (NumberFormat) format.clone(); // for safety
return this;
} | java | public GlobalizationPreferences setNumberFormat(int style, NumberFormat format) {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
if (numberFormats == null) {
numberFormats = new NumberFormat[NF_LIMIT];
}
numberFormats[style] = (NumberFormat) format.clone(); // for safety
return this;
} | [
"public",
"GlobalizationPreferences",
"setNumberFormat",
"(",
"int",
"style",
",",
"NumberFormat",
"format",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
... | Sets a number format explicitly. Overrides the general locale settings.
@param style NF_NUMBER, NF_CURRENCY, NF_PERCENT, NF_SCIENTIFIC, NF_INTEGER
@param format The number format
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Sets",
"a",
"number",
"format",
"explicitly",
".",
"Overrides",
"the",
"general",
"locale",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L715-L724 |
33,075 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.reset | public GlobalizationPreferences reset() {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
locales = null;
territory = null;
calendar = null;
collator = null;
breakIterators = null;
timezone = null;
currency = null;
dateFormats = null;
numberFormats = null;
implicitLocales = null;
return this;
} | java | public GlobalizationPreferences reset() {
if (isFrozen()) {
throw new UnsupportedOperationException("Attempt to modify immutable object");
}
locales = null;
territory = null;
calendar = null;
collator = null;
breakIterators = null;
timezone = null;
currency = null;
dateFormats = null;
numberFormats = null;
implicitLocales = null;
return this;
} | [
"public",
"GlobalizationPreferences",
"reset",
"(",
")",
"{",
"if",
"(",
"isFrozen",
"(",
")",
")",
"{",
"throw",
"new",
"UnsupportedOperationException",
"(",
"\"Attempt to modify immutable object\"",
")",
";",
"}",
"locales",
"=",
"null",
";",
"territory",
"=",
... | Restore the object to the initial state.
@return this, for chaining
@hide draft / provisional / internal are hidden on Android | [
"Restore",
"the",
"object",
"to",
"the",
"initial",
"state",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L732-L747 |
33,076 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java | GlobalizationPreferences.guessTerritory | protected String guessTerritory() {
String result;
// pass through locales to see if there is a territory.
for (ULocale locale : getLocales()) {
result = locale.getCountry();
if (result.length() != 0) {
return result;
}
}
// if not, guess from the first language tag, or maybe from
// intersection of languages, eg nl + fr => BE
// TODO: fix using real data
// for now, just use fixed values
ULocale firstLocale = getLocale(0);
String language = firstLocale.getLanguage();
String script = firstLocale.getScript();
result = null;
if (script.length() != 0) {
result = language_territory_hack_map.get(language + "_" + script);
}
if (result == null) {
result = language_territory_hack_map.get(language);
}
if (result == null) {
result = "US"; // need *some* default
}
return result;
} | java | protected String guessTerritory() {
String result;
// pass through locales to see if there is a territory.
for (ULocale locale : getLocales()) {
result = locale.getCountry();
if (result.length() != 0) {
return result;
}
}
// if not, guess from the first language tag, or maybe from
// intersection of languages, eg nl + fr => BE
// TODO: fix using real data
// for now, just use fixed values
ULocale firstLocale = getLocale(0);
String language = firstLocale.getLanguage();
String script = firstLocale.getScript();
result = null;
if (script.length() != 0) {
result = language_territory_hack_map.get(language + "_" + script);
}
if (result == null) {
result = language_territory_hack_map.get(language);
}
if (result == null) {
result = "US"; // need *some* default
}
return result;
} | [
"protected",
"String",
"guessTerritory",
"(",
")",
"{",
"String",
"result",
";",
"// pass through locales to see if there is a territory.",
"for",
"(",
"ULocale",
"locale",
":",
"getLocales",
"(",
")",
")",
"{",
"result",
"=",
"locale",
".",
"getCountry",
"(",
")"... | This function can be overridden by subclasses to use different heuristics.
@hide draft / provisional / internal are hidden on Android | [
"This",
"function",
"can",
"be",
"overridden",
"by",
"subclasses",
"to",
"use",
"different",
"heuristics",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GlobalizationPreferences.java#L973-L1000 |
33,077 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DefaultErrorHandler.java | DefaultErrorHandler.error | public void error(TransformerException exception) throws TransformerException
{
// If the m_throwExceptionOnError flag is true, rethrow the exception.
// Otherwise report the error to System.err.
if (m_throwExceptionOnError)
throw exception;
else
{
PrintWriter pw = getErrorWriter();
printLocation(pw, exception);
pw.println(exception.getMessage());
}
} | java | public void error(TransformerException exception) throws TransformerException
{
// If the m_throwExceptionOnError flag is true, rethrow the exception.
// Otherwise report the error to System.err.
if (m_throwExceptionOnError)
throw exception;
else
{
PrintWriter pw = getErrorWriter();
printLocation(pw, exception);
pw.println(exception.getMessage());
}
} | [
"public",
"void",
"error",
"(",
"TransformerException",
"exception",
")",
"throws",
"TransformerException",
"{",
"// If the m_throwExceptionOnError flag is true, rethrow the exception.",
"// Otherwise report the error to System.err.",
"if",
"(",
"m_throwExceptionOnError",
")",
"throw... | Receive notification of a recoverable error.
<p>This corresponds to the definition of "error" in section 1.2
of the W3C XML 1.0 Recommendation. For example, a validating
parser would use this callback to report the violation of a
validity constraint. The default behaviour is to take no
action.</p>
<p>The SAX parser must continue to provide normal parsing events
after invoking this method: it should still be possible for the
application to process the document through to the end. If the
application cannot do so, then the parser should report a fatal
error even if the XML 1.0 recommendation does not require it to
do so.</p>
@param exception The error information encapsulated in a
SAX parse exception.
@throws javax.xml.transform.TransformerException Any SAX exception, possibly
wrapping another exception.
@see javax.xml.transform.TransformerException | [
"Receive",
"notification",
"of",
"a",
"recoverable",
"error",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/DefaultErrorHandler.java#L228-L241 |
33,078 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.readInput | private void readInput() {
if (buf.limit() == buf.capacity())
makeSpace();
// Prepare to receive data
int p = buf.position();
buf.position(buf.limit());
buf.limit(buf.capacity());
int n = 0;
try {
n = source.read(buf);
} catch (IOException ioe) {
lastException = ioe;
n = -1;
}
if (n == -1) {
sourceClosed = true;
needInput = false;
}
if (n > 0)
needInput = false;
// Restore current position and limit for reading
buf.limit(buf.position());
buf.position(p);
// Android-changed: The matcher implementation eagerly calls toString() so we'll have
// to update its input whenever the buffer limit, position etc. changes.
matcher.reset(buf);
} | java | private void readInput() {
if (buf.limit() == buf.capacity())
makeSpace();
// Prepare to receive data
int p = buf.position();
buf.position(buf.limit());
buf.limit(buf.capacity());
int n = 0;
try {
n = source.read(buf);
} catch (IOException ioe) {
lastException = ioe;
n = -1;
}
if (n == -1) {
sourceClosed = true;
needInput = false;
}
if (n > 0)
needInput = false;
// Restore current position and limit for reading
buf.limit(buf.position());
buf.position(p);
// Android-changed: The matcher implementation eagerly calls toString() so we'll have
// to update its input whenever the buffer limit, position etc. changes.
matcher.reset(buf);
} | [
"private",
"void",
"readInput",
"(",
")",
"{",
"if",
"(",
"buf",
".",
"limit",
"(",
")",
"==",
"buf",
".",
"capacity",
"(",
")",
")",
"makeSpace",
"(",
")",
";",
"// Prepare to receive data",
"int",
"p",
"=",
"buf",
".",
"position",
"(",
")",
";",
... | Tries to read more input. May block. | [
"Tries",
"to",
"read",
"more",
"input",
".",
"May",
"block",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L757-L788 |
33,079 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.makeSpace | private boolean makeSpace() {
clearCaches();
int offset = savedScannerPosition == -1 ?
position : savedScannerPosition;
buf.position(offset);
// Gain space by compacting buffer
if (offset > 0) {
buf.compact();
translateSavedIndexes(offset);
position -= offset;
buf.flip();
return true;
}
// Gain space by growing buffer
int newSize = buf.capacity() * 2;
CharBuffer newBuf = CharBuffer.allocate(newSize);
newBuf.put(buf);
newBuf.flip();
translateSavedIndexes(offset);
position -= offset;
buf = newBuf;
matcher.reset(buf);
return true;
} | java | private boolean makeSpace() {
clearCaches();
int offset = savedScannerPosition == -1 ?
position : savedScannerPosition;
buf.position(offset);
// Gain space by compacting buffer
if (offset > 0) {
buf.compact();
translateSavedIndexes(offset);
position -= offset;
buf.flip();
return true;
}
// Gain space by growing buffer
int newSize = buf.capacity() * 2;
CharBuffer newBuf = CharBuffer.allocate(newSize);
newBuf.put(buf);
newBuf.flip();
translateSavedIndexes(offset);
position -= offset;
buf = newBuf;
matcher.reset(buf);
return true;
} | [
"private",
"boolean",
"makeSpace",
"(",
")",
"{",
"clearCaches",
"(",
")",
";",
"int",
"offset",
"=",
"savedScannerPosition",
"==",
"-",
"1",
"?",
"position",
":",
"savedScannerPosition",
";",
"buf",
".",
"position",
"(",
"offset",
")",
";",
"// Gain space b... | or else there will be space in the buffer | [
"or",
"else",
"there",
"will",
"be",
"space",
"in",
"the",
"buffer"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L792-L815 |
33,080 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.hasTokenInBuffer | private boolean hasTokenInBuffer() {
matchValid = false;
matcher.usePattern(delimPattern);
matcher.region(position, buf.limit());
// Skip delims first
if (matcher.lookingAt())
position = matcher.end();
// If we are sitting at the end, no more tokens in buffer
if (position == buf.limit())
return false;
return true;
} | java | private boolean hasTokenInBuffer() {
matchValid = false;
matcher.usePattern(delimPattern);
matcher.region(position, buf.limit());
// Skip delims first
if (matcher.lookingAt())
position = matcher.end();
// If we are sitting at the end, no more tokens in buffer
if (position == buf.limit())
return false;
return true;
} | [
"private",
"boolean",
"hasTokenInBuffer",
"(",
")",
"{",
"matchValid",
"=",
"false",
";",
"matcher",
".",
"usePattern",
"(",
"delimPattern",
")",
";",
"matcher",
".",
"region",
"(",
"position",
",",
"buf",
".",
"limit",
"(",
")",
")",
";",
"// Skip delims ... | means that there will be another token with or without more input. | [
"means",
"that",
"there",
"will",
"be",
"another",
"token",
"with",
"or",
"without",
"more",
"input",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L837-L851 |
33,081 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.findPatternInBuffer | private String findPatternInBuffer(Pattern pattern, int horizon) {
matchValid = false;
matcher.usePattern(pattern);
int bufferLimit = buf.limit();
int horizonLimit = -1;
int searchLimit = bufferLimit;
if (horizon > 0) {
horizonLimit = position + horizon;
if (horizonLimit < bufferLimit)
searchLimit = horizonLimit;
}
matcher.region(position, searchLimit);
if (matcher.find()) {
if (matcher.hitEnd() && (!sourceClosed)) {
// The match may be longer if didn't hit horizon or real end
if (searchLimit != horizonLimit) {
// Hit an artificial end; try to extend the match
needInput = true;
return null;
}
// The match could go away depending on what is next
if ((searchLimit == horizonLimit) && matcher.requireEnd()) {
// Rare case: we hit the end of input and it happens
// that it is at the horizon and the end of input is
// required for the match.
needInput = true;
return null;
}
}
// Did not hit end, or hit real end, or hit horizon
position = matcher.end();
return matcher.group();
}
if (sourceClosed)
return null;
// If there is no specified horizon, or if we have not searched
// to the specified horizon yet, get more input
if ((horizon == 0) || (searchLimit != horizonLimit))
needInput = true;
return null;
} | java | private String findPatternInBuffer(Pattern pattern, int horizon) {
matchValid = false;
matcher.usePattern(pattern);
int bufferLimit = buf.limit();
int horizonLimit = -1;
int searchLimit = bufferLimit;
if (horizon > 0) {
horizonLimit = position + horizon;
if (horizonLimit < bufferLimit)
searchLimit = horizonLimit;
}
matcher.region(position, searchLimit);
if (matcher.find()) {
if (matcher.hitEnd() && (!sourceClosed)) {
// The match may be longer if didn't hit horizon or real end
if (searchLimit != horizonLimit) {
// Hit an artificial end; try to extend the match
needInput = true;
return null;
}
// The match could go away depending on what is next
if ((searchLimit == horizonLimit) && matcher.requireEnd()) {
// Rare case: we hit the end of input and it happens
// that it is at the horizon and the end of input is
// required for the match.
needInput = true;
return null;
}
}
// Did not hit end, or hit real end, or hit horizon
position = matcher.end();
return matcher.group();
}
if (sourceClosed)
return null;
// If there is no specified horizon, or if we have not searched
// to the specified horizon yet, get more input
if ((horizon == 0) || (searchLimit != horizonLimit))
needInput = true;
return null;
} | [
"private",
"String",
"findPatternInBuffer",
"(",
"Pattern",
"pattern",
",",
"int",
"horizon",
")",
"{",
"matchValid",
"=",
"false",
";",
"matcher",
".",
"usePattern",
"(",
"pattern",
")",
";",
"int",
"bufferLimit",
"=",
"buf",
".",
"limit",
"(",
")",
";",
... | Returns a match for the specified input pattern. | [
"Returns",
"a",
"match",
"for",
"the",
"specified",
"input",
"pattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L966-L1008 |
33,082 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.matchPatternInBuffer | private String matchPatternInBuffer(Pattern pattern) {
matchValid = false;
matcher.usePattern(pattern);
matcher.region(position, buf.limit());
if (matcher.lookingAt()) {
if (matcher.hitEnd() && (!sourceClosed)) {
// Get more input and try again
needInput = true;
return null;
}
position = matcher.end();
return matcher.group();
}
if (sourceClosed)
return null;
// Read more to find pattern
needInput = true;
return null;
} | java | private String matchPatternInBuffer(Pattern pattern) {
matchValid = false;
matcher.usePattern(pattern);
matcher.region(position, buf.limit());
if (matcher.lookingAt()) {
if (matcher.hitEnd() && (!sourceClosed)) {
// Get more input and try again
needInput = true;
return null;
}
position = matcher.end();
return matcher.group();
}
if (sourceClosed)
return null;
// Read more to find pattern
needInput = true;
return null;
} | [
"private",
"String",
"matchPatternInBuffer",
"(",
"Pattern",
"pattern",
")",
"{",
"matchValid",
"=",
"false",
";",
"matcher",
".",
"usePattern",
"(",
"pattern",
")",
";",
"matcher",
".",
"region",
"(",
"position",
",",
"buf",
".",
"limit",
"(",
")",
")",
... | the current position | [
"the",
"current",
"position"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1012-L1032 |
33,083 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.close | public void close() {
if (closed)
return;
if (source instanceof Closeable) {
try {
((Closeable)source).close();
} catch (IOException ioe) {
lastException = ioe;
}
}
sourceClosed = true;
source = null;
closed = true;
} | java | public void close() {
if (closed)
return;
if (source instanceof Closeable) {
try {
((Closeable)source).close();
} catch (IOException ioe) {
lastException = ioe;
}
}
sourceClosed = true;
source = null;
closed = true;
} | [
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"closed",
")",
"return",
";",
"if",
"(",
"source",
"instanceof",
"Closeable",
")",
"{",
"try",
"{",
"(",
"(",
"Closeable",
")",
"source",
")",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"I... | Closes this scanner.
<p> If this scanner has not yet been closed then if its underlying
{@linkplain java.lang.Readable readable} also implements the {@link
java.io.Closeable} interface then the readable's <tt>close</tt> method
will be invoked. If this scanner is already closed then invoking this
method will have no effect.
<p>Attempting to perform search operations after a scanner has
been closed will result in an {@link IllegalStateException}. | [
"Closes",
"this",
"scanner",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1055-L1068 |
33,084 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.useLocale | public Scanner useLocale(Locale locale) {
if (locale.equals(this.locale))
return this;
this.locale = locale;
DecimalFormat df =
(DecimalFormat)NumberFormat.getNumberInstance(locale);
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
// These must be literalized to avoid collision with regex
// metacharacters such as dot or parenthesis
groupSeparator = "\\" + dfs.getGroupingSeparator();
decimalSeparator = "\\" + dfs.getDecimalSeparator();
// Quoting the nonzero length locale-specific things
// to avoid potential conflict with metacharacters
nanString = "\\Q" + dfs.getNaN() + "\\E";
infinityString = "\\Q" + dfs.getInfinity() + "\\E";
positivePrefix = df.getPositivePrefix();
if (positivePrefix.length() > 0)
positivePrefix = "\\Q" + positivePrefix + "\\E";
negativePrefix = df.getNegativePrefix();
if (negativePrefix.length() > 0)
negativePrefix = "\\Q" + negativePrefix + "\\E";
positiveSuffix = df.getPositiveSuffix();
if (positiveSuffix.length() > 0)
positiveSuffix = "\\Q" + positiveSuffix + "\\E";
negativeSuffix = df.getNegativeSuffix();
if (negativeSuffix.length() > 0)
negativeSuffix = "\\Q" + negativeSuffix + "\\E";
// Force rebuilding and recompilation of locale dependent
// primitive patterns
integerPattern = null;
floatPattern = null;
return this;
} | java | public Scanner useLocale(Locale locale) {
if (locale.equals(this.locale))
return this;
this.locale = locale;
DecimalFormat df =
(DecimalFormat)NumberFormat.getNumberInstance(locale);
DecimalFormatSymbols dfs = DecimalFormatSymbols.getInstance(locale);
// These must be literalized to avoid collision with regex
// metacharacters such as dot or parenthesis
groupSeparator = "\\" + dfs.getGroupingSeparator();
decimalSeparator = "\\" + dfs.getDecimalSeparator();
// Quoting the nonzero length locale-specific things
// to avoid potential conflict with metacharacters
nanString = "\\Q" + dfs.getNaN() + "\\E";
infinityString = "\\Q" + dfs.getInfinity() + "\\E";
positivePrefix = df.getPositivePrefix();
if (positivePrefix.length() > 0)
positivePrefix = "\\Q" + positivePrefix + "\\E";
negativePrefix = df.getNegativePrefix();
if (negativePrefix.length() > 0)
negativePrefix = "\\Q" + negativePrefix + "\\E";
positiveSuffix = df.getPositiveSuffix();
if (positiveSuffix.length() > 0)
positiveSuffix = "\\Q" + positiveSuffix + "\\E";
negativeSuffix = df.getNegativeSuffix();
if (negativeSuffix.length() > 0)
negativeSuffix = "\\Q" + negativeSuffix + "\\E";
// Force rebuilding and recompilation of locale dependent
// primitive patterns
integerPattern = null;
floatPattern = null;
return this;
} | [
"public",
"Scanner",
"useLocale",
"(",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
".",
"equals",
"(",
"this",
".",
"locale",
")",
")",
"return",
"this",
";",
"this",
".",
"locale",
"=",
"locale",
";",
"DecimalFormat",
"df",
"=",
"(",
"DecimalFo... | Sets this scanner's locale to the specified locale.
<p>A scanner's locale affects many elements of its default
primitive matching regular expressions; see
<a href= "#localized-numbers">localized numbers</a> above.
<p>Invoking the {@link #reset} method will set the scanner's locale to
the <a href= "#initial-locale">initial locale</a>.
@param locale A string specifying the locale to use
@return this scanner | [
"Sets",
"this",
"scanner",
"s",
"locale",
"to",
"the",
"specified",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1147-L1184 |
33,085 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.useRadix | public Scanner useRadix(int radix) {
if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX))
throw new IllegalArgumentException("radix:"+radix);
if (this.defaultRadix == radix)
return this;
this.defaultRadix = radix;
// Force rebuilding and recompilation of radix dependent patterns
integerPattern = null;
return this;
} | java | public Scanner useRadix(int radix) {
if ((radix < Character.MIN_RADIX) || (radix > Character.MAX_RADIX))
throw new IllegalArgumentException("radix:"+radix);
if (this.defaultRadix == radix)
return this;
this.defaultRadix = radix;
// Force rebuilding and recompilation of radix dependent patterns
integerPattern = null;
return this;
} | [
"public",
"Scanner",
"useRadix",
"(",
"int",
"radix",
")",
"{",
"if",
"(",
"(",
"radix",
"<",
"Character",
".",
"MIN_RADIX",
")",
"||",
"(",
"radix",
">",
"Character",
".",
"MAX_RADIX",
")",
")",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"radix:\"... | Sets this scanner's default radix to the specified radix.
<p>A scanner's radix affects elements of its default
number matching regular expressions; see
<a href= "#localized-numbers">localized numbers</a> above.
<p>If the radix is less than <code>Character.MIN_RADIX</code>
or greater than <code>Character.MAX_RADIX</code>, then an
<code>IllegalArgumentException</code> is thrown.
<p>Invoking the {@link #reset} method will set the scanner's radix to
<code>10</code>.
@param radix The radix to use when scanning numbers
@return this scanner
@throws IllegalArgumentException if radix is out of range | [
"Sets",
"this",
"scanner",
"s",
"default",
"radix",
"to",
"the",
"specified",
"radix",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1217-L1227 |
33,086 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.setRadix | private void setRadix(int radix) {
// Android-changed: Complain loudly if a bogus radix is being set.
if (radix > Character.MAX_RADIX) {
throw new IllegalArgumentException("radix == " + radix);
}
if (this.radix != radix) {
// Force rebuilding and recompilation of radix dependent patterns
integerPattern = null;
this.radix = radix;
}
} | java | private void setRadix(int radix) {
// Android-changed: Complain loudly if a bogus radix is being set.
if (radix > Character.MAX_RADIX) {
throw new IllegalArgumentException("radix == " + radix);
}
if (this.radix != radix) {
// Force rebuilding and recompilation of radix dependent patterns
integerPattern = null;
this.radix = radix;
}
} | [
"private",
"void",
"setRadix",
"(",
"int",
"radix",
")",
"{",
"// Android-changed: Complain loudly if a bogus radix is being set.",
"if",
"(",
"radix",
">",
"Character",
".",
"MAX_RADIX",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"radix == \"",
"+",
... | the default is left untouched. | [
"the",
"default",
"is",
"left",
"untouched",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1231-L1242 |
33,087 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.hasNext | public boolean hasNext() {
ensureOpen();
saveState();
while (!sourceClosed) {
if (hasTokenInBuffer())
return revertState(true);
readInput();
}
boolean result = hasTokenInBuffer();
return revertState(result);
} | java | public boolean hasNext() {
ensureOpen();
saveState();
while (!sourceClosed) {
if (hasTokenInBuffer())
return revertState(true);
readInput();
}
boolean result = hasTokenInBuffer();
return revertState(result);
} | [
"public",
"boolean",
"hasNext",
"(",
")",
"{",
"ensureOpen",
"(",
")",
";",
"saveState",
"(",
")",
";",
"while",
"(",
"!",
"sourceClosed",
")",
"{",
"if",
"(",
"hasTokenInBuffer",
"(",
")",
")",
"return",
"revertState",
"(",
"true",
")",
";",
"readInpu... | Returns true if this scanner has another token in its input.
This method may block while waiting for input to scan.
The scanner does not advance past any input.
@return true if and only if this scanner has another token
@throws IllegalStateException if this scanner is closed
@see java.util.Iterator | [
"Returns",
"true",
"if",
"this",
"scanner",
"has",
"another",
"token",
"in",
"its",
"input",
".",
"This",
"method",
"may",
"block",
"while",
"waiting",
"for",
"input",
"to",
"scan",
".",
"The",
"scanner",
"does",
"not",
"advance",
"past",
"any",
"input",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1305-L1315 |
33,088 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.hasNext | public boolean hasNext(Pattern pattern) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
hasNextPattern = null;
saveState();
while (true) {
if (getCompleteTokenInBuffer(pattern) != null) {
matchValid = true;
cacheResult();
return revertState(true);
}
if (needInput)
readInput();
else
return revertState(false);
}
} | java | public boolean hasNext(Pattern pattern) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
hasNextPattern = null;
saveState();
while (true) {
if (getCompleteTokenInBuffer(pattern) != null) {
matchValid = true;
cacheResult();
return revertState(true);
}
if (needInput)
readInput();
else
return revertState(false);
}
} | [
"public",
"boolean",
"hasNext",
"(",
"Pattern",
"pattern",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"hasNextPattern",
"=",
"null",
";",
"saveState",
"(",
")",
"... | Returns true if the next complete token matches the specified pattern.
A complete token is prefixed and postfixed by input that matches
the delimiter pattern. This method may block while waiting for input.
The scanner does not advance past any input.
@param pattern the pattern to scan for
@return true if and only if this scanner has another token matching
the specified pattern
@throws IllegalStateException if this scanner is closed | [
"Returns",
"true",
"if",
"the",
"next",
"complete",
"token",
"matches",
"the",
"specified",
"pattern",
".",
"A",
"complete",
"token",
"is",
"prefixed",
"and",
"postfixed",
"by",
"input",
"that",
"matches",
"the",
"delimiter",
"pattern",
".",
"This",
"method",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1404-L1422 |
33,089 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.hasNextLine | public boolean hasNextLine() {
saveState();
String result = findWithinHorizon(linePattern(), 0);
if (result != null) {
MatchResult mr = this.match();
String lineSep = mr.group(1);
if (lineSep != null) {
result = result.substring(0, result.length() -
lineSep.length());
cacheResult(result);
} else {
cacheResult();
}
}
revertState();
return (result != null);
} | java | public boolean hasNextLine() {
saveState();
String result = findWithinHorizon(linePattern(), 0);
if (result != null) {
MatchResult mr = this.match();
String lineSep = mr.group(1);
if (lineSep != null) {
result = result.substring(0, result.length() -
lineSep.length());
cacheResult(result);
} else {
cacheResult();
}
}
revertState();
return (result != null);
} | [
"public",
"boolean",
"hasNextLine",
"(",
")",
"{",
"saveState",
"(",
")",
";",
"String",
"result",
"=",
"findWithinHorizon",
"(",
"linePattern",
"(",
")",
",",
"0",
")",
";",
"if",
"(",
"result",
"!=",
"null",
")",
"{",
"MatchResult",
"mr",
"=",
"this"... | Returns true if there is another line in the input of this scanner.
This method may block while waiting for input. The scanner does not
advance past any input.
@return true if and only if this scanner has another line of input
@throws IllegalStateException if this scanner is closed | [
"Returns",
"true",
"if",
"there",
"is",
"another",
"line",
"in",
"the",
"input",
"of",
"this",
"scanner",
".",
"This",
"method",
"may",
"block",
"while",
"waiting",
"for",
"input",
".",
"The",
"scanner",
"does",
"not",
"advance",
"past",
"any",
"input",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1469-L1487 |
33,090 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.nextLine | public String nextLine() {
if (hasNextPattern == linePattern())
return getCachedResult();
clearCaches();
String result = findWithinHorizon(linePattern, 0);
if (result == null)
throw new NoSuchElementException("No line found");
MatchResult mr = this.match();
String lineSep = mr.group(1);
if (lineSep != null)
result = result.substring(0, result.length() - lineSep.length());
if (result == null)
throw new NoSuchElementException();
else
return result;
} | java | public String nextLine() {
if (hasNextPattern == linePattern())
return getCachedResult();
clearCaches();
String result = findWithinHorizon(linePattern, 0);
if (result == null)
throw new NoSuchElementException("No line found");
MatchResult mr = this.match();
String lineSep = mr.group(1);
if (lineSep != null)
result = result.substring(0, result.length() - lineSep.length());
if (result == null)
throw new NoSuchElementException();
else
return result;
} | [
"public",
"String",
"nextLine",
"(",
")",
"{",
"if",
"(",
"hasNextPattern",
"==",
"linePattern",
"(",
")",
")",
"return",
"getCachedResult",
"(",
")",
";",
"clearCaches",
"(",
")",
";",
"String",
"result",
"=",
"findWithinHorizon",
"(",
"linePattern",
",",
... | Advances this scanner past the current line and returns the input
that was skipped.
This method returns the rest of the current line, excluding any line
separator at the end. The position is set to the beginning of the next
line.
<p>Since this method continues to search through the input looking
for a line separator, it may buffer all of the input searching for
the line to skip if no line separators are present.
@return the line that was skipped
@throws NoSuchElementException if no line was found
@throws IllegalStateException if this scanner is closed | [
"Advances",
"this",
"scanner",
"past",
"the",
"current",
"line",
"and",
"returns",
"the",
"input",
"that",
"was",
"skipped",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1505-L1521 |
33,091 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.findWithinHorizon | public String findWithinHorizon(String pattern, int horizon) {
return findWithinHorizon(patternCache.forName(pattern), horizon);
} | java | public String findWithinHorizon(String pattern, int horizon) {
return findWithinHorizon(patternCache.forName(pattern), horizon);
} | [
"public",
"String",
"findWithinHorizon",
"(",
"String",
"pattern",
",",
"int",
"horizon",
")",
"{",
"return",
"findWithinHorizon",
"(",
"patternCache",
".",
"forName",
"(",
"pattern",
")",
",",
"horizon",
")",
";",
"}"
] | Attempts to find the next occurrence of a pattern constructed from the
specified string, ignoring delimiters.
<p>An invocation of this method of the form
<tt>findWithinHorizon(pattern)</tt> behaves in exactly the same way as
the invocation
<tt>findWithinHorizon(Pattern.compile(pattern, horizon))</tt>.
@param pattern a string specifying the pattern to search for
@param horizon the search horizon
@return the text that matched the specified pattern
@throws IllegalStateException if this scanner is closed
@throws IllegalArgumentException if horizon is negative | [
"Attempts",
"to",
"find",
"the",
"next",
"occurrence",
"of",
"a",
"pattern",
"constructed",
"from",
"the",
"specified",
"string",
"ignoring",
"delimiters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1606-L1608 |
33,092 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.findWithinHorizon | public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true;
return token;
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} | java | public String findWithinHorizon(Pattern pattern, int horizon) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
if (horizon < 0)
throw new IllegalArgumentException("horizon < 0");
clearCaches();
// Search for the pattern
while (true) {
String token = findPatternInBuffer(pattern, horizon);
if (token != null) {
matchValid = true;
return token;
}
if (needInput)
readInput();
else
break; // up to end of input
}
return null;
} | [
"public",
"String",
"findWithinHorizon",
"(",
"Pattern",
"pattern",
",",
"int",
"horizon",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"if",
"(",
"horizon",
"<",
"... | Attempts to find the next occurrence of the specified pattern.
<p>This method searches through the input up to the specified
search horizon, ignoring delimiters. If the pattern is found the
scanner advances past the input that matched and returns the string
that matched the pattern. If no such pattern is detected then the
null is returned and the scanner's position remains unchanged. This
method may block waiting for input that matches the pattern.
<p>A scanner will never search more than <code>horizon</code> code
points beyond its current position. Note that a match may be clipped
by the horizon; that is, an arbitrary match result may have been
different if the horizon had been larger. The scanner treats the
horizon as a transparent, non-anchoring bound (see {@link
Matcher#useTransparentBounds} and {@link Matcher#useAnchoringBounds}).
<p>If horizon is <code>0</code>, then the horizon is ignored and
this method continues to search through the input looking for the
specified pattern without bound. In this case it may buffer all of
the input searching for the pattern.
<p>If horizon is negative, then an IllegalArgumentException is
thrown.
@param pattern the pattern to scan for
@param horizon the search horizon
@return the text that matched the specified pattern
@throws IllegalStateException if this scanner is closed
@throws IllegalArgumentException if horizon is negative | [
"Attempts",
"to",
"find",
"the",
"next",
"occurrence",
"of",
"the",
"specified",
"pattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1641-L1662 |
33,093 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.skip | public Scanner skip(Pattern pattern) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
clearCaches();
// Search for the pattern
while (true) {
String token = matchPatternInBuffer(pattern);
if (token != null) {
matchValid = true;
position = matcher.end();
return this;
}
if (needInput)
readInput();
else
throw new NoSuchElementException();
}
} | java | public Scanner skip(Pattern pattern) {
ensureOpen();
if (pattern == null)
throw new NullPointerException();
clearCaches();
// Search for the pattern
while (true) {
String token = matchPatternInBuffer(pattern);
if (token != null) {
matchValid = true;
position = matcher.end();
return this;
}
if (needInput)
readInput();
else
throw new NoSuchElementException();
}
} | [
"public",
"Scanner",
"skip",
"(",
"Pattern",
"pattern",
")",
"{",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"pattern",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"clearCaches",
"(",
")",
";",
"// Search for the pattern",
"while",... | Skips input that matches the specified pattern, ignoring delimiters.
This method will skip input if an anchored match of the specified
pattern succeeds.
<p>If a match to the specified pattern is not found at the
current position, then no input is skipped and a
<tt>NoSuchElementException</tt> is thrown.
<p>Since this method seeks to match the specified pattern starting at
the scanner's current position, patterns that can match a lot of
input (".*", for example) may cause the scanner to buffer a large
amount of input.
<p>Note that it is possible to skip something without risking a
<code>NoSuchElementException</code> by using a pattern that can
match nothing, e.g., <code>sc.skip("[ \t]*")</code>.
@param pattern a string specifying the pattern to skip over
@return this scanner
@throws NoSuchElementException if the specified pattern is not found
@throws IllegalStateException if this scanner is closed | [
"Skips",
"input",
"that",
"matches",
"the",
"specified",
"pattern",
"ignoring",
"delimiters",
".",
"This",
"method",
"will",
"skip",
"input",
"if",
"an",
"anchored",
"match",
"of",
"the",
"specified",
"pattern",
"succeeds",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L1687-L1706 |
33,094 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.processIntegerToken | private String processIntegerToken(String token) {
String result = token.replaceAll(""+groupSeparator, "");
boolean isNegative = false;
int preLen = negativePrefix.length();
if ((preLen > 0) && result.startsWith(negativePrefix)) {
isNegative = true;
result = result.substring(preLen);
}
int sufLen = negativeSuffix.length();
if ((sufLen > 0) && result.endsWith(negativeSuffix)) {
isNegative = true;
result = result.substring(result.length() - sufLen,
result.length());
}
if (isNegative)
result = "-" + result;
return result;
} | java | private String processIntegerToken(String token) {
String result = token.replaceAll(""+groupSeparator, "");
boolean isNegative = false;
int preLen = negativePrefix.length();
if ((preLen > 0) && result.startsWith(negativePrefix)) {
isNegative = true;
result = result.substring(preLen);
}
int sufLen = negativeSuffix.length();
if ((sufLen > 0) && result.endsWith(negativeSuffix)) {
isNegative = true;
result = result.substring(result.length() - sufLen,
result.length());
}
if (isNegative)
result = "-" + result;
return result;
} | [
"private",
"String",
"processIntegerToken",
"(",
"String",
"token",
")",
"{",
"String",
"result",
"=",
"token",
".",
"replaceAll",
"(",
"\"\"",
"+",
"groupSeparator",
",",
"\"\"",
")",
";",
"boolean",
"isNegative",
"=",
"false",
";",
"int",
"preLen",
"=",
... | The integer token must be stripped of prefixes, group separators,
and suffixes, non ascii digits must be converted into ascii digits
before parse will accept it. | [
"The",
"integer",
"token",
"must",
"be",
"stripped",
"of",
"prefixes",
"group",
"separators",
"and",
"suffixes",
"non",
"ascii",
"digits",
"must",
"be",
"converted",
"into",
"ascii",
"digits",
"before",
"parse",
"will",
"accept",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L2013-L2030 |
33,095 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.processFloatToken | private String processFloatToken(String token) {
String result = token.replaceAll(groupSeparator, "");
if (!decimalSeparator.equals("\\."))
result = result.replaceAll(decimalSeparator, ".");
boolean isNegative = false;
int preLen = negativePrefix.length();
if ((preLen > 0) && result.startsWith(negativePrefix)) {
isNegative = true;
result = result.substring(preLen);
}
int sufLen = negativeSuffix.length();
if ((sufLen > 0) && result.endsWith(negativeSuffix)) {
isNegative = true;
result = result.substring(result.length() - sufLen,
result.length());
}
if (result.equals(nanString))
result = "NaN";
if (result.equals(infinityString))
result = "Infinity";
// Android-changed: Match the infinity symbol.
if (result.equals("\u221E"))
result = "Infinity";
if (isNegative)
result = "-" + result;
// Translate non-ASCII digits
Matcher m = NON_ASCII_DIGIT.matcher(result);
if (m.find()) {
StringBuilder inASCII = new StringBuilder();
for (int i=0; i<result.length(); i++) {
char nextChar = result.charAt(i);
if (Character.isDigit(nextChar)) {
int d = Character.digit(nextChar, 10);
if (d != -1)
inASCII.append(d);
else
inASCII.append(nextChar);
} else {
inASCII.append(nextChar);
}
}
result = inASCII.toString();
}
return result;
} | java | private String processFloatToken(String token) {
String result = token.replaceAll(groupSeparator, "");
if (!decimalSeparator.equals("\\."))
result = result.replaceAll(decimalSeparator, ".");
boolean isNegative = false;
int preLen = negativePrefix.length();
if ((preLen > 0) && result.startsWith(negativePrefix)) {
isNegative = true;
result = result.substring(preLen);
}
int sufLen = negativeSuffix.length();
if ((sufLen > 0) && result.endsWith(negativeSuffix)) {
isNegative = true;
result = result.substring(result.length() - sufLen,
result.length());
}
if (result.equals(nanString))
result = "NaN";
if (result.equals(infinityString))
result = "Infinity";
// Android-changed: Match the infinity symbol.
if (result.equals("\u221E"))
result = "Infinity";
if (isNegative)
result = "-" + result;
// Translate non-ASCII digits
Matcher m = NON_ASCII_DIGIT.matcher(result);
if (m.find()) {
StringBuilder inASCII = new StringBuilder();
for (int i=0; i<result.length(); i++) {
char nextChar = result.charAt(i);
if (Character.isDigit(nextChar)) {
int d = Character.digit(nextChar, 10);
if (d != -1)
inASCII.append(d);
else
inASCII.append(nextChar);
} else {
inASCII.append(nextChar);
}
}
result = inASCII.toString();
}
return result;
} | [
"private",
"String",
"processFloatToken",
"(",
"String",
"token",
")",
"{",
"String",
"result",
"=",
"token",
".",
"replaceAll",
"(",
"groupSeparator",
",",
"\"\"",
")",
";",
"if",
"(",
"!",
"decimalSeparator",
".",
"equals",
"(",
"\"\\\\.\"",
")",
")",
"r... | The float token must be stripped of prefixes, group separators,
and suffixes, non ascii digits must be converted into ascii digits
before parseFloat will accept it.
If there are non-ascii digits in the token these digits must
be processed before the token is passed to parseFloat. | [
"The",
"float",
"token",
"must",
"be",
"stripped",
"of",
"prefixes",
"group",
"separators",
"and",
"suffixes",
"non",
"ascii",
"digits",
"must",
"be",
"converted",
"into",
"ascii",
"digits",
"before",
"parseFloat",
"will",
"accept",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L2212-L2258 |
33,096 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java | Scanner.reset | public Scanner reset() {
delimPattern = WHITESPACE_PATTERN;
useLocale(Locale.getDefault(Locale.Category.FORMAT));
useRadix(10);
clearCaches();
return this;
} | java | public Scanner reset() {
delimPattern = WHITESPACE_PATTERN;
useLocale(Locale.getDefault(Locale.Category.FORMAT));
useRadix(10);
clearCaches();
return this;
} | [
"public",
"Scanner",
"reset",
"(",
")",
"{",
"delimPattern",
"=",
"WHITESPACE_PATTERN",
";",
"useLocale",
"(",
"Locale",
".",
"getDefault",
"(",
"Locale",
".",
"Category",
".",
"FORMAT",
")",
")",
";",
"useRadix",
"(",
"10",
")",
";",
"clearCaches",
"(",
... | Resets this scanner.
<p> Resetting a scanner discards all of its explicit state
information which may have been changed by invocations of {@link
#useDelimiter}, {@link #useLocale}, or {@link #useRadix}.
<p> An invocation of this method of the form
<tt>scanner.reset()</tt> behaves in exactly the same way as the
invocation
<blockquote><pre>{@code
scanner.useDelimiter("\\p{javaWhitespace}+")
.useLocale(Locale.getDefault(Locale.Category.FORMAT))
.useRadix(10);
}</pre></blockquote>
@return this scanner
@since 1.6 | [
"Resets",
"this",
"scanner",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Scanner.java#L2585-L2591 |
33,097 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java | Attributes2Impl.removeAttribute | public void removeAttribute (int index)
{
int origMax = getLength () - 1;
super.removeAttribute (index);
if (index != origMax) {
System.arraycopy (declared, index + 1, declared, index,
origMax - index);
System.arraycopy (specified, index + 1, specified, index,
origMax - index);
}
} | java | public void removeAttribute (int index)
{
int origMax = getLength () - 1;
super.removeAttribute (index);
if (index != origMax) {
System.arraycopy (declared, index + 1, declared, index,
origMax - index);
System.arraycopy (specified, index + 1, specified, index,
origMax - index);
}
} | [
"public",
"void",
"removeAttribute",
"(",
"int",
"index",
")",
"{",
"int",
"origMax",
"=",
"getLength",
"(",
")",
"-",
"1",
";",
"super",
".",
"removeAttribute",
"(",
"index",
")",
";",
"if",
"(",
"index",
"!=",
"origMax",
")",
"{",
"System",
".",
"a... | javadoc entirely from superclass | [
"javadoc",
"entirely",
"from",
"superclass"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L263-L274 |
33,098 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java | Attributes2Impl.setDeclared | public void setDeclared (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
declared [index] = value;
} | java | public void setDeclared (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
declared [index] = value;
} | [
"public",
"void",
"setDeclared",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"getLength",
"(",
")",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"No attribute at index: \"",
"+",
... | Assign a value to the "declared" flag of a specific attribute.
This is normally needed only for attributes of type CDATA,
including attributes whose type is changed to or from CDATA.
@param index The index of the attribute (zero-based).
@param value The desired flag value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not identify an attribute.
@see #setType | [
"Assign",
"a",
"value",
"to",
"the",
"declared",
"flag",
"of",
"a",
"specific",
"attribute",
".",
"This",
"is",
"normally",
"needed",
"only",
"for",
"attributes",
"of",
"type",
"CDATA",
"including",
"attributes",
"whose",
"type",
"is",
"changed",
"to",
"or",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L288-L294 |
33,099 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java | Attributes2Impl.setSpecified | public void setSpecified (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
specified [index] = value;
} | java | public void setSpecified (int index, boolean value)
{
if (index < 0 || index >= getLength ())
throw new ArrayIndexOutOfBoundsException (
"No attribute at index: " + index);
specified [index] = value;
} | [
"public",
"void",
"setSpecified",
"(",
"int",
"index",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"index",
"<",
"0",
"||",
"index",
">=",
"getLength",
"(",
")",
")",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"\"No attribute at index: \"",
"+",
... | Assign a value to the "specified" flag of a specific attribute.
This is the only way this flag can be cleared, except clearing
by initialization with the copy constructor.
@param index The index of the attribute (zero-based).
@param value The desired flag value.
@exception java.lang.ArrayIndexOutOfBoundsException When the
supplied index does not identify an attribute. | [
"Assign",
"a",
"value",
"to",
"the",
"specified",
"flag",
"of",
"a",
"specific",
"attribute",
".",
"This",
"is",
"the",
"only",
"way",
"this",
"flag",
"can",
"be",
"cleared",
"except",
"clearing",
"by",
"initialization",
"with",
"the",
"copy",
"constructor",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/ext/Attributes2Impl.java#L307-L313 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.