id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,400 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java | RuleCharacterIterator._advance | private void _advance(int count) {
if (buf != null) {
bufPos += count;
if (bufPos == buf.length) {
buf = null;
}
} else {
pos.setIndex(pos.getIndex() + count);
if (pos.getIndex() > text.length()) {
pos.setIndex(text.length());
}
}
} | java | private void _advance(int count) {
if (buf != null) {
bufPos += count;
if (bufPos == buf.length) {
buf = null;
}
} else {
pos.setIndex(pos.getIndex() + count);
if (pos.getIndex() > text.length()) {
pos.setIndex(text.length());
}
}
} | [
"private",
"void",
"_advance",
"(",
"int",
"count",
")",
"{",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"bufPos",
"+=",
"count",
";",
"if",
"(",
"bufPos",
"==",
"buf",
".",
"length",
")",
"{",
"buf",
"=",
"null",
";",
"}",
"}",
"else",
"{",
"po... | Advances the position by the given amount.
@param count the number of 16-bit code units to advance past | [
"Advances",
"the",
"position",
"by",
"the",
"given",
"amount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java#L336-L348 |
34,401 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java | LocaleIDs.getISO3Country | public static String getISO3Country(String country){
int offset = findIndex(_countries, country);
if(offset>=0){
return _countries3[offset];
}else{
offset = findIndex(_obsoleteCountries, country);
if(offset>=0){
return _obsoleteCountries3[offset];
}
}
return "";
} | java | public static String getISO3Country(String country){
int offset = findIndex(_countries, country);
if(offset>=0){
return _countries3[offset];
}else{
offset = findIndex(_obsoleteCountries, country);
if(offset>=0){
return _obsoleteCountries3[offset];
}
}
return "";
} | [
"public",
"static",
"String",
"getISO3Country",
"(",
"String",
"country",
")",
"{",
"int",
"offset",
"=",
"findIndex",
"(",
"_countries",
",",
"country",
")",
";",
"if",
"(",
"offset",
">=",
"0",
")",
"{",
"return",
"_countries3",
"[",
"offset",
"]",
";"... | Returns a three-letter abbreviation for the provided country. If the provided
country is empty, returns the empty string. Otherwise, returns
an uppercase ISO 3166 3-letter country code.
@exception MissingResourceException Throws MissingResourceException if the
three-letter country abbreviation is not available for this locale. | [
"Returns",
"a",
"three",
"-",
"letter",
"abbreviation",
"for",
"the",
"provided",
"country",
".",
"If",
"the",
"provided",
"country",
"is",
"empty",
"returns",
"the",
"empty",
"string",
".",
"Otherwise",
"returns",
"an",
"uppercase",
"ISO",
"3166",
"3",
"-",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java#L50-L62 |
34,402 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java | LocaleIDs.findIndex | private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i;
}
}
return -1;
} | java | private static int findIndex(String[] array, String target){
for (int i = 0; i < array.length; i++) {
if (target.equals(array[i])) {
return i;
}
}
return -1;
} | [
"private",
"static",
"int",
"findIndex",
"(",
"String",
"[",
"]",
"array",
",",
"String",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"array",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"target",
".",
"equals",
... | linear search of the string array. the arrays are unfortunately ordered by the
two-letter target code, not the three-letter search code, which seems backwards. | [
"linear",
"search",
"of",
"the",
"string",
"array",
".",
"the",
"arrays",
"are",
"unfortunately",
"ordered",
"by",
"the",
"two",
"-",
"letter",
"target",
"code",
"not",
"the",
"three",
"-",
"letter",
"search",
"code",
"which",
"seems",
"backwards",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDs.java#L122-L129 |
34,403 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLFilterImpl.java | XMLFilterImpl.setFeature | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (parent != null) {
parent.setFeature(name, value);
} else {
throw new SAXNotRecognizedException("Feature: " + name);
}
} | java | public void setFeature (String name, boolean value)
throws SAXNotRecognizedException, SAXNotSupportedException
{
if (parent != null) {
parent.setFeature(name, value);
} else {
throw new SAXNotRecognizedException("Feature: " + name);
}
} | [
"public",
"void",
"setFeature",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"parent",
"!=",
"null",
")",
"{",
"parent",
".",
"setFeature",
"(",
"name",
",",
"value... | Set the value of a feature.
<p>This will always fail if the parent is null.</p>
@param name The feature name.
@param value The requested feature value.
@exception org.xml.sax.SAXNotRecognizedException If the feature
value can't be assigned or retrieved from the parent.
@exception org.xml.sax.SAXNotSupportedException When the
parent recognizes the feature name but
cannot set the requested value. | [
"Set",
"the",
"value",
"of",
"a",
"feature",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/xml/sax/helpers/XMLFilterImpl.java#L149-L157 |
34,404 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java | FilterExprWalker.init | public void init(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
super.init(compiler, opPos, stepType);
// Smooth over an anomily in the opcode map...
switch (stepType)
{
case OpCodes.OP_FUNCTION :
case OpCodes.OP_EXTFUNCTION :
m_mustHardReset = true;
case OpCodes.OP_GROUP :
case OpCodes.OP_VARIABLE :
m_expr = compiler.compile(opPos);
m_expr.exprSetParent(this);
//if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof org.apache.xalan.templates.FuncKey))
if(m_expr instanceof org.apache.xpath.operations.Variable)
{
// hack/temp workaround
m_canDetachNodeset = false;
}
break;
default :
m_expr = compiler.compile(opPos + 2);
m_expr.exprSetParent(this);
}
// if(m_expr instanceof WalkingIterator)
// {
// WalkingIterator wi = (WalkingIterator)m_expr;
// if(wi.getFirstWalker() instanceof FilterExprWalker)
// {
// FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker();
// if(null == fw.getNextWalker())
// {
// m_expr = fw.m_expr;
// m_expr.exprSetParent(this);
// }
// }
//
// }
} | java | public void init(Compiler compiler, int opPos, int stepType)
throws javax.xml.transform.TransformerException
{
super.init(compiler, opPos, stepType);
// Smooth over an anomily in the opcode map...
switch (stepType)
{
case OpCodes.OP_FUNCTION :
case OpCodes.OP_EXTFUNCTION :
m_mustHardReset = true;
case OpCodes.OP_GROUP :
case OpCodes.OP_VARIABLE :
m_expr = compiler.compile(opPos);
m_expr.exprSetParent(this);
//if((OpCodes.OP_FUNCTION == stepType) && (m_expr instanceof org.apache.xalan.templates.FuncKey))
if(m_expr instanceof org.apache.xpath.operations.Variable)
{
// hack/temp workaround
m_canDetachNodeset = false;
}
break;
default :
m_expr = compiler.compile(opPos + 2);
m_expr.exprSetParent(this);
}
// if(m_expr instanceof WalkingIterator)
// {
// WalkingIterator wi = (WalkingIterator)m_expr;
// if(wi.getFirstWalker() instanceof FilterExprWalker)
// {
// FilterExprWalker fw = (FilterExprWalker)wi.getFirstWalker();
// if(null == fw.getNextWalker())
// {
// m_expr = fw.m_expr;
// m_expr.exprSetParent(this);
// }
// }
//
// }
} | [
"public",
"void",
"init",
"(",
"Compiler",
"compiler",
",",
"int",
"opPos",
",",
"int",
"stepType",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"super",
".",
"init",
"(",
"compiler",
",",
"opPos",
",",
"stepType"... | Init a FilterExprWalker.
@param compiler non-null reference to the Compiler that is constructing.
@param opPos positive opcode position for this step.
@param stepType The type of step.
@throws javax.xml.transform.TransformerException | [
"Init",
"a",
"FilterExprWalker",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java#L62-L103 |
34,405 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java | FilterExprWalker.setRoot | public void setRoot(int root)
{
super.setRoot(root);
m_exprObj = FilterExprIteratorSimple.executeFilterExpr(root,
m_lpi.getXPathContext(), m_lpi.getPrefixResolver(),
m_lpi.getIsTopLevel(), m_lpi.m_stackFrame, m_expr);
} | java | public void setRoot(int root)
{
super.setRoot(root);
m_exprObj = FilterExprIteratorSimple.executeFilterExpr(root,
m_lpi.getXPathContext(), m_lpi.getPrefixResolver(),
m_lpi.getIsTopLevel(), m_lpi.m_stackFrame, m_expr);
} | [
"public",
"void",
"setRoot",
"(",
"int",
"root",
")",
"{",
"super",
".",
"setRoot",
"(",
"root",
")",
";",
"m_exprObj",
"=",
"FilterExprIteratorSimple",
".",
"executeFilterExpr",
"(",
"root",
",",
"m_lpi",
".",
"getXPathContext",
"(",
")",
",",
"m_lpi",
".... | Set the root node of the TreeWalker.
@param root non-null reference to the root, or starting point of
the query. | [
"Set",
"the",
"root",
"node",
"of",
"the",
"TreeWalker",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java#L126-L135 |
34,406 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java | FilterExprWalker.acceptNode | public short acceptNode(int n)
{
try
{
if (getPredicateCount() > 0)
{
countProximityPosition(0);
if (!executePredicates(n, m_lpi.getXPathContext()))
return DTMIterator.FILTER_SKIP;
}
return DTMIterator.FILTER_ACCEPT;
}
catch (javax.xml.transform.TransformerException se)
{
throw new RuntimeException(se.getMessage());
}
} | java | public short acceptNode(int n)
{
try
{
if (getPredicateCount() > 0)
{
countProximityPosition(0);
if (!executePredicates(n, m_lpi.getXPathContext()))
return DTMIterator.FILTER_SKIP;
}
return DTMIterator.FILTER_ACCEPT;
}
catch (javax.xml.transform.TransformerException se)
{
throw new RuntimeException(se.getMessage());
}
} | [
"public",
"short",
"acceptNode",
"(",
"int",
"n",
")",
"{",
"try",
"{",
"if",
"(",
"getPredicateCount",
"(",
")",
">",
"0",
")",
"{",
"countProximityPosition",
"(",
"0",
")",
";",
"if",
"(",
"!",
"executePredicates",
"(",
"n",
",",
"m_lpi",
".",
"get... | This method needs to override AxesWalker.acceptNode because FilterExprWalkers
don't need to, and shouldn't, do a node test.
@param n The node to check to see if it passes the filter or not.
@return a constant to determine whether the node is accepted,
rejected, or skipped, as defined above . | [
"This",
"method",
"needs",
"to",
"override",
"AxesWalker",
".",
"acceptNode",
"because",
"FilterExprWalkers",
"don",
"t",
"need",
"to",
"and",
"shouldn",
"t",
"do",
"a",
"node",
"test",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/FilterExprWalker.java#L162-L181 |
34,407 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BitSieve.java | BitSieve.sieveSearch | private int sieveSearch(int limit, int start) {
if (start >= limit)
return -1;
int index = start;
do {
if (!get(index))
return index;
index++;
} while(index < limit-1);
return -1;
} | java | private int sieveSearch(int limit, int start) {
if (start >= limit)
return -1;
int index = start;
do {
if (!get(index))
return index;
index++;
} while(index < limit-1);
return -1;
} | [
"private",
"int",
"sieveSearch",
"(",
"int",
"limit",
",",
"int",
"start",
")",
"{",
"if",
"(",
"start",
">=",
"limit",
")",
"return",
"-",
"1",
";",
"int",
"index",
"=",
"start",
";",
"do",
"{",
"if",
"(",
"!",
"get",
"(",
"index",
")",
")",
"... | This method returns the index of the first clear bit in the search
array that occurs at or after start. It will not search past the
specified limit. It returns -1 if there is no such clear bit. | [
"This",
"method",
"returns",
"the",
"index",
"of",
"the",
"first",
"clear",
"bit",
"in",
"the",
"search",
"array",
"that",
"occurs",
"at",
"or",
"after",
"start",
".",
"It",
"will",
"not",
"search",
"past",
"the",
"specified",
"limit",
".",
"It",
"return... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BitSieve.java#L166-L177 |
34,408 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BitSieve.java | BitSieve.sieveSingle | private void sieveSingle(int limit, int start, int step) {
while(start < limit) {
set(start);
start += step;
}
} | java | private void sieveSingle(int limit, int start, int step) {
while(start < limit) {
set(start);
start += step;
}
} | [
"private",
"void",
"sieveSingle",
"(",
"int",
"limit",
",",
"int",
"start",
",",
"int",
"step",
")",
"{",
"while",
"(",
"start",
"<",
"limit",
")",
"{",
"set",
"(",
"start",
")",
";",
"start",
"+=",
"step",
";",
"}",
"}"
] | Sieve a single set of multiples out of the sieve. Begin to remove
multiples of the specified step starting at the specified start index,
up to the specified limit. | [
"Sieve",
"a",
"single",
"set",
"of",
"multiples",
"out",
"of",
"the",
"sieve",
".",
"Begin",
"to",
"remove",
"multiples",
"of",
"the",
"specified",
"step",
"starting",
"at",
"the",
"specified",
"start",
"index",
"up",
"to",
"the",
"specified",
"limit",
"."... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BitSieve.java#L184-L189 |
34,409 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BitSieve.java | BitSieve.retrieve | BigInteger retrieve(BigInteger initValue, int certainty, java.util.Random random) {
// Examine the sieve one long at a time to find possible primes
int offset = 1;
for (int i=0; i<bits.length; i++) {
long nextLong = ~bits[i];
for (int j=0; j<64; j++) {
if ((nextLong & 1) == 1) {
BigInteger candidate = initValue.add(
BigInteger.valueOf(offset));
if (candidate.primeToCertainty(certainty, random))
return candidate;
}
nextLong >>>= 1;
offset+=2;
}
}
return null;
} | java | BigInteger retrieve(BigInteger initValue, int certainty, java.util.Random random) {
// Examine the sieve one long at a time to find possible primes
int offset = 1;
for (int i=0; i<bits.length; i++) {
long nextLong = ~bits[i];
for (int j=0; j<64; j++) {
if ((nextLong & 1) == 1) {
BigInteger candidate = initValue.add(
BigInteger.valueOf(offset));
if (candidate.primeToCertainty(certainty, random))
return candidate;
}
nextLong >>>= 1;
offset+=2;
}
}
return null;
} | [
"BigInteger",
"retrieve",
"(",
"BigInteger",
"initValue",
",",
"int",
"certainty",
",",
"java",
".",
"util",
".",
"Random",
"random",
")",
"{",
"// Examine the sieve one long at a time to find possible primes",
"int",
"offset",
"=",
"1",
";",
"for",
"(",
"int",
"i... | Test probable primes in the sieve and return successful candidates. | [
"Test",
"probable",
"primes",
"in",
"the",
"sieve",
"and",
"return",
"successful",
"candidates",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BitSieve.java#L194-L211 |
34,410 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.getPlatformLogger | static Logger getPlatformLogger(String name) {
LogManager manager = LogManager.getLogManager();
// all loggers in the system context will default to
// the system logger's resource bundle
Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME);
return result;
} | java | static Logger getPlatformLogger(String name) {
LogManager manager = LogManager.getLogManager();
// all loggers in the system context will default to
// the system logger's resource bundle
Logger result = manager.demandSystemLogger(name, SYSTEM_LOGGER_RB_NAME);
return result;
} | [
"static",
"Logger",
"getPlatformLogger",
"(",
"String",
"name",
")",
"{",
"LogManager",
"manager",
"=",
"LogManager",
".",
"getLogManager",
"(",
")",
";",
"// all loggers in the system context will default to",
"// the system logger's resource bundle",
"Logger",
"result",
"... | i.e. caller of sun.util.logging.PlatformLogger.getLogger | [
"i",
".",
"e",
".",
"caller",
"of",
"sun",
".",
"util",
".",
"logging",
".",
"PlatformLogger",
".",
"getLogger"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L489-L496 |
34,411 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.isLoggable | public boolean isLoggable(Level level) {
if (level.intValue() < levelValue || levelValue == offValue) {
return false;
}
return true;
} | java | public boolean isLoggable(Level level) {
if (level.intValue() < levelValue || levelValue == offValue) {
return false;
}
return true;
} | [
"public",
"boolean",
"isLoggable",
"(",
"Level",
"level",
")",
"{",
"if",
"(",
"level",
".",
"intValue",
"(",
")",
"<",
"levelValue",
"||",
"levelValue",
"==",
"offValue",
")",
"{",
"return",
"false",
";",
"}",
"return",
"true",
";",
"}"
] | Check if a message of the given level would actually be logged
by this logger. This check is based on the Loggers effective level,
which may be inherited from its parent.
@param level a message logging level
@return true if the given message level is currently being logged. | [
"Check",
"if",
"a",
"message",
"of",
"the",
"given",
"level",
"would",
"actually",
"be",
"logged",
"by",
"this",
"logger",
".",
"This",
"check",
"is",
"based",
"on",
"the",
"Loggers",
"effective",
"level",
"which",
"may",
"be",
"inherited",
"from",
"its",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1312-L1317 |
34,412 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.findResourceBundle | private synchronized ResourceBundle findResourceBundle(String name,
boolean useCallersClassLoader) {
// For all lookups, we first check the thread context class loader
// if it is set. If not, we use the system classloader. If we
// still haven't found it we use the callersClassLoaderRef if it
// is set and useCallersClassLoader is true. We set
// callersClassLoaderRef initially upon creating the logger with a
// non-null resource bundle name.
// Return a null bundle for a null name.
if (name == null) {
return null;
}
Locale currentLocale = Locale.getDefault();
// Normally we should hit on our simple one entry cache.
if (catalog != null && currentLocale.equals(catalogLocale)
&& name.equals(catalogName)) {
return catalog;
}
if (name.equals(SYSTEM_LOGGER_RB_NAME)) {
catalog = findSystemResourceBundle(currentLocale);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
}
// Use the thread's context ClassLoader. If there isn't one, use the
// {@linkplain java.lang.ClassLoader#getSystemClassLoader() system ClassLoader}.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
try {
catalog = ResourceBundle.getBundle(name, currentLocale, cl);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
// We can't find the ResourceBundle in the default
// ClassLoader. Drop through.
}
/* J2ObjC removed: J2ObjC only has one class loader.
if (useCallersClassLoader) {
// Try with the caller's ClassLoader
ClassLoader callersClassLoader = getCallersClassLoader();
if (callersClassLoader != null && callersClassLoader != cl) {
try {
catalog = ResourceBundle.getBundle(name, currentLocale,
callersClassLoader);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
}
}
}
// If -Djdk.logging.allowStackWalkSearch=true is set,
// does stack walk to search for the resource bundle
if (LoggerHelper.allowStackWalkSearch) {
return findResourceBundleFromStack(name, currentLocale, cl);
} else {
return null;
}
*/
return null;
} | java | private synchronized ResourceBundle findResourceBundle(String name,
boolean useCallersClassLoader) {
// For all lookups, we first check the thread context class loader
// if it is set. If not, we use the system classloader. If we
// still haven't found it we use the callersClassLoaderRef if it
// is set and useCallersClassLoader is true. We set
// callersClassLoaderRef initially upon creating the logger with a
// non-null resource bundle name.
// Return a null bundle for a null name.
if (name == null) {
return null;
}
Locale currentLocale = Locale.getDefault();
// Normally we should hit on our simple one entry cache.
if (catalog != null && currentLocale.equals(catalogLocale)
&& name.equals(catalogName)) {
return catalog;
}
if (name.equals(SYSTEM_LOGGER_RB_NAME)) {
catalog = findSystemResourceBundle(currentLocale);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
}
// Use the thread's context ClassLoader. If there isn't one, use the
// {@linkplain java.lang.ClassLoader#getSystemClassLoader() system ClassLoader}.
ClassLoader cl = Thread.currentThread().getContextClassLoader();
if (cl == null) {
cl = ClassLoader.getSystemClassLoader();
}
try {
catalog = ResourceBundle.getBundle(name, currentLocale, cl);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
// We can't find the ResourceBundle in the default
// ClassLoader. Drop through.
}
/* J2ObjC removed: J2ObjC only has one class loader.
if (useCallersClassLoader) {
// Try with the caller's ClassLoader
ClassLoader callersClassLoader = getCallersClassLoader();
if (callersClassLoader != null && callersClassLoader != cl) {
try {
catalog = ResourceBundle.getBundle(name, currentLocale,
callersClassLoader);
catalogName = name;
catalogLocale = currentLocale;
return catalog;
} catch (MissingResourceException ex) {
}
}
}
// If -Djdk.logging.allowStackWalkSearch=true is set,
// does stack walk to search for the resource bundle
if (LoggerHelper.allowStackWalkSearch) {
return findResourceBundleFromStack(name, currentLocale, cl);
} else {
return null;
}
*/
return null;
} | [
"private",
"synchronized",
"ResourceBundle",
"findResourceBundle",
"(",
"String",
"name",
",",
"boolean",
"useCallersClassLoader",
")",
"{",
"// For all lookups, we first check the thread context class loader",
"// if it is set. If not, we use the system classloader. If we",
"// still ... | Private utility method to map a resource bundle name to an
actual resource bundle, using a simple one-entry cache.
Returns null for a null name.
May also return null if we can't find the resource bundle and
there is no suitable previous cached value.
@param name the ResourceBundle to locate
@param userCallersClassLoader if true search using the caller's ClassLoader
@return ResourceBundle specified by name or null if not found | [
"Private",
"utility",
"method",
"to",
"map",
"a",
"resource",
"bundle",
"name",
"to",
"an",
"actual",
"resource",
"bundle",
"using",
"a",
"simple",
"one",
"-",
"entry",
"cache",
".",
"Returns",
"null",
"for",
"a",
"null",
"name",
".",
"May",
"also",
"ret... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1430-L1500 |
34,413 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.setupResourceInfo | private synchronized void setupResourceInfo(String name,
Class<?> callersClass) {
if (name == null) {
return;
}
/* J2ObjC removed.
setCallersClassLoaderRef(callersClass);
*/
if (findResourceBundle(name, true) == null) {
// We've failed to find an expected ResourceBundle.
// unset the caller's ClassLoader since we were unable to find the
// the bundle using it
this.callersClassLoaderRef = null;
throw new MissingResourceException("Can't find " + name + " bundle",
name, "");
}
resourceBundleName = name;
} | java | private synchronized void setupResourceInfo(String name,
Class<?> callersClass) {
if (name == null) {
return;
}
/* J2ObjC removed.
setCallersClassLoaderRef(callersClass);
*/
if (findResourceBundle(name, true) == null) {
// We've failed to find an expected ResourceBundle.
// unset the caller's ClassLoader since we were unable to find the
// the bundle using it
this.callersClassLoaderRef = null;
throw new MissingResourceException("Can't find " + name + " bundle",
name, "");
}
resourceBundleName = name;
} | [
"private",
"synchronized",
"void",
"setupResourceInfo",
"(",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"callersClass",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"return",
";",
"}",
"/* J2ObjC removed.\n setCallersClassLoaderRef(callersClass);\... | Synchronized to prevent races in setting the fields. | [
"Synchronized",
"to",
"prevent",
"races",
"in",
"setting",
"the",
"fields",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1549-L1567 |
34,414 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.doSetParent | private void doSetParent(Logger newParent) {
// System.err.println("doSetParent \"" + getName() + "\" \""
// + newParent.getName() + "\"");
synchronized (treeLock) {
// Remove ourself from any previous parent.
LogManager.LoggerWeakRef ref = null;
if (parent != null) {
// assert parent.kids != null;
for (Iterator<LogManager.LoggerWeakRef> iter = parent.kids.iterator(); iter.hasNext(); ) {
ref = iter.next();
Logger kid = ref.get();
if (kid == this) {
// ref is used down below to complete the reparenting
iter.remove();
break;
} else {
ref = null;
}
}
// We have now removed ourself from our parents' kids.
}
// Set our new parent.
parent = newParent;
if (parent.kids == null) {
parent.kids = new ArrayList<>(2);
}
if (ref == null) {
// we didn't have a previous parent
ref = manager.new LoggerWeakRef(this);
}
ref.setParentRef(new WeakReference<Logger>(parent));
parent.kids.add(ref);
// As a result of the reparenting, the effective level
// may have changed for us and our children.
updateEffectiveLevel();
}
} | java | private void doSetParent(Logger newParent) {
// System.err.println("doSetParent \"" + getName() + "\" \""
// + newParent.getName() + "\"");
synchronized (treeLock) {
// Remove ourself from any previous parent.
LogManager.LoggerWeakRef ref = null;
if (parent != null) {
// assert parent.kids != null;
for (Iterator<LogManager.LoggerWeakRef> iter = parent.kids.iterator(); iter.hasNext(); ) {
ref = iter.next();
Logger kid = ref.get();
if (kid == this) {
// ref is used down below to complete the reparenting
iter.remove();
break;
} else {
ref = null;
}
}
// We have now removed ourself from our parents' kids.
}
// Set our new parent.
parent = newParent;
if (parent.kids == null) {
parent.kids = new ArrayList<>(2);
}
if (ref == null) {
// we didn't have a previous parent
ref = manager.new LoggerWeakRef(this);
}
ref.setParentRef(new WeakReference<Logger>(parent));
parent.kids.add(ref);
// As a result of the reparenting, the effective level
// may have changed for us and our children.
updateEffectiveLevel();
}
} | [
"private",
"void",
"doSetParent",
"(",
"Logger",
"newParent",
")",
"{",
"// System.err.println(\"doSetParent \\\"\" + getName() + \"\\\" \\\"\"",
"// + newParent.getName() + \"\\\"\");",
"synchronized",
"(",
"treeLock",
")",
"{",
"// Remove ourself from any... | Logger onto a parent logger. | [
"Logger",
"onto",
"a",
"parent",
"logger",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1611-L1653 |
34,415 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.updateEffectiveLevel | private void updateEffectiveLevel() {
// assert Thread.holdsLock(treeLock);
// Figure out our current effective level.
int newLevelValue;
if (levelObject != null) {
newLevelValue = levelObject.intValue();
} else {
if (parent != null) {
newLevelValue = parent.levelValue;
} else {
// This may happen during initialization.
newLevelValue = Level.INFO.intValue();
}
}
// If our effective value hasn't changed, we're done.
if (levelValue == newLevelValue) {
return;
}
levelValue = newLevelValue;
// System.err.println("effective level: \"" + getName() + "\" := " + level);
// Recursively update the level on each of our kids.
if (kids != null) {
for (int i = 0; i < kids.size(); i++) {
LogManager.LoggerWeakRef ref = kids.get(i);
Logger kid = ref.get();
if (kid != null) {
kid.updateEffectiveLevel();
}
}
}
} | java | private void updateEffectiveLevel() {
// assert Thread.holdsLock(treeLock);
// Figure out our current effective level.
int newLevelValue;
if (levelObject != null) {
newLevelValue = levelObject.intValue();
} else {
if (parent != null) {
newLevelValue = parent.levelValue;
} else {
// This may happen during initialization.
newLevelValue = Level.INFO.intValue();
}
}
// If our effective value hasn't changed, we're done.
if (levelValue == newLevelValue) {
return;
}
levelValue = newLevelValue;
// System.err.println("effective level: \"" + getName() + "\" := " + level);
// Recursively update the level on each of our kids.
if (kids != null) {
for (int i = 0; i < kids.size(); i++) {
LogManager.LoggerWeakRef ref = kids.get(i);
Logger kid = ref.get();
if (kid != null) {
kid.updateEffectiveLevel();
}
}
}
} | [
"private",
"void",
"updateEffectiveLevel",
"(",
")",
"{",
"// assert Thread.holdsLock(treeLock);",
"// Figure out our current effective level.",
"int",
"newLevelValue",
";",
"if",
"(",
"levelObject",
"!=",
"null",
")",
"{",
"newLevelValue",
"=",
"levelObject",
".",
"intVa... | recursively for our children. | [
"recursively",
"for",
"our",
"children",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1673-L1708 |
34,416 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java | Logger.getEffectiveResourceBundleName | private String getEffectiveResourceBundleName() {
Logger target = this;
while (target != null) {
String rbn = target.getResourceBundleName();
if (rbn != null) {
return rbn;
}
target = target.getParent();
}
return null;
} | java | private String getEffectiveResourceBundleName() {
Logger target = this;
while (target != null) {
String rbn = target.getResourceBundleName();
if (rbn != null) {
return rbn;
}
target = target.getParent();
}
return null;
} | [
"private",
"String",
"getEffectiveResourceBundleName",
"(",
")",
"{",
"Logger",
"target",
"=",
"this",
";",
"while",
"(",
"target",
"!=",
"null",
")",
"{",
"String",
"rbn",
"=",
"target",
".",
"getResourceBundleName",
"(",
")",
";",
"if",
"(",
"rbn",
"!=",... | May return null | [
"May",
"return",
"null"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/Logger.java#L1714-L1724 |
34,417 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCHeaderGenerator.java | ObjectiveCHeaderGenerator.pushIgnoreNullabilityPragmas | protected void pushIgnoreNullabilityPragmas() {
if (getGenerationUnit().options().nullability()
|| getGenerationUnit().hasNullabilityAnnotations()) {
newline();
println("#if __has_feature(nullability)");
println("#pragma clang diagnostic push");
println("#pragma GCC diagnostic ignored \"-Wnullability\"");
println("#pragma GCC diagnostic ignored \"-Wnullability-completeness\"");
println("#endif");
}
} | java | protected void pushIgnoreNullabilityPragmas() {
if (getGenerationUnit().options().nullability()
|| getGenerationUnit().hasNullabilityAnnotations()) {
newline();
println("#if __has_feature(nullability)");
println("#pragma clang diagnostic push");
println("#pragma GCC diagnostic ignored \"-Wnullability\"");
println("#pragma GCC diagnostic ignored \"-Wnullability-completeness\"");
println("#endif");
}
} | [
"protected",
"void",
"pushIgnoreNullabilityPragmas",
"(",
")",
"{",
"if",
"(",
"getGenerationUnit",
"(",
")",
".",
"options",
"(",
")",
".",
"nullability",
"(",
")",
"||",
"getGenerationUnit",
"(",
")",
".",
"hasNullabilityAnnotations",
"(",
")",
")",
"{",
"... | Ignores nullability warnings. This method should be paired with popIgnoreNullabilityPragmas.
<p>-Wnullability: In Java, conflicting nullability annotations do not cause compilation issues
(e.g.changing a parameter from {@code @Nullable} to {@code @NonNull} in an overriding method).
In Objective-C, they generate compiler warnings. The transpiled code should be able to compile
in spite of conflicting/incomplete Java nullability annotations.
<p>-Wnullability-completeness: if clang finds any nullability annotations, it checks that all
annotable sites have annotations. Java checker frameworks don't have that requirement. | [
"Ignores",
"nullability",
"warnings",
".",
"This",
"method",
"should",
"be",
"paired",
"with",
"popIgnoreNullabilityPragmas",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCHeaderGenerator.java#L160-L170 |
34,418 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCHeaderGenerator.java | ObjectiveCHeaderGenerator.popIgnoreNullabilityPragmas | protected void popIgnoreNullabilityPragmas() {
if (getGenerationUnit().options().nullability()
|| getGenerationUnit().hasNullabilityAnnotations()) {
newline();
println("#if __has_feature(nullability)");
println("#pragma clang diagnostic pop");
println("#endif");
}
} | java | protected void popIgnoreNullabilityPragmas() {
if (getGenerationUnit().options().nullability()
|| getGenerationUnit().hasNullabilityAnnotations()) {
newline();
println("#if __has_feature(nullability)");
println("#pragma clang diagnostic pop");
println("#endif");
}
} | [
"protected",
"void",
"popIgnoreNullabilityPragmas",
"(",
")",
"{",
"if",
"(",
"getGenerationUnit",
"(",
")",
".",
"options",
"(",
")",
".",
"nullability",
"(",
")",
"||",
"getGenerationUnit",
"(",
")",
".",
"hasNullabilityAnnotations",
"(",
")",
")",
"{",
"n... | Restores warnings after a call to pushIgnoreNullabilityPragmas. | [
"Restores",
"warnings",
"after",
"a",
"call",
"to",
"pushIgnoreNullabilityPragmas",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/ObjectiveCHeaderGenerator.java#L173-L181 |
34,419 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java | Trie.getSerializedDataSize | public int getSerializedDataSize()
{
// includes signature, option, dataoffset and datalength output
int result = (4 << 2);
result += (m_dataOffset_ << 1);
if (isCharTrie()) {
result += (m_dataLength_ << 1);
}
else if (isIntTrie()) {
result += (m_dataLength_ << 2);
}
return result;
} | java | public int getSerializedDataSize()
{
// includes signature, option, dataoffset and datalength output
int result = (4 << 2);
result += (m_dataOffset_ << 1);
if (isCharTrie()) {
result += (m_dataLength_ << 1);
}
else if (isIntTrie()) {
result += (m_dataLength_ << 2);
}
return result;
} | [
"public",
"int",
"getSerializedDataSize",
"(",
")",
"{",
"// includes signature, option, dataoffset and datalength output",
"int",
"result",
"=",
"(",
"4",
"<<",
"2",
")",
";",
"result",
"+=",
"(",
"m_dataOffset_",
"<<",
"1",
")",
";",
"if",
"(",
"isCharTrie",
"... | Gets the serialized data file size of the Trie. This is used during
trie data reading for size checking purposes.
@return size size of serialized trie data file in terms of the number
of bytes | [
"Gets",
"the",
"serialized",
"data",
"file",
"size",
"of",
"the",
"Trie",
".",
"This",
"is",
"used",
"during",
"trie",
"data",
"reading",
"for",
"size",
"checking",
"purposes",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java#L128-L140 |
34,420 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java | Trie.getBMPOffset | protected final int getBMPOffset(char ch)
{
return (ch >= UTF16.LEAD_SURROGATE_MIN_VALUE
&& ch <= UTF16.LEAD_SURROGATE_MAX_VALUE)
? getRawOffset(LEAD_INDEX_OFFSET_, ch)
: getRawOffset(0, ch);
// using a getRawOffset(ch) makes no diff
} | java | protected final int getBMPOffset(char ch)
{
return (ch >= UTF16.LEAD_SURROGATE_MIN_VALUE
&& ch <= UTF16.LEAD_SURROGATE_MAX_VALUE)
? getRawOffset(LEAD_INDEX_OFFSET_, ch)
: getRawOffset(0, ch);
// using a getRawOffset(ch) makes no diff
} | [
"protected",
"final",
"int",
"getBMPOffset",
"(",
"char",
"ch",
")",
"{",
"return",
"(",
"ch",
">=",
"UTF16",
".",
"LEAD_SURROGATE_MIN_VALUE",
"&&",
"ch",
"<=",
"UTF16",
".",
"LEAD_SURROGATE_MAX_VALUE",
")",
"?",
"getRawOffset",
"(",
"LEAD_INDEX_OFFSET_",
",",
... | Gets the offset to data which the BMP character points to
Treats a lead surrogate as a normal code point.
@param ch BMP character
@return offset to data | [
"Gets",
"the",
"offset",
"to",
"data",
"which",
"the",
"BMP",
"character",
"points",
"to",
"Treats",
"a",
"lead",
"surrogate",
"as",
"a",
"normal",
"code",
"point",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java#L310-L317 |
34,421 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java | Trie.checkHeader | private final boolean checkHeader(int signature)
{
// check the signature
// Trie in big-endian US-ASCII (0x54726965).
// Magic number to authenticate the data.
if (signature != HEADER_SIGNATURE_) {
return false;
}
if ((m_options_ & HEADER_OPTIONS_SHIFT_MASK_) !=
INDEX_STAGE_1_SHIFT_ ||
((m_options_ >> HEADER_OPTIONS_INDEX_SHIFT_) &
HEADER_OPTIONS_SHIFT_MASK_)
!= INDEX_STAGE_2_SHIFT_) {
return false;
}
return true;
} | java | private final boolean checkHeader(int signature)
{
// check the signature
// Trie in big-endian US-ASCII (0x54726965).
// Magic number to authenticate the data.
if (signature != HEADER_SIGNATURE_) {
return false;
}
if ((m_options_ & HEADER_OPTIONS_SHIFT_MASK_) !=
INDEX_STAGE_1_SHIFT_ ||
((m_options_ >> HEADER_OPTIONS_INDEX_SHIFT_) &
HEADER_OPTIONS_SHIFT_MASK_)
!= INDEX_STAGE_2_SHIFT_) {
return false;
}
return true;
} | [
"private",
"final",
"boolean",
"checkHeader",
"(",
"int",
"signature",
")",
"{",
"// check the signature",
"// Trie in big-endian US-ASCII (0x54726965).",
"// Magic number to authenticate the data.",
"if",
"(",
"signature",
"!=",
"HEADER_SIGNATURE_",
")",
"{",
"return",
"fals... | Authenticates raw data header.
Checking the header information, signature and options.
@param signature This contains the options and type of a Trie
@return true if the header is authenticated valid | [
"Authenticates",
"raw",
"data",
"header",
".",
"Checking",
"the",
"header",
"information",
"signature",
"and",
"options",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie.java#L441-L458 |
34,422 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObjectFactory.java | XObjectFactory.create | static public XObject create(Object val)
{
XObject result;
if (val instanceof XObject)
{
result = (XObject) val;
}
else if (val instanceof String)
{
result = new XString((String) val);
}
else if (val instanceof Boolean)
{
result = new XBoolean((Boolean)val);
}
else if (val instanceof Double)
{
result = new XNumber(((Double) val));
}
else
{
result = new XObject(val);
}
return result;
} | java | static public XObject create(Object val)
{
XObject result;
if (val instanceof XObject)
{
result = (XObject) val;
}
else if (val instanceof String)
{
result = new XString((String) val);
}
else if (val instanceof Boolean)
{
result = new XBoolean((Boolean)val);
}
else if (val instanceof Double)
{
result = new XNumber(((Double) val));
}
else
{
result = new XObject(val);
}
return result;
} | [
"static",
"public",
"XObject",
"create",
"(",
"Object",
"val",
")",
"{",
"XObject",
"result",
";",
"if",
"(",
"val",
"instanceof",
"XObject",
")",
"{",
"result",
"=",
"(",
"XObject",
")",
"val",
";",
"}",
"else",
"if",
"(",
"val",
"instanceof",
"String... | Create the right XObject based on the type of the object passed. This
function can not make an XObject that exposes DOM Nodes, NodeLists, and
NodeIterators to the XSLT stylesheet as node-sets.
@param val The java object which this object will wrap.
@return the right XObject based on the type of the object passed. | [
"Create",
"the",
"right",
"XObject",
"based",
"on",
"the",
"type",
"of",
"the",
"object",
"passed",
".",
"This",
"function",
"can",
"not",
"make",
"an",
"XObject",
"that",
"exposes",
"DOM",
"Nodes",
"NodeLists",
"and",
"NodeIterators",
"to",
"the",
"XSLT",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObjectFactory.java#L43-L70 |
34,423 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java | RevocationChecker.certCanSignCrl | static boolean certCanSignCrl(X509Certificate cert) {
// if the cert doesn't include the key usage ext, or
// the key usage ext asserts cRLSigning, return true,
// otherwise return false.
boolean[] keyUsage = cert.getKeyUsage();
if (keyUsage != null) {
return keyUsage[6];
}
return false;
} | java | static boolean certCanSignCrl(X509Certificate cert) {
// if the cert doesn't include the key usage ext, or
// the key usage ext asserts cRLSigning, return true,
// otherwise return false.
boolean[] keyUsage = cert.getKeyUsage();
if (keyUsage != null) {
return keyUsage[6];
}
return false;
} | [
"static",
"boolean",
"certCanSignCrl",
"(",
"X509Certificate",
"cert",
")",
"{",
"// if the cert doesn't include the key usage ext, or",
"// the key usage ext asserts cRLSigning, return true,",
"// otherwise return false.",
"boolean",
"[",
"]",
"keyUsage",
"=",
"cert",
".",
"getK... | Checks that a cert can be used to verify a CRL.
@param cert an X509Certificate to check
@return a boolean specifying if the cert is allowed to vouch for the
validity of a CRL | [
"Checks",
"that",
"a",
"cert",
"can",
"be",
"used",
"to",
"verify",
"a",
"CRL",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/RevocationChecker.java#L768-L777 |
34,424 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java | LocaleUtility.getLocaleFromName | public static Locale getLocaleFromName(String name) {
String language = "";
String country = "";
String variant = "";
int i1 = name.indexOf('_');
if (i1 < 0) {
language = name;
} else {
language = name.substring(0, i1);
++i1;
int i2 = name.indexOf('_', i1);
if (i2 < 0) {
country = name.substring(i1);
} else {
country = name.substring(i1, i2);
variant = name.substring(i2+1);
}
}
return new Locale(language, country, variant);
} | java | public static Locale getLocaleFromName(String name) {
String language = "";
String country = "";
String variant = "";
int i1 = name.indexOf('_');
if (i1 < 0) {
language = name;
} else {
language = name.substring(0, i1);
++i1;
int i2 = name.indexOf('_', i1);
if (i2 < 0) {
country = name.substring(i1);
} else {
country = name.substring(i1, i2);
variant = name.substring(i2+1);
}
}
return new Locale(language, country, variant);
} | [
"public",
"static",
"Locale",
"getLocaleFromName",
"(",
"String",
"name",
")",
"{",
"String",
"language",
"=",
"\"\"",
";",
"String",
"country",
"=",
"\"\"",
";",
"String",
"variant",
"=",
"\"\"",
";",
"int",
"i1",
"=",
"name",
".",
"indexOf",
"(",
"'",
... | A helper function to convert a string of the form
aa_BB_CC to a locale object. Why isn't this in Locale? | [
"A",
"helper",
"function",
"to",
"convert",
"a",
"string",
"of",
"the",
"form",
"aa_BB_CC",
"to",
"a",
"locale",
"object",
".",
"Why",
"isn",
"t",
"this",
"in",
"Locale?"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleUtility.java#L27-L48 |
34,425 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.set | public Trie2Writable set(int c, int value) {
if (c<0 || c>0x10ffff) {
throw new IllegalArgumentException("Invalid code point.");
}
set(c, true, value);
fHash = 0;
return this;
} | java | public Trie2Writable set(int c, int value) {
if (c<0 || c>0x10ffff) {
throw new IllegalArgumentException("Invalid code point.");
}
set(c, true, value);
fHash = 0;
return this;
} | [
"public",
"Trie2Writable",
"set",
"(",
"int",
"c",
",",
"int",
"value",
")",
"{",
"if",
"(",
"c",
"<",
"0",
"||",
"c",
">",
"0x10ffff",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Invalid code point.\"",
")",
";",
"}",
"set",
"(",
"c"... | Set a value for a code point.
@param c the code point
@param value the value | [
"Set",
"a",
"value",
"for",
"a",
"code",
"point",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L295-L302 |
34,426 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.fillBlock | private void fillBlock(int block, /*UChar32*/ int start, /*UChar32*/ int limit,
int value, int initialValue, boolean overwrite) {
int i;
int pLimit = block+limit;
if(overwrite) {
for (i=block+start; i<pLimit; i++) {
data[i] = value;
}
} else {
for (i=block+start; i<pLimit; i++) {
if(data[i]==initialValue) {
data[i]=value;
}
}
}
} | java | private void fillBlock(int block, /*UChar32*/ int start, /*UChar32*/ int limit,
int value, int initialValue, boolean overwrite) {
int i;
int pLimit = block+limit;
if(overwrite) {
for (i=block+start; i<pLimit; i++) {
data[i] = value;
}
} else {
for (i=block+start; i<pLimit; i++) {
if(data[i]==initialValue) {
data[i]=value;
}
}
}
} | [
"private",
"void",
"fillBlock",
"(",
"int",
"block",
",",
"/*UChar32*/",
"int",
"start",
",",
"/*UChar32*/",
"int",
"limit",
",",
"int",
"value",
",",
"int",
"initialValue",
",",
"boolean",
"overwrite",
")",
"{",
"int",
"i",
";",
"int",
"pLimit",
"=",
"b... | initialValue is ignored if overwrite=TRUE
@hide draft / provisional / internal are hidden on Android | [
"initialValue",
"is",
"ignored",
"if",
"overwrite",
"=",
"TRUE"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L364-L379 |
34,427 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.setRange | public Trie2Writable setRange(Trie2.Range range, boolean overwrite) {
fHash = 0;
if (range.leadSurrogate) {
for (int c=range.startCodePoint; c<=range.endCodePoint; c++) {
if (overwrite || getFromU16SingleLead((char)c) == this.initialValue) {
setForLeadSurrogateCodeUnit((char)c, range.value);
}
}
} else {
setRange(range.startCodePoint, range.endCodePoint, range.value, overwrite);
}
return this;
} | java | public Trie2Writable setRange(Trie2.Range range, boolean overwrite) {
fHash = 0;
if (range.leadSurrogate) {
for (int c=range.startCodePoint; c<=range.endCodePoint; c++) {
if (overwrite || getFromU16SingleLead((char)c) == this.initialValue) {
setForLeadSurrogateCodeUnit((char)c, range.value);
}
}
} else {
setRange(range.startCodePoint, range.endCodePoint, range.value, overwrite);
}
return this;
} | [
"public",
"Trie2Writable",
"setRange",
"(",
"Trie2",
".",
"Range",
"range",
",",
"boolean",
"overwrite",
")",
"{",
"fHash",
"=",
"0",
";",
"if",
"(",
"range",
".",
"leadSurrogate",
")",
"{",
"for",
"(",
"int",
"c",
"=",
"range",
".",
"startCodePoint",
... | Set the values from a Trie2.Range.
All code points within the range will get the value if
overwrite is TRUE or if the old value is the initial value.
Ranges with the lead surrogate flag set will set the alternate
lead-surrogate values in the Trie, rather than the code point values.
This function is intended to work with the ranges produced when iterating
the contents of a source Trie.
@param range contains the range of code points and the value to be set.
@param overwrite flag for whether old non-initial values are to be overwritten | [
"Set",
"the",
"values",
"from",
"a",
"Trie2",
".",
"Range",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L528-L540 |
34,428 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.toTrie2_16 | public Trie2_16 toTrie2_16() {
Trie2_16 frozenTrie = new Trie2_16();
freeze(frozenTrie, ValueWidth.BITS_16);
return frozenTrie;
} | java | public Trie2_16 toTrie2_16() {
Trie2_16 frozenTrie = new Trie2_16();
freeze(frozenTrie, ValueWidth.BITS_16);
return frozenTrie;
} | [
"public",
"Trie2_16",
"toTrie2_16",
"(",
")",
"{",
"Trie2_16",
"frozenTrie",
"=",
"new",
"Trie2_16",
"(",
")",
";",
"freeze",
"(",
"frozenTrie",
",",
"ValueWidth",
".",
"BITS_16",
")",
";",
"return",
"frozenTrie",
";",
"}"
] | Produce an optimized, read-only Trie2_16 from this writable Trie.
The data values outside of the range that will fit in a 16 bit
unsigned value will be truncated. | [
"Produce",
"an",
"optimized",
"read",
"-",
"only",
"Trie2_16",
"from",
"this",
"writable",
"Trie",
".",
"The",
"data",
"values",
"outside",
"of",
"the",
"range",
"that",
"will",
"fit",
"in",
"a",
"16",
"bit",
"unsigned",
"value",
"will",
"be",
"truncated",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L986-L990 |
34,429 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java | Trie2Writable.toTrie2_32 | public Trie2_32 toTrie2_32() {
Trie2_32 frozenTrie = new Trie2_32();
freeze(frozenTrie, ValueWidth.BITS_32);
return frozenTrie;
} | java | public Trie2_32 toTrie2_32() {
Trie2_32 frozenTrie = new Trie2_32();
freeze(frozenTrie, ValueWidth.BITS_32);
return frozenTrie;
} | [
"public",
"Trie2_32",
"toTrie2_32",
"(",
")",
"{",
"Trie2_32",
"frozenTrie",
"=",
"new",
"Trie2_32",
"(",
")",
";",
"freeze",
"(",
"frozenTrie",
",",
"ValueWidth",
".",
"BITS_32",
")",
";",
"return",
"frozenTrie",
";",
"}"
] | Produce an optimized, read-only Trie2_32 from this writable Trie. | [
"Produce",
"an",
"optimized",
"read",
"-",
"only",
"Trie2_32",
"from",
"this",
"writable",
"Trie",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Trie2Writable.java#L997-L1001 |
34,430 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java | TimeUnitFormat.setLocale | @Deprecated
public TimeUnitFormat setLocale(ULocale locale) {
if (locale != this.locale){
mf = mf.withLocale(locale);
// Needed for getLocale(ULocale.VALID_LOCALE)
setLocale(locale, locale);
this.locale = locale;
isReady = false;
}
return this;
} | java | @Deprecated
public TimeUnitFormat setLocale(ULocale locale) {
if (locale != this.locale){
mf = mf.withLocale(locale);
// Needed for getLocale(ULocale.VALID_LOCALE)
setLocale(locale, locale);
this.locale = locale;
isReady = false;
}
return this;
} | [
"@",
"Deprecated",
"public",
"TimeUnitFormat",
"setLocale",
"(",
"ULocale",
"locale",
")",
"{",
"if",
"(",
"locale",
"!=",
"this",
".",
"locale",
")",
"{",
"mf",
"=",
"mf",
".",
"withLocale",
"(",
"locale",
")",
";",
"// Needed for getLocale(ULocale.VALID_LOCA... | Set the locale used for formatting or parsing.
@param locale locale of this time unit formatter.
@return this, for chaining.
@deprecated ICU 53 see {@link MeasureFormat}. | [
"Set",
"the",
"locale",
"used",
"for",
"formatting",
"or",
"parsing",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java#L192-L203 |
34,431 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java | TimeUnitFormat.format | @Deprecated
public StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition pos) {
return mf.format(obj, toAppendTo, pos);
} | java | @Deprecated
public StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition pos) {
return mf.format(obj, toAppendTo, pos);
} | [
"@",
"Deprecated",
"public",
"StringBuffer",
"format",
"(",
"Object",
"obj",
",",
"StringBuffer",
"toAppendTo",
",",
"FieldPosition",
"pos",
")",
"{",
"return",
"mf",
".",
"format",
"(",
"obj",
",",
"toAppendTo",
",",
"pos",
")",
";",
"}"
] | Format a TimeUnitAmount.
@see java.text.Format#format(java.lang.Object, java.lang.StringBuffer, java.text.FieldPosition)
@deprecated ICU 53 see {@link MeasureFormat}. | [
"Format",
"a",
"TimeUnitAmount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java#L249-L253 |
34,432 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java | TimeUnitFormat.parseObject | @Deprecated
@Override
public TimeUnitAmount parseObject(String source, ParsePosition pos) {
if (!isReady) {
setup();
}
Number resultNumber = null;
TimeUnit resultTimeUnit = null;
int oldPos = pos.getIndex();
int newPos = -1;
int longestParseDistance = 0;
String countOfLongestMatch = null;
// we don't worry too much about speed on parsing, but this can be optimized later if needed.
// Parse by iterating through all available patterns
// and looking for the longest match.
for (TimeUnit timeUnit : timeUnitToCountToPatterns.keySet()) {
Map<String, Object[]> countToPattern = timeUnitToCountToPatterns.get(timeUnit);
for (Entry<String, Object[]> patternEntry : countToPattern.entrySet()) {
String count = patternEntry.getKey();
for (int styl = FULL_NAME; styl < TOTAL_STYLES; ++styl) {
MessageFormat pattern = (MessageFormat) (patternEntry.getValue())[styl];
pos.setErrorIndex(-1);
pos.setIndex(oldPos);
// see if we can parse
Object parsed = pattern.parseObject(source, pos);
if (pos.getErrorIndex() != -1 || pos.getIndex() == oldPos) {
// nothing parsed
continue;
}
Number temp = null;
if (((Object[]) parsed).length != 0) {
// pattern with Number as beginning,
// such as "{0} d".
// check to make sure that the timeUnit is consistent
Object tempObj = ((Object[]) parsed)[0];
if (tempObj instanceof Number) {
temp = (Number) tempObj;
} else {
// Since we now format the number ourselves, parseObject will likely give us back a String
// for
// the number. When this happens we must parse the formatted number ourselves.
try {
temp = format.parse(tempObj.toString());
} catch (ParseException e) {
continue;
}
}
}
int parseDistance = pos.getIndex() - oldPos;
if (parseDistance > longestParseDistance) {
resultNumber = temp;
resultTimeUnit = timeUnit;
newPos = pos.getIndex();
longestParseDistance = parseDistance;
countOfLongestMatch = count;
}
}
}
}
/*
* After find the longest match, parse the number. Result number could be null for the pattern without number
* pattern. such as unit pattern in Arabic. When result number is null, use plural rule to set the number.
*/
if (resultNumber == null && longestParseDistance != 0) {
// set the number using plurrual count
if (countOfLongestMatch.equals("zero")) {
resultNumber = Integer.valueOf(0);
} else if (countOfLongestMatch.equals("one")) {
resultNumber = Integer.valueOf(1);
} else if (countOfLongestMatch.equals("two")) {
resultNumber = Integer.valueOf(2);
} else {
// should not happen.
// TODO: how to handle?
resultNumber = Integer.valueOf(3);
}
}
if (longestParseDistance == 0) {
pos.setIndex(oldPos);
pos.setErrorIndex(0);
return null;
} else {
pos.setIndex(newPos);
pos.setErrorIndex(-1);
return new TimeUnitAmount(resultNumber, resultTimeUnit);
}
} | java | @Deprecated
@Override
public TimeUnitAmount parseObject(String source, ParsePosition pos) {
if (!isReady) {
setup();
}
Number resultNumber = null;
TimeUnit resultTimeUnit = null;
int oldPos = pos.getIndex();
int newPos = -1;
int longestParseDistance = 0;
String countOfLongestMatch = null;
// we don't worry too much about speed on parsing, but this can be optimized later if needed.
// Parse by iterating through all available patterns
// and looking for the longest match.
for (TimeUnit timeUnit : timeUnitToCountToPatterns.keySet()) {
Map<String, Object[]> countToPattern = timeUnitToCountToPatterns.get(timeUnit);
for (Entry<String, Object[]> patternEntry : countToPattern.entrySet()) {
String count = patternEntry.getKey();
for (int styl = FULL_NAME; styl < TOTAL_STYLES; ++styl) {
MessageFormat pattern = (MessageFormat) (patternEntry.getValue())[styl];
pos.setErrorIndex(-1);
pos.setIndex(oldPos);
// see if we can parse
Object parsed = pattern.parseObject(source, pos);
if (pos.getErrorIndex() != -1 || pos.getIndex() == oldPos) {
// nothing parsed
continue;
}
Number temp = null;
if (((Object[]) parsed).length != 0) {
// pattern with Number as beginning,
// such as "{0} d".
// check to make sure that the timeUnit is consistent
Object tempObj = ((Object[]) parsed)[0];
if (tempObj instanceof Number) {
temp = (Number) tempObj;
} else {
// Since we now format the number ourselves, parseObject will likely give us back a String
// for
// the number. When this happens we must parse the formatted number ourselves.
try {
temp = format.parse(tempObj.toString());
} catch (ParseException e) {
continue;
}
}
}
int parseDistance = pos.getIndex() - oldPos;
if (parseDistance > longestParseDistance) {
resultNumber = temp;
resultTimeUnit = timeUnit;
newPos = pos.getIndex();
longestParseDistance = parseDistance;
countOfLongestMatch = count;
}
}
}
}
/*
* After find the longest match, parse the number. Result number could be null for the pattern without number
* pattern. such as unit pattern in Arabic. When result number is null, use plural rule to set the number.
*/
if (resultNumber == null && longestParseDistance != 0) {
// set the number using plurrual count
if (countOfLongestMatch.equals("zero")) {
resultNumber = Integer.valueOf(0);
} else if (countOfLongestMatch.equals("one")) {
resultNumber = Integer.valueOf(1);
} else if (countOfLongestMatch.equals("two")) {
resultNumber = Integer.valueOf(2);
} else {
// should not happen.
// TODO: how to handle?
resultNumber = Integer.valueOf(3);
}
}
if (longestParseDistance == 0) {
pos.setIndex(oldPos);
pos.setErrorIndex(0);
return null;
} else {
pos.setIndex(newPos);
pos.setErrorIndex(-1);
return new TimeUnitAmount(resultNumber, resultTimeUnit);
}
} | [
"@",
"Deprecated",
"@",
"Override",
"public",
"TimeUnitAmount",
"parseObject",
"(",
"String",
"source",
",",
"ParsePosition",
"pos",
")",
"{",
"if",
"(",
"!",
"isReady",
")",
"{",
"setup",
"(",
")",
";",
"}",
"Number",
"resultNumber",
"=",
"null",
";",
"... | Parse a TimeUnitAmount.
@see java.text.Format#parseObject(java.lang.String, java.text.ParsePosition)
@deprecated ICU 53 see {@link MeasureFormat}. | [
"Parse",
"a",
"TimeUnitAmount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java#L260-L346 |
34,433 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java | TimeUnitFormat.searchInTree | private void searchInTree(String resourceKey, int styl, TimeUnit timeUnit, String srcPluralCount,
String searchPluralCount, Map<String, Object[]> countToPatterns) {
ULocale parentLocale = locale;
String srcTimeUnitName = timeUnit.toString();
while (parentLocale != null) {
try {
// look for pattern for srcPluralCount in locale tree
ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(
ICUData.ICU_UNIT_BASE_NAME, parentLocale);
unitsRes = unitsRes.getWithFallback(resourceKey);
ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
final MessageFormat messageFormat = new MessageFormat(pattern, locale);
Object[] pair = countToPatterns.get(srcPluralCount);
if (pair == null) {
pair = new Object[2];
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
return;
} catch (MissingResourceException e) {
}
parentLocale = parentLocale.getFallback();
}
// if no unitsShort resource was found even after fallback to root locale
// then search the units resource fallback from the current level to root
if (parentLocale == null && resourceKey.equals("unitsShort")) {
searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
if (countToPatterns.get(srcPluralCount) != null
&& countToPatterns.get(srcPluralCount)[styl] != null) {
return;
}
}
// if not found the pattern for this plural count at all,
// fall-back to plural count "other"
if (searchPluralCount.equals("other")) {
// set default fall back the same as the resource in root
MessageFormat messageFormat = null;
if (timeUnit == TimeUnit.SECOND) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_SECOND, locale);
} else if (timeUnit == TimeUnit.MINUTE) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MINUTE, locale);
} else if (timeUnit == TimeUnit.HOUR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_HOUR, locale);
} else if (timeUnit == TimeUnit.WEEK) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_WEEK, locale);
} else if (timeUnit == TimeUnit.DAY) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_DAY, locale);
} else if (timeUnit == TimeUnit.MONTH) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MONTH, locale);
} else if (timeUnit == TimeUnit.YEAR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_YEAR, locale);
}
Object[] pair = countToPatterns.get(srcPluralCount);
if (pair == null) {
pair = new Object[2];
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
} else {
// fall back to rule "other", and search in parents
searchInTree(resourceKey, styl, timeUnit, srcPluralCount, "other", countToPatterns);
}
} | java | private void searchInTree(String resourceKey, int styl, TimeUnit timeUnit, String srcPluralCount,
String searchPluralCount, Map<String, Object[]> countToPatterns) {
ULocale parentLocale = locale;
String srcTimeUnitName = timeUnit.toString();
while (parentLocale != null) {
try {
// look for pattern for srcPluralCount in locale tree
ICUResourceBundle unitsRes = (ICUResourceBundle) UResourceBundle.getBundleInstance(
ICUData.ICU_UNIT_BASE_NAME, parentLocale);
unitsRes = unitsRes.getWithFallback(resourceKey);
ICUResourceBundle oneUnitRes = unitsRes.getWithFallback(srcTimeUnitName);
String pattern = oneUnitRes.getStringWithFallback(searchPluralCount);
final MessageFormat messageFormat = new MessageFormat(pattern, locale);
Object[] pair = countToPatterns.get(srcPluralCount);
if (pair == null) {
pair = new Object[2];
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
return;
} catch (MissingResourceException e) {
}
parentLocale = parentLocale.getFallback();
}
// if no unitsShort resource was found even after fallback to root locale
// then search the units resource fallback from the current level to root
if (parentLocale == null && resourceKey.equals("unitsShort")) {
searchInTree("units", styl, timeUnit, srcPluralCount, searchPluralCount, countToPatterns);
if (countToPatterns.get(srcPluralCount) != null
&& countToPatterns.get(srcPluralCount)[styl] != null) {
return;
}
}
// if not found the pattern for this plural count at all,
// fall-back to plural count "other"
if (searchPluralCount.equals("other")) {
// set default fall back the same as the resource in root
MessageFormat messageFormat = null;
if (timeUnit == TimeUnit.SECOND) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_SECOND, locale);
} else if (timeUnit == TimeUnit.MINUTE) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MINUTE, locale);
} else if (timeUnit == TimeUnit.HOUR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_HOUR, locale);
} else if (timeUnit == TimeUnit.WEEK) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_WEEK, locale);
} else if (timeUnit == TimeUnit.DAY) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_DAY, locale);
} else if (timeUnit == TimeUnit.MONTH) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_MONTH, locale);
} else if (timeUnit == TimeUnit.YEAR) {
messageFormat = new MessageFormat(DEFAULT_PATTERN_FOR_YEAR, locale);
}
Object[] pair = countToPatterns.get(srcPluralCount);
if (pair == null) {
pair = new Object[2];
countToPatterns.put(srcPluralCount, pair);
}
pair[styl] = messageFormat;
} else {
// fall back to rule "other", and search in parents
searchInTree(resourceKey, styl, timeUnit, srcPluralCount, "other", countToPatterns);
}
} | [
"private",
"void",
"searchInTree",
"(",
"String",
"resourceKey",
",",
"int",
"styl",
",",
"TimeUnit",
"timeUnit",
",",
"String",
"srcPluralCount",
",",
"String",
"searchPluralCount",
",",
"Map",
"<",
"String",
",",
"Object",
"[",
"]",
">",
"countToPatterns",
"... | then, "other" is the searchPluralCount. | [
"then",
"other",
"is",
"the",
"searchPluralCount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TimeUnitFormat.java#L506-L569 |
34,434 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormatSymbols.java | DecimalFormatSymbols.initialize | private void initialize( ULocale locale ) {
this.requestedLocale = locale.toLocale();
this.ulocale = locale;
CacheData data = cachedLocaleData.getInstance(locale, null /* unused */);
setLocale(data.validLocale, data.validLocale);
setDigitStrings(data.digits);
String[] numberElements = data.numberElements;
// Copy data from the numberElements map into instance fields
setDecimalSeparatorString(numberElements[0]);
setGroupingSeparatorString(numberElements[1]);
// See CLDR #9781
// assert numberElements[2].length() == 1;
patternSeparator = numberElements[2].charAt(0);
setPercentString(numberElements[3]);
setMinusSignString(numberElements[4]);
setPlusSignString(numberElements[5]);
setExponentSeparator(numberElements[6]);
setPerMillString(numberElements[7]);
setInfinity(numberElements[8]);
setNaN(numberElements[9]);
setMonetaryDecimalSeparatorString(numberElements[10]);
setMonetaryGroupingSeparatorString(numberElements[11]);
setExponentMultiplicationSign(numberElements[12]);
digit = DecimalFormat.PATTERN_DIGIT; // Localized pattern character no longer in CLDR
padEscape = DecimalFormat.PATTERN_PAD_ESCAPE;
sigDigit = DecimalFormat.PATTERN_SIGNIFICANT_DIGIT;
CurrencyDisplayInfo info = CurrencyData.provider.getInstance(locale, true);
// Obtain currency data from the currency API. This is strictly
// for backward compatibility; we don't use DecimalFormatSymbols
// for currency data anymore.
currency = Currency.getInstance(locale);
if (currency != null) {
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getName(locale, Currency.SYMBOL_NAME, null);
CurrencyFormatInfo fmtInfo = info.getFormatInfo(intlCurrencySymbol);
if (fmtInfo != null) {
currencyPattern = fmtInfo.currencyPattern;
setMonetaryDecimalSeparatorString(fmtInfo.monetarySeparator);
setMonetaryGroupingSeparatorString(fmtInfo.monetaryGroupingSeparator);
}
} else {
intlCurrencySymbol = "XXX";
currencySymbol = "\u00A4"; // 'OX' currency symbol
}
// Get currency spacing data.
initSpacingInfo(info.getSpacingInfo());
} | java | private void initialize( ULocale locale ) {
this.requestedLocale = locale.toLocale();
this.ulocale = locale;
CacheData data = cachedLocaleData.getInstance(locale, null /* unused */);
setLocale(data.validLocale, data.validLocale);
setDigitStrings(data.digits);
String[] numberElements = data.numberElements;
// Copy data from the numberElements map into instance fields
setDecimalSeparatorString(numberElements[0]);
setGroupingSeparatorString(numberElements[1]);
// See CLDR #9781
// assert numberElements[2].length() == 1;
patternSeparator = numberElements[2].charAt(0);
setPercentString(numberElements[3]);
setMinusSignString(numberElements[4]);
setPlusSignString(numberElements[5]);
setExponentSeparator(numberElements[6]);
setPerMillString(numberElements[7]);
setInfinity(numberElements[8]);
setNaN(numberElements[9]);
setMonetaryDecimalSeparatorString(numberElements[10]);
setMonetaryGroupingSeparatorString(numberElements[11]);
setExponentMultiplicationSign(numberElements[12]);
digit = DecimalFormat.PATTERN_DIGIT; // Localized pattern character no longer in CLDR
padEscape = DecimalFormat.PATTERN_PAD_ESCAPE;
sigDigit = DecimalFormat.PATTERN_SIGNIFICANT_DIGIT;
CurrencyDisplayInfo info = CurrencyData.provider.getInstance(locale, true);
// Obtain currency data from the currency API. This is strictly
// for backward compatibility; we don't use DecimalFormatSymbols
// for currency data anymore.
currency = Currency.getInstance(locale);
if (currency != null) {
intlCurrencySymbol = currency.getCurrencyCode();
currencySymbol = currency.getName(locale, Currency.SYMBOL_NAME, null);
CurrencyFormatInfo fmtInfo = info.getFormatInfo(intlCurrencySymbol);
if (fmtInfo != null) {
currencyPattern = fmtInfo.currencyPattern;
setMonetaryDecimalSeparatorString(fmtInfo.monetarySeparator);
setMonetaryGroupingSeparatorString(fmtInfo.monetaryGroupingSeparator);
}
} else {
intlCurrencySymbol = "XXX";
currencySymbol = "\u00A4"; // 'OX' currency symbol
}
// Get currency spacing data.
initSpacingInfo(info.getSpacingInfo());
} | [
"private",
"void",
"initialize",
"(",
"ULocale",
"locale",
")",
"{",
"this",
".",
"requestedLocale",
"=",
"locale",
".",
"toLocale",
"(",
")",
";",
"this",
".",
"ulocale",
"=",
"locale",
";",
"CacheData",
"data",
"=",
"cachedLocaleData",
".",
"getInstance",
... | Initializes the symbols from the locale data. | [
"Initializes",
"the",
"symbols",
"from",
"the",
"locale",
"data",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormatSymbols.java#L1213-L1268 |
34,435 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.init | @Override
public void init(boolean forward) throws CertPathValidatorException {
if (!forward) {
prevPubKey = trustedPubKey;
if (PKIX.isDSAPublicKeyWithoutParams(prevPubKey)) {
// If TrustAnchor is a DSA public key and it has no params, it
// cannot be used to verify the signature of the first cert,
// so throw exception
throw new CertPathValidatorException("Key parameters missing");
}
prevSubject = caName;
} else {
throw new
CertPathValidatorException("forward checking not supported");
}
} | java | @Override
public void init(boolean forward) throws CertPathValidatorException {
if (!forward) {
prevPubKey = trustedPubKey;
if (PKIX.isDSAPublicKeyWithoutParams(prevPubKey)) {
// If TrustAnchor is a DSA public key and it has no params, it
// cannot be used to verify the signature of the first cert,
// so throw exception
throw new CertPathValidatorException("Key parameters missing");
}
prevSubject = caName;
} else {
throw new
CertPathValidatorException("forward checking not supported");
}
} | [
"@",
"Override",
"public",
"void",
"init",
"(",
"boolean",
"forward",
")",
"throws",
"CertPathValidatorException",
"{",
"if",
"(",
"!",
"forward",
")",
"{",
"prevPubKey",
"=",
"trustedPubKey",
";",
"if",
"(",
"PKIX",
".",
"isDSAPublicKeyWithoutParams",
"(",
"p... | Initializes the internal state of the checker from parameters
specified in the constructor. | [
"Initializes",
"the",
"internal",
"state",
"of",
"the",
"checker",
"from",
"parameters",
"specified",
"in",
"the",
"constructor",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L100-L115 |
34,436 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.verifySignature | private void verifySignature(X509Certificate cert)
throws CertPathValidatorException
{
String msg = "signature";
if (debug != null)
debug.println("---checking " + msg + "...");
try {
if (sigProvider != null) {
cert.verify(prevPubKey, sigProvider);
} else {
cert.verify(prevPubKey);
}
} catch (SignatureException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1,
BasicReason.INVALID_SIGNATURE);
} catch (GeneralSecurityException e) {
throw new CertPathValidatorException(msg + " check failed", e);
}
if (debug != null)
debug.println(msg + " verified.");
} | java | private void verifySignature(X509Certificate cert)
throws CertPathValidatorException
{
String msg = "signature";
if (debug != null)
debug.println("---checking " + msg + "...");
try {
if (sigProvider != null) {
cert.verify(prevPubKey, sigProvider);
} else {
cert.verify(prevPubKey);
}
} catch (SignatureException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1,
BasicReason.INVALID_SIGNATURE);
} catch (GeneralSecurityException e) {
throw new CertPathValidatorException(msg + " check failed", e);
}
if (debug != null)
debug.println(msg + " verified.");
} | [
"private",
"void",
"verifySignature",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertPathValidatorException",
"{",
"String",
"msg",
"=",
"\"signature\"",
";",
"if",
"(",
"debug",
"!=",
"null",
")",
"debug",
".",
"println",
"(",
"\"---checking \"",
"+",
"msg... | Verifies the signature on the certificate using the previous public key.
@param cert the X509Certificate
@throws CertPathValidatorException if certificate does not verify | [
"Verifies",
"the",
"signature",
"on",
"the",
"certificate",
"using",
"the",
"previous",
"public",
"key",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L158-L181 |
34,437 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.verifyTimestamp | private void verifyTimestamp(X509Certificate cert)
throws CertPathValidatorException
{
String msg = "timestamp";
if (debug != null)
debug.println("---checking " + msg + ":" + date.toString() + "...");
try {
cert.checkValidity(date);
} catch (CertificateExpiredException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1, BasicReason.EXPIRED);
} catch (CertificateNotYetValidException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1, BasicReason.NOT_YET_VALID);
}
if (debug != null)
debug.println(msg + " verified.");
} | java | private void verifyTimestamp(X509Certificate cert)
throws CertPathValidatorException
{
String msg = "timestamp";
if (debug != null)
debug.println("---checking " + msg + ":" + date.toString() + "...");
try {
cert.checkValidity(date);
} catch (CertificateExpiredException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1, BasicReason.EXPIRED);
} catch (CertificateNotYetValidException e) {
throw new CertPathValidatorException
(msg + " check failed", e, null, -1, BasicReason.NOT_YET_VALID);
}
if (debug != null)
debug.println(msg + " verified.");
} | [
"private",
"void",
"verifyTimestamp",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertPathValidatorException",
"{",
"String",
"msg",
"=",
"\"timestamp\"",
";",
"if",
"(",
"debug",
"!=",
"null",
")",
"debug",
".",
"println",
"(",
"\"---checking \"",
"+",
"msg... | Internal method to verify the timestamp on a certificate | [
"Internal",
"method",
"to",
"verify",
"the",
"timestamp",
"on",
"a",
"certificate"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L186-L205 |
34,438 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.verifyNameChaining | private void verifyNameChaining(X509Certificate cert)
throws CertPathValidatorException
{
if (prevSubject != null) {
String msg = "subject/issuer name chaining";
if (debug != null)
debug.println("---checking " + msg + "...");
X500Principal currIssuer = cert.getIssuerX500Principal();
// reject null or empty issuer DNs
if (X500Name.asX500Name(currIssuer).isEmpty()) {
throw new CertPathValidatorException
(msg + " check failed: " +
"empty/null issuer DN in certificate is invalid", null,
null, -1, PKIXReason.NAME_CHAINING);
}
if (!(currIssuer.equals(prevSubject))) {
throw new CertPathValidatorException
(msg + " check failed", null, null, -1,
PKIXReason.NAME_CHAINING);
}
if (debug != null)
debug.println(msg + " verified.");
}
} | java | private void verifyNameChaining(X509Certificate cert)
throws CertPathValidatorException
{
if (prevSubject != null) {
String msg = "subject/issuer name chaining";
if (debug != null)
debug.println("---checking " + msg + "...");
X500Principal currIssuer = cert.getIssuerX500Principal();
// reject null or empty issuer DNs
if (X500Name.asX500Name(currIssuer).isEmpty()) {
throw new CertPathValidatorException
(msg + " check failed: " +
"empty/null issuer DN in certificate is invalid", null,
null, -1, PKIXReason.NAME_CHAINING);
}
if (!(currIssuer.equals(prevSubject))) {
throw new CertPathValidatorException
(msg + " check failed", null, null, -1,
PKIXReason.NAME_CHAINING);
}
if (debug != null)
debug.println(msg + " verified.");
}
} | [
"private",
"void",
"verifyNameChaining",
"(",
"X509Certificate",
"cert",
")",
"throws",
"CertPathValidatorException",
"{",
"if",
"(",
"prevSubject",
"!=",
"null",
")",
"{",
"String",
"msg",
"=",
"\"subject/issuer name chaining\"",
";",
"if",
"(",
"debug",
"!=",
"n... | Internal method to check that cert has a valid DN to be next in a chain | [
"Internal",
"method",
"to",
"check",
"that",
"cert",
"has",
"a",
"valid",
"DN",
"to",
"be",
"next",
"in",
"a",
"chain"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L210-L238 |
34,439 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.updateState | private void updateState(X509Certificate currCert)
throws CertPathValidatorException
{
PublicKey cKey = currCert.getPublicKey();
if (debug != null) {
debug.println("BasicChecker.updateState issuer: " +
currCert.getIssuerX500Principal().toString() + "; subject: " +
currCert.getSubjectX500Principal() + "; serial#: " +
currCert.getSerialNumber().toString());
}
if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
// cKey needs to inherit DSA parameters from prev key
cKey = makeInheritedParamsKey(cKey, prevPubKey);
if (debug != null) debug.println("BasicChecker.updateState Made " +
"key with inherited params");
}
prevPubKey = cKey;
prevSubject = currCert.getSubjectX500Principal();
} | java | private void updateState(X509Certificate currCert)
throws CertPathValidatorException
{
PublicKey cKey = currCert.getPublicKey();
if (debug != null) {
debug.println("BasicChecker.updateState issuer: " +
currCert.getIssuerX500Principal().toString() + "; subject: " +
currCert.getSubjectX500Principal() + "; serial#: " +
currCert.getSerialNumber().toString());
}
if (PKIX.isDSAPublicKeyWithoutParams(cKey)) {
// cKey needs to inherit DSA parameters from prev key
cKey = makeInheritedParamsKey(cKey, prevPubKey);
if (debug != null) debug.println("BasicChecker.updateState Made " +
"key with inherited params");
}
prevPubKey = cKey;
prevSubject = currCert.getSubjectX500Principal();
} | [
"private",
"void",
"updateState",
"(",
"X509Certificate",
"currCert",
")",
"throws",
"CertPathValidatorException",
"{",
"PublicKey",
"cKey",
"=",
"currCert",
".",
"getPublicKey",
"(",
")",
";",
"if",
"(",
"debug",
"!=",
"null",
")",
"{",
"debug",
".",
"println... | Internal method to manage state information at each iteration | [
"Internal",
"method",
"to",
"manage",
"state",
"information",
"at",
"each",
"iteration"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L243-L261 |
34,440 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java | BasicChecker.makeInheritedParamsKey | static PublicKey makeInheritedParamsKey(PublicKey keyValueKey,
PublicKey keyParamsKey) throws CertPathValidatorException
{
if (!(keyValueKey instanceof DSAPublicKey) ||
!(keyParamsKey instanceof DSAPublicKey))
throw new CertPathValidatorException("Input key is not " +
"appropriate type for " +
"inheriting parameters");
DSAParams params = ((DSAPublicKey)keyParamsKey).getParams();
if (params == null)
throw new CertPathValidatorException("Key parameters missing");
try {
BigInteger y = ((DSAPublicKey)keyValueKey).getY();
KeyFactory kf = KeyFactory.getInstance("DSA");
DSAPublicKeySpec ks = new DSAPublicKeySpec(y,
params.getP(),
params.getQ(),
params.getG());
return kf.generatePublic(ks);
} catch (GeneralSecurityException e) {
throw new CertPathValidatorException("Unable to generate key with" +
" inherited parameters: " +
e.getMessage(), e);
}
} | java | static PublicKey makeInheritedParamsKey(PublicKey keyValueKey,
PublicKey keyParamsKey) throws CertPathValidatorException
{
if (!(keyValueKey instanceof DSAPublicKey) ||
!(keyParamsKey instanceof DSAPublicKey))
throw new CertPathValidatorException("Input key is not " +
"appropriate type for " +
"inheriting parameters");
DSAParams params = ((DSAPublicKey)keyParamsKey).getParams();
if (params == null)
throw new CertPathValidatorException("Key parameters missing");
try {
BigInteger y = ((DSAPublicKey)keyValueKey).getY();
KeyFactory kf = KeyFactory.getInstance("DSA");
DSAPublicKeySpec ks = new DSAPublicKeySpec(y,
params.getP(),
params.getQ(),
params.getG());
return kf.generatePublic(ks);
} catch (GeneralSecurityException e) {
throw new CertPathValidatorException("Unable to generate key with" +
" inherited parameters: " +
e.getMessage(), e);
}
} | [
"static",
"PublicKey",
"makeInheritedParamsKey",
"(",
"PublicKey",
"keyValueKey",
",",
"PublicKey",
"keyParamsKey",
")",
"throws",
"CertPathValidatorException",
"{",
"if",
"(",
"!",
"(",
"keyValueKey",
"instanceof",
"DSAPublicKey",
")",
"||",
"!",
"(",
"keyParamsKey",... | Internal method to create a new key with inherited key parameters.
@param keyValueKey key from which to obtain key value
@param keyParamsKey key from which to obtain key parameters
@return new public key having value and parameters
@throws CertPathValidatorException if keys are not appropriate types
for this operation | [
"Internal",
"method",
"to",
"create",
"a",
"new",
"key",
"with",
"inherited",
"key",
"parameters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BasicChecker.java#L272-L296 |
34,441 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getCountMatchPattern | XPath getCountMatchPattern(XPathContext support, int contextNode)
throws javax.xml.transform.TransformerException
{
XPath countMatchPattern = m_countMatchPattern;
DTM dtm = support.getDTM(contextNode);
if (null == countMatchPattern)
{
switch (dtm.getNodeType(contextNode))
{
case DTM.ELEMENT_NODE :
MyPrefixResolver resolver;
if (dtm.getNamespaceURI(contextNode) == null) {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, false);
} else {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, true);
}
countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, resolver,
XPath.MATCH, support.getErrorListener());
break;
case DTM.ATTRIBUTE_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this,
this, XPath.MATCH, support.getErrorListener());
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("text()", this);
countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.COMMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("comment()", this);
countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.DOCUMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("/", this);
countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode)
+ ")", this, this, XPath.MATCH, support.getErrorListener());
break;
default :
countMatchPattern = null;
}
}
return countMatchPattern;
} | java | XPath getCountMatchPattern(XPathContext support, int contextNode)
throws javax.xml.transform.TransformerException
{
XPath countMatchPattern = m_countMatchPattern;
DTM dtm = support.getDTM(contextNode);
if (null == countMatchPattern)
{
switch (dtm.getNodeType(contextNode))
{
case DTM.ELEMENT_NODE :
MyPrefixResolver resolver;
if (dtm.getNamespaceURI(contextNode) == null) {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, false);
} else {
resolver = new MyPrefixResolver(dtm.getNode(contextNode), dtm,contextNode, true);
}
countMatchPattern = new XPath(dtm.getNodeName(contextNode), this, resolver,
XPath.MATCH, support.getErrorListener());
break;
case DTM.ATTRIBUTE_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("@"+contextNode.getNodeName(), this);
countMatchPattern = new XPath("@" + dtm.getNodeName(contextNode), this,
this, XPath.MATCH, support.getErrorListener());
break;
case DTM.CDATA_SECTION_NODE :
case DTM.TEXT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("text()", this);
countMatchPattern = new XPath("text()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.COMMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("comment()", this);
countMatchPattern = new XPath("comment()", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.DOCUMENT_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("/", this);
countMatchPattern = new XPath("/", this, this, XPath.MATCH, support.getErrorListener());
break;
case DTM.PROCESSING_INSTRUCTION_NODE :
// countMatchPattern = m_stylesheet.createMatchPattern("pi("+contextNode.getNodeName()+")", this);
countMatchPattern = new XPath("pi(" + dtm.getNodeName(contextNode)
+ ")", this, this, XPath.MATCH, support.getErrorListener());
break;
default :
countMatchPattern = null;
}
}
return countMatchPattern;
} | [
"XPath",
"getCountMatchPattern",
"(",
"XPathContext",
"support",
",",
"int",
"contextNode",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"XPath",
"countMatchPattern",
"=",
"m_countMatchPattern",
";",
"DTM",
"dtm",
"=",
"s... | Get the count match pattern, or a default value.
@param support The XPath runtime state for this.
@param contextNode The node that "." expresses.
@return the count match pattern, or a default value.
@throws javax.xml.transform.TransformerException | [
"Get",
"the",
"count",
"match",
"pattern",
"or",
"a",
"default",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L718-L775 |
34,442 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getPreviousNode | public int getPreviousNode(XPathContext xctxt, int pos)
throws TransformerException
{
XPath countMatchPattern = getCountMatchPattern(xctxt, pos);
DTM dtm = xctxt.getDTM(pos);
if (Constants.NUMBERLEVEL_ANY == m_level)
{
XPath fromMatchPattern = m_fromMatchPattern;
// Do a backwards document-order walk 'till a node is found that matches
// the 'from' pattern, or a node is found that matches the 'count' pattern,
// or the top of the tree is found.
while (DTM.NULL != pos)
{
// Get the previous sibling, if there is no previous sibling,
// then count the parent, but if there is a previous sibling,
// dive down to the lowest right-hand (last) child of that sibling.
int next = dtm.getPreviousSibling(pos);
if (DTM.NULL == next)
{
next = dtm.getParent(pos);
if ((DTM.NULL != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore(
xctxt, next) != XPath.MATCH_SCORE_NONE)))
|| (dtm.getNodeType(next) == DTM.DOCUMENT_NODE)))
{
pos = DTM.NULL; // return null from function.
break; // from while loop
}
}
else
{
// dive down to the lowest right child.
int child = next;
while (DTM.NULL != child)
{
child = dtm.getLastChild(next);
if (DTM.NULL != child)
next = child;
}
}
pos = next;
if ((DTM.NULL != pos)
&& ((null == countMatchPattern)
|| (countMatchPattern.getMatchScore(xctxt, pos)
!= XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
else // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
{
while (DTM.NULL != pos)
{
pos = dtm.getPreviousSibling(pos);
if ((DTM.NULL != pos)
&& ((null == countMatchPattern)
|| (countMatchPattern.getMatchScore(xctxt, pos)
!= XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
return pos;
} | java | public int getPreviousNode(XPathContext xctxt, int pos)
throws TransformerException
{
XPath countMatchPattern = getCountMatchPattern(xctxt, pos);
DTM dtm = xctxt.getDTM(pos);
if (Constants.NUMBERLEVEL_ANY == m_level)
{
XPath fromMatchPattern = m_fromMatchPattern;
// Do a backwards document-order walk 'till a node is found that matches
// the 'from' pattern, or a node is found that matches the 'count' pattern,
// or the top of the tree is found.
while (DTM.NULL != pos)
{
// Get the previous sibling, if there is no previous sibling,
// then count the parent, but if there is a previous sibling,
// dive down to the lowest right-hand (last) child of that sibling.
int next = dtm.getPreviousSibling(pos);
if (DTM.NULL == next)
{
next = dtm.getParent(pos);
if ((DTM.NULL != next) && ((((null != fromMatchPattern) && (fromMatchPattern.getMatchScore(
xctxt, next) != XPath.MATCH_SCORE_NONE)))
|| (dtm.getNodeType(next) == DTM.DOCUMENT_NODE)))
{
pos = DTM.NULL; // return null from function.
break; // from while loop
}
}
else
{
// dive down to the lowest right child.
int child = next;
while (DTM.NULL != child)
{
child = dtm.getLastChild(next);
if (DTM.NULL != child)
next = child;
}
}
pos = next;
if ((DTM.NULL != pos)
&& ((null == countMatchPattern)
|| (countMatchPattern.getMatchScore(xctxt, pos)
!= XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
else // NUMBERLEVEL_MULTI or NUMBERLEVEL_SINGLE
{
while (DTM.NULL != pos)
{
pos = dtm.getPreviousSibling(pos);
if ((DTM.NULL != pos)
&& ((null == countMatchPattern)
|| (countMatchPattern.getMatchScore(xctxt, pos)
!= XPath.MATCH_SCORE_NONE)))
{
break;
}
}
}
return pos;
} | [
"public",
"int",
"getPreviousNode",
"(",
"XPathContext",
"xctxt",
",",
"int",
"pos",
")",
"throws",
"TransformerException",
"{",
"XPath",
"countMatchPattern",
"=",
"getCountMatchPattern",
"(",
"xctxt",
",",
"pos",
")",
";",
"DTM",
"dtm",
"=",
"xctxt",
".",
"ge... | Get the previous node to be counted.
@param xctxt The XPath runtime state for this.
@param pos The current node
@return the previous node to be counted.
@throws TransformerException | [
"Get",
"the",
"previous",
"node",
"to",
"be",
"counted",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L852-L930 |
34,443 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getTargetNode | public int getTargetNode(XPathContext xctxt, int sourceNode)
throws TransformerException
{
int target = DTM.NULL;
XPath countMatchPattern = getCountMatchPattern(xctxt, sourceNode);
if (Constants.NUMBERLEVEL_ANY == m_level)
{
target = findPrecedingOrAncestorOrSelf(xctxt, m_fromMatchPattern,
countMatchPattern, sourceNode,
this);
}
else
{
target = findAncestor(xctxt, m_fromMatchPattern, countMatchPattern,
sourceNode, this);
}
return target;
} | java | public int getTargetNode(XPathContext xctxt, int sourceNode)
throws TransformerException
{
int target = DTM.NULL;
XPath countMatchPattern = getCountMatchPattern(xctxt, sourceNode);
if (Constants.NUMBERLEVEL_ANY == m_level)
{
target = findPrecedingOrAncestorOrSelf(xctxt, m_fromMatchPattern,
countMatchPattern, sourceNode,
this);
}
else
{
target = findAncestor(xctxt, m_fromMatchPattern, countMatchPattern,
sourceNode, this);
}
return target;
} | [
"public",
"int",
"getTargetNode",
"(",
"XPathContext",
"xctxt",
",",
"int",
"sourceNode",
")",
"throws",
"TransformerException",
"{",
"int",
"target",
"=",
"DTM",
".",
"NULL",
";",
"XPath",
"countMatchPattern",
"=",
"getCountMatchPattern",
"(",
"xctxt",
",",
"so... | Get the target node that will be counted..
@param xctxt The XPath runtime state for this.
@param sourceNode non-null reference to the <a href="http://www.w3.org/TR/xslt#dt-current-node">current source node</a>.
@return the target node that will be counted
@throws TransformerException | [
"Get",
"the",
"target",
"node",
"that",
"will",
"be",
"counted",
".."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L942-L962 |
34,444 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getMatchingAncestors | NodeVector getMatchingAncestors(
XPathContext xctxt, int node, boolean stopAtFirstFound)
throws javax.xml.transform.TransformerException
{
NodeSetDTM ancestors = new NodeSetDTM(xctxt.getDTMManager());
XPath countMatchPattern = getCountMatchPattern(xctxt, node);
DTM dtm = xctxt.getDTM(node);
while (DTM.NULL != node)
{
if ((null != m_fromMatchPattern)
&& (m_fromMatchPattern.getMatchScore(xctxt, node)
!= XPath.MATCH_SCORE_NONE))
{
// The following if statement gives level="single" different
// behavior from level="multiple", which seems incorrect according
// to the XSLT spec. For now we are leaving this in to replicate
// the same behavior in XT, but, for all intents and purposes we
// think this is a bug, or there is something about level="single"
// that we still don't understand.
if (!stopAtFirstFound)
break;
}
if (null == countMatchPattern)
System.out.println(
"Programmers error! countMatchPattern should never be null!");
if (countMatchPattern.getMatchScore(xctxt, node)
!= XPath.MATCH_SCORE_NONE)
{
ancestors.addElement(node);
if (stopAtFirstFound)
break;
}
node = dtm.getParent(node);
}
return ancestors;
} | java | NodeVector getMatchingAncestors(
XPathContext xctxt, int node, boolean stopAtFirstFound)
throws javax.xml.transform.TransformerException
{
NodeSetDTM ancestors = new NodeSetDTM(xctxt.getDTMManager());
XPath countMatchPattern = getCountMatchPattern(xctxt, node);
DTM dtm = xctxt.getDTM(node);
while (DTM.NULL != node)
{
if ((null != m_fromMatchPattern)
&& (m_fromMatchPattern.getMatchScore(xctxt, node)
!= XPath.MATCH_SCORE_NONE))
{
// The following if statement gives level="single" different
// behavior from level="multiple", which seems incorrect according
// to the XSLT spec. For now we are leaving this in to replicate
// the same behavior in XT, but, for all intents and purposes we
// think this is a bug, or there is something about level="single"
// that we still don't understand.
if (!stopAtFirstFound)
break;
}
if (null == countMatchPattern)
System.out.println(
"Programmers error! countMatchPattern should never be null!");
if (countMatchPattern.getMatchScore(xctxt, node)
!= XPath.MATCH_SCORE_NONE)
{
ancestors.addElement(node);
if (stopAtFirstFound)
break;
}
node = dtm.getParent(node);
}
return ancestors;
} | [
"NodeVector",
"getMatchingAncestors",
"(",
"XPathContext",
"xctxt",
",",
"int",
"node",
",",
"boolean",
"stopAtFirstFound",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"NodeSetDTM",
"ancestors",
"=",
"new",
"NodeSetDTM",
... | Get the ancestors, up to the root, that match the
pattern.
@param xctxt The XPath runtime state for this.
@param node Count this node and it's ancestors.
@param stopAtFirstFound Flag indicating to stop after the
first node is found (difference between level = single
or multiple)
@return The number of ancestors that match the pattern.
@throws javax.xml.transform.TransformerException | [
"Get",
"the",
"ancestors",
"up",
"to",
"the",
"root",
"that",
"match",
"the",
"pattern",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L977-L1020 |
34,445 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getLocale | Locale getLocale(TransformerImpl transformer, int contextNode)
throws TransformerException
{
Locale locale = null;
if (null != m_lang_avt)
{
XPathContext xctxt = transformer.getXPathContext();
String langValue = m_lang_avt.evaluate(xctxt, contextNode, this);
if (null != langValue)
{
// Not really sure what to do about the country code, so I use the
// default from the system.
// TODO: fix xml:lang handling.
locale = new Locale(langValue.toUpperCase(), "");
//Locale.getDefault().getDisplayCountry());
if (null == locale)
{
transformer.getMsgMgr().warn(this, null, xctxt.getDTM(contextNode).getNode(contextNode),
XSLTErrorResources.WG_LOCALE_NOT_FOUND,
new Object[]{ langValue }); //"Warning: Could not find locale for xml:lang="+langValue);
locale = Locale.getDefault();
}
}
}
else
{
locale = Locale.getDefault();
}
return locale;
} | java | Locale getLocale(TransformerImpl transformer, int contextNode)
throws TransformerException
{
Locale locale = null;
if (null != m_lang_avt)
{
XPathContext xctxt = transformer.getXPathContext();
String langValue = m_lang_avt.evaluate(xctxt, contextNode, this);
if (null != langValue)
{
// Not really sure what to do about the country code, so I use the
// default from the system.
// TODO: fix xml:lang handling.
locale = new Locale(langValue.toUpperCase(), "");
//Locale.getDefault().getDisplayCountry());
if (null == locale)
{
transformer.getMsgMgr().warn(this, null, xctxt.getDTM(contextNode).getNode(contextNode),
XSLTErrorResources.WG_LOCALE_NOT_FOUND,
new Object[]{ langValue }); //"Warning: Could not find locale for xml:lang="+langValue);
locale = Locale.getDefault();
}
}
}
else
{
locale = Locale.getDefault();
}
return locale;
} | [
"Locale",
"getLocale",
"(",
"TransformerImpl",
"transformer",
",",
"int",
"contextNode",
")",
"throws",
"TransformerException",
"{",
"Locale",
"locale",
"=",
"null",
";",
"if",
"(",
"null",
"!=",
"m_lang_avt",
")",
"{",
"XPathContext",
"xctxt",
"=",
"transformer... | Get the locale we should be using.
@param transformer non-null reference to the the current transform-time state.
@param contextNode The node that "." expresses.
@return The locale to use. May be specified by "lang" attribute,
but if not, use default locale on the system.
@throws TransformerException | [
"Get",
"the",
"locale",
"we",
"should",
"be",
"using",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1033-L1069 |
34,446 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.getNumberFormatter | private DecimalFormat getNumberFormatter(
TransformerImpl transformer, int contextNode) throws TransformerException
{
// Patch from Steven Serocki
// Maybe we really want to do the clone in getLocale() and return
// a clone of the default Locale??
Locale locale = (Locale)getLocale(transformer, contextNode).clone();
// Helper to format local specific numbers to strings.
DecimalFormat formatter = null;
//synchronized (locale)
//{
// formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
//}
String digitGroupSepValue =
(null != m_groupingSeparator_avt)
? m_groupingSeparator_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
// Validate grouping separator if an AVT was used; otherwise this was
// validated statically in XSLTAttributeDef.java.
if ((digitGroupSepValue != null) && (!m_groupingSeparator_avt.isSimple()) &&
(digitGroupSepValue.length() != 1))
{
transformer.getMsgMgr().warn(
this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_NAME, m_groupingSeparator_avt.getName()});
}
String nDigitsPerGroupValue =
(null != m_groupingSize_avt)
? m_groupingSize_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
// TODO: Handle digit-group attributes
if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue) &&
// Ignore if separation value is empty string
(digitGroupSepValue.length() > 0))
{
try
{
formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
formatter.setGroupingSize(
Integer.valueOf(nDigitsPerGroupValue).intValue());
DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
symbols.setGroupingSeparator(digitGroupSepValue.charAt(0));
formatter.setDecimalFormatSymbols(symbols);
formatter.setGroupingUsed(true);
}
catch (NumberFormatException ex)
{
formatter.setGroupingUsed(false);
}
}
return formatter;
} | java | private DecimalFormat getNumberFormatter(
TransformerImpl transformer, int contextNode) throws TransformerException
{
// Patch from Steven Serocki
// Maybe we really want to do the clone in getLocale() and return
// a clone of the default Locale??
Locale locale = (Locale)getLocale(transformer, contextNode).clone();
// Helper to format local specific numbers to strings.
DecimalFormat formatter = null;
//synchronized (locale)
//{
// formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
//}
String digitGroupSepValue =
(null != m_groupingSeparator_avt)
? m_groupingSeparator_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
// Validate grouping separator if an AVT was used; otherwise this was
// validated statically in XSLTAttributeDef.java.
if ((digitGroupSepValue != null) && (!m_groupingSeparator_avt.isSimple()) &&
(digitGroupSepValue.length() != 1))
{
transformer.getMsgMgr().warn(
this, XSLTErrorResources.WG_ILLEGAL_ATTRIBUTE_VALUE,
new Object[]{ Constants.ATTRNAME_NAME, m_groupingSeparator_avt.getName()});
}
String nDigitsPerGroupValue =
(null != m_groupingSize_avt)
? m_groupingSize_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
// TODO: Handle digit-group attributes
if ((null != digitGroupSepValue) && (null != nDigitsPerGroupValue) &&
// Ignore if separation value is empty string
(digitGroupSepValue.length() > 0))
{
try
{
formatter = (DecimalFormat) NumberFormat.getNumberInstance(locale);
formatter.setGroupingSize(
Integer.valueOf(nDigitsPerGroupValue).intValue());
DecimalFormatSymbols symbols = formatter.getDecimalFormatSymbols();
symbols.setGroupingSeparator(digitGroupSepValue.charAt(0));
formatter.setDecimalFormatSymbols(symbols);
formatter.setGroupingUsed(true);
}
catch (NumberFormatException ex)
{
formatter.setGroupingUsed(false);
}
}
return formatter;
} | [
"private",
"DecimalFormat",
"getNumberFormatter",
"(",
"TransformerImpl",
"transformer",
",",
"int",
"contextNode",
")",
"throws",
"TransformerException",
"{",
"// Patch from Steven Serocki",
"// Maybe we really want to do the clone in getLocale() and return ",
"// a clone of the defa... | Get the number formatter to be used the format the numbers
@param transformer non-null reference to the the current transform-time state.
@param contextNode The node that "." expresses.
($objectName$) @return The number formatter to be used
@throws TransformerException | [
"Get",
"the",
"number",
"formatter",
"to",
"be",
"used",
"the",
"format",
"the",
"numbers"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1081-L1142 |
34,447 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.formatNumberList | String formatNumberList(
TransformerImpl transformer, long[] list, int contextNode)
throws TransformerException
{
String numStr;
FastStringBuffer formattedNumber = StringBufferPool.get();
try
{
int nNumbers = list.length, numberWidth = 1;
char numberType = '1';
String formatToken, lastSepString = null, formatTokenString = null;
// If a seperator hasn't been specified, then use "."
// as a default separator.
// For instance: [2][1][5] with a format value of "1 "
// should format to "2.1.5 " (I think).
// Otherwise, use the seperator specified in the format string.
// For instance: [2][1][5] with a format value of "01-001. "
// should format to "02-001-005 ".
String lastSep = ".";
boolean isFirstToken = true; // true if first token
String formatValue =
(null != m_format_avt)
? m_format_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
if (null == formatValue)
formatValue = "1";
NumberFormatStringTokenizer formatTokenizer =
new NumberFormatStringTokenizer(formatValue);
// int sepCount = 0; // keep track of seperators
// Loop through all the numbers in the list.
for (int i = 0; i < nNumbers; i++)
{
// Loop to the next digit, letter, or separator.
if (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
// If the first character of this token is a character or digit, then
// it is a number format directive.
if (Character.isLetterOrDigit(
formatToken.charAt(formatToken.length() - 1)))
{
numberWidth = formatToken.length();
numberType = formatToken.charAt(numberWidth - 1);
}
// If there is a number format directive ahead,
// then append the formatToken.
else if (formatTokenizer.isLetterOrDigitAhead())
{
formatTokenString = formatToken;
// Append the formatToken string...
// For instance [2][1][5] with a format value of "1--1. "
// should format to "2--1--5. " (I guess).
while (formatTokenizer.nextIsSep())
{
formatToken = formatTokenizer.nextToken();
formatTokenString += formatToken;
}
// Record this separator, so it can be used as the
// next separator, if the next is the last.
// For instance: [2][1][5] with a format value of "1-1 "
// should format to "2-1-5 ".
if (!isFirstToken)
lastSep = formatTokenString;
// Since we know the next is a number or digit, we get it now.
formatToken = formatTokenizer.nextToken();
numberWidth = formatToken.length();
numberType = formatToken.charAt(numberWidth - 1);
}
else // only separators left
{
// Set up the string for the trailing characters after
// the last number is formatted (i.e. after the loop).
lastSepString = formatToken;
// And append any remaining characters to the lastSepString.
while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
lastSepString += formatToken;
}
} // else
} // end if(formatTokenizer.hasMoreTokens())
// if this is the first token and there was a prefix
// append the prefix else, append the separator
// For instance, [2][1][5] with a format value of "(1-1.) "
// should format to "(2-1-5.) " (I guess).
if (null != formatTokenString && isFirstToken)
{
formattedNumber.append(formatTokenString);
}
else if (null != lastSep &&!isFirstToken)
formattedNumber.append(lastSep);
getFormattedNumber(transformer, contextNode, numberType, numberWidth,
list[i], formattedNumber);
isFirstToken = false; // After the first pass, this should be false
} // end for loop
// Check to see if we finished up the format string...
// Skip past all remaining letters or digits
while (formatTokenizer.isLetterOrDigitAhead())
{
formatTokenizer.nextToken();
}
if (lastSepString != null)
formattedNumber.append(lastSepString);
while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
formattedNumber.append(formatToken);
}
numStr = formattedNumber.toString();
}
finally
{
StringBufferPool.free(formattedNumber);
}
return numStr;
} | java | String formatNumberList(
TransformerImpl transformer, long[] list, int contextNode)
throws TransformerException
{
String numStr;
FastStringBuffer formattedNumber = StringBufferPool.get();
try
{
int nNumbers = list.length, numberWidth = 1;
char numberType = '1';
String formatToken, lastSepString = null, formatTokenString = null;
// If a seperator hasn't been specified, then use "."
// as a default separator.
// For instance: [2][1][5] with a format value of "1 "
// should format to "2.1.5 " (I think).
// Otherwise, use the seperator specified in the format string.
// For instance: [2][1][5] with a format value of "01-001. "
// should format to "02-001-005 ".
String lastSep = ".";
boolean isFirstToken = true; // true if first token
String formatValue =
(null != m_format_avt)
? m_format_avt.evaluate(
transformer.getXPathContext(), contextNode, this) : null;
if (null == formatValue)
formatValue = "1";
NumberFormatStringTokenizer formatTokenizer =
new NumberFormatStringTokenizer(formatValue);
// int sepCount = 0; // keep track of seperators
// Loop through all the numbers in the list.
for (int i = 0; i < nNumbers; i++)
{
// Loop to the next digit, letter, or separator.
if (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
// If the first character of this token is a character or digit, then
// it is a number format directive.
if (Character.isLetterOrDigit(
formatToken.charAt(formatToken.length() - 1)))
{
numberWidth = formatToken.length();
numberType = formatToken.charAt(numberWidth - 1);
}
// If there is a number format directive ahead,
// then append the formatToken.
else if (formatTokenizer.isLetterOrDigitAhead())
{
formatTokenString = formatToken;
// Append the formatToken string...
// For instance [2][1][5] with a format value of "1--1. "
// should format to "2--1--5. " (I guess).
while (formatTokenizer.nextIsSep())
{
formatToken = formatTokenizer.nextToken();
formatTokenString += formatToken;
}
// Record this separator, so it can be used as the
// next separator, if the next is the last.
// For instance: [2][1][5] with a format value of "1-1 "
// should format to "2-1-5 ".
if (!isFirstToken)
lastSep = formatTokenString;
// Since we know the next is a number or digit, we get it now.
formatToken = formatTokenizer.nextToken();
numberWidth = formatToken.length();
numberType = formatToken.charAt(numberWidth - 1);
}
else // only separators left
{
// Set up the string for the trailing characters after
// the last number is formatted (i.e. after the loop).
lastSepString = formatToken;
// And append any remaining characters to the lastSepString.
while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
lastSepString += formatToken;
}
} // else
} // end if(formatTokenizer.hasMoreTokens())
// if this is the first token and there was a prefix
// append the prefix else, append the separator
// For instance, [2][1][5] with a format value of "(1-1.) "
// should format to "(2-1-5.) " (I guess).
if (null != formatTokenString && isFirstToken)
{
formattedNumber.append(formatTokenString);
}
else if (null != lastSep &&!isFirstToken)
formattedNumber.append(lastSep);
getFormattedNumber(transformer, contextNode, numberType, numberWidth,
list[i], formattedNumber);
isFirstToken = false; // After the first pass, this should be false
} // end for loop
// Check to see if we finished up the format string...
// Skip past all remaining letters or digits
while (formatTokenizer.isLetterOrDigitAhead())
{
formatTokenizer.nextToken();
}
if (lastSepString != null)
formattedNumber.append(lastSepString);
while (formatTokenizer.hasMoreTokens())
{
formatToken = formatTokenizer.nextToken();
formattedNumber.append(formatToken);
}
numStr = formattedNumber.toString();
}
finally
{
StringBufferPool.free(formattedNumber);
}
return numStr;
} | [
"String",
"formatNumberList",
"(",
"TransformerImpl",
"transformer",
",",
"long",
"[",
"]",
"list",
",",
"int",
"contextNode",
")",
"throws",
"TransformerException",
"{",
"String",
"numStr",
";",
"FastStringBuffer",
"formattedNumber",
"=",
"StringBufferPool",
".",
"... | Format a vector of numbers into a formatted string.
@param transformer non-null reference to the the current transform-time state.
@param list Array of one or more long integer numbers.
@param contextNode The node that "." expresses.
@return String that represents list according to
%conversion-atts; attributes.
TODO: Optimize formatNumberList so that it caches the last count and
reuses that info for the next count.
@throws TransformerException | [
"Format",
"a",
"vector",
"of",
"numbers",
"into",
"a",
"formatted",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1157-L1295 |
34,448 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.int2singlealphaCount | protected String int2singlealphaCount(long val, CharArrayWrapper table)
{
int radix = table.getLength();
// TODO: throw error on out of range input
if (val > radix)
{
return getZeroString();
}
else
return (new Character(table.getChar((int)val - 1))).toString(); // index into table is off one, starts at 0
} | java | protected String int2singlealphaCount(long val, CharArrayWrapper table)
{
int radix = table.getLength();
// TODO: throw error on out of range input
if (val > radix)
{
return getZeroString();
}
else
return (new Character(table.getChar((int)val - 1))).toString(); // index into table is off one, starts at 0
} | [
"protected",
"String",
"int2singlealphaCount",
"(",
"long",
"val",
",",
"CharArrayWrapper",
"table",
")",
"{",
"int",
"radix",
"=",
"table",
".",
"getLength",
"(",
")",
";",
"// TODO: throw error on out of range input",
"if",
"(",
"val",
">",
"radix",
")",
"{",... | Convert a long integer into alphabetic counting, in other words
count using the sequence A B C ... Z.
@param val Value to convert -- must be greater than zero.
@param table a table containing one character for each digit in the radix
@return String representing alpha count of number.
@see TransformerImpl#DecimalToRoman
Note that the radix of the conversion is inferred from the size
of the table. | [
"Convert",
"a",
"long",
"integer",
"into",
"alphabetic",
"counting",
"in",
"other",
"words",
"count",
"using",
"the",
"sequence",
"A",
"B",
"C",
"...",
"Z",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1592-L1604 |
34,449 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java | ElemNumber.long2roman | protected String long2roman(long val, boolean prefixesAreOK)
{
if (val <= 0)
{
return getZeroString();
}
String roman = "";
int place = 0;
if (val <= 3999L)
{
do
{
while (val >= m_romanConvertTable[place].m_postValue)
{
roman += m_romanConvertTable[place].m_postLetter;
val -= m_romanConvertTable[place].m_postValue;
}
if (prefixesAreOK)
{
if (val >= m_romanConvertTable[place].m_preValue)
{
roman += m_romanConvertTable[place].m_preLetter;
val -= m_romanConvertTable[place].m_preValue;
}
}
place++;
}
while (val > 0);
}
else
{
roman = XSLTErrorResources.ERROR_STRING;
}
return roman;
} | java | protected String long2roman(long val, boolean prefixesAreOK)
{
if (val <= 0)
{
return getZeroString();
}
String roman = "";
int place = 0;
if (val <= 3999L)
{
do
{
while (val >= m_romanConvertTable[place].m_postValue)
{
roman += m_romanConvertTable[place].m_postLetter;
val -= m_romanConvertTable[place].m_postValue;
}
if (prefixesAreOK)
{
if (val >= m_romanConvertTable[place].m_preValue)
{
roman += m_romanConvertTable[place].m_preLetter;
val -= m_romanConvertTable[place].m_preValue;
}
}
place++;
}
while (val > 0);
}
else
{
roman = XSLTErrorResources.ERROR_STRING;
}
return roman;
} | [
"protected",
"String",
"long2roman",
"(",
"long",
"val",
",",
"boolean",
"prefixesAreOK",
")",
"{",
"if",
"(",
"val",
"<=",
"0",
")",
"{",
"return",
"getZeroString",
"(",
")",
";",
"}",
"String",
"roman",
"=",
"\"\"",
";",
"int",
"place",
"=",
"0",
"... | Convert a long integer into roman numerals.
@param val Value to convert.
@param prefixesAreOK true_ to enable prefix notation (e.g. 4 = "IV"),
false_ to disable prefix notation (e.g. 4 = "IIII").
@return Roman numeral string.
@see DecimalToRoman
@see m_romanConvertTable | [
"Convert",
"a",
"long",
"integer",
"into",
"roman",
"numerals",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemNumber.java#L1930-L1970 |
34,450 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AuthorityKeyIdentifierExtension.java | AuthorityKeyIdentifierExtension.encodeThis | private void encodeThis() throws IOException {
if (id == null && names == null && serialNum == null) {
this.extensionValue = null;
return;
}
DerOutputStream seq = new DerOutputStream();
DerOutputStream tmp = new DerOutputStream();
if (id != null) {
DerOutputStream tmp1 = new DerOutputStream();
id.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_ID), tmp1);
}
try {
if (names != null) {
DerOutputStream tmp1 = new DerOutputStream();
names.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
true, TAG_NAMES), tmp1);
}
} catch (Exception e) {
throw new IOException(e.toString());
}
if (serialNum != null) {
DerOutputStream tmp1 = new DerOutputStream();
serialNum.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_SERIAL_NUM), tmp1);
}
seq.write(DerValue.tag_Sequence, tmp);
this.extensionValue = seq.toByteArray();
} | java | private void encodeThis() throws IOException {
if (id == null && names == null && serialNum == null) {
this.extensionValue = null;
return;
}
DerOutputStream seq = new DerOutputStream();
DerOutputStream tmp = new DerOutputStream();
if (id != null) {
DerOutputStream tmp1 = new DerOutputStream();
id.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_ID), tmp1);
}
try {
if (names != null) {
DerOutputStream tmp1 = new DerOutputStream();
names.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
true, TAG_NAMES), tmp1);
}
} catch (Exception e) {
throw new IOException(e.toString());
}
if (serialNum != null) {
DerOutputStream tmp1 = new DerOutputStream();
serialNum.encode(tmp1);
tmp.writeImplicit(DerValue.createTag(DerValue.TAG_CONTEXT,
false, TAG_SERIAL_NUM), tmp1);
}
seq.write(DerValue.tag_Sequence, tmp);
this.extensionValue = seq.toByteArray();
} | [
"private",
"void",
"encodeThis",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"id",
"==",
"null",
"&&",
"names",
"==",
"null",
"&&",
"serialNum",
"==",
"null",
")",
"{",
"this",
".",
"extensionValue",
"=",
"null",
";",
"return",
";",
"}",
"DerOut... | Encode only the extension value | [
"Encode",
"only",
"the",
"extension",
"value"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AuthorityKeyIdentifierExtension.java#L83-L114 |
34,451 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AuthorityKeyIdentifierExtension.java | AuthorityKeyIdentifierExtension.getEncodedKeyIdentifier | public byte[] getEncodedKeyIdentifier() throws IOException {
if (id != null) {
DerOutputStream derOut = new DerOutputStream();
id.encode(derOut);
return derOut.toByteArray();
}
return null;
} | java | public byte[] getEncodedKeyIdentifier() throws IOException {
if (id != null) {
DerOutputStream derOut = new DerOutputStream();
id.encode(derOut);
return derOut.toByteArray();
}
return null;
} | [
"public",
"byte",
"[",
"]",
"getEncodedKeyIdentifier",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"id",
"!=",
"null",
")",
"{",
"DerOutputStream",
"derOut",
"=",
"new",
"DerOutputStream",
"(",
")",
";",
"id",
".",
"encode",
"(",
"derOut",
")",
";... | Return the encoded key identifier, or null if not specified. | [
"Return",
"the",
"encoded",
"key",
"identifier",
"or",
"null",
"if",
"not",
"specified",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/AuthorityKeyIdentifierExtension.java#L314-L321 |
34,452 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.getFCD16 | public int getFCD16(int c) {
if(c<0) {
return 0;
} else if(c<0x180) {
return tccc180[c];
} else if(c<=0xffff) {
if(!singleLeadMightHaveNonZeroFCD16(c)) { return 0; }
}
return getFCD16FromNormData(c);
} | java | public int getFCD16(int c) {
if(c<0) {
return 0;
} else if(c<0x180) {
return tccc180[c];
} else if(c<=0xffff) {
if(!singleLeadMightHaveNonZeroFCD16(c)) { return 0; }
}
return getFCD16FromNormData(c);
} | [
"public",
"int",
"getFCD16",
"(",
"int",
"c",
")",
"{",
"if",
"(",
"c",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"else",
"if",
"(",
"c",
"<",
"0x180",
")",
"{",
"return",
"tccc180",
"[",
"c",
"]",
";",
"}",
"else",
"if",
"(",
"c",
"<=",... | Returns the FCD data for code point c.
@param c A Unicode code point.
@return The lccc(c) in bits 15..8 and tccc(c) in bits 7..0. | [
"Returns",
"the",
"FCD",
"data",
"for",
"code",
"point",
"c",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L709-L718 |
34,453 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.getFCD16FromNormData | public int getFCD16FromNormData(int c) {
// Only loops for 1:1 algorithmic mappings.
for(;;) {
int norm16=getNorm16(c);
if(norm16<=minYesNo) {
// no decomposition or Hangul syllable, all zeros
return 0;
} else if(norm16>=MIN_NORMAL_MAYBE_YES) {
// combining mark
norm16&=0xff;
return norm16|(norm16<<8);
} else if(norm16>=minMaybeYes) {
return 0;
} else if(isDecompNoAlgorithmic(norm16)) {
c=mapAlgorithmic(c, norm16);
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
if((firstUnit&MAPPING_LENGTH_MASK)==0) {
// A character that is deleted (maps to an empty string) must
// get the worst-case lccc and tccc values because arbitrary
// characters on both sides will become adjacent.
return 0x1ff;
} else {
int fcd16=firstUnit>>8; // tccc
if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) {
fcd16|=extraData.charAt(norm16-1)&0xff00; // lccc
}
return fcd16;
}
}
}
} | java | public int getFCD16FromNormData(int c) {
// Only loops for 1:1 algorithmic mappings.
for(;;) {
int norm16=getNorm16(c);
if(norm16<=minYesNo) {
// no decomposition or Hangul syllable, all zeros
return 0;
} else if(norm16>=MIN_NORMAL_MAYBE_YES) {
// combining mark
norm16&=0xff;
return norm16|(norm16<<8);
} else if(norm16>=minMaybeYes) {
return 0;
} else if(isDecompNoAlgorithmic(norm16)) {
c=mapAlgorithmic(c, norm16);
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
if((firstUnit&MAPPING_LENGTH_MASK)==0) {
// A character that is deleted (maps to an empty string) must
// get the worst-case lccc and tccc values because arbitrary
// characters on both sides will become adjacent.
return 0x1ff;
} else {
int fcd16=firstUnit>>8; // tccc
if((firstUnit&MAPPING_HAS_CCC_LCCC_WORD)!=0) {
fcd16|=extraData.charAt(norm16-1)&0xff00; // lccc
}
return fcd16;
}
}
}
} | [
"public",
"int",
"getFCD16FromNormData",
"(",
"int",
"c",
")",
"{",
"// Only loops for 1:1 algorithmic mappings.",
"for",
"(",
";",
";",
")",
"{",
"int",
"norm16",
"=",
"getNorm16",
"(",
"c",
")",
";",
"if",
"(",
"norm16",
"<=",
"minYesNo",
")",
"{",
"// n... | Gets the FCD value from the regular normalization data. | [
"Gets",
"the",
"FCD",
"value",
"from",
"the",
"regular",
"normalization",
"data",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L730-L762 |
34,454 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.getDecomposition | public String getDecomposition(int c) {
int decomp=-1;
int norm16;
for(;;) {
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
} else if(isHangul(norm16)) {
// Hangul syllable: decompose algorithmically
StringBuilder buffer=new StringBuilder();
Hangul.decompose(c, buffer);
return buffer.toString();
} else if(isDecompNoAlgorithmic(norm16)) {
decomp=c=mapAlgorithmic(c, norm16);
continue;
} else {
// c decomposes, get everything from the variable-length extra data
int length=extraData.charAt(norm16++)&MAPPING_LENGTH_MASK;
return extraData.substring(norm16, norm16+length);
}
if(decomp<0) {
return null;
} else {
return UTF16.valueOf(decomp);
}
}
} | java | public String getDecomposition(int c) {
int decomp=-1;
int norm16;
for(;;) {
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
} else if(isHangul(norm16)) {
// Hangul syllable: decompose algorithmically
StringBuilder buffer=new StringBuilder();
Hangul.decompose(c, buffer);
return buffer.toString();
} else if(isDecompNoAlgorithmic(norm16)) {
decomp=c=mapAlgorithmic(c, norm16);
continue;
} else {
// c decomposes, get everything from the variable-length extra data
int length=extraData.charAt(norm16++)&MAPPING_LENGTH_MASK;
return extraData.substring(norm16, norm16+length);
}
if(decomp<0) {
return null;
} else {
return UTF16.valueOf(decomp);
}
}
} | [
"public",
"String",
"getDecomposition",
"(",
"int",
"c",
")",
"{",
"int",
"decomp",
"=",
"-",
"1",
";",
"int",
"norm16",
";",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"c",
"<",
"minDecompNoCP",
"||",
"isDecompYes",
"(",
"norm16",
"=",
"getNorm16",
... | Gets the decomposition for one code point.
@param c code point
@return c's decomposition, if it has one; returns null if it does not have a decomposition | [
"Gets",
"the",
"decomposition",
"for",
"one",
"code",
"point",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L769-L794 |
34,455 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.getRawDecomposition | public String getRawDecomposition(int c) {
// We do not loop in this method because an algorithmic mapping itself
// becomes a final result rather than having to be decomposed recursively.
int norm16;
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
return null;
} else if(isHangul(norm16)) {
// Hangul syllable: decompose algorithmically
StringBuilder buffer=new StringBuilder();
Hangul.getRawDecomposition(c, buffer);
return buffer.toString();
} else if(isDecompNoAlgorithmic(norm16)) {
return UTF16.valueOf(mapAlgorithmic(c, norm16));
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
int mLength=firstUnit&MAPPING_LENGTH_MASK; // length of normal mapping
if((firstUnit&MAPPING_HAS_RAW_MAPPING)!=0) {
// Read the raw mapping from before the firstUnit and before the optional ccc/lccc word.
// Bit 7=MAPPING_HAS_CCC_LCCC_WORD
int rawMapping=norm16-((firstUnit>>7)&1)-1;
char rm0=extraData.charAt(rawMapping);
if(rm0<=MAPPING_LENGTH_MASK) {
return extraData.substring(rawMapping-rm0, rawMapping);
} else {
// Copy the normal mapping and replace its first two code units with rm0.
StringBuilder buffer=new StringBuilder(mLength-1).append(rm0);
norm16+=1+2; // skip over the firstUnit and the first two mapping code units
return buffer.append(extraData, norm16, norm16+mLength-2).toString();
}
} else {
norm16+=1; // skip over the firstUnit
return extraData.substring(norm16, norm16+mLength);
}
}
} | java | public String getRawDecomposition(int c) {
// We do not loop in this method because an algorithmic mapping itself
// becomes a final result rather than having to be decomposed recursively.
int norm16;
if(c<minDecompNoCP || isDecompYes(norm16=getNorm16(c))) {
// c does not decompose
return null;
} else if(isHangul(norm16)) {
// Hangul syllable: decompose algorithmically
StringBuilder buffer=new StringBuilder();
Hangul.getRawDecomposition(c, buffer);
return buffer.toString();
} else if(isDecompNoAlgorithmic(norm16)) {
return UTF16.valueOf(mapAlgorithmic(c, norm16));
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
int mLength=firstUnit&MAPPING_LENGTH_MASK; // length of normal mapping
if((firstUnit&MAPPING_HAS_RAW_MAPPING)!=0) {
// Read the raw mapping from before the firstUnit and before the optional ccc/lccc word.
// Bit 7=MAPPING_HAS_CCC_LCCC_WORD
int rawMapping=norm16-((firstUnit>>7)&1)-1;
char rm0=extraData.charAt(rawMapping);
if(rm0<=MAPPING_LENGTH_MASK) {
return extraData.substring(rawMapping-rm0, rawMapping);
} else {
// Copy the normal mapping and replace its first two code units with rm0.
StringBuilder buffer=new StringBuilder(mLength-1).append(rm0);
norm16+=1+2; // skip over the firstUnit and the first two mapping code units
return buffer.append(extraData, norm16, norm16+mLength-2).toString();
}
} else {
norm16+=1; // skip over the firstUnit
return extraData.substring(norm16, norm16+mLength);
}
}
} | [
"public",
"String",
"getRawDecomposition",
"(",
"int",
"c",
")",
"{",
"// We do not loop in this method because an algorithmic mapping itself",
"// becomes a final result rather than having to be decomposed recursively.",
"int",
"norm16",
";",
"if",
"(",
"c",
"<",
"minDecompNoCP",
... | Gets the raw decomposition for one code point.
@param c code point
@return c's raw decomposition, if it has one; returns null if it does not have a decomposition | [
"Gets",
"the",
"raw",
"decomposition",
"for",
"one",
"code",
"point",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L801-L837 |
34,456 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.decompose | public Appendable decompose(CharSequence s, StringBuilder dest) {
decompose(s, 0, s.length(), dest, s.length());
return dest;
} | java | public Appendable decompose(CharSequence s, StringBuilder dest) {
decompose(s, 0, s.length(), dest, s.length());
return dest;
} | [
"public",
"Appendable",
"decompose",
"(",
"CharSequence",
"s",
",",
"StringBuilder",
"dest",
")",
"{",
"decompose",
"(",
"s",
",",
"0",
",",
"s",
".",
"length",
"(",
")",
",",
"dest",
",",
"s",
".",
"length",
"(",
")",
")",
";",
"return",
"dest",
"... | NFD without an NFD Normalizer2 instance. | [
"NFD",
"without",
"an",
"NFD",
"Normalizer2",
"instance",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L930-L933 |
34,457 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.decompose | public void decompose(CharSequence s, int src, int limit, StringBuilder dest,
int destLengthEstimate) {
if(destLengthEstimate<0) {
destLengthEstimate=limit-src;
}
dest.setLength(0);
ReorderingBuffer buffer=new ReorderingBuffer(this, dest, destLengthEstimate);
decompose(s, src, limit, buffer);
} | java | public void decompose(CharSequence s, int src, int limit, StringBuilder dest,
int destLengthEstimate) {
if(destLengthEstimate<0) {
destLengthEstimate=limit-src;
}
dest.setLength(0);
ReorderingBuffer buffer=new ReorderingBuffer(this, dest, destLengthEstimate);
decompose(s, src, limit, buffer);
} | [
"public",
"void",
"decompose",
"(",
"CharSequence",
"s",
",",
"int",
"src",
",",
"int",
"limit",
",",
"StringBuilder",
"dest",
",",
"int",
"destLengthEstimate",
")",
"{",
"if",
"(",
"destLengthEstimate",
"<",
"0",
")",
"{",
"destLengthEstimate",
"=",
"limit"... | Decomposes s[src, limit[ and writes the result to dest.
limit can be NULL if src is NUL-terminated.
destLengthEstimate is the initial dest buffer capacity and can be -1. | [
"Decomposes",
"s",
"[",
"src",
"limit",
"[",
"and",
"writes",
"the",
"result",
"to",
"dest",
".",
"limit",
"can",
"be",
"NULL",
"if",
"src",
"is",
"NUL",
"-",
"terminated",
".",
"destLengthEstimate",
"is",
"the",
"initial",
"dest",
"buffer",
"capacity",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L939-L947 |
34,458 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.hasDecompBoundary | public boolean hasDecompBoundary(int c, boolean before) {
for(;;) {
if(c<minDecompNoCP) {
return true;
}
int norm16=getNorm16(c);
if(isHangul(norm16) || isDecompYesAndZeroCC(norm16)) {
return true;
} else if(norm16>MIN_NORMAL_MAYBE_YES) {
return false; // ccc!=0
} else if(isDecompNoAlgorithmic(norm16)) {
c=mapAlgorithmic(c, norm16);
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
if((firstUnit&MAPPING_LENGTH_MASK)==0) {
return false;
}
if(!before) {
// decomp after-boundary: same as hasFCDBoundaryAfter(),
// fcd16<=1 || trailCC==0
if(firstUnit>0x1ff) {
return false; // trailCC>1
}
if(firstUnit<=0xff) {
return true; // trailCC==0
}
// if(trailCC==1) test leadCC==0, same as checking for before-boundary
}
// true if leadCC==0 (hasFCDBoundaryBefore())
return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (extraData.charAt(norm16-1)&0xff00)==0;
}
}
} | java | public boolean hasDecompBoundary(int c, boolean before) {
for(;;) {
if(c<minDecompNoCP) {
return true;
}
int norm16=getNorm16(c);
if(isHangul(norm16) || isDecompYesAndZeroCC(norm16)) {
return true;
} else if(norm16>MIN_NORMAL_MAYBE_YES) {
return false; // ccc!=0
} else if(isDecompNoAlgorithmic(norm16)) {
c=mapAlgorithmic(c, norm16);
} else {
// c decomposes, get everything from the variable-length extra data
int firstUnit=extraData.charAt(norm16);
if((firstUnit&MAPPING_LENGTH_MASK)==0) {
return false;
}
if(!before) {
// decomp after-boundary: same as hasFCDBoundaryAfter(),
// fcd16<=1 || trailCC==0
if(firstUnit>0x1ff) {
return false; // trailCC>1
}
if(firstUnit<=0xff) {
return true; // trailCC==0
}
// if(trailCC==1) test leadCC==0, same as checking for before-boundary
}
// true if leadCC==0 (hasFCDBoundaryBefore())
return (firstUnit&MAPPING_HAS_CCC_LCCC_WORD)==0 || (extraData.charAt(norm16-1)&0xff00)==0;
}
}
} | [
"public",
"boolean",
"hasDecompBoundary",
"(",
"int",
"c",
",",
"boolean",
"before",
")",
"{",
"for",
"(",
";",
";",
")",
"{",
"if",
"(",
"c",
"<",
"minDecompNoCP",
")",
"{",
"return",
"true",
";",
"}",
"int",
"norm16",
"=",
"getNorm16",
"(",
"c",
... | at the cost of building the FCD trie for a decomposition normalizer. | [
"at",
"the",
"cost",
"of",
"building",
"the",
"FCD",
"trie",
"for",
"a",
"decomposition",
"normalizer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L1579-L1612 |
34,459 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.decomposeShort | public void decomposeShort(CharSequence s, int src, int limit,
ReorderingBuffer buffer) {
while(src<limit) {
int c=Character.codePointAt(s, src);
src+=Character.charCount(c);
decompose(c, getNorm16(c), buffer);
}
} | java | public void decomposeShort(CharSequence s, int src, int limit,
ReorderingBuffer buffer) {
while(src<limit) {
int c=Character.codePointAt(s, src);
src+=Character.charCount(c);
decompose(c, getNorm16(c), buffer);
}
} | [
"public",
"void",
"decomposeShort",
"(",
"CharSequence",
"s",
",",
"int",
"src",
",",
"int",
"limit",
",",
"ReorderingBuffer",
"buffer",
")",
"{",
"while",
"(",
"src",
"<",
"limit",
")",
"{",
"int",
"c",
"=",
"Character",
".",
"codePointAt",
"(",
"s",
... | Public in Java for collation implementation code. | [
"Public",
"in",
"Java",
"for",
"collation",
"implementation",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L1765-L1772 |
34,460 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java | Normalizer2Impl.combine | private static int combine(String compositions, int list, int trail) {
int key1, firstUnit;
if(trail<COMP_1_TRAIL_LIMIT) {
// trail character is 0..33FF
// result entry may have 2 or 3 units
key1=(trail<<1);
while(key1>(firstUnit=compositions.charAt(list))) {
list+=2+(firstUnit&COMP_1_TRIPLE);
}
if(key1==(firstUnit&COMP_1_TRAIL_MASK)) {
if((firstUnit&COMP_1_TRIPLE)!=0) {
return (compositions.charAt(list+1)<<16)|compositions.charAt(list+2);
} else {
return compositions.charAt(list+1);
}
}
} else {
// trail character is 3400..10FFFF
// result entry has 3 units
key1=COMP_1_TRAIL_LIMIT+(((trail>>COMP_1_TRAIL_SHIFT))&~COMP_1_TRIPLE);
int key2=(trail<<COMP_2_TRAIL_SHIFT)&0xffff;
int secondUnit;
for(;;) {
if(key1>(firstUnit=compositions.charAt(list))) {
list+=2+(firstUnit&COMP_1_TRIPLE);
} else if(key1==(firstUnit&COMP_1_TRAIL_MASK)) {
if(key2>(secondUnit=compositions.charAt(list+1))) {
if((firstUnit&COMP_1_LAST_TUPLE)!=0) {
break;
} else {
list+=3;
}
} else if(key2==(secondUnit&COMP_2_TRAIL_MASK)) {
return ((secondUnit&~COMP_2_TRAIL_MASK)<<16)|compositions.charAt(list+2);
} else {
break;
}
} else {
break;
}
}
}
return -1;
} | java | private static int combine(String compositions, int list, int trail) {
int key1, firstUnit;
if(trail<COMP_1_TRAIL_LIMIT) {
// trail character is 0..33FF
// result entry may have 2 or 3 units
key1=(trail<<1);
while(key1>(firstUnit=compositions.charAt(list))) {
list+=2+(firstUnit&COMP_1_TRIPLE);
}
if(key1==(firstUnit&COMP_1_TRAIL_MASK)) {
if((firstUnit&COMP_1_TRIPLE)!=0) {
return (compositions.charAt(list+1)<<16)|compositions.charAt(list+2);
} else {
return compositions.charAt(list+1);
}
}
} else {
// trail character is 3400..10FFFF
// result entry has 3 units
key1=COMP_1_TRAIL_LIMIT+(((trail>>COMP_1_TRAIL_SHIFT))&~COMP_1_TRIPLE);
int key2=(trail<<COMP_2_TRAIL_SHIFT)&0xffff;
int secondUnit;
for(;;) {
if(key1>(firstUnit=compositions.charAt(list))) {
list+=2+(firstUnit&COMP_1_TRIPLE);
} else if(key1==(firstUnit&COMP_1_TRAIL_MASK)) {
if(key2>(secondUnit=compositions.charAt(list+1))) {
if((firstUnit&COMP_1_LAST_TUPLE)!=0) {
break;
} else {
list+=3;
}
} else if(key2==(secondUnit&COMP_2_TRAIL_MASK)) {
return ((secondUnit&~COMP_2_TRAIL_MASK)<<16)|compositions.charAt(list+2);
} else {
break;
}
} else {
break;
}
}
}
return -1;
} | [
"private",
"static",
"int",
"combine",
"(",
"String",
"compositions",
",",
"int",
"list",
",",
"int",
"trail",
")",
"{",
"int",
"key1",
",",
"firstUnit",
";",
"if",
"(",
"trail",
"<",
"COMP_1_TRAIL_LIMIT",
")",
"{",
"// trail character is 0..33FF",
"// result ... | Finds the recomposition result for
a forward-combining "lead" character,
specified with a pointer to its compositions list,
and a backward-combining "trail" character.
<p>If the lead and trail characters combine, then this function returns
the following "compositeAndFwd" value:
<pre>
Bits 21..1 composite character
Bit 0 set if the composite is a forward-combining starter
</pre>
otherwise it returns -1.
<p>The compositions list has (trail, compositeAndFwd) pair entries,
encoded as either pairs or triples of 16-bit units.
The last entry has the high bit of its first unit set.
<p>The list is sorted by ascending trail characters (there are no duplicates).
A linear search is used.
<p>See normalizer2impl.h for a more detailed description
of the compositions list format. | [
"Finds",
"the",
"recomposition",
"result",
"for",
"a",
"forward",
"-",
"combining",
"lead",
"character",
"specified",
"with",
"a",
"pointer",
"to",
"its",
"compositions",
"list",
"and",
"a",
"backward",
"-",
"combining",
"trail",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Normalizer2Impl.java#L1830-L1873 |
34,461 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.isGroupingPosition | private boolean isGroupingPosition(int pos) {
boolean result = false;
if (isGroupingUsed() && (pos > 0) && (groupingSize > 0)) {
if ((groupingSize2 > 0) && (pos > groupingSize)) {
result = ((pos - groupingSize) % groupingSize2) == 0;
} else {
result = pos % groupingSize == 0;
}
}
return result;
} | java | private boolean isGroupingPosition(int pos) {
boolean result = false;
if (isGroupingUsed() && (pos > 0) && (groupingSize > 0)) {
if ((groupingSize2 > 0) && (pos > groupingSize)) {
result = ((pos - groupingSize) % groupingSize2) == 0;
} else {
result = pos % groupingSize == 0;
}
}
return result;
} | [
"private",
"boolean",
"isGroupingPosition",
"(",
"int",
"pos",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"isGroupingUsed",
"(",
")",
"&&",
"(",
"pos",
">",
"0",
")",
"&&",
"(",
"groupingSize",
">",
"0",
")",
")",
"{",
"if",
"(",
... | Returns true if a grouping separator belongs at the given position, based on whether
grouping is in use and the values of the primary and secondary grouping interval.
@param pos the number of integer digits to the right of the current position. Zero
indicates the position after the rightmost integer digit.
@return true if a grouping character belongs at the current position. | [
"Returns",
"true",
"if",
"a",
"grouping",
"separator",
"belongs",
"at",
"the",
"given",
"position",
"based",
"on",
"whether",
"grouping",
"is",
"in",
"use",
"and",
"the",
"values",
"of",
"the",
"primary",
"and",
"secondary",
"grouping",
"interval",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L1237-L1247 |
34,462 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.getEquivalentDecimals | private UnicodeSet getEquivalentDecimals(String decimal, boolean strictParse) {
UnicodeSet equivSet = UnicodeSet.EMPTY;
if (strictParse) {
if (strictDotEquivalents.contains(decimal)) {
equivSet = strictDotEquivalents;
} else if (strictCommaEquivalents.contains(decimal)) {
equivSet = strictCommaEquivalents;
}
} else {
if (dotEquivalents.contains(decimal)) {
equivSet = dotEquivalents;
} else if (commaEquivalents.contains(decimal)) {
equivSet = commaEquivalents;
}
}
return equivSet;
} | java | private UnicodeSet getEquivalentDecimals(String decimal, boolean strictParse) {
UnicodeSet equivSet = UnicodeSet.EMPTY;
if (strictParse) {
if (strictDotEquivalents.contains(decimal)) {
equivSet = strictDotEquivalents;
} else if (strictCommaEquivalents.contains(decimal)) {
equivSet = strictCommaEquivalents;
}
} else {
if (dotEquivalents.contains(decimal)) {
equivSet = dotEquivalents;
} else if (commaEquivalents.contains(decimal)) {
equivSet = commaEquivalents;
}
}
return equivSet;
} | [
"private",
"UnicodeSet",
"getEquivalentDecimals",
"(",
"String",
"decimal",
",",
"boolean",
"strictParse",
")",
"{",
"UnicodeSet",
"equivSet",
"=",
"UnicodeSet",
".",
"EMPTY",
";",
"if",
"(",
"strictParse",
")",
"{",
"if",
"(",
"strictDotEquivalents",
".",
"cont... | Returns a set of characters equivalent to the given desimal separator used for
parsing number. This method may return an empty set. | [
"Returns",
"a",
"set",
"of",
"characters",
"equivalent",
"to",
"the",
"given",
"desimal",
"separator",
"used",
"for",
"parsing",
"number",
".",
"This",
"method",
"may",
"return",
"an",
"empty",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2824-L2840 |
34,463 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.skipPadding | private final int skipPadding(String text, int position) {
while (position < text.length() && text.charAt(position) == pad) {
++position;
}
return position;
} | java | private final int skipPadding(String text, int position) {
while (position < text.length() && text.charAt(position) == pad) {
++position;
}
return position;
} | [
"private",
"final",
"int",
"skipPadding",
"(",
"String",
"text",
",",
"int",
"position",
")",
"{",
"while",
"(",
"position",
"<",
"text",
".",
"length",
"(",
")",
"&&",
"text",
".",
"charAt",
"(",
"position",
")",
"==",
"pad",
")",
"{",
"++",
"positi... | Starting at position, advance past a run of pad characters, if any. Return the
index of the first character after position that is not a pad character. Result is
>= position. | [
"Starting",
"at",
"position",
"advance",
"past",
"a",
"run",
"of",
"pad",
"characters",
"if",
"any",
".",
"Return",
"the",
"index",
"of",
"the",
"first",
"character",
"after",
"position",
"that",
"is",
"not",
"a",
"pad",
"character",
".",
"Result",
"is",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2847-L2852 |
34,464 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.compareAffix | private int compareAffix(String text, int pos, boolean isNegative, boolean isPrefix,
String affixPat, boolean complexCurrencyParsing, int type, Currency[] currency) {
if (currency != null || currencyChoice != null || (currencySignCount != CURRENCY_SIGN_COUNT_ZERO && complexCurrencyParsing)) {
return compareComplexAffix(affixPat, text, pos, type, currency);
}
if (isPrefix) {
return compareSimpleAffix(isNegative ? negativePrefix : positivePrefix, text, pos);
} else {
return compareSimpleAffix(isNegative ? negativeSuffix : positiveSuffix, text, pos);
}
} | java | private int compareAffix(String text, int pos, boolean isNegative, boolean isPrefix,
String affixPat, boolean complexCurrencyParsing, int type, Currency[] currency) {
if (currency != null || currencyChoice != null || (currencySignCount != CURRENCY_SIGN_COUNT_ZERO && complexCurrencyParsing)) {
return compareComplexAffix(affixPat, text, pos, type, currency);
}
if (isPrefix) {
return compareSimpleAffix(isNegative ? negativePrefix : positivePrefix, text, pos);
} else {
return compareSimpleAffix(isNegative ? negativeSuffix : positiveSuffix, text, pos);
}
} | [
"private",
"int",
"compareAffix",
"(",
"String",
"text",
",",
"int",
"pos",
",",
"boolean",
"isNegative",
",",
"boolean",
"isPrefix",
",",
"String",
"affixPat",
",",
"boolean",
"complexCurrencyParsing",
",",
"int",
"type",
",",
"Currency",
"[",
"]",
"currency"... | Returns the length matched by the given affix, or -1 if none. Runs of white space
in the affix, match runs of white space in the input. Pattern white space and input
white space are determined differently; see code.
@param text input text
@param pos offset into input at which to begin matching
@param isNegative
@param isPrefix
@param affixPat affix pattern used for currency affix comparison
@param complexCurrencyParsing whether it is currency parsing or not
@param type compare against currency type, LONG_NAME only or not.
@param currency return value for parsed currency, for generic currency parsing
mode, or null for normal parsing. In generic currency parsing mode, any currency
is parsed, not just the currency that this formatter is set to.
@return length of input that matches, or -1 if match failure | [
"Returns",
"the",
"length",
"matched",
"by",
"the",
"given",
"affix",
"or",
"-",
"1",
"if",
"none",
".",
"Runs",
"of",
"white",
"space",
"in",
"the",
"affix",
"match",
"runs",
"of",
"white",
"space",
"in",
"the",
"input",
".",
"Pattern",
"white",
"spac... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2871-L2882 |
34,465 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.trimMarksFromAffix | private static String trimMarksFromAffix(String affix) {
boolean hasBidiMark = false;
int idx = 0;
for (; idx < affix.length(); idx++) {
if (isBidiMark(affix.charAt(idx))) {
hasBidiMark = true;
break;
}
}
if (!hasBidiMark) {
return affix;
}
StringBuilder buf = new StringBuilder();
buf.append(affix, 0, idx);
idx++; // skip the first Bidi mark
for (; idx < affix.length(); idx++) {
char c = affix.charAt(idx);
if (!isBidiMark(c)) {
buf.append(c);
}
}
return buf.toString();
} | java | private static String trimMarksFromAffix(String affix) {
boolean hasBidiMark = false;
int idx = 0;
for (; idx < affix.length(); idx++) {
if (isBidiMark(affix.charAt(idx))) {
hasBidiMark = true;
break;
}
}
if (!hasBidiMark) {
return affix;
}
StringBuilder buf = new StringBuilder();
buf.append(affix, 0, idx);
idx++; // skip the first Bidi mark
for (; idx < affix.length(); idx++) {
char c = affix.charAt(idx);
if (!isBidiMark(c)) {
buf.append(c);
}
}
return buf.toString();
} | [
"private",
"static",
"String",
"trimMarksFromAffix",
"(",
"String",
"affix",
")",
"{",
"boolean",
"hasBidiMark",
"=",
"false",
";",
"int",
"idx",
"=",
"0",
";",
"for",
"(",
";",
"idx",
"<",
"affix",
".",
"length",
"(",
")",
";",
"idx",
"++",
")",
"{"... | Remove bidi marks from affix | [
"Remove",
"bidi",
"marks",
"from",
"affix"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2894-L2918 |
34,466 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.compareSimpleAffix | private static int compareSimpleAffix(String affix, String input, int pos) {
int start = pos;
// Affixes here might consist of sign, currency symbol and related spacing, etc.
// For more efficiency we should keep lazily-created trimmed affixes around in
// instance variables instead of trimming each time they are used (the next step).
String trimmedAffix = (affix.length() > 1)? trimMarksFromAffix(affix): affix;
for (int i = 0; i < trimmedAffix.length();) {
int c = UTF16.charAt(trimmedAffix, i);
int len = UTF16.getCharCount(c);
if (PatternProps.isWhiteSpace(c)) {
// We may have a pattern like: \u200F and input text like: \u200F Note
// that U+200F and U+0020 are Pattern_White_Space but only U+0020 is
// UWhiteSpace. So we have to first do a direct match of the run of RULE
// whitespace in the pattern, then match any extra characters.
boolean literalMatch = false;
while (pos < input.length()) {
int ic = UTF16.charAt(input, pos);
if (ic == c) {
literalMatch = true;
i += len;
pos += len;
if (i == trimmedAffix.length()) {
break;
}
c = UTF16.charAt(trimmedAffix, i);
len = UTF16.getCharCount(c);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
} else if (isBidiMark(ic)) {
pos++; // just skip over this input text
} else {
break;
}
}
// Advance over run in trimmedAffix
i = skipPatternWhiteSpace(trimmedAffix, i);
// Advance over run in input text. Must see at least one white space char
// in input, unless we've already matched some characters literally.
int s = pos;
pos = skipUWhiteSpace(input, pos);
if (pos == s && !literalMatch) {
return -1;
}
// If we skip UWhiteSpace in the input text, we need to skip it in the
// pattern. Otherwise, the previous lines may have skipped over text
// (such as U+00A0) that is also in the trimmedAffix.
i = skipUWhiteSpace(trimmedAffix, i);
} else {
boolean match = false;
while (pos < input.length()) {
int ic = UTF16.charAt(input, pos);
if (!match && equalWithSignCompatibility(ic, c)) {
i += len;
pos += len;
match = true;
} else if (isBidiMark(ic)) {
pos++; // just skip over this input text
} else {
break;
}
}
if (!match) {
return -1;
}
}
}
return pos - start;
} | java | private static int compareSimpleAffix(String affix, String input, int pos) {
int start = pos;
// Affixes here might consist of sign, currency symbol and related spacing, etc.
// For more efficiency we should keep lazily-created trimmed affixes around in
// instance variables instead of trimming each time they are used (the next step).
String trimmedAffix = (affix.length() > 1)? trimMarksFromAffix(affix): affix;
for (int i = 0; i < trimmedAffix.length();) {
int c = UTF16.charAt(trimmedAffix, i);
int len = UTF16.getCharCount(c);
if (PatternProps.isWhiteSpace(c)) {
// We may have a pattern like: \u200F and input text like: \u200F Note
// that U+200F and U+0020 are Pattern_White_Space but only U+0020 is
// UWhiteSpace. So we have to first do a direct match of the run of RULE
// whitespace in the pattern, then match any extra characters.
boolean literalMatch = false;
while (pos < input.length()) {
int ic = UTF16.charAt(input, pos);
if (ic == c) {
literalMatch = true;
i += len;
pos += len;
if (i == trimmedAffix.length()) {
break;
}
c = UTF16.charAt(trimmedAffix, i);
len = UTF16.getCharCount(c);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
} else if (isBidiMark(ic)) {
pos++; // just skip over this input text
} else {
break;
}
}
// Advance over run in trimmedAffix
i = skipPatternWhiteSpace(trimmedAffix, i);
// Advance over run in input text. Must see at least one white space char
// in input, unless we've already matched some characters literally.
int s = pos;
pos = skipUWhiteSpace(input, pos);
if (pos == s && !literalMatch) {
return -1;
}
// If we skip UWhiteSpace in the input text, we need to skip it in the
// pattern. Otherwise, the previous lines may have skipped over text
// (such as U+00A0) that is also in the trimmedAffix.
i = skipUWhiteSpace(trimmedAffix, i);
} else {
boolean match = false;
while (pos < input.length()) {
int ic = UTF16.charAt(input, pos);
if (!match && equalWithSignCompatibility(ic, c)) {
i += len;
pos += len;
match = true;
} else if (isBidiMark(ic)) {
pos++; // just skip over this input text
} else {
break;
}
}
if (!match) {
return -1;
}
}
}
return pos - start;
} | [
"private",
"static",
"int",
"compareSimpleAffix",
"(",
"String",
"affix",
",",
"String",
"input",
",",
"int",
"pos",
")",
"{",
"int",
"start",
"=",
"pos",
";",
"// Affixes here might consist of sign, currency symbol and related spacing, etc.",
"// For more efficiency we sho... | Return the length matched by the given affix, or -1 if none. Runs of white space in
the affix, match runs of white space in the input. Pattern white space and input
white space are determined differently; see code.
@param affix pattern string, taken as a literal
@param input input text
@param pos offset into input at which to begin matching
@return length of input that matches, or -1 if match failure | [
"Return",
"the",
"length",
"matched",
"by",
"the",
"given",
"affix",
"or",
"-",
"1",
"if",
"none",
".",
"Runs",
"of",
"white",
"space",
"in",
"the",
"affix",
"match",
"runs",
"of",
"white",
"space",
"in",
"the",
"input",
".",
"Pattern",
"white",
"space... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L2930-L3000 |
34,467 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.skipPatternWhiteSpace | private static int skipPatternWhiteSpace(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} | java | private static int skipPatternWhiteSpace(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!PatternProps.isWhiteSpace(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} | [
"private",
"static",
"int",
"skipPatternWhiteSpace",
"(",
"String",
"text",
",",
"int",
"pos",
")",
"{",
"while",
"(",
"pos",
"<",
"text",
".",
"length",
"(",
")",
")",
"{",
"int",
"c",
"=",
"UTF16",
".",
"charAt",
"(",
"text",
",",
"pos",
")",
";"... | Skips over a run of zero or more Pattern_White_Space characters at pos in text. | [
"Skips",
"over",
"a",
"run",
"of",
"zero",
"or",
"more",
"Pattern_White_Space",
"characters",
"at",
"pos",
"in",
"text",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L3011-L3020 |
34,468 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.skipBidiMarks | private static int skipBidiMarks(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!isBidiMark(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} | java | private static int skipBidiMarks(String text, int pos) {
while (pos < text.length()) {
int c = UTF16.charAt(text, pos);
if (!isBidiMark(c)) {
break;
}
pos += UTF16.getCharCount(c);
}
return pos;
} | [
"private",
"static",
"int",
"skipBidiMarks",
"(",
"String",
"text",
",",
"int",
"pos",
")",
"{",
"while",
"(",
"pos",
"<",
"text",
".",
"length",
"(",
")",
")",
"{",
"int",
"c",
"=",
"UTF16",
".",
"charAt",
"(",
"text",
",",
"pos",
")",
";",
"if"... | Skips over a run of zero or more bidi marks at pos in text. | [
"Skips",
"over",
"a",
"run",
"of",
"zero",
"or",
"more",
"bidi",
"marks",
"at",
"pos",
"in",
"text",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L3039-L3048 |
34,469 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.setDecimalFormatSymbols | public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
symbols = (DecimalFormatSymbols) newSymbols.clone();
setCurrencyForSymbols();
expandAffixes(null);
} | java | public void setDecimalFormatSymbols(DecimalFormatSymbols newSymbols) {
symbols = (DecimalFormatSymbols) newSymbols.clone();
setCurrencyForSymbols();
expandAffixes(null);
} | [
"public",
"void",
"setDecimalFormatSymbols",
"(",
"DecimalFormatSymbols",
"newSymbols",
")",
"{",
"symbols",
"=",
"(",
"DecimalFormatSymbols",
")",
"newSymbols",
".",
"clone",
"(",
")",
";",
"setCurrencyForSymbols",
"(",
")",
";",
"expandAffixes",
"(",
"null",
")"... | Sets the decimal format symbols used by this format. The format uses a copy of the
provided symbols.
@param newSymbols desired DecimalFormatSymbols
@see DecimalFormatSymbols | [
"Sets",
"the",
"decimal",
"format",
"symbols",
"used",
"by",
"this",
"format",
".",
"The",
"format",
"uses",
"a",
"copy",
"of",
"the",
"provided",
"symbols",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L3244-L3248 |
34,470 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.setCurrencyForSymbols | private void setCurrencyForSymbols() {
// Bug 4212072 Update the affix strings according to symbols in order to keep the
// affix strings up to date. [Richard/GCL]
// With the introduction of the Currency object, the currency symbols in the DFS
// object are ignored. For backward compatibility, we check any explicitly set DFS
// object. If it is a default symbols object for its locale, we change the
// currency object to one for that locale. If it is custom, we set the currency to
// null.
DecimalFormatSymbols def = new DecimalFormatSymbols(symbols.getULocale());
if (symbols.getCurrencySymbol().equals(def.getCurrencySymbol())
&& symbols.getInternationalCurrencySymbol()
.equals(def.getInternationalCurrencySymbol())) {
setCurrency(Currency.getInstance(symbols.getULocale()));
} else {
setCurrency(null);
}
} | java | private void setCurrencyForSymbols() {
// Bug 4212072 Update the affix strings according to symbols in order to keep the
// affix strings up to date. [Richard/GCL]
// With the introduction of the Currency object, the currency symbols in the DFS
// object are ignored. For backward compatibility, we check any explicitly set DFS
// object. If it is a default symbols object for its locale, we change the
// currency object to one for that locale. If it is custom, we set the currency to
// null.
DecimalFormatSymbols def = new DecimalFormatSymbols(symbols.getULocale());
if (symbols.getCurrencySymbol().equals(def.getCurrencySymbol())
&& symbols.getInternationalCurrencySymbol()
.equals(def.getInternationalCurrencySymbol())) {
setCurrency(Currency.getInstance(symbols.getULocale()));
} else {
setCurrency(null);
}
} | [
"private",
"void",
"setCurrencyForSymbols",
"(",
")",
"{",
"// Bug 4212072 Update the affix strings according to symbols in order to keep the",
"// affix strings up to date. [Richard/GCL]",
"// With the introduction of the Currency object, the currency symbols in the DFS",
"// object are ignored.... | Update the currency object to match the symbols. This method is used only when the
caller has passed in a symbols object that may not be the default object for its
locale. | [
"Update",
"the",
"currency",
"object",
"to",
"match",
"the",
"symbols",
".",
"This",
"method",
"is",
"used",
"only",
"when",
"the",
"caller",
"has",
"passed",
"in",
"a",
"symbols",
"object",
"that",
"may",
"not",
"be",
"the",
"default",
"object",
"for",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L3255-L3274 |
34,471 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.setRoundingMode | @Override
public void setRoundingMode(int roundingMode) {
if (roundingMode < BigDecimal.ROUND_UP || roundingMode > BigDecimal.ROUND_UNNECESSARY) {
throw new IllegalArgumentException("Invalid rounding mode: " + roundingMode);
}
this.roundingMode = roundingMode;
resetActualRounding();
} | java | @Override
public void setRoundingMode(int roundingMode) {
if (roundingMode < BigDecimal.ROUND_UP || roundingMode > BigDecimal.ROUND_UNNECESSARY) {
throw new IllegalArgumentException("Invalid rounding mode: " + roundingMode);
}
this.roundingMode = roundingMode;
resetActualRounding();
} | [
"@",
"Override",
"public",
"void",
"setRoundingMode",
"(",
"int",
"roundingMode",
")",
"{",
"if",
"(",
"roundingMode",
"<",
"BigDecimal",
".",
"ROUND_UP",
"||",
"roundingMode",
">",
"BigDecimal",
".",
"ROUND_UNNECESSARY",
")",
"{",
"throw",
"new",
"IllegalArgume... | Sets the rounding mode. This has no effect unless the rounding increment is greater
than zero.
@param roundingMode A rounding mode, between <code>BigDecimal.ROUND_UP</code> and
<code>BigDecimal.ROUND_UNNECESSARY</code>.
@exception IllegalArgumentException if <code>roundingMode</code> is unrecognized.
@see #setRoundingIncrement
@see #getRoundingIncrement
@see #getRoundingMode
@see java.math.BigDecimal | [
"Sets",
"the",
"rounding",
"mode",
".",
"This",
"has",
"no",
"effect",
"unless",
"the",
"rounding",
"increment",
"is",
"greater",
"than",
"zero",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L3504-L3512 |
34,472 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java | DecimalFormat.formatAffix2Attribute | private void formatAffix2Attribute(boolean isPrefix, Field fieldType,
StringBuffer buf, int offset, int symbolSize) {
int begin;
begin = offset;
if (!isPrefix) {
begin += buf.length();
}
addAttribute(fieldType, begin, begin + symbolSize);
} | java | private void formatAffix2Attribute(boolean isPrefix, Field fieldType,
StringBuffer buf, int offset, int symbolSize) {
int begin;
begin = offset;
if (!isPrefix) {
begin += buf.length();
}
addAttribute(fieldType, begin, begin + symbolSize);
} | [
"private",
"void",
"formatAffix2Attribute",
"(",
"boolean",
"isPrefix",
",",
"Field",
"fieldType",
",",
"StringBuffer",
"buf",
",",
"int",
"offset",
",",
"int",
"symbolSize",
")",
"{",
"int",
"begin",
";",
"begin",
"=",
"offset",
";",
"if",
"(",
"!",
"isPr... | Fix for prefix and suffix in Ticket 11805. | [
"Fix",
"for",
"prefix",
"and",
"suffix",
"in",
"Ticket",
"11805",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DecimalFormat.java#L4321-L4330 |
34,473 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java | Matcher.appendEvaluated | private void appendEvaluated(StringBuffer buffer, String s) {
boolean escape = false;
boolean dollar = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\\' && !escape) {
escape = true;
} else if (c == '$' && !escape) {
dollar = true;
} else if (c >= '0' && c <= '9' && dollar) {
buffer.append(group(c - '0'));
dollar = false;
} else {
buffer.append(c);
dollar = false;
escape = false;
}
}
if (escape) {
throw new ArrayIndexOutOfBoundsException(s.length());
}
} | java | private void appendEvaluated(StringBuffer buffer, String s) {
boolean escape = false;
boolean dollar = false;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == '\\' && !escape) {
escape = true;
} else if (c == '$' && !escape) {
dollar = true;
} else if (c >= '0' && c <= '9' && dollar) {
buffer.append(group(c - '0'));
dollar = false;
} else {
buffer.append(c);
dollar = false;
escape = false;
}
}
if (escape) {
throw new ArrayIndexOutOfBoundsException(s.length());
}
} | [
"private",
"void",
"appendEvaluated",
"(",
"StringBuffer",
"buffer",
",",
"String",
"s",
")",
"{",
"boolean",
"escape",
"=",
"false",
";",
"boolean",
"dollar",
"=",
"false",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(... | Internal helper method to append a given string to a given string buffer.
If the string contains any references to groups, these are replaced by
the corresponding group's contents.
@param buffer the string buffer.
@param s the string to append. | [
"Internal",
"helper",
"method",
"to",
"append",
"a",
"given",
"string",
"to",
"a",
"given",
"string",
"buffer",
".",
"If",
"the",
"string",
"contains",
"any",
"references",
"to",
"groups",
"these",
"are",
"replaced",
"by",
"the",
"corresponding",
"group",
"s... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java#L631-L654 |
34,474 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java | Matcher.replaceAll | public String replaceAll(String replacement) {
reset();
StringBuffer buffer = new StringBuffer(input.length());
while (find()) {
appendReplacement(buffer, replacement);
}
return appendTail(buffer).toString();
} | java | public String replaceAll(String replacement) {
reset();
StringBuffer buffer = new StringBuffer(input.length());
while (find()) {
appendReplacement(buffer, replacement);
}
return appendTail(buffer).toString();
} | [
"public",
"String",
"replaceAll",
"(",
"String",
"replacement",
")",
"{",
"reset",
"(",
")",
";",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"input",
".",
"length",
"(",
")",
")",
";",
"while",
"(",
"find",
"(",
")",
")",
"{",
"appendRe... | Replaces every subsequence of the input sequence that matches the
pattern with the given replacement string.
<p> This method first resets this matcher. It then scans the input
sequence looking for matches of the pattern. Characters that are not
part of any match are appended directly to the result string; each match
is replaced in the result by the replacement string. The replacement
string may contain references to captured subsequences as in the {@link
#appendReplacement appendReplacement} method.
<p> Note that backslashes (<tt>\</tt>) and dollar signs (<tt>$</tt>) in
the replacement string may cause the results to be different than if it
were being treated as a literal replacement string. Dollar signs may be
treated as references to captured subsequences as described above, and
backslashes are used to escape literal characters in the replacement
string.
<p> Given the regular expression <tt>a*b</tt>, the input
<tt>"aabfooaabfooabfoob"</tt>, and the replacement string
<tt>"-"</tt>, an invocation of this method on a matcher for that
expression would yield the string <tt>"-foo-foo-foo-"</tt>.
<p> Invoking this method changes this matcher's state. If the matcher
is to be used in further matching operations then it should first be
reset. </p>
@param replacement
The replacement string
@return The string constructed by replacing each matching subsequence
by the replacement string, substituting captured subsequences
as needed | [
"Replaces",
"every",
"subsequence",
"of",
"the",
"input",
"sequence",
"that",
"matches",
"the",
"pattern",
"with",
"the",
"given",
"replacement",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/Matcher.java#L714-L721 |
34,475 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ByteArrayWrapper.java | ByteArrayWrapper.compareTo | public int compareTo(ByteArrayWrapper other) {
if (this == other) return 0;
int minSize = size < other.size ? size : other.size;
for (int i = 0; i < minSize; ++i) {
if (bytes[i] != other.bytes[i]) {
return (bytes[i] & 0xFF) - (other.bytes[i] & 0xFF);
}
}
return size - other.size;
} | java | public int compareTo(ByteArrayWrapper other) {
if (this == other) return 0;
int minSize = size < other.size ? size : other.size;
for (int i = 0; i < minSize; ++i) {
if (bytes[i] != other.bytes[i]) {
return (bytes[i] & 0xFF) - (other.bytes[i] & 0xFF);
}
}
return size - other.size;
} | [
"public",
"int",
"compareTo",
"(",
"ByteArrayWrapper",
"other",
")",
"{",
"if",
"(",
"this",
"==",
"other",
")",
"return",
"0",
";",
"int",
"minSize",
"=",
"size",
"<",
"other",
".",
"size",
"?",
"size",
":",
"other",
".",
"size",
";",
"for",
"(",
... | Compare this object to another ByteArrayWrapper, which must not be null.
@param other the object to compare to.
@return a value <0, 0, or >0 as this compares less than, equal to, or
greater than other.
@throws ClassCastException if the other object is not a ByteArrayWrapper | [
"Compare",
"this",
"object",
"to",
"another",
"ByteArrayWrapper",
"which",
"must",
"not",
"be",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ByteArrayWrapper.java#L240-L249 |
34,476 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ByteArrayWrapper.java | ByteArrayWrapper.copyBytes | private static final void copyBytes(byte[] src, int srcoff, byte[] tgt,
int tgtoff, int length) {
if (length < 64) {
for (int i = srcoff, n = tgtoff; -- length >= 0; ++ i, ++ n) {
tgt[n] = src[i];
}
}
else {
System.arraycopy(src, srcoff, tgt, tgtoff, length);
}
} | java | private static final void copyBytes(byte[] src, int srcoff, byte[] tgt,
int tgtoff, int length) {
if (length < 64) {
for (int i = srcoff, n = tgtoff; -- length >= 0; ++ i, ++ n) {
tgt[n] = src[i];
}
}
else {
System.arraycopy(src, srcoff, tgt, tgtoff, length);
}
} | [
"private",
"static",
"final",
"void",
"copyBytes",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"srcoff",
",",
"byte",
"[",
"]",
"tgt",
",",
"int",
"tgtoff",
",",
"int",
"length",
")",
"{",
"if",
"(",
"length",
"<",
"64",
")",
"{",
"for",
"(",
"int"... | Copies the contents of src byte array from offset srcoff to the
target of tgt byte array at the offset tgtoff.
@param src source byte array to copy from
@param srcoff start offset of src to copy from
@param tgt target byte array to copy to
@param tgtoff start offset of tgt to copy to
@param length size of contents to copy | [
"Copies",
"the",
"contents",
"of",
"src",
"byte",
"array",
"from",
"offset",
"srcoff",
"to",
"the",
"target",
"of",
"tgt",
"byte",
"array",
"at",
"the",
"offset",
"tgtoff",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ByteArrayWrapper.java#L262-L272 |
34,477 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java | SerializerUtils.addAttributes | public static void addAttributes(SerializationHandler handler, int src)
throws TransformerException
{
TransformerImpl transformer =
(TransformerImpl) handler.getTransformer();
DTM dtm = transformer.getXPathContext().getDTM(src);
for (int node = dtm.getFirstAttribute(src);
DTM.NULL != node;
node = dtm.getNextAttribute(node))
{
addAttribute(handler, node);
}
} | java | public static void addAttributes(SerializationHandler handler, int src)
throws TransformerException
{
TransformerImpl transformer =
(TransformerImpl) handler.getTransformer();
DTM dtm = transformer.getXPathContext().getDTM(src);
for (int node = dtm.getFirstAttribute(src);
DTM.NULL != node;
node = dtm.getNextAttribute(node))
{
addAttribute(handler, node);
}
} | [
"public",
"static",
"void",
"addAttributes",
"(",
"SerializationHandler",
"handler",
",",
"int",
"src",
")",
"throws",
"TransformerException",
"{",
"TransformerImpl",
"transformer",
"=",
"(",
"TransformerImpl",
")",
"handler",
".",
"getTransformer",
"(",
")",
";",
... | Copy DOM attributes to the result element.
@param src Source node with the attributes
@throws TransformerException | [
"Copy",
"DOM",
"attributes",
"to",
"the",
"result",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java#L93-L107 |
34,478 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java | SerializerUtils.outputResultTreeFragment | public static void outputResultTreeFragment(
SerializationHandler handler,
XObject obj,
XPathContext support)
throws org.xml.sax.SAXException
{
int doc = obj.rtf();
DTM dtm = support.getDTM(doc);
if (null != dtm)
{
for (int n = dtm.getFirstChild(doc);
DTM.NULL != n;
n = dtm.getNextSibling(n))
{
handler.flushPending();
// I think. . . . This used to have a (true) arg
// to flush prefixes, will that cause problems ???
if (dtm.getNodeType(n) == DTM.ELEMENT_NODE
&& dtm.getNamespaceURI(n) == null)
handler.startPrefixMapping("", "");
dtm.dispatchToEvents(n, handler);
}
}
} | java | public static void outputResultTreeFragment(
SerializationHandler handler,
XObject obj,
XPathContext support)
throws org.xml.sax.SAXException
{
int doc = obj.rtf();
DTM dtm = support.getDTM(doc);
if (null != dtm)
{
for (int n = dtm.getFirstChild(doc);
DTM.NULL != n;
n = dtm.getNextSibling(n))
{
handler.flushPending();
// I think. . . . This used to have a (true) arg
// to flush prefixes, will that cause problems ???
if (dtm.getNodeType(n) == DTM.ELEMENT_NODE
&& dtm.getNamespaceURI(n) == null)
handler.startPrefixMapping("", "");
dtm.dispatchToEvents(n, handler);
}
}
} | [
"public",
"static",
"void",
"outputResultTreeFragment",
"(",
"SerializationHandler",
"handler",
",",
"XObject",
"obj",
",",
"XPathContext",
"support",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"int",
"doc",
"=",
"obj",
".",
"rtf",... | Given a result tree fragment, walk the tree and
output it to the SerializationHandler.
@param obj Result tree fragment object
@param support XPath context for the result tree fragment
@throws org.xml.sax.SAXException | [
"Given",
"a",
"result",
"tree",
"fragment",
"walk",
"the",
"tree",
"and",
"output",
"it",
"to",
"the",
"SerializationHandler",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java#L118-L144 |
34,479 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java | SerializerUtils.isDefinedNSDecl | public static boolean isDefinedNSDecl(
SerializationHandler serializer,
int attr,
DTM dtm)
{
if (DTM.NAMESPACE_NODE == dtm.getNodeType(attr))
{
// String prefix = dtm.getPrefix(attr);
String prefix = dtm.getNodeNameX(attr);
String uri = serializer.getNamespaceURIFromPrefix(prefix);
// String uri = getURI(prefix);
if ((null != uri) && uri.equals(dtm.getStringValue(attr)))
return true;
}
return false;
} | java | public static boolean isDefinedNSDecl(
SerializationHandler serializer,
int attr,
DTM dtm)
{
if (DTM.NAMESPACE_NODE == dtm.getNodeType(attr))
{
// String prefix = dtm.getPrefix(attr);
String prefix = dtm.getNodeNameX(attr);
String uri = serializer.getNamespaceURIFromPrefix(prefix);
// String uri = getURI(prefix);
if ((null != uri) && uri.equals(dtm.getStringValue(attr)))
return true;
}
return false;
} | [
"public",
"static",
"boolean",
"isDefinedNSDecl",
"(",
"SerializationHandler",
"serializer",
",",
"int",
"attr",
",",
"DTM",
"dtm",
")",
"{",
"if",
"(",
"DTM",
".",
"NAMESPACE_NODE",
"==",
"dtm",
".",
"getNodeType",
"(",
"attr",
")",
")",
"{",
"// String pre... | Returns whether a namespace is defined
@param attr Namespace attribute node
@param dtm The DTM that owns attr.
@return True if the namespace is already defined in
list of namespaces | [
"Returns",
"whether",
"a",
"namespace",
"is",
"defined"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/serialize/SerializerUtils.java#L216-L235 |
34,480 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java | XObject.num | public double num() throws javax.xml.transform.TransformerException
{
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return 0.0;
} | java | public double num() throws javax.xml.transform.TransformerException
{
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return 0.0;
} | [
"public",
"double",
"num",
"(",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"error",
"(",
"XPATHErrorResources",
".",
"ER_CANT_CONVERT_TO_NUMBER",
",",
"new",
"Object",
"[",
"]",
"{",
"getTypeString",
"(",
")",
"}",
... | Cast result object to a number. Always issues an error.
@return 0.0
@throws javax.xml.transform.TransformerException | [
"Cast",
"result",
"object",
"to",
"a",
"number",
".",
"Always",
"issues",
"an",
"error",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java#L235-L242 |
34,481 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java | XObject.bool | public boolean bool() throws javax.xml.transform.TransformerException
{
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return false;
} | java | public boolean bool() throws javax.xml.transform.TransformerException
{
error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
new Object[]{ getTypeString() }); //"Can not convert "+getTypeString()+" to a number");
return false;
} | [
"public",
"boolean",
"bool",
"(",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"error",
"(",
"XPATHErrorResources",
".",
"ER_CANT_CONVERT_TO_NUMBER",
",",
"new",
"Object",
"[",
"]",
"{",
"getTypeString",
"(",
")",
"}"... | Cast result object to a boolean. Always issues an error.
@return false
@throws javax.xml.transform.TransformerException | [
"Cast",
"result",
"object",
"to",
"a",
"boolean",
".",
"Always",
"issues",
"an",
"error",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java#L263-L270 |
34,482 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java | XObject.castToType | public Object castToType(int t, XPathContext support)
throws javax.xml.transform.TransformerException
{
Object result;
switch (t)
{
case CLASS_STRING :
result = str();
break;
case CLASS_NUMBER :
result = new Double(num());
break;
case CLASS_NODESET :
result = iter();
break;
case CLASS_BOOLEAN :
result = new Boolean(bool());
break;
case CLASS_UNKNOWN :
result = m_obj;
break;
// %TBD% What to do here?
// case CLASS_RTREEFRAG :
// result = rtree(support);
// break;
default :
error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
new Object[]{ getTypeString(),
Integer.toString(t) }); //"Can not convert "+getTypeString()+" to a type#"+t);
result = null;
}
return result;
} | java | public Object castToType(int t, XPathContext support)
throws javax.xml.transform.TransformerException
{
Object result;
switch (t)
{
case CLASS_STRING :
result = str();
break;
case CLASS_NUMBER :
result = new Double(num());
break;
case CLASS_NODESET :
result = iter();
break;
case CLASS_BOOLEAN :
result = new Boolean(bool());
break;
case CLASS_UNKNOWN :
result = m_obj;
break;
// %TBD% What to do here?
// case CLASS_RTREEFRAG :
// result = rtree(support);
// break;
default :
error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
new Object[]{ getTypeString(),
Integer.toString(t) }); //"Can not convert "+getTypeString()+" to a type#"+t);
result = null;
}
return result;
} | [
"public",
"Object",
"castToType",
"(",
"int",
"t",
",",
"XPathContext",
"support",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"Object",
"result",
";",
"switch",
"(",
"t",
")",
"{",
"case",
"CLASS_STRING",
":",
"... | Cast object to type t.
@param t Type of object to cast this to
@param support XPath context to use for the conversion
@return This object as the given type t
@throws javax.xml.transform.TransformerException | [
"Cast",
"object",
"to",
"type",
"t",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/objects/XObject.java#L489-L526 |
34,483 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URL.java | URL.readObject | private synchronized void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException
{
s.defaultReadObject(); // read the fields
if ((handler = getDelegate().getURLStreamHandler(protocol)) == null) {
throw new IOException("unknown protocol: " + protocol);
}
// Construct authority part
if (authority == null &&
((host != null && host.length() > 0) || port != -1)) {
if (host == null)
host = "";
authority = (port == -1) ? host : host + ":" + port;
// Handle hosts with userInfo in them
int at = host.lastIndexOf('@');
if (at != -1) {
userInfo = host.substring(0, at);
host = host.substring(at+1);
}
} else if (authority != null) {
// Construct user info part
int ind = authority.indexOf('@');
if (ind != -1)
userInfo = authority.substring(0, ind);
}
// Construct path and query part
path = null;
query = null;
if (file != null) {
// Fix: only do this if hierarchical?
int q = file.lastIndexOf('?');
if (q != -1) {
query = file.substring(q+1);
path = file.substring(0, q);
} else
path = file;
}
hashCode = -1;
} | java | private synchronized void readObject(java.io.ObjectInputStream s)
throws IOException, ClassNotFoundException
{
s.defaultReadObject(); // read the fields
if ((handler = getDelegate().getURLStreamHandler(protocol)) == null) {
throw new IOException("unknown protocol: " + protocol);
}
// Construct authority part
if (authority == null &&
((host != null && host.length() > 0) || port != -1)) {
if (host == null)
host = "";
authority = (port == -1) ? host : host + ":" + port;
// Handle hosts with userInfo in them
int at = host.lastIndexOf('@');
if (at != -1) {
userInfo = host.substring(0, at);
host = host.substring(at+1);
}
} else if (authority != null) {
// Construct user info part
int ind = authority.indexOf('@');
if (ind != -1)
userInfo = authority.substring(0, ind);
}
// Construct path and query part
path = null;
query = null;
if (file != null) {
// Fix: only do this if hierarchical?
int q = file.lastIndexOf('?');
if (q != -1) {
query = file.substring(q+1);
path = file.substring(0, q);
} else
path = file;
}
hashCode = -1;
} | [
"private",
"synchronized",
"void",
"readObject",
"(",
"java",
".",
"io",
".",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"s",
".",
"defaultReadObject",
"(",
")",
";",
"// read the fields",
"if",
"(",
"(",
"handler... | readObject is called to restore the state of the URL from the
stream. It reads the components of the URL and finds the local
stream handler. | [
"readObject",
"is",
"called",
"to",
"restore",
"the",
"state",
"of",
"the",
"URL",
"from",
"the",
"stream",
".",
"It",
"reads",
"the",
"components",
"of",
"the",
"URL",
"and",
"finds",
"the",
"local",
"stream",
"handler",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/URL.java#L976-L1017 |
34,484 | google/j2objc | jre_emul/android/platform/libcore/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java | XmlPullParserFactory.newPullParser | public XmlPullParser newPullParser() throws XmlPullParserException {
final XmlPullParser pp = getParserInstance();
for (Map.Entry<String, Boolean> entry : features.entrySet()) {
// NOTE: This test is needed for compatibility reasons. We guarantee
// that we only set a feature on a parser if its value is true.
if (entry.getValue()) {
pp.setFeature(entry.getKey(), entry.getValue());
}
}
return pp;
} | java | public XmlPullParser newPullParser() throws XmlPullParserException {
final XmlPullParser pp = getParserInstance();
for (Map.Entry<String, Boolean> entry : features.entrySet()) {
// NOTE: This test is needed for compatibility reasons. We guarantee
// that we only set a feature on a parser if its value is true.
if (entry.getValue()) {
pp.setFeature(entry.getKey(), entry.getValue());
}
}
return pp;
} | [
"public",
"XmlPullParser",
"newPullParser",
"(",
")",
"throws",
"XmlPullParserException",
"{",
"final",
"XmlPullParser",
"pp",
"=",
"getParserInstance",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"Boolean",
">",
"entry",
":",
"features... | Creates a new instance of a XML Pull Parser
using the currently configured factory features.
@return A new instance of a XML Pull Parser. | [
"Creates",
"a",
"new",
"instance",
"of",
"a",
"XML",
"Pull",
"Parser",
"using",
"the",
"currently",
"configured",
"factory",
"features",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/xml/src/main/java/org/xmlpull/v1/XmlPullParserFactory.java#L126-L137 |
34,485 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java | Rfc822Token.quoteNameIfNecessary | public static String quoteNameIfNecessary(String name) {
int len = name.length();
for (int i = 0; i < len; i++) {
char c = name.charAt(i);
if (! ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c == ' ') ||
(c >= '0' && c <= '9'))) {
return '"' + quoteName(name) + '"';
}
}
return name;
} | java | public static String quoteNameIfNecessary(String name) {
int len = name.length();
for (int i = 0; i < len; i++) {
char c = name.charAt(i);
if (! ((c >= 'A' && c <= 'Z') ||
(c >= 'a' && c <= 'z') ||
(c == ' ') ||
(c >= '0' && c <= '9'))) {
return '"' + quoteName(name) + '"';
}
}
return name;
} | [
"public",
"static",
"String",
"quoteNameIfNecessary",
"(",
"String",
"name",
")",
"{",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"char",
"c",
"=",
... | Returns the name, conservatively quoting it if there are any
characters that are likely to cause trouble outside of a
quoted string, or returning it literally if it seems safe. | [
"Returns",
"the",
"name",
"conservatively",
"quoting",
"it",
"if",
"there",
"are",
"any",
"characters",
"that",
"are",
"likely",
"to",
"cause",
"trouble",
"outside",
"of",
"a",
"quoted",
"string",
"or",
"returning",
"it",
"literally",
"if",
"it",
"seems",
"s... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java#L111-L126 |
34,486 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java | Rfc822Token.quoteName | public static String quoteName(String name) {
StringBuilder sb = new StringBuilder();
int len = name.length();
for (int i = 0; i < len; i++) {
char c = name.charAt(i);
if (c == '\\' || c == '"') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
} | java | public static String quoteName(String name) {
StringBuilder sb = new StringBuilder();
int len = name.length();
for (int i = 0; i < len; i++) {
char c = name.charAt(i);
if (c == '\\' || c == '"') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
} | [
"public",
"static",
"String",
"quoteName",
"(",
"String",
"name",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"len",
"=",
"name",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",... | Returns the name, with internal backslashes and quotation marks
preceded by backslashes. The outer quote marks themselves are not
added by this method. | [
"Returns",
"the",
"name",
"with",
"internal",
"backslashes",
"and",
"quotation",
"marks",
"preceded",
"by",
"backslashes",
".",
"The",
"outer",
"quote",
"marks",
"themselves",
"are",
"not",
"added",
"by",
"this",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java#L133-L148 |
34,487 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java | Rfc822Token.quoteComment | public static String quoteComment(String comment) {
int len = comment.length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++) {
char c = comment.charAt(i);
if (c == '(' || c == ')' || c == '\\') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
} | java | public static String quoteComment(String comment) {
int len = comment.length();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < len; i++) {
char c = comment.charAt(i);
if (c == '(' || c == ')' || c == '\\') {
sb.append('\\');
}
sb.append(c);
}
return sb.toString();
} | [
"public",
"static",
"String",
"quoteComment",
"(",
"String",
"comment",
")",
"{",
"int",
"len",
"=",
"comment",
".",
"length",
"(",
")",
";",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i... | Returns the comment, with internal backslashes and parentheses
preceded by backslashes. The outer parentheses themselves are
not added by this method. | [
"Returns",
"the",
"comment",
"with",
"internal",
"backslashes",
"and",
"parentheses",
"preceded",
"by",
"backslashes",
".",
"The",
"outer",
"parentheses",
"themselves",
"are",
"not",
"added",
"by",
"this",
"method",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/util/Rfc822Token.java#L155-L170 |
34,488 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.copy | DateTimeParseContext copy() {
DateTimeParseContext newContext = new DateTimeParseContext(formatter);
newContext.caseSensitive = caseSensitive;
newContext.strict = strict;
return newContext;
} | java | DateTimeParseContext copy() {
DateTimeParseContext newContext = new DateTimeParseContext(formatter);
newContext.caseSensitive = caseSensitive;
newContext.strict = strict;
return newContext;
} | [
"DateTimeParseContext",
"copy",
"(",
")",
"{",
"DateTimeParseContext",
"newContext",
"=",
"new",
"DateTimeParseContext",
"(",
"formatter",
")",
";",
"newContext",
".",
"caseSensitive",
"=",
"caseSensitive",
";",
"newContext",
".",
"strict",
"=",
"strict",
";",
"re... | Creates a copy of this context.
This retains the case sensitive and strict flags. | [
"Creates",
"a",
"copy",
"of",
"this",
"context",
".",
"This",
"retains",
"the",
"case",
"sensitive",
"and",
"strict",
"flags",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L130-L135 |
34,489 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.charEqualsIgnoreCase | static boolean charEqualsIgnoreCase(char c1, char c2) {
return c1 == c2 ||
Character.toUpperCase(c1) == Character.toUpperCase(c2) ||
Character.toLowerCase(c1) == Character.toLowerCase(c2);
} | java | static boolean charEqualsIgnoreCase(char c1, char c2) {
return c1 == c2 ||
Character.toUpperCase(c1) == Character.toUpperCase(c2) ||
Character.toLowerCase(c1) == Character.toLowerCase(c2);
} | [
"static",
"boolean",
"charEqualsIgnoreCase",
"(",
"char",
"c1",
",",
"char",
"c2",
")",
"{",
"return",
"c1",
"==",
"c2",
"||",
"Character",
".",
"toUpperCase",
"(",
"c1",
")",
"==",
"Character",
".",
"toUpperCase",
"(",
"c2",
")",
"||",
"Character",
".",... | Compares two characters ignoring case.
@param c1 the first
@param c2 the second
@return true if equal | [
"Compares",
"two",
"characters",
"ignoring",
"case",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L255-L259 |
34,490 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.endOptional | void endOptional(boolean successful) {
if (successful) {
parsed.remove(parsed.size() - 2);
} else {
parsed.remove(parsed.size() - 1);
}
} | java | void endOptional(boolean successful) {
if (successful) {
parsed.remove(parsed.size() - 2);
} else {
parsed.remove(parsed.size() - 1);
}
} | [
"void",
"endOptional",
"(",
"boolean",
"successful",
")",
"{",
"if",
"(",
"successful",
")",
"{",
"parsed",
".",
"remove",
"(",
"parsed",
".",
"size",
"(",
")",
"-",
"2",
")",
";",
"}",
"else",
"{",
"parsed",
".",
"remove",
"(",
"parsed",
".",
"siz... | Ends the parsing of an optional segment of the input.
@param successful whether the optional segment was successfully parsed | [
"Ends",
"the",
"parsing",
"of",
"an",
"optional",
"segment",
"of",
"the",
"input",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L295-L301 |
34,491 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java | DateTimeParseContext.toResolved | TemporalAccessor toResolved(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
Parsed parsed = currentParsed();
parsed.chrono = getEffectiveChronology();
parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone());
return parsed.resolve(resolverStyle, resolverFields);
} | java | TemporalAccessor toResolved(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
Parsed parsed = currentParsed();
parsed.chrono = getEffectiveChronology();
parsed.zone = (parsed.zone != null ? parsed.zone : formatter.getZone());
return parsed.resolve(resolverStyle, resolverFields);
} | [
"TemporalAccessor",
"toResolved",
"(",
"ResolverStyle",
"resolverStyle",
",",
"Set",
"<",
"TemporalField",
">",
"resolverFields",
")",
"{",
"Parsed",
"parsed",
"=",
"currentParsed",
"(",
")",
";",
"parsed",
".",
"chrono",
"=",
"getEffectiveChronology",
"(",
")",
... | Gets the resolved result of the parse.
@return the result of the parse, not null | [
"Gets",
"the",
"resolved",
"result",
"of",
"the",
"parse",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimeParseContext.java#L327-L332 |
34,492 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/SparseArray.java | SparseArray.removeAtRange | public void removeAtRange(int index, int size) {
final int end = Math.min(mSize, index + size);
for (int i = index; i < end; i++) {
removeAt(i);
}
} | java | public void removeAtRange(int index, int size) {
final int end = Math.min(mSize, index + size);
for (int i = index; i < end; i++) {
removeAt(i);
}
} | [
"public",
"void",
"removeAtRange",
"(",
"int",
"index",
",",
"int",
"size",
")",
"{",
"final",
"int",
"end",
"=",
"Math",
".",
"min",
"(",
"mSize",
",",
"index",
"+",
"size",
")",
";",
"for",
"(",
"int",
"i",
"=",
"index",
";",
"i",
"<",
"end",
... | Remove a range of mappings as a batch.
@param index Index to begin at
@param size Number of mappings to remove | [
"Remove",
"a",
"range",
"of",
"mappings",
"as",
"a",
"batch",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseArray.java#L157-L162 |
34,493 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/util/SparseArray.java | SparseArray.clear | public void clear() {
int n = mSize;
Object[] values = mValues;
for (int i = 0; i < n; i++) {
values[i] = null;
}
mSize = 0;
mGarbage = false;
} | java | public void clear() {
int n = mSize;
Object[] values = mValues;
for (int i = 0; i < n; i++) {
values[i] = null;
}
mSize = 0;
mGarbage = false;
} | [
"public",
"void",
"clear",
"(",
")",
"{",
"int",
"n",
"=",
"mSize",
";",
"Object",
"[",
"]",
"values",
"=",
"mValues",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"values",
"[",
"i",
"]",
"=",
"null"... | Removes all key-value mappings from this SparseArray. | [
"Removes",
"all",
"key",
"-",
"value",
"mappings",
"from",
"this",
"SparseArray",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/util/SparseArray.java#L345-L355 |
34,494 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.lastCEWithPrimaryBefore | long lastCEWithPrimaryBefore(long p) {
if(p == 0) { return 0; }
assert(p > elements[(int)elements[IX_FIRST_PRIMARY_INDEX]]);
int index = findP(p);
long q = elements[index];
long secTer;
if(p == (q & 0xffffff00L)) {
// p == elements[index] is a root primary. Find the CE before it.
// We must not be in a primary range.
assert((q & PRIMARY_STEP_MASK) == 0);
secTer = elements[index - 1];
if((secTer & SEC_TER_DELTA_FLAG) == 0) {
// Primary CE just before p.
p = secTer & 0xffffff00L;
secTer = Collation.COMMON_SEC_AND_TER_CE;
} else {
// secTer = last secondary & tertiary for the previous primary
index -= 2;
for(;;) {
p = elements[index];
if((p & SEC_TER_DELTA_FLAG) == 0) {
p &= 0xffffff00L;
break;
}
--index;
}
}
} else {
// p > elements[index] which is the previous primary.
// Find the last secondary & tertiary weights for it.
p = q & 0xffffff00L;
secTer = Collation.COMMON_SEC_AND_TER_CE;
for(;;) {
q = elements[++index];
if((q & SEC_TER_DELTA_FLAG) == 0) {
// We must not be in a primary range.
assert((q & PRIMARY_STEP_MASK) == 0);
break;
}
secTer = q;
}
}
return (p << 32) | (secTer & ~SEC_TER_DELTA_FLAG);
} | java | long lastCEWithPrimaryBefore(long p) {
if(p == 0) { return 0; }
assert(p > elements[(int)elements[IX_FIRST_PRIMARY_INDEX]]);
int index = findP(p);
long q = elements[index];
long secTer;
if(p == (q & 0xffffff00L)) {
// p == elements[index] is a root primary. Find the CE before it.
// We must not be in a primary range.
assert((q & PRIMARY_STEP_MASK) == 0);
secTer = elements[index - 1];
if((secTer & SEC_TER_DELTA_FLAG) == 0) {
// Primary CE just before p.
p = secTer & 0xffffff00L;
secTer = Collation.COMMON_SEC_AND_TER_CE;
} else {
// secTer = last secondary & tertiary for the previous primary
index -= 2;
for(;;) {
p = elements[index];
if((p & SEC_TER_DELTA_FLAG) == 0) {
p &= 0xffffff00L;
break;
}
--index;
}
}
} else {
// p > elements[index] which is the previous primary.
// Find the last secondary & tertiary weights for it.
p = q & 0xffffff00L;
secTer = Collation.COMMON_SEC_AND_TER_CE;
for(;;) {
q = elements[++index];
if((q & SEC_TER_DELTA_FLAG) == 0) {
// We must not be in a primary range.
assert((q & PRIMARY_STEP_MASK) == 0);
break;
}
secTer = q;
}
}
return (p << 32) | (secTer & ~SEC_TER_DELTA_FLAG);
} | [
"long",
"lastCEWithPrimaryBefore",
"(",
"long",
"p",
")",
"{",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"assert",
"(",
"p",
">",
"elements",
"[",
"(",
"int",
")",
"elements",
"[",
"IX_FIRST_PRIMARY_INDEX",
"]",
"]",
")",
";",
"... | Returns the last root CE with a primary weight before p.
Intended only for reordering group boundaries. | [
"Returns",
"the",
"last",
"root",
"CE",
"with",
"a",
"primary",
"weight",
"before",
"p",
".",
"Intended",
"only",
"for",
"reordering",
"group",
"boundaries",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L150-L193 |
34,495 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.firstCEWithPrimaryAtLeast | long firstCEWithPrimaryAtLeast(long p) {
if(p == 0) { return 0; }
int index = findP(p);
if(p != (elements[index] & 0xffffff00L)) {
for(;;) {
p = elements[++index];
if((p & SEC_TER_DELTA_FLAG) == 0) {
// First primary after p. We must not be in a primary range.
assert((p & PRIMARY_STEP_MASK) == 0);
break;
}
}
}
// The code above guarantees that p has at most 3 bytes: (p & 0xff) == 0.
return (p << 32) | Collation.COMMON_SEC_AND_TER_CE;
} | java | long firstCEWithPrimaryAtLeast(long p) {
if(p == 0) { return 0; }
int index = findP(p);
if(p != (elements[index] & 0xffffff00L)) {
for(;;) {
p = elements[++index];
if((p & SEC_TER_DELTA_FLAG) == 0) {
// First primary after p. We must not be in a primary range.
assert((p & PRIMARY_STEP_MASK) == 0);
break;
}
}
}
// The code above guarantees that p has at most 3 bytes: (p & 0xff) == 0.
return (p << 32) | Collation.COMMON_SEC_AND_TER_CE;
} | [
"long",
"firstCEWithPrimaryAtLeast",
"(",
"long",
"p",
")",
"{",
"if",
"(",
"p",
"==",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"index",
"=",
"findP",
"(",
"p",
")",
";",
"if",
"(",
"p",
"!=",
"(",
"elements",
"[",
"index",
"]",
"&",
"0xf... | Returns the first root CE with a primary weight of at least p.
Intended only for reordering group boundaries. | [
"Returns",
"the",
"first",
"root",
"CE",
"with",
"a",
"primary",
"weight",
"of",
"at",
"least",
"p",
".",
"Intended",
"only",
"for",
"reordering",
"group",
"boundaries",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L199-L214 |
34,496 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.getPrimaryBefore | long getPrimaryBefore(long p, boolean isCompressible) {
int index = findPrimary(p);
int step;
long q = elements[index];
if(p == (q & 0xffffff00L)) {
// Found p itself. Return the previous primary.
// See if p is at the end of a previous range.
step = (int)q & PRIMARY_STEP_MASK;
if(step == 0) {
// p is not at the end of a range. Look for the previous primary.
do {
p = elements[--index];
} while((p & SEC_TER_DELTA_FLAG) != 0);
return p & 0xffffff00L;
}
} else {
// p is in a range, and not at the start.
long nextElement = elements[index + 1];
assert(isEndOfPrimaryRange(nextElement));
step = (int)nextElement & PRIMARY_STEP_MASK;
}
// Return the previous range primary.
if((p & 0xffff) == 0) {
return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step);
} else {
return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step);
}
} | java | long getPrimaryBefore(long p, boolean isCompressible) {
int index = findPrimary(p);
int step;
long q = elements[index];
if(p == (q & 0xffffff00L)) {
// Found p itself. Return the previous primary.
// See if p is at the end of a previous range.
step = (int)q & PRIMARY_STEP_MASK;
if(step == 0) {
// p is not at the end of a range. Look for the previous primary.
do {
p = elements[--index];
} while((p & SEC_TER_DELTA_FLAG) != 0);
return p & 0xffffff00L;
}
} else {
// p is in a range, and not at the start.
long nextElement = elements[index + 1];
assert(isEndOfPrimaryRange(nextElement));
step = (int)nextElement & PRIMARY_STEP_MASK;
}
// Return the previous range primary.
if((p & 0xffff) == 0) {
return Collation.decTwoBytePrimaryByOneStep(p, isCompressible, step);
} else {
return Collation.decThreeBytePrimaryByOneStep(p, isCompressible, step);
}
} | [
"long",
"getPrimaryBefore",
"(",
"long",
"p",
",",
"boolean",
"isCompressible",
")",
"{",
"int",
"index",
"=",
"findPrimary",
"(",
"p",
")",
";",
"int",
"step",
";",
"long",
"q",
"=",
"elements",
"[",
"index",
"]",
";",
"if",
"(",
"p",
"==",
"(",
"... | Returns the primary weight before p.
p must be greater than the first root primary. | [
"Returns",
"the",
"primary",
"weight",
"before",
"p",
".",
"p",
"must",
"be",
"greater",
"than",
"the",
"first",
"root",
"primary",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L220-L247 |
34,497 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java | CollationRootElements.findPrimary | int findPrimary(long p) {
// Requirement: p must occur as a root primary.
assert((p & 0xff) == 0); // at most a 3-byte primary
int index = findP(p);
// If p is in a range, then we just assume that p is an actual primary in this range.
// (Too cumbersome/expensive to check.)
// Otherwise, it must be an exact match.
assert(isEndOfPrimaryRange(elements[index + 1]) || p == (elements[index] & 0xffffff00L));
return index;
} | java | int findPrimary(long p) {
// Requirement: p must occur as a root primary.
assert((p & 0xff) == 0); // at most a 3-byte primary
int index = findP(p);
// If p is in a range, then we just assume that p is an actual primary in this range.
// (Too cumbersome/expensive to check.)
// Otherwise, it must be an exact match.
assert(isEndOfPrimaryRange(elements[index + 1]) || p == (elements[index] & 0xffffff00L));
return index;
} | [
"int",
"findPrimary",
"(",
"long",
"p",
")",
"{",
"// Requirement: p must occur as a root primary.",
"assert",
"(",
"(",
"p",
"&",
"0xff",
")",
"==",
"0",
")",
";",
"// at most a 3-byte primary",
"int",
"index",
"=",
"findP",
"(",
"p",
")",
";",
"// If p is in... | Finds the index of the input primary.
p must occur as a root primary, and must not be 0. | [
"Finds",
"the",
"index",
"of",
"the",
"input",
"primary",
".",
"p",
"must",
"occur",
"as",
"a",
"root",
"primary",
"and",
"must",
"not",
"be",
"0",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/coll/CollationRootElements.java#L308-L317 |
34,498 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java | TimeZone.createGmtOffsetString | public static String createGmtOffsetString(boolean includeGmt,
boolean includeMinuteSeparator, int offsetMillis) {
int offsetMinutes = offsetMillis / 60000;
char sign = '+';
if (offsetMinutes < 0) {
sign = '-';
offsetMinutes = -offsetMinutes;
}
StringBuilder builder = new StringBuilder(9);
if (includeGmt) {
builder.append("GMT");
}
builder.append(sign);
appendNumber(builder, 2, offsetMinutes / 60);
if (includeMinuteSeparator) {
builder.append(':');
}
appendNumber(builder, 2, offsetMinutes % 60);
return builder.toString();
} | java | public static String createGmtOffsetString(boolean includeGmt,
boolean includeMinuteSeparator, int offsetMillis) {
int offsetMinutes = offsetMillis / 60000;
char sign = '+';
if (offsetMinutes < 0) {
sign = '-';
offsetMinutes = -offsetMinutes;
}
StringBuilder builder = new StringBuilder(9);
if (includeGmt) {
builder.append("GMT");
}
builder.append(sign);
appendNumber(builder, 2, offsetMinutes / 60);
if (includeMinuteSeparator) {
builder.append(':');
}
appendNumber(builder, 2, offsetMinutes % 60);
return builder.toString();
} | [
"public",
"static",
"String",
"createGmtOffsetString",
"(",
"boolean",
"includeGmt",
",",
"boolean",
"includeMinuteSeparator",
",",
"int",
"offsetMillis",
")",
"{",
"int",
"offsetMinutes",
"=",
"offsetMillis",
"/",
"60000",
";",
"char",
"sign",
"=",
"'",
"'",
";... | Returns a string representation of an offset from UTC.
<p>The format is "[GMT](+|-)HH[:]MM". The output is not localized.
@param includeGmt true to include "GMT", false to exclude
@param includeMinuteSeparator true to include the separator between hours and minutes, false
to exclude.
@param offsetMillis the offset from UTC
@hide used internally by SimpleDateFormat | [
"Returns",
"a",
"string",
"representation",
"of",
"an",
"offset",
"from",
"UTC",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L425-L444 |
34,499 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java | TimeZone.getAvailableIDs | public static String[] getAvailableIDs(int rawOffset) {
List<String> ids = new ArrayList<>();
for (String id : getAvailableIDs()) {
TimeZone tz = NativeTimeZone.get(id);
if (tz.getRawOffset() == rawOffset) {
ids.add(id);
}
}
return ids.toArray(new String[0]);
} | java | public static String[] getAvailableIDs(int rawOffset) {
List<String> ids = new ArrayList<>();
for (String id : getAvailableIDs()) {
TimeZone tz = NativeTimeZone.get(id);
if (tz.getRawOffset() == rawOffset) {
ids.add(id);
}
}
return ids.toArray(new String[0]);
} | [
"public",
"static",
"String",
"[",
"]",
"getAvailableIDs",
"(",
"int",
"rawOffset",
")",
"{",
"List",
"<",
"String",
">",
"ids",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"for",
"(",
"String",
"id",
":",
"getAvailableIDs",
"(",
")",
")",
"{",
"Ti... | Gets the available IDs according to the given time zone offset in milliseconds.
@param rawOffset the given time zone GMT offset in milliseconds.
@return an array of IDs, where the time zone for that ID has
the specified GMT offset. For example, "America/Phoenix" and "America/Denver"
both have GMT-07:00, but differ in daylight saving behavior.
@see #getRawOffset() | [
"Gets",
"the",
"available",
"IDs",
"according",
"to",
"the",
"given",
"time",
"zone",
"offset",
"in",
"milliseconds",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TimeZone.java#L640-L649 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.