id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,600 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FormattedFloatingDecimal.java | FormattedFloatingDecimal.applyPrecision | private char [] applyPrecision(int length) {
char [] result = new char[nDigits];
for (int i = 0; i < result.length; i++) result[i] = '0';
if (length >= nDigits || length < 0) {
// no rounding necessary
System.arraycopy(digits, 0, result, 0, nDigits);
return result;
}
if (length == 0) {
// only one digit (0 or 1) is returned because the precision
// excludes all significant digits
if (digits[0] >= '5') {
result[0] = '1';
}
return result;
}
int i = length;
int q = digits[i];
if (q >= '5' && i > 0) {
q = digits[--i];
if ( q == '9' ) {
while ( q == '9' && i > 0 ){
q = digits[--i];
}
if ( q == '9' ){
// carryout! High-order 1, rest 0s, larger exp.
result[0] = '1';
return result;
}
}
result[i] = (char)(q + 1);
}
while (--i >= 0) {
result[i] = digits[i];
}
return result;
} | java | private char [] applyPrecision(int length) {
char [] result = new char[nDigits];
for (int i = 0; i < result.length; i++) result[i] = '0';
if (length >= nDigits || length < 0) {
// no rounding necessary
System.arraycopy(digits, 0, result, 0, nDigits);
return result;
}
if (length == 0) {
// only one digit (0 or 1) is returned because the precision
// excludes all significant digits
if (digits[0] >= '5') {
result[0] = '1';
}
return result;
}
int i = length;
int q = digits[i];
if (q >= '5' && i > 0) {
q = digits[--i];
if ( q == '9' ) {
while ( q == '9' && i > 0 ){
q = digits[--i];
}
if ( q == '9' ){
// carryout! High-order 1, rest 0s, larger exp.
result[0] = '1';
return result;
}
}
result[i] = (char)(q + 1);
}
while (--i >= 0) {
result[i] = digits[i];
}
return result;
} | [
"private",
"char",
"[",
"]",
"applyPrecision",
"(",
"int",
"length",
")",
"{",
"char",
"[",
"]",
"result",
"=",
"new",
"char",
"[",
"nDigits",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"result",
".",
"length",
";",
"i",
"++",
"... | rounds at a particular precision. | [
"rounds",
"at",
"a",
"particular",
"precision",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FormattedFloatingDecimal.java#L424-L462 |
33,601 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java | FunctionDef1Arg.getArg0AsNode | protected int getArg0AsNode(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return (null == m_arg0)
? xctxt.getCurrentNode() : m_arg0.asNode(xctxt);
} | java | protected int getArg0AsNode(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
return (null == m_arg0)
? xctxt.getCurrentNode() : m_arg0.asNode(xctxt);
} | [
"protected",
"int",
"getArg0AsNode",
"(",
"XPathContext",
"xctxt",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"return",
"(",
"null",
"==",
"m_arg0",
")",
"?",
"xctxt",
".",
"getCurrentNode",
"(",
")",
":",
"m_arg0... | Execute the first argument expression that is expected to return a
nodeset. If the argument is null, then return the current context node.
@param xctxt Runtime XPath context.
@return The first node of the executed nodeset, or the current context
node if the first argument is null.
@throws javax.xml.transform.TransformerException if an error occurs while
executing the argument expression. | [
"Execute",
"the",
"first",
"argument",
"expression",
"that",
"is",
"expected",
"to",
"return",
"a",
"nodeset",
".",
"If",
"the",
"argument",
"is",
"null",
"then",
"return",
"the",
"current",
"context",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java#L51-L57 |
33,602 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java | FunctionDef1Arg.getArg0AsString | protected XMLString getArg0AsString(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if(null == m_arg0)
{
int currentNode = xctxt.getCurrentNode();
if(DTM.NULL == currentNode)
return XString.EMPTYSTRING;
else
{
DTM dtm = xctxt.getDTM(currentNode);
return dtm.getStringValue(currentNode);
}
}
else
return m_arg0.execute(xctxt).xstr();
} | java | protected XMLString getArg0AsString(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if(null == m_arg0)
{
int currentNode = xctxt.getCurrentNode();
if(DTM.NULL == currentNode)
return XString.EMPTYSTRING;
else
{
DTM dtm = xctxt.getDTM(currentNode);
return dtm.getStringValue(currentNode);
}
}
else
return m_arg0.execute(xctxt).xstr();
} | [
"protected",
"XMLString",
"getArg0AsString",
"(",
"XPathContext",
"xctxt",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"if",
"(",
"null",
"==",
"m_arg0",
")",
"{",
"int",
"currentNode",
"=",
"xctxt",
".",
"getCurrent... | Execute the first argument expression that is expected to return a
string. If the argument is null, then get the string value from the
current context node.
@param xctxt Runtime XPath context.
@return The string value of the first argument, or the string value of the
current context node if the first argument is null.
@throws javax.xml.transform.TransformerException if an error occurs while
executing the argument expression. | [
"Execute",
"the",
"first",
"argument",
"expression",
"that",
"is",
"expected",
"to",
"return",
"a",
"string",
".",
"If",
"the",
"argument",
"is",
"null",
"then",
"get",
"the",
"string",
"value",
"from",
"the",
"current",
"context",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java#L81-L98 |
33,603 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java | FunctionDef1Arg.getArg0AsNumber | protected double getArg0AsNumber(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if(null == m_arg0)
{
int currentNode = xctxt.getCurrentNode();
if(DTM.NULL == currentNode)
return 0;
else
{
DTM dtm = xctxt.getDTM(currentNode);
XMLString str = dtm.getStringValue(currentNode);
return str.toDouble();
}
}
else
return m_arg0.execute(xctxt).num();
} | java | protected double getArg0AsNumber(XPathContext xctxt)
throws javax.xml.transform.TransformerException
{
if(null == m_arg0)
{
int currentNode = xctxt.getCurrentNode();
if(DTM.NULL == currentNode)
return 0;
else
{
DTM dtm = xctxt.getDTM(currentNode);
XMLString str = dtm.getStringValue(currentNode);
return str.toDouble();
}
}
else
return m_arg0.execute(xctxt).num();
} | [
"protected",
"double",
"getArg0AsNumber",
"(",
"XPathContext",
"xctxt",
")",
"throws",
"javax",
".",
"xml",
".",
"transform",
".",
"TransformerException",
"{",
"if",
"(",
"null",
"==",
"m_arg0",
")",
"{",
"int",
"currentNode",
"=",
"xctxt",
".",
"getCurrentNod... | Execute the first argument expression that is expected to return a
number. If the argument is null, then get the number value from the
current context node.
@param xctxt Runtime XPath context.
@return The number value of the first argument, or the number value of the
current context node if the first argument is null.
@throws javax.xml.transform.TransformerException if an error occurs while
executing the argument expression. | [
"Execute",
"the",
"first",
"argument",
"expression",
"that",
"is",
"expected",
"to",
"return",
"a",
"number",
".",
"If",
"the",
"argument",
"is",
"null",
"then",
"get",
"the",
"number",
"value",
"from",
"the",
"current",
"context",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/functions/FunctionDef1Arg.java#L113-L132 |
33,604 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java | X509Key.setKey | protected void setKey(BitArray key) {
this.bitStringKey = (BitArray)key.clone();
/*
* Do this to keep the byte array form consistent with
* this. Can delete when byte[] key is deleted.
*/
this.key = key.toByteArray();
int remaining = key.length() % 8;
this.unusedBits =
((remaining == 0) ? 0 : 8 - remaining);
} | java | protected void setKey(BitArray key) {
this.bitStringKey = (BitArray)key.clone();
/*
* Do this to keep the byte array form consistent with
* this. Can delete when byte[] key is deleted.
*/
this.key = key.toByteArray();
int remaining = key.length() % 8;
this.unusedBits =
((remaining == 0) ? 0 : 8 - remaining);
} | [
"protected",
"void",
"setKey",
"(",
"BitArray",
"key",
")",
"{",
"this",
".",
"bitStringKey",
"=",
"(",
"BitArray",
")",
"key",
".",
"clone",
"(",
")",
";",
"/*\n * Do this to keep the byte array form consistent with\n * this. Can delete when byte[] key is d... | Sets the key in the BitArray form. | [
"Sets",
"the",
"key",
"in",
"the",
"BitArray",
"form",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java#L113-L124 |
33,605 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java | X509Key.getKey | protected BitArray getKey() {
/*
* Do this for consistency in case a subclass
* modifies byte[] key directly. Remove when
* byte[] key is deleted.
* Note: the consistency checks fail when the subclass
* modifies a non byte-aligned key (into a byte-aligned key)
* using the deprecated byte[] key field.
*/
this.bitStringKey = new BitArray(
this.key.length * 8 - this.unusedBits,
this.key);
return (BitArray)bitStringKey.clone();
} | java | protected BitArray getKey() {
/*
* Do this for consistency in case a subclass
* modifies byte[] key directly. Remove when
* byte[] key is deleted.
* Note: the consistency checks fail when the subclass
* modifies a non byte-aligned key (into a byte-aligned key)
* using the deprecated byte[] key field.
*/
this.bitStringKey = new BitArray(
this.key.length * 8 - this.unusedBits,
this.key);
return (BitArray)bitStringKey.clone();
} | [
"protected",
"BitArray",
"getKey",
"(",
")",
"{",
"/*\n * Do this for consistency in case a subclass\n * modifies byte[] key directly. Remove when\n * byte[] key is deleted.\n * Note: the consistency checks fail when the subclass\n * modifies a non byte-aligned ke... | Gets the key. The key may or may not be byte aligned.
@return a BitArray containing the key. | [
"Gets",
"the",
"key",
".",
"The",
"key",
"may",
"or",
"may",
"not",
"be",
"byte",
"aligned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java#L130-L144 |
33,606 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java | X509Key.parse | public static PublicKey parse(DerValue in) throws IOException
{
AlgorithmId algorithm;
PublicKey subjectKey;
if (in.tag != DerValue.tag_Sequence)
throw new IOException("corrupt subject key");
algorithm = AlgorithmId.parse(in.data.getDerValue());
try {
subjectKey = buildX509Key(algorithm,
in.data.getUnalignedBitString());
} catch (InvalidKeyException e) {
throw new IOException("subject key, " + e.getMessage(), e);
}
if (in.data.available() != 0)
throw new IOException("excess subject key");
return subjectKey;
} | java | public static PublicKey parse(DerValue in) throws IOException
{
AlgorithmId algorithm;
PublicKey subjectKey;
if (in.tag != DerValue.tag_Sequence)
throw new IOException("corrupt subject key");
algorithm = AlgorithmId.parse(in.data.getDerValue());
try {
subjectKey = buildX509Key(algorithm,
in.data.getUnalignedBitString());
} catch (InvalidKeyException e) {
throw new IOException("subject key, " + e.getMessage(), e);
}
if (in.data.available() != 0)
throw new IOException("excess subject key");
return subjectKey;
} | [
"public",
"static",
"PublicKey",
"parse",
"(",
"DerValue",
"in",
")",
"throws",
"IOException",
"{",
"AlgorithmId",
"algorithm",
";",
"PublicKey",
"subjectKey",
";",
"if",
"(",
"in",
".",
"tag",
"!=",
"DerValue",
".",
"tag_Sequence",
")",
"throw",
"new",
"IOE... | Construct X.509 subject public key from a DER value. If
the runtime environment is configured with a specific class for
this kind of key, a subclass is returned. Otherwise, a generic
X509Key object is returned.
<P>This mechanism gurantees that keys (and algorithms) may be
freely manipulated and transferred, without risk of losing
information. Also, when a key (or algorithm) needs some special
handling, that specific need can be accomodated.
@param in the DER-encoded SubjectPublicKeyInfo value
@exception IOException on data format errors | [
"Construct",
"X",
".",
"509",
"subject",
"public",
"key",
"from",
"a",
"DER",
"value",
".",
"If",
"the",
"runtime",
"environment",
"is",
"configured",
"with",
"a",
"specific",
"class",
"for",
"this",
"kind",
"of",
"key",
"a",
"subclass",
"is",
"returned",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java#L160-L180 |
33,607 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java | X509Key.readObject | private void readObject(ObjectInputStream stream) throws IOException {
try {
decode(stream);
} catch (InvalidKeyException e) {
e.printStackTrace();
throw new IOException("deserialized key is invalid: " +
e.getMessage());
}
} | java | private void readObject(ObjectInputStream stream) throws IOException {
try {
decode(stream);
} catch (InvalidKeyException e) {
e.printStackTrace();
throw new IOException("deserialized key is invalid: " +
e.getMessage());
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
"{",
"try",
"{",
"decode",
"(",
"stream",
")",
";",
"}",
"catch",
"(",
"InvalidKeyException",
"e",
")",
"{",
"e",
".",
"printStackTrace",
"(",
")",
";",
"thr... | Serialization read ... X.509 keys serialize as
themselves, and they're parsed when they get read back. | [
"Serialization",
"read",
"...",
"X",
".",
"509",
"keys",
"serialize",
"as",
"themselves",
"and",
"they",
"re",
"parsed",
"when",
"they",
"get",
"read",
"back",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509Key.java#L418-L426 |
33,608 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/PrivateKeyUsageExtension.java | PrivateKeyUsageExtension.valid | public void valid(Date now)
throws CertificateNotYetValidException, CertificateExpiredException {
/*
* we use the internal Dates rather than the passed in Date
* because someone could override the Date methods after()
* and before() to do something entirely different.
*/
if (notBefore.after(now)) {
throw new CertificateNotYetValidException("NotBefore: " +
notBefore.toString());
}
if (notAfter.before(now)) {
throw new CertificateExpiredException("NotAfter: " +
notAfter.toString());
}
} | java | public void valid(Date now)
throws CertificateNotYetValidException, CertificateExpiredException {
/*
* we use the internal Dates rather than the passed in Date
* because someone could override the Date methods after()
* and before() to do something entirely different.
*/
if (notBefore.after(now)) {
throw new CertificateNotYetValidException("NotBefore: " +
notBefore.toString());
}
if (notAfter.before(now)) {
throw new CertificateExpiredException("NotAfter: " +
notAfter.toString());
}
} | [
"public",
"void",
"valid",
"(",
"Date",
"now",
")",
"throws",
"CertificateNotYetValidException",
",",
"CertificateExpiredException",
"{",
"/*\n * we use the internal Dates rather than the passed in Date\n * because someone could override the Date methods after()\n * a... | Verify that that the passed time is within the validity period.
@exception CertificateExpiredException if the certificate has expired
with respect to the <code>Date</code> supplied.
@exception CertificateNotYetValidException if the certificate is not
yet valid with respect to the <code>Date</code> supplied. | [
"Verify",
"that",
"that",
"the",
"passed",
"time",
"is",
"within",
"the",
"validity",
"period",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/PrivateKeyUsageExtension.java#L207-L222 |
33,609 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java | SchemaFactory.getFeature | public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | java | public boolean getFeature(String name) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | [
"public",
"boolean",
"getFeature",
"(",
"String",
"name",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name == null\"",
")",
";",
"}",
... | Look up the value of a feature flag.
<p>The feature name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to recognize a feature name but
temporarily be unable to return its value.
<p>Implementers are free (and encouraged) to invent their own features,
using names built on their own URIs.</p>
@param name The feature name, which is a non-null fully-qualified URI.
@return The current value of the feature (true or false).
@exception org.xml.sax.SAXNotRecognizedException If the feature
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the feature name but
cannot determine its value at this time.
@exception NullPointerException
if the name parameter is null.
@see #setFeature(String, boolean) | [
"Look",
"up",
"the",
"value",
"of",
"a",
"feature",
"flag",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java#L267-L273 |
33,610 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java | SchemaFactory.setFeature | public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | java | public void setFeature(String name, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
if (name == null) {
throw new NullPointerException("name == null");
}
throw new SAXNotRecognizedException(name);
} | [
"public",
"void",
"setFeature",
"(",
"String",
"name",
",",
"boolean",
"value",
")",
"throws",
"SAXNotRecognizedException",
",",
"SAXNotSupportedException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"name == nul... | Set the value of a feature flag.
<p>
Feature can be used to control the way a {@link SchemaFactory}
parses schemas, although {@link SchemaFactory}s are not required
to recognize any specific feature names.</p>
<p>The feature name is any fully-qualified URI. It is
possible for a {@link SchemaFactory} to expose a feature value but
to be unable to change the current value.</p>
<p>All implementations are required to support the {@link javax.xml.XMLConstants#FEATURE_SECURE_PROCESSING} feature.
When the feature is:</p>
<ul>
<li>
<code>true</code>: the implementation will limit XML processing to conform to implementation limits.
Examples include entity expansion limits and XML Schema constructs that would consume large amounts of resources.
If XML processing is limited for security reasons, it will be reported via a call to the registered
{@link ErrorHandler#fatalError(org.xml.sax.SAXParseException)}.
See {@link #setErrorHandler(ErrorHandler errorHandler)}.
</li>
<li>
<code>false</code>: the implementation will processing XML according to the XML specifications without
regard to possible implementation limits.
</li>
</ul>
@param name The feature name, which is a non-null fully-qualified URI.
@param value The requested value of the feature (true or false).
@exception org.xml.sax.SAXNotRecognizedException If the feature
value can't be assigned or retrieved.
@exception org.xml.sax.SAXNotSupportedException When the
{@link SchemaFactory} recognizes the feature name but
cannot set the requested value.
@exception NullPointerException
if the name parameter is null.
@see #getFeature(String) | [
"Set",
"the",
"value",
"of",
"a",
"feature",
"flag",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/javax/xml/validation/SchemaFactory.java#L316-L321 |
33,611 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.internalBuildTailoring | private final void internalBuildTailoring(String rules) throws Exception {
CollationTailoring base = CollationRoot.getRoot();
// Most code using Collator does not need to build a Collator from rules.
// By using reflection, most code will not have a static dependency on the builder code.
// CollationBuilder builder = new CollationBuilder(base);
ClassLoader classLoader = ClassLoaderUtil.getClassLoader(getClass());
CollationTailoring t;
try {
Class<?> builderClass = classLoader.loadClass("android.icu.impl.coll.CollationBuilder");
Object builder = builderClass.getConstructor(CollationTailoring.class).newInstance(base);
// builder.parseAndBuild(rules);
Method parseAndBuild = builderClass.getMethod("parseAndBuild", String.class);
t = (CollationTailoring)parseAndBuild.invoke(builder, rules);
} catch(InvocationTargetException e) {
throw (Exception)e.getTargetException();
}
t.actualLocale = null;
adoptTailoring(t);
} | java | private final void internalBuildTailoring(String rules) throws Exception {
CollationTailoring base = CollationRoot.getRoot();
// Most code using Collator does not need to build a Collator from rules.
// By using reflection, most code will not have a static dependency on the builder code.
// CollationBuilder builder = new CollationBuilder(base);
ClassLoader classLoader = ClassLoaderUtil.getClassLoader(getClass());
CollationTailoring t;
try {
Class<?> builderClass = classLoader.loadClass("android.icu.impl.coll.CollationBuilder");
Object builder = builderClass.getConstructor(CollationTailoring.class).newInstance(base);
// builder.parseAndBuild(rules);
Method parseAndBuild = builderClass.getMethod("parseAndBuild", String.class);
t = (CollationTailoring)parseAndBuild.invoke(builder, rules);
} catch(InvocationTargetException e) {
throw (Exception)e.getTargetException();
}
t.actualLocale = null;
adoptTailoring(t);
} | [
"private",
"final",
"void",
"internalBuildTailoring",
"(",
"String",
"rules",
")",
"throws",
"Exception",
"{",
"CollationTailoring",
"base",
"=",
"CollationRoot",
".",
"getRoot",
"(",
")",
";",
"// Most code using Collator does not need to build a Collator from rules.",
"//... | Implements from-rule constructors.
@param rules rule string
@throws Exception | [
"Implements",
"from",
"-",
"rule",
"constructors",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L218-L236 |
33,612 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getCollationElementIterator | public CollationElementIterator getCollationElementIterator(CharacterIterator source) {
initMaxExpansions();
CharacterIterator newsource = (CharacterIterator) source.clone();
return new CollationElementIterator(newsource, this);
} | java | public CollationElementIterator getCollationElementIterator(CharacterIterator source) {
initMaxExpansions();
CharacterIterator newsource = (CharacterIterator) source.clone();
return new CollationElementIterator(newsource, this);
} | [
"public",
"CollationElementIterator",
"getCollationElementIterator",
"(",
"CharacterIterator",
"source",
")",
"{",
"initMaxExpansions",
"(",
")",
";",
"CharacterIterator",
"newsource",
"=",
"(",
"CharacterIterator",
")",
"source",
".",
"clone",
"(",
")",
";",
"return"... | Return a CollationElementIterator for the given CharacterIterator. The source iterator's integrity will be
preserved since a new copy will be created for use.
@see CollationElementIterator | [
"Return",
"a",
"CollationElementIterator",
"for",
"the",
"given",
"CharacterIterator",
".",
"The",
"source",
"iterator",
"s",
"integrity",
"will",
"be",
"preserved",
"since",
"a",
"new",
"copy",
"will",
"be",
"created",
"for",
"use",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L277-L281 |
33,613 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.freeze | @Override
public Collator freeze() {
if (!isFrozen()) {
frozenLock = new ReentrantLock();
if (collationBuffer == null) {
collationBuffer = new CollationBuffer(data);
}
}
return this;
} | java | @Override
public Collator freeze() {
if (!isFrozen()) {
frozenLock = new ReentrantLock();
if (collationBuffer == null) {
collationBuffer = new CollationBuffer(data);
}
}
return this;
} | [
"@",
"Override",
"public",
"Collator",
"freeze",
"(",
")",
"{",
"if",
"(",
"!",
"isFrozen",
"(",
")",
")",
"{",
"frozenLock",
"=",
"new",
"ReentrantLock",
"(",
")",
";",
"if",
"(",
"collationBuffer",
"==",
"null",
")",
"{",
"collationBuffer",
"=",
"new... | Freezes the collator.
@return the collator itself. | [
"Freezes",
"the",
"collator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L311-L320 |
33,614 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.cloneAsThawed | @Override
public RuleBasedCollator cloneAsThawed() {
try {
RuleBasedCollator result = (RuleBasedCollator) super.clone();
// since all collation data in the RuleBasedCollator do not change
// we can safely assign the result.fields to this collator
// except in cases where we can't
result.settings = settings.clone();
result.collationBuffer = null;
result.frozenLock = null;
return result;
} catch (CloneNotSupportedException e) {
// Clone is implemented
return null;
}
} | java | @Override
public RuleBasedCollator cloneAsThawed() {
try {
RuleBasedCollator result = (RuleBasedCollator) super.clone();
// since all collation data in the RuleBasedCollator do not change
// we can safely assign the result.fields to this collator
// except in cases where we can't
result.settings = settings.clone();
result.collationBuffer = null;
result.frozenLock = null;
return result;
} catch (CloneNotSupportedException e) {
// Clone is implemented
return null;
}
} | [
"@",
"Override",
"public",
"RuleBasedCollator",
"cloneAsThawed",
"(",
")",
"{",
"try",
"{",
"RuleBasedCollator",
"result",
"=",
"(",
"RuleBasedCollator",
")",
"super",
".",
"clone",
"(",
")",
";",
"// since all collation data in the RuleBasedCollator do not change",
"//... | Provides for the clone operation. Any clone is initially unfrozen. | [
"Provides",
"for",
"the",
"clone",
"operation",
".",
"Any",
"clone",
"is",
"initially",
"unfrozen",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L325-L340 |
33,615 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.setUpperCaseFirst | public void setUpperCaseFirst(boolean upperfirst) {
checkNotFrozen();
if (upperfirst == isUpperCaseFirst()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(upperfirst ? CollationSettings.CASE_FIRST_AND_UPPER_MASK : 0);
setFastLatinOptions(ownedSettings);
} | java | public void setUpperCaseFirst(boolean upperfirst) {
checkNotFrozen();
if (upperfirst == isUpperCaseFirst()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(upperfirst ? CollationSettings.CASE_FIRST_AND_UPPER_MASK : 0);
setFastLatinOptions(ownedSettings);
} | [
"public",
"void",
"setUpperCaseFirst",
"(",
"boolean",
"upperfirst",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"if",
"(",
"upperfirst",
"==",
"isUpperCaseFirst",
"(",
")",
")",
"{",
"return",
";",
"}",
"CollationSettings",
"ownedSettings",
"=",
"getOwnedSetting... | Sets whether uppercase characters sort before lowercase characters or vice versa, in strength TERTIARY. The
default mode is false, and so lowercase characters sort before uppercase characters. If true, sort upper case
characters first.
@param upperfirst
true to sort uppercase characters before lowercase characters, false to sort lowercase characters
before uppercase characters
@see #isLowerCaseFirst
@see #isUpperCaseFirst
@see #setLowerCaseFirst
@see #setCaseFirstDefault | [
"Sets",
"whether",
"uppercase",
"characters",
"sort",
"before",
"lowercase",
"characters",
"or",
"vice",
"versa",
"in",
"strength",
"TERTIARY",
".",
"The",
"default",
"mode",
"is",
"false",
"and",
"so",
"lowercase",
"characters",
"sort",
"before",
"uppercase",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L412-L418 |
33,616 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.setLowerCaseFirst | public void setLowerCaseFirst(boolean lowerfirst) {
checkNotFrozen();
if (lowerfirst == isLowerCaseFirst()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(lowerfirst ? CollationSettings.CASE_FIRST : 0);
setFastLatinOptions(ownedSettings);
} | java | public void setLowerCaseFirst(boolean lowerfirst) {
checkNotFrozen();
if (lowerfirst == isLowerCaseFirst()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setCaseFirst(lowerfirst ? CollationSettings.CASE_FIRST : 0);
setFastLatinOptions(ownedSettings);
} | [
"public",
"void",
"setLowerCaseFirst",
"(",
"boolean",
"lowerfirst",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"if",
"(",
"lowerfirst",
"==",
"isLowerCaseFirst",
"(",
")",
")",
"{",
"return",
";",
"}",
"CollationSettings",
"ownedSettings",
"=",
"getOwnedSetting... | Sets the orders of lower cased characters to sort before upper cased characters, in strength TERTIARY. The
default mode is false. If true is set, the RuleBasedCollator will sort lower cased characters before the upper
cased ones. Otherwise, if false is set, the RuleBasedCollator will ignore case preferences.
@param lowerfirst
true for sorting lower cased characters before upper cased characters, false to ignore case
preferences.
@see #isLowerCaseFirst
@see #isUpperCaseFirst
@see #setUpperCaseFirst
@see #setCaseFirstDefault | [
"Sets",
"the",
"orders",
"of",
"lower",
"cased",
"characters",
"to",
"sort",
"before",
"upper",
"cased",
"characters",
"in",
"strength",
"TERTIARY",
".",
"The",
"default",
"mode",
"is",
"false",
".",
"If",
"true",
"is",
"set",
"the",
"RuleBasedCollator",
"wi... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L433-L439 |
33,617 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.setNumericCollationDefault | public void setNumericCollationDefault() {
checkNotFrozen();
CollationSettings defaultSettings = getDefaultSettings();
if(settings.readOnly() == defaultSettings) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlagDefault(CollationSettings.NUMERIC, defaultSettings.options);
setFastLatinOptions(ownedSettings);
} | java | public void setNumericCollationDefault() {
checkNotFrozen();
CollationSettings defaultSettings = getDefaultSettings();
if(settings.readOnly() == defaultSettings) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlagDefault(CollationSettings.NUMERIC, defaultSettings.options);
setFastLatinOptions(ownedSettings);
} | [
"public",
"void",
"setNumericCollationDefault",
"(",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"CollationSettings",
"defaultSettings",
"=",
"getDefaultSettings",
"(",
")",
";",
"if",
"(",
"settings",
".",
"readOnly",
"(",
")",
"==",
"defaultSettings",
")",
"{",... | Method to set numeric collation to its default value.
@see #getNumericCollation
@see #setNumericCollation | [
"Method",
"to",
"set",
"numeric",
"collation",
"to",
"its",
"default",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L545-L552 |
33,618 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.setDecomposition | @Override
public void setDecomposition(int decomposition)
{
checkNotFrozen();
boolean flag;
switch(decomposition) {
case NO_DECOMPOSITION:
flag = false;
break;
case CANONICAL_DECOMPOSITION:
flag = true;
break;
default:
throw new IllegalArgumentException("Wrong decomposition mode.");
}
if(flag == settings.readOnly().getFlag(CollationSettings.CHECK_FCD)) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlag(CollationSettings.CHECK_FCD, flag);
setFastLatinOptions(ownedSettings);
} | java | @Override
public void setDecomposition(int decomposition)
{
checkNotFrozen();
boolean flag;
switch(decomposition) {
case NO_DECOMPOSITION:
flag = false;
break;
case CANONICAL_DECOMPOSITION:
flag = true;
break;
default:
throw new IllegalArgumentException("Wrong decomposition mode.");
}
if(flag == settings.readOnly().getFlag(CollationSettings.CHECK_FCD)) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setFlag(CollationSettings.CHECK_FCD, flag);
setFastLatinOptions(ownedSettings);
} | [
"@",
"Override",
"public",
"void",
"setDecomposition",
"(",
"int",
"decomposition",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"boolean",
"flag",
";",
"switch",
"(",
"decomposition",
")",
"{",
"case",
"NO_DECOMPOSITION",
":",
"flag",
"=",
"false",
";",
"brea... | Sets the decomposition mode of this Collator. Setting this
decomposition attribute with CANONICAL_DECOMPOSITION allows the
Collator to handle un-normalized text properly, producing the
same results as if the text were normalized. If
NO_DECOMPOSITION is set, it is the user's responsibility to
insure that all text is already in the appropriate form before
a comparison or before getting a CollationKey. Adjusting
decomposition mode allows the user to select between faster and
more complete collation behavior.
<p>Since a great many of the world's languages do not require
text normalization, most locales set NO_DECOMPOSITION as the
default decomposition mode.
The default decompositon mode for the Collator is
NO_DECOMPOSITON, unless specified otherwise by the locale used
to create the Collator.
<p>See getDecomposition for a description of decomposition
mode.
@param decomposition the new decomposition mode
@see #getDecomposition
@see #NO_DECOMPOSITION
@see #CANONICAL_DECOMPOSITION
@throws IllegalArgumentException If the given value is not a valid
decomposition mode. | [
"Sets",
"the",
"decomposition",
"mode",
"of",
"this",
"Collator",
".",
"Setting",
"this",
"decomposition",
"attribute",
"with",
"CANONICAL_DECOMPOSITION",
"allows",
"the",
"Collator",
"to",
"handle",
"un",
"-",
"normalized",
"text",
"properly",
"producing",
"the",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L649-L668 |
33,619 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.setStrength | @Override
public void setStrength(int newStrength) {
checkNotFrozen();
if(newStrength == getStrength()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setStrength(newStrength);
setFastLatinOptions(ownedSettings);
} | java | @Override
public void setStrength(int newStrength) {
checkNotFrozen();
if(newStrength == getStrength()) { return; }
CollationSettings ownedSettings = getOwnedSettings();
ownedSettings.setStrength(newStrength);
setFastLatinOptions(ownedSettings);
} | [
"@",
"Override",
"public",
"void",
"setStrength",
"(",
"int",
"newStrength",
")",
"{",
"checkNotFrozen",
"(",
")",
";",
"if",
"(",
"newStrength",
"==",
"getStrength",
"(",
")",
")",
"{",
"return",
";",
"}",
"CollationSettings",
"ownedSettings",
"=",
"getOwne... | Sets this Collator's strength attribute. The strength attribute determines the minimum level of difference
considered significant during comparison.
<p>See the Collator class description for an example of use.
@param newStrength
the new strength value.
@see #getStrength
@see #setStrengthDefault
@see #PRIMARY
@see #SECONDARY
@see #TERTIARY
@see #QUATERNARY
@see #IDENTICAL
@exception IllegalArgumentException
If the new strength value is not one of PRIMARY, SECONDARY, TERTIARY, QUATERNARY or IDENTICAL. | [
"Sets",
"this",
"Collator",
"s",
"strength",
"attribute",
".",
"The",
"strength",
"attribute",
"determines",
"the",
"minimum",
"level",
"of",
"difference",
"considered",
"significant",
"during",
"comparison",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L688-L695 |
33,620 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getTailoredSet | @Override
public UnicodeSet getTailoredSet() {
UnicodeSet tailored = new UnicodeSet();
if(data.base != null) {
new TailoredSet(tailored).forData(data);
}
return tailored;
} | java | @Override
public UnicodeSet getTailoredSet() {
UnicodeSet tailored = new UnicodeSet();
if(data.base != null) {
new TailoredSet(tailored).forData(data);
}
return tailored;
} | [
"@",
"Override",
"public",
"UnicodeSet",
"getTailoredSet",
"(",
")",
"{",
"UnicodeSet",
"tailored",
"=",
"new",
"UnicodeSet",
"(",
")",
";",
"if",
"(",
"data",
".",
"base",
"!=",
"null",
")",
"{",
"new",
"TailoredSet",
"(",
"tailored",
")",
".",
"forData... | Get a UnicodeSet that contains all the characters and sequences tailored in this collator.
@return a pointer to a UnicodeSet object containing all the code points and sequences that may sort differently
than in the root collator. | [
"Get",
"a",
"UnicodeSet",
"that",
"contains",
"all",
"the",
"characters",
"and",
"sequences",
"tailored",
"in",
"this",
"collator",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L968-L975 |
33,621 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.internalAddContractions | void internalAddContractions(int c, UnicodeSet set) {
new ContractionsAndExpansions(set, null, null, false).forCodePoint(data, c);
} | java | void internalAddContractions(int c, UnicodeSet set) {
new ContractionsAndExpansions(set, null, null, false).forCodePoint(data, c);
} | [
"void",
"internalAddContractions",
"(",
"int",
"c",
",",
"UnicodeSet",
"set",
")",
"{",
"new",
"ContractionsAndExpansions",
"(",
"set",
",",
"null",
",",
"null",
",",
"false",
")",
".",
"forCodePoint",
"(",
"data",
",",
"c",
")",
";",
"}"
] | Adds the contractions that start with character c to the set.
Ignores prefixes. Used by AlphabeticIndex.
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Adds",
"the",
"contractions",
"that",
"start",
"with",
"character",
"c",
"to",
"the",
"set",
".",
"Ignores",
"prefixes",
".",
"Used",
"by",
"AlphabeticIndex",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1006-L1008 |
33,622 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getRawCollationKey | @Override
public RawCollationKey getRawCollationKey(String source, RawCollationKey key) {
if (source == null) {
return null;
}
CollationBuffer buffer = null;
try {
buffer = getCollationBuffer();
return getRawCollationKey(source, key, buffer);
} finally {
releaseCollationBuffer(buffer);
}
} | java | @Override
public RawCollationKey getRawCollationKey(String source, RawCollationKey key) {
if (source == null) {
return null;
}
CollationBuffer buffer = null;
try {
buffer = getCollationBuffer();
return getRawCollationKey(source, key, buffer);
} finally {
releaseCollationBuffer(buffer);
}
} | [
"@",
"Override",
"public",
"RawCollationKey",
"getRawCollationKey",
"(",
"String",
"source",
",",
"RawCollationKey",
"key",
")",
"{",
"if",
"(",
"source",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"CollationBuffer",
"buffer",
"=",
"null",
";",
"try... | Gets the simpler form of a CollationKey for the String source following the rules of this Collator and stores the
result into the user provided argument key. If key has a internal byte array of length that's too small for the
result, the internal byte array will be grown to the exact required size.
@param source the text String to be transformed into a RawCollationKey
@param key output RawCollationKey to store results
@return If key is null, a new instance of RawCollationKey will be created and returned, otherwise the user
provided key will be returned.
@see #getCollationKey
@see #compare(String, String)
@see RawCollationKey
@hide unsupported on Android | [
"Gets",
"the",
"simpler",
"form",
"of",
"a",
"CollationKey",
"for",
"the",
"String",
"source",
"following",
"the",
"rules",
"of",
"this",
"Collator",
"and",
"stores",
"the",
"result",
"into",
"the",
"user",
"provided",
"argument",
"key",
".",
"If",
"key",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1063-L1075 |
33,623 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.internalGetCEs | @Deprecated
public long[] internalGetCEs(CharSequence str) {
CollationBuffer buffer = null;
try {
buffer = getCollationBuffer();
boolean numeric = settings.readOnly().isNumeric();
CollationIterator iter;
if(settings.readOnly().dontCheckFCD()) {
buffer.leftUTF16CollIter.setText(numeric, str, 0);
iter = buffer.leftUTF16CollIter;
} else {
buffer.leftFCDUTF16Iter.setText(numeric, str, 0);
iter = buffer.leftFCDUTF16Iter;
}
int length = iter.fetchCEs() - 1;
assert length >= 0 && iter.getCE(length) == Collation.NO_CE;
long[] ces = new long[length];
System.arraycopy(iter.getCEs(), 0, ces, 0, length);
return ces;
} finally {
releaseCollationBuffer(buffer);
}
} | java | @Deprecated
public long[] internalGetCEs(CharSequence str) {
CollationBuffer buffer = null;
try {
buffer = getCollationBuffer();
boolean numeric = settings.readOnly().isNumeric();
CollationIterator iter;
if(settings.readOnly().dontCheckFCD()) {
buffer.leftUTF16CollIter.setText(numeric, str, 0);
iter = buffer.leftUTF16CollIter;
} else {
buffer.leftFCDUTF16Iter.setText(numeric, str, 0);
iter = buffer.leftFCDUTF16Iter;
}
int length = iter.fetchCEs() - 1;
assert length >= 0 && iter.getCE(length) == Collation.NO_CE;
long[] ces = new long[length];
System.arraycopy(iter.getCEs(), 0, ces, 0, length);
return ces;
} finally {
releaseCollationBuffer(buffer);
}
} | [
"@",
"Deprecated",
"public",
"long",
"[",
"]",
"internalGetCEs",
"(",
"CharSequence",
"str",
")",
"{",
"CollationBuffer",
"buffer",
"=",
"null",
";",
"try",
"{",
"buffer",
"=",
"getCollationBuffer",
"(",
")",
";",
"boolean",
"numeric",
"=",
"settings",
".",
... | Returns the CEs for the string.
@param str the string
@deprecated This API is ICU internal only.
@hide original deprecated declaration
@hide draft / provisional / internal are hidden on Android | [
"Returns",
"the",
"CEs",
"for",
"the",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1178-L1200 |
33,624 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getVersion | @Override
public VersionInfo getVersion() {
int version = tailoring.version;
int rtVersion = VersionInfo.UCOL_RUNTIME_VERSION.getMajor();
return VersionInfo.getInstance(
(version >>> 24) + (rtVersion << 4) + (rtVersion >> 4),
((version >> 16) & 0xff), ((version >> 8) & 0xff), (version & 0xff));
} | java | @Override
public VersionInfo getVersion() {
int version = tailoring.version;
int rtVersion = VersionInfo.UCOL_RUNTIME_VERSION.getMajor();
return VersionInfo.getInstance(
(version >>> 24) + (rtVersion << 4) + (rtVersion >> 4),
((version >> 16) & 0xff), ((version >> 8) & 0xff), (version & 0xff));
} | [
"@",
"Override",
"public",
"VersionInfo",
"getVersion",
"(",
")",
"{",
"int",
"version",
"=",
"tailoring",
".",
"version",
";",
"int",
"rtVersion",
"=",
"VersionInfo",
".",
"UCOL_RUNTIME_VERSION",
".",
"getMajor",
"(",
")",
";",
"return",
"VersionInfo",
".",
... | Get the version of this collator object.
@return the version object associated with this collator | [
"Get",
"the",
"version",
"of",
"this",
"collator",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1755-L1762 |
33,625 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java | RuleBasedCollator.getUCAVersion | @Override
public VersionInfo getUCAVersion() {
VersionInfo v = getVersion();
// Note: This is tied to how the current implementation encodes the UCA version
// in the overall getVersion().
// Alternatively, we could load the root collator and get at lower-level data from there.
// Either way, it will reflect the input collator's UCA version only
// if it is a known implementation.
// (C++ comment) It would be cleaner to make this a virtual Collator method.
// (In Java, it is virtual.)
return VersionInfo.getInstance(v.getMinor() >> 3, v.getMinor() & 7, v.getMilli() >> 6, 0);
} | java | @Override
public VersionInfo getUCAVersion() {
VersionInfo v = getVersion();
// Note: This is tied to how the current implementation encodes the UCA version
// in the overall getVersion().
// Alternatively, we could load the root collator and get at lower-level data from there.
// Either way, it will reflect the input collator's UCA version only
// if it is a known implementation.
// (C++ comment) It would be cleaner to make this a virtual Collator method.
// (In Java, it is virtual.)
return VersionInfo.getInstance(v.getMinor() >> 3, v.getMinor() & 7, v.getMilli() >> 6, 0);
} | [
"@",
"Override",
"public",
"VersionInfo",
"getUCAVersion",
"(",
")",
"{",
"VersionInfo",
"v",
"=",
"getVersion",
"(",
")",
";",
"// Note: This is tied to how the current implementation encodes the UCA version",
"// in the overall getVersion().",
"// Alternatively, we could load the... | Get the UCA version of this collator object.
@return the version object associated with this collator | [
"Get",
"the",
"UCA",
"version",
"of",
"this",
"collator",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/RuleBasedCollator.java#L1769-L1780 |
33,626 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java | CharacterDecoder.decodeBuffer | public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
int i;
int totalBytes = 0;
PushbackInputStream ps = new PushbackInputStream (aStream);
decodeBufferPrefix(ps, bStream);
while (true) {
int length;
try {
length = decodeLinePrefix(ps, bStream);
for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
}
if ((i + bytesPerAtom()) == length) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
} else {
decodeAtom(ps, bStream, length - i);
totalBytes += (length - i);
}
decodeLineSuffix(ps, bStream);
} catch (CEStreamExhausted e) {
break;
}
}
decodeBufferSuffix(ps, bStream);
} | java | public void decodeBuffer(InputStream aStream, OutputStream bStream) throws IOException {
int i;
int totalBytes = 0;
PushbackInputStream ps = new PushbackInputStream (aStream);
decodeBufferPrefix(ps, bStream);
while (true) {
int length;
try {
length = decodeLinePrefix(ps, bStream);
for (i = 0; (i+bytesPerAtom()) < length; i += bytesPerAtom()) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
}
if ((i + bytesPerAtom()) == length) {
decodeAtom(ps, bStream, bytesPerAtom());
totalBytes += bytesPerAtom();
} else {
decodeAtom(ps, bStream, length - i);
totalBytes += (length - i);
}
decodeLineSuffix(ps, bStream);
} catch (CEStreamExhausted e) {
break;
}
}
decodeBufferSuffix(ps, bStream);
} | [
"public",
"void",
"decodeBuffer",
"(",
"InputStream",
"aStream",
",",
"OutputStream",
"bStream",
")",
"throws",
"IOException",
"{",
"int",
"i",
";",
"int",
"totalBytes",
"=",
"0",
";",
"PushbackInputStream",
"ps",
"=",
"new",
"PushbackInputStream",
"(",
"aStream... | Decode the text from the InputStream and write the decoded
octets to the OutputStream. This method runs until the stream
is exhausted.
@exception CEFormatException An error has occured while decoding
@exception CEStreamExhausted The input stream is unexpectedly out of data | [
"Decode",
"the",
"text",
"from",
"the",
"InputStream",
"and",
"write",
"the",
"decoded",
"octets",
"to",
"the",
"OutputStream",
".",
"This",
"method",
"runs",
"until",
"the",
"stream",
"is",
"exhausted",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L151-L179 |
33,627 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java | CharacterDecoder.decodeBuffer | public byte decodeBuffer(String inputString)[] throws IOException {
byte inputBuffer[] = new byte[inputString.length()];
ByteArrayInputStream inStream;
ByteArrayOutputStream outStream;
inputString.getBytes(0, inputString.length(), inputBuffer, 0);
inStream = new ByteArrayInputStream(inputBuffer);
outStream = new ByteArrayOutputStream();
decodeBuffer(inStream, outStream);
return (outStream.toByteArray());
} | java | public byte decodeBuffer(String inputString)[] throws IOException {
byte inputBuffer[] = new byte[inputString.length()];
ByteArrayInputStream inStream;
ByteArrayOutputStream outStream;
inputString.getBytes(0, inputString.length(), inputBuffer, 0);
inStream = new ByteArrayInputStream(inputBuffer);
outStream = new ByteArrayOutputStream();
decodeBuffer(inStream, outStream);
return (outStream.toByteArray());
} | [
"public",
"byte",
"decodeBuffer",
"(",
"String",
"inputString",
")",
"[",
"]",
"throws",
"IOException",
"{",
"byte",
"inputBuffer",
"[",
"]",
"=",
"new",
"byte",
"[",
"inputString",
".",
"length",
"(",
")",
"]",
";",
"ByteArrayInputStream",
"inStream",
";",
... | Alternate decode interface that takes a String containing the encoded
buffer and returns a byte array containing the data.
@exception CEFormatException An error has occured while decoding | [
"Alternate",
"decode",
"interface",
"that",
"takes",
"a",
"String",
"containing",
"the",
"encoded",
"buffer",
"and",
"returns",
"a",
"byte",
"array",
"containing",
"the",
"data",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L186-L196 |
33,628 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java | CharacterDecoder.decodeBuffer | public byte decodeBuffer(InputStream in)[] throws IOException {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
decodeBuffer(in, outStream);
return (outStream.toByteArray());
} | java | public byte decodeBuffer(InputStream in)[] throws IOException {
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
decodeBuffer(in, outStream);
return (outStream.toByteArray());
} | [
"public",
"byte",
"decodeBuffer",
"(",
"InputStream",
"in",
")",
"[",
"]",
"throws",
"IOException",
"{",
"ByteArrayOutputStream",
"outStream",
"=",
"new",
"ByteArrayOutputStream",
"(",
")",
";",
"decodeBuffer",
"(",
"in",
",",
"outStream",
")",
";",
"return",
... | Decode the contents of the inputstream into a buffer. | [
"Decode",
"the",
"contents",
"of",
"the",
"inputstream",
"into",
"a",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/CharacterDecoder.java#L201-L205 |
33,629 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.closeCDATA | protected void closeCDATA() throws org.xml.sax.SAXException
{
try
{
m_writer.write(CDATA_DELIMITER_CLOSE);
// write out a CDATA section closing "]]>"
m_cdataTagOpen = false; // Remember that we have done so.
}
catch (IOException e)
{
throw new SAXException(e);
}
} | java | protected void closeCDATA() throws org.xml.sax.SAXException
{
try
{
m_writer.write(CDATA_DELIMITER_CLOSE);
// write out a CDATA section closing "]]>"
m_cdataTagOpen = false; // Remember that we have done so.
}
catch (IOException e)
{
throw new SAXException(e);
}
} | [
"protected",
"void",
"closeCDATA",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"try",
"{",
"m_writer",
".",
"write",
"(",
"CDATA_DELIMITER_CLOSE",
")",
";",
"// write out a CDATA section closing \"]]>\"",
"m_cdataTagOpen",
"=",
"fa... | This helper method to writes out "]]>" when closing a CDATA section.
@throws org.xml.sax.SAXException | [
"This",
"helper",
"method",
"to",
"writes",
"out",
"]]",
">",
"when",
"closing",
"a",
"CDATA",
"section",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L192-L204 |
33,630 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.flushWriter | protected final void flushWriter() throws org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
if (null != writer)
{
try
{
if (writer instanceof WriterToUTF8Buffered)
{
if (m_shouldFlush)
((WriterToUTF8Buffered) writer).flush();
else
((WriterToUTF8Buffered) writer).flushBuffer();
}
if (writer instanceof WriterToASCI)
{
if (m_shouldFlush)
writer.flush();
}
else
{
// Flush always.
// Not a great thing if the writer was created
// by this class, but don't have a choice.
writer.flush();
}
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(ioe);
}
}
} | java | protected final void flushWriter() throws org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
if (null != writer)
{
try
{
if (writer instanceof WriterToUTF8Buffered)
{
if (m_shouldFlush)
((WriterToUTF8Buffered) writer).flush();
else
((WriterToUTF8Buffered) writer).flushBuffer();
}
if (writer instanceof WriterToASCI)
{
if (m_shouldFlush)
writer.flush();
}
else
{
// Flush always.
// Not a great thing if the writer was created
// by this class, but don't have a choice.
writer.flush();
}
}
catch (IOException ioe)
{
throw new org.xml.sax.SAXException(ioe);
}
}
} | [
"protected",
"final",
"void",
"flushWriter",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"final",
"java",
".",
"io",
".",
"Writer",
"writer",
"=",
"m_writer",
";",
"if",
"(",
"null",
"!=",
"writer",
")",
"{",
"try",
"... | Flush the formatter's result stream.
@throws org.xml.sax.SAXException | [
"Flush",
"the",
"formatter",
"s",
"result",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L239-L271 |
33,631 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.getOutputFormat | public Properties getOutputFormat() {
Properties def = new Properties();
{
Set s = getOutputPropDefaultKeys();
Iterator i = s.iterator();
while (i.hasNext()) {
String key = (String) i.next();
String val = getOutputPropertyDefault(key);
def.put(key, val);
}
}
Properties props = new Properties(def);
{
Set s = getOutputPropKeys();
Iterator i = s.iterator();
while (i.hasNext()) {
String key = (String) i.next();
String val = getOutputPropertyNonDefault(key);
if (val != null)
props.put(key, val);
}
}
return props;
} | java | public Properties getOutputFormat() {
Properties def = new Properties();
{
Set s = getOutputPropDefaultKeys();
Iterator i = s.iterator();
while (i.hasNext()) {
String key = (String) i.next();
String val = getOutputPropertyDefault(key);
def.put(key, val);
}
}
Properties props = new Properties(def);
{
Set s = getOutputPropKeys();
Iterator i = s.iterator();
while (i.hasNext()) {
String key = (String) i.next();
String val = getOutputPropertyNonDefault(key);
if (val != null)
props.put(key, val);
}
}
return props;
} | [
"public",
"Properties",
"getOutputFormat",
"(",
")",
"{",
"Properties",
"def",
"=",
"new",
"Properties",
"(",
")",
";",
"{",
"Set",
"s",
"=",
"getOutputPropDefaultKeys",
"(",
")",
";",
"Iterator",
"i",
"=",
"s",
".",
"iterator",
"(",
")",
";",
"while",
... | Returns the output format for this serializer.
@return The output format in use | [
"Returns",
"the",
"output",
"format",
"for",
"this",
"serializer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L617-L641 |
33,632 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.escapingNotNeeded | protected boolean escapingNotNeeded(char ch)
{
final boolean ret;
if (ch < 127)
{
// This is the old/fast code here, but is this
// correct for all encodings?
if (ch >= CharInfo.S_SPACE || (CharInfo.S_LINEFEED == ch ||
CharInfo.S_CARRIAGERETURN == ch || CharInfo.S_HORIZONAL_TAB == ch))
ret= true;
else
ret = false;
}
else {
ret = m_encodingInfo.isInEncoding(ch);
}
return ret;
} | java | protected boolean escapingNotNeeded(char ch)
{
final boolean ret;
if (ch < 127)
{
// This is the old/fast code here, but is this
// correct for all encodings?
if (ch >= CharInfo.S_SPACE || (CharInfo.S_LINEFEED == ch ||
CharInfo.S_CARRIAGERETURN == ch || CharInfo.S_HORIZONAL_TAB == ch))
ret= true;
else
ret = false;
}
else {
ret = m_encodingInfo.isInEncoding(ch);
}
return ret;
} | [
"protected",
"boolean",
"escapingNotNeeded",
"(",
"char",
"ch",
")",
"{",
"final",
"boolean",
"ret",
";",
"if",
"(",
"ch",
"<",
"127",
")",
"{",
"// This is the old/fast code here, but is this ",
"// correct for all encodings?",
"if",
"(",
"ch",
">=",
"CharInfo",
... | Tell if this character can be written without escaping. | [
"Tell",
"if",
"this",
"character",
"can",
"be",
"written",
"without",
"escaping",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L940-L957 |
33,633 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.accumDefaultEntity | int accumDefaultEntity(
java.io.Writer writer,
char ch,
int i,
char[] chars,
int len,
boolean fromTextNode,
boolean escLF)
throws IOException
{
if (!escLF && CharInfo.S_LINEFEED == ch)
{
writer.write(m_lineSep, 0, m_lineSepLen);
}
else
{
// if this is text node character and a special one of those,
// or if this is a character from attribute value and a special one of those
if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch)))
{
String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
if (null != outputStringForChar)
{
writer.write(outputStringForChar);
}
else
return i;
}
else
return i;
}
return i + 1;
} | java | int accumDefaultEntity(
java.io.Writer writer,
char ch,
int i,
char[] chars,
int len,
boolean fromTextNode,
boolean escLF)
throws IOException
{
if (!escLF && CharInfo.S_LINEFEED == ch)
{
writer.write(m_lineSep, 0, m_lineSepLen);
}
else
{
// if this is text node character and a special one of those,
// or if this is a character from attribute value and a special one of those
if ((fromTextNode && m_charInfo.shouldMapTextChar(ch)) || (!fromTextNode && m_charInfo.shouldMapAttrChar(ch)))
{
String outputStringForChar = m_charInfo.getOutputStringForChar(ch);
if (null != outputStringForChar)
{
writer.write(outputStringForChar);
}
else
return i;
}
else
return i;
}
return i + 1;
} | [
"int",
"accumDefaultEntity",
"(",
"java",
".",
"io",
".",
"Writer",
"writer",
",",
"char",
"ch",
",",
"int",
"i",
",",
"char",
"[",
"]",
"chars",
",",
"int",
"len",
",",
"boolean",
"fromTextNode",
",",
"boolean",
"escLF",
")",
"throws",
"IOException",
... | Handle one of the default entities, return false if it
is not a default entity.
@param ch character to be escaped.
@param i index into character array.
@param chars non-null reference to character array.
@param len length of chars.
@param fromTextNode true if the characters being processed
are from a text node, false if they are from an attribute value
@param escLF true if the linefeed should be escaped.
@return i+1 if the character was written, else i.
@throws java.io.IOException | [
"Handle",
"one",
"of",
"the",
"default",
"entities",
"return",
"false",
"if",
"it",
"is",
"not",
"a",
"default",
"entity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1057-L1093 |
33,634 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.writeNormalizedChars | void writeNormalizedChars(
char ch[],
int start,
int length,
boolean isCData,
boolean useSystemLineSeparator)
throws IOException, org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
int end = start + length;
for (int i = start; i < end; i++)
{
char c = ch[i];
if (CharInfo.S_LINEFEED == c && useSystemLineSeparator)
{
writer.write(m_lineSep, 0, m_lineSepLen);
}
else if (isCData && (!escapingNotNeeded(c)))
{
// if (i != 0)
if (m_cdataTagOpen)
closeCDATA();
// This needs to go into a function...
if (Encodings.isHighUTF16Surrogate(c))
{
writeUTF16Surrogate(c, ch, i, end);
i++ ; // process two input characters
}
else
{
writer.write("&#");
String intStr = Integer.toString((int) c);
writer.write(intStr);
writer.write(';');
}
// if ((i != 0) && (i < (end - 1)))
// if (!m_cdataTagOpen && (i < (end - 1)))
// {
// writer.write(CDATA_DELIMITER_OPEN);
// m_cdataTagOpen = true;
// }
}
else if (
isCData
&& ((i < (end - 2))
&& (']' == c)
&& (']' == ch[i + 1])
&& ('>' == ch[i + 2])))
{
writer.write(CDATA_CONTINUE);
i += 2;
}
else
{
if (escapingNotNeeded(c))
{
if (isCData && !m_cdataTagOpen)
{
writer.write(CDATA_DELIMITER_OPEN);
m_cdataTagOpen = true;
}
writer.write(c);
}
// This needs to go into a function...
else if (Encodings.isHighUTF16Surrogate(c))
{
if (m_cdataTagOpen)
closeCDATA();
writeUTF16Surrogate(c, ch, i, end);
i++; // process two input characters
}
else
{
if (m_cdataTagOpen)
closeCDATA();
writer.write("&#");
String intStr = Integer.toString((int) c);
writer.write(intStr);
writer.write(';');
}
}
}
} | java | void writeNormalizedChars(
char ch[],
int start,
int length,
boolean isCData,
boolean useSystemLineSeparator)
throws IOException, org.xml.sax.SAXException
{
final java.io.Writer writer = m_writer;
int end = start + length;
for (int i = start; i < end; i++)
{
char c = ch[i];
if (CharInfo.S_LINEFEED == c && useSystemLineSeparator)
{
writer.write(m_lineSep, 0, m_lineSepLen);
}
else if (isCData && (!escapingNotNeeded(c)))
{
// if (i != 0)
if (m_cdataTagOpen)
closeCDATA();
// This needs to go into a function...
if (Encodings.isHighUTF16Surrogate(c))
{
writeUTF16Surrogate(c, ch, i, end);
i++ ; // process two input characters
}
else
{
writer.write("&#");
String intStr = Integer.toString((int) c);
writer.write(intStr);
writer.write(';');
}
// if ((i != 0) && (i < (end - 1)))
// if (!m_cdataTagOpen && (i < (end - 1)))
// {
// writer.write(CDATA_DELIMITER_OPEN);
// m_cdataTagOpen = true;
// }
}
else if (
isCData
&& ((i < (end - 2))
&& (']' == c)
&& (']' == ch[i + 1])
&& ('>' == ch[i + 2])))
{
writer.write(CDATA_CONTINUE);
i += 2;
}
else
{
if (escapingNotNeeded(c))
{
if (isCData && !m_cdataTagOpen)
{
writer.write(CDATA_DELIMITER_OPEN);
m_cdataTagOpen = true;
}
writer.write(c);
}
// This needs to go into a function...
else if (Encodings.isHighUTF16Surrogate(c))
{
if (m_cdataTagOpen)
closeCDATA();
writeUTF16Surrogate(c, ch, i, end);
i++; // process two input characters
}
else
{
if (m_cdataTagOpen)
closeCDATA();
writer.write("&#");
String intStr = Integer.toString((int) c);
writer.write(intStr);
writer.write(';');
}
}
}
} | [
"void",
"writeNormalizedChars",
"(",
"char",
"ch",
"[",
"]",
",",
"int",
"start",
",",
"int",
"length",
",",
"boolean",
"isCData",
",",
"boolean",
"useSystemLineSeparator",
")",
"throws",
"IOException",
",",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException"... | Normalize the characters, but don't escape.
@param ch The characters from the XML document.
@param start The start position in the array.
@param length The number of characters to read from the array.
@param isCData true if a CDATA block should be built around the characters.
@param useSystemLineSeparator true if the operating systems
end-of-line separator should be output rather than a new-line character.
@throws IOException
@throws org.xml.sax.SAXException | [
"Normalize",
"the",
"characters",
"but",
"don",
"t",
"escape",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1107-L1200 |
33,635 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.processDirty | private int processDirty(
char[] chars,
int end,
int i,
char ch,
int lastDirty,
boolean fromTextNode) throws IOException
{
int startClean = lastDirty + 1;
// if we have some clean characters accumulated
// process them before the dirty one.
if (i > startClean)
{
int lengthClean = i - startClean;
m_writer.write(chars, startClean, lengthClean);
}
// process the "dirty" character
if (CharInfo.S_LINEFEED == ch && fromTextNode)
{
m_writer.write(m_lineSep, 0, m_lineSepLen);
}
else
{
startClean =
accumDefaultEscape(
m_writer,
(char)ch,
i,
chars,
end,
fromTextNode,
false);
i = startClean - 1;
}
// Return the index of the last character that we just processed
// which is a dirty character.
return i;
} | java | private int processDirty(
char[] chars,
int end,
int i,
char ch,
int lastDirty,
boolean fromTextNode) throws IOException
{
int startClean = lastDirty + 1;
// if we have some clean characters accumulated
// process them before the dirty one.
if (i > startClean)
{
int lengthClean = i - startClean;
m_writer.write(chars, startClean, lengthClean);
}
// process the "dirty" character
if (CharInfo.S_LINEFEED == ch && fromTextNode)
{
m_writer.write(m_lineSep, 0, m_lineSepLen);
}
else
{
startClean =
accumDefaultEscape(
m_writer,
(char)ch,
i,
chars,
end,
fromTextNode,
false);
i = startClean - 1;
}
// Return the index of the last character that we just processed
// which is a dirty character.
return i;
} | [
"private",
"int",
"processDirty",
"(",
"char",
"[",
"]",
"chars",
",",
"int",
"end",
",",
"int",
"i",
",",
"char",
"ch",
",",
"int",
"lastDirty",
",",
"boolean",
"fromTextNode",
")",
"throws",
"IOException",
"{",
"int",
"startClean",
"=",
"lastDirty",
"+... | Process a dirty character and any preeceding clean characters
that were not yet processed.
@param chars array of characters being processed
@param end one (1) beyond the last character
in chars to be processed
@param i the index of the dirty character
@param ch the character in chars[i]
@param lastDirty the last dirty character previous to i
@param fromTextNode true if the characters being processed are
from a text node, false if they are from an attribute value.
@return the index of the last character processed | [
"Process",
"a",
"dirty",
"character",
"and",
"any",
"preeceding",
"clean",
"characters",
"that",
"were",
"not",
"yet",
"processed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1706-L1744 |
33,636 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.accumDefaultEscape | private int accumDefaultEscape(
Writer writer,
char ch,
int i,
char[] chars,
int len,
boolean fromTextNode,
boolean escLF)
throws IOException
{
int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF);
if (i == pos)
{
if (Encodings.isHighUTF16Surrogate(ch))
{
// Should be the UTF-16 low surrogate of the hig/low pair.
char next;
// Unicode code point formed from the high/low pair.
int codePoint = 0;
if (i + 1 >= len)
{
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] { Integer.toHexString(ch)}));
//"Invalid UTF-16 surrogate detected: "
//+Integer.toHexString(ch)+ " ?");
}
else
{
next = chars[++i];
if (!(Encodings.isLowUTF16Surrogate(next)))
throw new IOException(
Utils.messages.createMessage(
MsgKey
.ER_INVALID_UTF16_SURROGATE,
new Object[] {
Integer.toHexString(ch)
+ " "
+ Integer.toHexString(next)}));
//"Invalid UTF-16 surrogate detected: "
//+Integer.toHexString(ch)+" "+Integer.toHexString(next));
codePoint = Encodings.toCodePoint(ch,next);
}
writer.write("&#");
writer.write(Integer.toString(codePoint));
writer.write(';');
pos += 2; // count the two characters that went into writing out this entity
}
else
{
/* This if check is added to support control characters in XML 1.1.
* If a character is a Control Character within C0 and C1 range, it is desirable
* to write it out as Numeric Character Reference(NCR) regardless of XML Version
* being used for output document.
*/
if (isCharacterInC0orC1Range(ch) || isNELorLSEPCharacter(ch))
{
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
else if ((!escapingNotNeeded(ch) ||
( (fromTextNode && m_charInfo.shouldMapTextChar(ch))
|| (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))))
&& m_elemContext.m_currentElemDepth > 0)
{
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
else
{
writer.write(ch);
}
pos++; // count the single character that was processed
}
}
return pos;
} | java | private int accumDefaultEscape(
Writer writer,
char ch,
int i,
char[] chars,
int len,
boolean fromTextNode,
boolean escLF)
throws IOException
{
int pos = accumDefaultEntity(writer, ch, i, chars, len, fromTextNode, escLF);
if (i == pos)
{
if (Encodings.isHighUTF16Surrogate(ch))
{
// Should be the UTF-16 low surrogate of the hig/low pair.
char next;
// Unicode code point formed from the high/low pair.
int codePoint = 0;
if (i + 1 >= len)
{
throw new IOException(
Utils.messages.createMessage(
MsgKey.ER_INVALID_UTF16_SURROGATE,
new Object[] { Integer.toHexString(ch)}));
//"Invalid UTF-16 surrogate detected: "
//+Integer.toHexString(ch)+ " ?");
}
else
{
next = chars[++i];
if (!(Encodings.isLowUTF16Surrogate(next)))
throw new IOException(
Utils.messages.createMessage(
MsgKey
.ER_INVALID_UTF16_SURROGATE,
new Object[] {
Integer.toHexString(ch)
+ " "
+ Integer.toHexString(next)}));
//"Invalid UTF-16 surrogate detected: "
//+Integer.toHexString(ch)+" "+Integer.toHexString(next));
codePoint = Encodings.toCodePoint(ch,next);
}
writer.write("&#");
writer.write(Integer.toString(codePoint));
writer.write(';');
pos += 2; // count the two characters that went into writing out this entity
}
else
{
/* This if check is added to support control characters in XML 1.1.
* If a character is a Control Character within C0 and C1 range, it is desirable
* to write it out as Numeric Character Reference(NCR) regardless of XML Version
* being used for output document.
*/
if (isCharacterInC0orC1Range(ch) || isNELorLSEPCharacter(ch))
{
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
else if ((!escapingNotNeeded(ch) ||
( (fromTextNode && m_charInfo.shouldMapTextChar(ch))
|| (!fromTextNode && m_charInfo.shouldMapAttrChar(ch))))
&& m_elemContext.m_currentElemDepth > 0)
{
writer.write("&#");
writer.write(Integer.toString(ch));
writer.write(';');
}
else
{
writer.write(ch);
}
pos++; // count the single character that was processed
}
}
return pos;
} | [
"private",
"int",
"accumDefaultEscape",
"(",
"Writer",
"writer",
",",
"char",
"ch",
",",
"int",
"i",
",",
"char",
"[",
"]",
"chars",
",",
"int",
"len",
",",
"boolean",
"fromTextNode",
",",
"boolean",
"escLF",
")",
"throws",
"IOException",
"{",
"int",
"po... | Escape and writer.write a character.
@param ch character to be escaped.
@param i index into character array.
@param chars non-null reference to character array.
@param len length of chars.
@param fromTextNode true if the characters being processed are
from a text node, false if the characters being processed are from
an attribute value.
@param escLF true if the linefeed should be escaped.
@return i+1 if a character was written, i+2 if two characters
were written out, else return i.
@throws org.xml.sax.SAXException | [
"Escape",
"and",
"writer",
".",
"write",
"a",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1783-L1871 |
33,637 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.startElement | public void startElement(
String elementNamespaceURI,
String elementLocalName,
String elementName)
throws SAXException
{
startElement(elementNamespaceURI, elementLocalName, elementName, null);
} | java | public void startElement(
String elementNamespaceURI,
String elementLocalName,
String elementName)
throws SAXException
{
startElement(elementNamespaceURI, elementLocalName, elementName, null);
} | [
"public",
"void",
"startElement",
"(",
"String",
"elementNamespaceURI",
",",
"String",
"elementLocalName",
",",
"String",
"elementName",
")",
"throws",
"SAXException",
"{",
"startElement",
"(",
"elementNamespaceURI",
",",
"elementLocalName",
",",
"elementName",
",",
"... | Receive notification of the beginning of an element, additional
namespace or attribute information can occur before or after this call,
that is associated with this element.
@param elementNamespaceURI The Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed.
@param elementLocalName The local name (without prefix), or the
empty string if Namespace processing is not being
performed.
@param elementName The element type name.
@throws org.xml.sax.SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.ContentHandler#startElement
@see org.xml.sax.ContentHandler#endElement
@see org.xml.sax.AttributeList
@throws org.xml.sax.SAXException | [
"Receive",
"notification",
"of",
"the",
"beginning",
"of",
"an",
"element",
"additional",
"namespace",
"or",
"attribute",
"information",
"can",
"occur",
"before",
"or",
"after",
"this",
"call",
"that",
"is",
"associated",
"with",
"this",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L1984-L1991 |
33,638 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.startPrefixMapping | public void startPrefixMapping(String prefix, String uri)
throws org.xml.sax.SAXException
{
// the "true" causes the flush of any open tags
startPrefixMapping(prefix, uri, true);
} | java | public void startPrefixMapping(String prefix, String uri)
throws org.xml.sax.SAXException
{
// the "true" causes the flush of any open tags
startPrefixMapping(prefix, uri, true);
} | [
"public",
"void",
"startPrefixMapping",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"// the \"true\" causes the flush of any open tags",
"startPrefixMapping",
"(",
"prefix",
",",
"uri",
",",
... | Begin the scope of a prefix-URI Namespace mapping
just before another element is about to start.
This call will close any open tags so that the prefix mapping
will not apply to the current element, but the up comming child.
@see org.xml.sax.ContentHandler#startPrefixMapping
@param prefix The Namespace prefix being declared.
@param uri The Namespace URI the prefix is mapped to.
@throws org.xml.sax.SAXException The client may throw
an exception during processing. | [
"Begin",
"the",
"scope",
"of",
"a",
"prefix",
"-",
"URI",
"Namespace",
"mapping",
"just",
"before",
"another",
"element",
"is",
"about",
"to",
"start",
".",
"This",
"call",
"will",
"close",
"any",
"open",
"tags",
"so",
"that",
"the",
"prefix",
"mapping",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2295-L2300 |
33,639 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.startEntity | public void startEntity(String name) throws org.xml.sax.SAXException
{
if (name.equals("[dtd]"))
m_inExternalDTD = true;
if (!m_expandDTDEntities && !m_inExternalDTD) {
/* Only leave the entity as-is if
* we've been told not to expand them
* and this is not the magic [dtd] name.
*/
startNonEscaping();
characters("&" + name + ';');
endNonEscaping();
}
m_inEntityRef = true;
} | java | public void startEntity(String name) throws org.xml.sax.SAXException
{
if (name.equals("[dtd]"))
m_inExternalDTD = true;
if (!m_expandDTDEntities && !m_inExternalDTD) {
/* Only leave the entity as-is if
* we've been told not to expand them
* and this is not the magic [dtd] name.
*/
startNonEscaping();
characters("&" + name + ';');
endNonEscaping();
}
m_inEntityRef = true;
} | [
"public",
"void",
"startEntity",
"(",
"String",
"name",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"name",
".",
"equals",
"(",
"\"[dtd]\"",
")",
")",
"m_inExternalDTD",
"=",
"true",
";",
"if",
"(",
"!",
"m_expand... | Report the beginning of an entity.
The start and end of the document entity are not reported.
The start and end of the external DTD subset are reported
using the pseudo-name "[dtd]". All other events must be
properly nested within start/end entity events.
@param name The name of the entity. If it is a parameter
entity, the name will begin with '%'.
@throws org.xml.sax.SAXException The application may raise an exception.
@see #endEntity
@see org.xml.sax.ext.DeclHandler#internalEntityDecl
@see org.xml.sax.ext.DeclHandler#externalEntityDecl | [
"Report",
"the",
"beginning",
"of",
"an",
"entity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2586-L2602 |
33,640 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.setCdataSectionElements | public void setCdataSectionElements(Vector URI_and_localNames)
{
// convert to the new way.
if (URI_and_localNames != null)
{
final int len = URI_and_localNames.size() - 1;
if (len > 0)
{
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 2)
{
// whitspace separated "{uri1}local1 {uri2}local2 ..."
if (i != 0)
sb.append(' ');
final String uri = (String) URI_and_localNames.elementAt(i);
final String localName =
(String) URI_and_localNames.elementAt(i + 1);
if (uri != null)
{
// If there is no URI don't put this in, just the localName then.
sb.append('{');
sb.append(uri);
sb.append('}');
}
sb.append(localName);
}
m_StringOfCDATASections = sb.toString();
}
}
initCdataElems(m_StringOfCDATASections);
} | java | public void setCdataSectionElements(Vector URI_and_localNames)
{
// convert to the new way.
if (URI_and_localNames != null)
{
final int len = URI_and_localNames.size() - 1;
if (len > 0)
{
final StringBuffer sb = new StringBuffer();
for (int i = 0; i < len; i += 2)
{
// whitspace separated "{uri1}local1 {uri2}local2 ..."
if (i != 0)
sb.append(' ');
final String uri = (String) URI_and_localNames.elementAt(i);
final String localName =
(String) URI_and_localNames.elementAt(i + 1);
if (uri != null)
{
// If there is no URI don't put this in, just the localName then.
sb.append('{');
sb.append(uri);
sb.append('}');
}
sb.append(localName);
}
m_StringOfCDATASections = sb.toString();
}
}
initCdataElems(m_StringOfCDATASections);
} | [
"public",
"void",
"setCdataSectionElements",
"(",
"Vector",
"URI_and_localNames",
")",
"{",
"// convert to the new way.",
"if",
"(",
"URI_and_localNames",
"!=",
"null",
")",
"{",
"final",
"int",
"len",
"=",
"URI_and_localNames",
".",
"size",
"(",
")",
"-",
"1",
... | Remembers the cdata sections specified in the cdata-section-elements.
The "official way to set URI and localName pairs.
This method should be used by both Xalan and XSLTC.
@param URI_and_localNames a vector of pairs of Strings (URI/local) | [
"Remembers",
"the",
"cdata",
"sections",
"specified",
"in",
"the",
"cdata",
"-",
"section",
"-",
"elements",
".",
"The",
"official",
"way",
"to",
"set",
"URI",
"and",
"localName",
"pairs",
".",
"This",
"method",
"should",
"be",
"used",
"by",
"both",
"Xalan... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2809-L2839 |
33,641 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.ensureAttributesNamespaceIsDeclared | protected String ensureAttributesNamespaceIsDeclared(
String ns,
String localName,
String rawName)
throws org.xml.sax.SAXException
{
if (ns != null && ns.length() > 0)
{
// extract the prefix in front of the raw name
int index = 0;
String prefixFromRawName =
(index = rawName.indexOf(":")) < 0
? ""
: rawName.substring(0, index);
if (index > 0)
{
// we have a prefix, lets see if it maps to a namespace
String uri = m_prefixMap.lookupNamespace(prefixFromRawName);
if (uri != null && uri.equals(ns))
{
// the prefix in the raw name is already maps to the given namespace uri
// so we don't need to do anything
return null;
}
else
{
// The uri does not map to the prefix in the raw name,
// so lets make the mapping.
this.startPrefixMapping(prefixFromRawName, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefixFromRawName,
"xmlns:" + prefixFromRawName,
"CDATA",
ns, false);
return prefixFromRawName;
}
}
else
{
// we don't have a prefix in the raw name.
// Does the URI map to a prefix already?
String prefix = m_prefixMap.lookupPrefix(ns);
if (prefix == null)
{
// uri is not associated with a prefix,
// so lets generate a new prefix to use
prefix = m_prefixMap.generateNextPrefix();
this.startPrefixMapping(prefix, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefix,
"xmlns:" + prefix,
"CDATA",
ns, false);
}
return prefix;
}
}
return null;
} | java | protected String ensureAttributesNamespaceIsDeclared(
String ns,
String localName,
String rawName)
throws org.xml.sax.SAXException
{
if (ns != null && ns.length() > 0)
{
// extract the prefix in front of the raw name
int index = 0;
String prefixFromRawName =
(index = rawName.indexOf(":")) < 0
? ""
: rawName.substring(0, index);
if (index > 0)
{
// we have a prefix, lets see if it maps to a namespace
String uri = m_prefixMap.lookupNamespace(prefixFromRawName);
if (uri != null && uri.equals(ns))
{
// the prefix in the raw name is already maps to the given namespace uri
// so we don't need to do anything
return null;
}
else
{
// The uri does not map to the prefix in the raw name,
// so lets make the mapping.
this.startPrefixMapping(prefixFromRawName, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefixFromRawName,
"xmlns:" + prefixFromRawName,
"CDATA",
ns, false);
return prefixFromRawName;
}
}
else
{
// we don't have a prefix in the raw name.
// Does the URI map to a prefix already?
String prefix = m_prefixMap.lookupPrefix(ns);
if (prefix == null)
{
// uri is not associated with a prefix,
// so lets generate a new prefix to use
prefix = m_prefixMap.generateNextPrefix();
this.startPrefixMapping(prefix, ns, false);
this.addAttribute(
"http://www.w3.org/2000/xmlns/",
prefix,
"xmlns:" + prefix,
"CDATA",
ns, false);
}
return prefix;
}
}
return null;
} | [
"protected",
"String",
"ensureAttributesNamespaceIsDeclared",
"(",
"String",
"ns",
",",
"String",
"localName",
",",
"String",
"rawName",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"ns",
"!=",
"null",
"&&",
"ns",
".",
... | Makes sure that the namespace URI for the given qualified attribute name
is declared.
@param ns the namespace URI
@param rawName the qualified name
@return returns null if no action is taken, otherwise it returns the
prefix used in declaring the namespace.
@throws SAXException | [
"Makes",
"sure",
"that",
"the",
"namespace",
"URI",
"for",
"the",
"given",
"qualified",
"attribute",
"name",
"is",
"declared",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L2850-L2915 |
33,642 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.firePseudoAttributes | protected void firePseudoAttributes()
{
if (m_tracer != null)
{
try
{
// flush out the "<elemName" if not already flushed
m_writer.flush();
// make a StringBuffer to write the name="value" pairs to.
StringBuffer sb = new StringBuffer();
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
// make a writer that internally appends to the same
// StringBuffer
java.io.Writer writer =
new ToStream.WritertoStringBuffer(sb);
processAttributes(writer, nAttrs);
// Don't clear the attributes!
// We only want to see what would be written out
// at this point, we don't want to loose them.
}
sb.append('>'); // the potential > after the attributes.
// convert the StringBuffer to a char array and
// emit the trace event that these characters "might"
// be written
char ch[] = sb.toString().toCharArray();
m_tracer.fireGenerateEvent(
SerializerTrace.EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS,
ch,
0,
ch.length);
}
catch (IOException ioe)
{
// ignore ?
}
catch (SAXException se)
{
// ignore ?
}
}
} | java | protected void firePseudoAttributes()
{
if (m_tracer != null)
{
try
{
// flush out the "<elemName" if not already flushed
m_writer.flush();
// make a StringBuffer to write the name="value" pairs to.
StringBuffer sb = new StringBuffer();
int nAttrs = m_attributes.getLength();
if (nAttrs > 0)
{
// make a writer that internally appends to the same
// StringBuffer
java.io.Writer writer =
new ToStream.WritertoStringBuffer(sb);
processAttributes(writer, nAttrs);
// Don't clear the attributes!
// We only want to see what would be written out
// at this point, we don't want to loose them.
}
sb.append('>'); // the potential > after the attributes.
// convert the StringBuffer to a char array and
// emit the trace event that these characters "might"
// be written
char ch[] = sb.toString().toCharArray();
m_tracer.fireGenerateEvent(
SerializerTrace.EVENTTYPE_OUTPUT_PSEUDO_CHARACTERS,
ch,
0,
ch.length);
}
catch (IOException ioe)
{
// ignore ?
}
catch (SAXException se)
{
// ignore ?
}
}
} | [
"protected",
"void",
"firePseudoAttributes",
"(",
")",
"{",
"if",
"(",
"m_tracer",
"!=",
"null",
")",
"{",
"try",
"{",
"// flush out the \"<elemName\" if not already flushed",
"m_writer",
".",
"flush",
"(",
")",
";",
"// make a StringBuffer to write the name=\"value\" pai... | To fire off the pseudo characters of attributes, as they currently
exist. This method should be called everytime an attribute is added,
or when an attribute value is changed, or an element is created. | [
"To",
"fire",
"off",
"the",
"pseudo",
"characters",
"of",
"attributes",
"as",
"they",
"currently",
"exist",
".",
"This",
"method",
"should",
"be",
"called",
"everytime",
"an",
"attribute",
"is",
"added",
"or",
"when",
"an",
"attribute",
"value",
"is",
"chang... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3138-L3182 |
33,643 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.resetToStream | private void resetToStream()
{
this.m_cdataStartCalled = false;
/* The stream is being reset. It is one of
* ToXMLStream, ToHTMLStream ... and this type can't be changed
* so neither should m_charInfo which is associated with the
* type of Stream. Just leave m_charInfo as-is for the next re-use.
*
*/
// this.m_charInfo = null; // don't set to null
this.m_disableOutputEscapingStates.clear();
// this.m_encodingInfo = null; // don't set to null
this.m_escaping = true;
// Leave m_format alone for now - Brian M.
// this.m_format = null;
this.m_expandDTDEntities = true;
this.m_inDoctype = false;
this.m_ispreserve = false;
this.m_isprevtext = false;
this.m_isUTF8 = false; // ?? used anywhere ??
this.m_lineSep = s_systemLineSep;
this.m_lineSepLen = s_systemLineSep.length;
this.m_lineSepUse = true;
// this.m_outputStream = null; // Don't reset it may be re-used
this.m_preserves.clear();
this.m_shouldFlush = true;
this.m_spaceBeforeClose = false;
this.m_startNewLine = false;
this.m_writer_set_by_user = false;
} | java | private void resetToStream()
{
this.m_cdataStartCalled = false;
/* The stream is being reset. It is one of
* ToXMLStream, ToHTMLStream ... and this type can't be changed
* so neither should m_charInfo which is associated with the
* type of Stream. Just leave m_charInfo as-is for the next re-use.
*
*/
// this.m_charInfo = null; // don't set to null
this.m_disableOutputEscapingStates.clear();
// this.m_encodingInfo = null; // don't set to null
this.m_escaping = true;
// Leave m_format alone for now - Brian M.
// this.m_format = null;
this.m_expandDTDEntities = true;
this.m_inDoctype = false;
this.m_ispreserve = false;
this.m_isprevtext = false;
this.m_isUTF8 = false; // ?? used anywhere ??
this.m_lineSep = s_systemLineSep;
this.m_lineSepLen = s_systemLineSep.length;
this.m_lineSepUse = true;
// this.m_outputStream = null; // Don't reset it may be re-used
this.m_preserves.clear();
this.m_shouldFlush = true;
this.m_spaceBeforeClose = false;
this.m_startNewLine = false;
this.m_writer_set_by_user = false;
} | [
"private",
"void",
"resetToStream",
"(",
")",
"{",
"this",
".",
"m_cdataStartCalled",
"=",
"false",
";",
"/* The stream is being reset. It is one of\n * ToXMLStream, ToHTMLStream ... and this type can't be changed\n * so neither should m_charInfo which is associated with th... | Reset all of the fields owned by ToStream class | [
"Reset",
"all",
"of",
"the",
"fields",
"owned",
"by",
"ToStream",
"class"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3262-L3292 |
33,644 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.notationDecl | public void notationDecl(String name, String pubID, String sysID) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!NOTATION ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | java | public void notationDecl(String name, String pubID, String sysID) throws SAXException {
// TODO Auto-generated method stub
try {
DTDprolog();
m_writer.write("<!NOTATION ");
m_writer.write(name);
if (pubID != null) {
m_writer.write(" PUBLIC \"");
m_writer.write(pubID);
}
else {
m_writer.write(" SYSTEM \"");
m_writer.write(sysID);
}
m_writer.write("\" >");
m_writer.write(m_lineSep, 0, m_lineSepLen);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} | [
"public",
"void",
"notationDecl",
"(",
"String",
"name",
",",
"String",
"pubID",
",",
"String",
"sysID",
")",
"throws",
"SAXException",
"{",
"// TODO Auto-generated method stub",
"try",
"{",
"DTDprolog",
"(",
")",
";",
"m_writer",
".",
"write",
"(",
"\"<!NOTATIO... | If this method is called, the serializer is used as a
DTDHandler, which changes behavior how the serializer
handles document entities.
@see org.xml.sax.DTDHandler#notationDecl(java.lang.String, java.lang.String, java.lang.String) | [
"If",
"this",
"method",
"is",
"called",
"the",
"serializer",
"is",
"used",
"as",
"a",
"DTDHandler",
"which",
"changes",
"behavior",
"how",
"the",
"serializer",
"handles",
"document",
"entities",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3489-L3511 |
33,645 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.DTDprolog | private void DTDprolog() throws SAXException, IOException {
final java.io.Writer writer = m_writer;
if (m_needToOutputDocTypeDecl)
{
outputDocTypeDecl(m_elemContext.m_elementName, false);
m_needToOutputDocTypeDecl = false;
}
if (m_inDoctype)
{
writer.write(" [");
writer.write(m_lineSep, 0, m_lineSepLen);
m_inDoctype = false;
}
} | java | private void DTDprolog() throws SAXException, IOException {
final java.io.Writer writer = m_writer;
if (m_needToOutputDocTypeDecl)
{
outputDocTypeDecl(m_elemContext.m_elementName, false);
m_needToOutputDocTypeDecl = false;
}
if (m_inDoctype)
{
writer.write(" [");
writer.write(m_lineSep, 0, m_lineSepLen);
m_inDoctype = false;
}
} | [
"private",
"void",
"DTDprolog",
"(",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"final",
"java",
".",
"io",
".",
"Writer",
"writer",
"=",
"m_writer",
";",
"if",
"(",
"m_needToOutputDocTypeDecl",
")",
"{",
"outputDocTypeDecl",
"(",
"m_elemContext",
... | A private helper method to output the
@throws SAXException
@throws IOException | [
"A",
"private",
"helper",
"method",
"to",
"output",
"the"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3550-L3563 |
33,646 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java | ToStream.addCdataSectionElements | public void addCdataSectionElements(String URI_and_localNames)
{
if (URI_and_localNames != null)
initCdataElems(URI_and_localNames);
if (m_StringOfCDATASections == null)
m_StringOfCDATASections = URI_and_localNames;
else
m_StringOfCDATASections += (" " + URI_and_localNames);
} | java | public void addCdataSectionElements(String URI_and_localNames)
{
if (URI_and_localNames != null)
initCdataElems(URI_and_localNames);
if (m_StringOfCDATASections == null)
m_StringOfCDATASections = URI_and_localNames;
else
m_StringOfCDATASections += (" " + URI_and_localNames);
} | [
"public",
"void",
"addCdataSectionElements",
"(",
"String",
"URI_and_localNames",
")",
"{",
"if",
"(",
"URI_and_localNames",
"!=",
"null",
")",
"initCdataElems",
"(",
"URI_and_localNames",
")",
";",
"if",
"(",
"m_StringOfCDATASections",
"==",
"null",
")",
"m_StringO... | Remembers the cdata sections specified in the cdata-section-elements by appending the given
cdata section elements to the list. This method can be called multiple times, but once an
element is put in the list of cdata section elements it can not be removed.
This method should be used by both Xalan and XSLTC.
@param URI_and_localNames a whitespace separated list of element names, each element
is a URI in curly braces (optional) and a local name. An example of such a parameter is:
"{http://company.com}price {myURI2}book chapter" | [
"Remembers",
"the",
"cdata",
"sections",
"specified",
"in",
"the",
"cdata",
"-",
"section",
"-",
"elements",
"by",
"appending",
"the",
"given",
"cdata",
"section",
"elements",
"to",
"the",
"list",
".",
"This",
"method",
"can",
"be",
"called",
"multiple",
"ti... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToStream.java#L3592-L3600 |
33,647 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java | TrieIterator.reset | @Override
public final void reset()
{
m_currentCodepoint_ = 0;
m_nextCodepoint_ = 0;
m_nextIndex_ = 0;
m_nextBlock_ = m_trie_.m_index_[0] << Trie.INDEX_STAGE_2_SHIFT_;
if (m_nextBlock_ == m_trie_.m_dataOffset_) {
m_nextValue_ = m_initialValue_;
}
else {
m_nextValue_ = extract(m_trie_.getValue(m_nextBlock_));
}
m_nextBlockIndex_ = 0;
m_nextTrailIndexOffset_ = TRAIL_SURROGATE_INDEX_BLOCK_LENGTH_;
} | java | @Override
public final void reset()
{
m_currentCodepoint_ = 0;
m_nextCodepoint_ = 0;
m_nextIndex_ = 0;
m_nextBlock_ = m_trie_.m_index_[0] << Trie.INDEX_STAGE_2_SHIFT_;
if (m_nextBlock_ == m_trie_.m_dataOffset_) {
m_nextValue_ = m_initialValue_;
}
else {
m_nextValue_ = extract(m_trie_.getValue(m_nextBlock_));
}
m_nextBlockIndex_ = 0;
m_nextTrailIndexOffset_ = TRAIL_SURROGATE_INDEX_BLOCK_LENGTH_;
} | [
"@",
"Override",
"public",
"final",
"void",
"reset",
"(",
")",
"{",
"m_currentCodepoint_",
"=",
"0",
";",
"m_nextCodepoint_",
"=",
"0",
";",
"m_nextIndex_",
"=",
"0",
";",
"m_nextBlock_",
"=",
"m_trie_",
".",
"m_index_",
"[",
"0",
"]",
"<<",
"Trie",
".",... | Resets the iterator to the beginning of the iteration | [
"Resets",
"the",
"iterator",
"to",
"the",
"beginning",
"of",
"the",
"iteration"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java#L141-L156 |
33,648 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java | TrieIterator.setResult | private final void setResult(Element element, int start, int limit,
int value)
{
element.start = start;
element.limit = limit;
element.value = value;
} | java | private final void setResult(Element element, int start, int limit,
int value)
{
element.start = start;
element.limit = limit;
element.value = value;
} | [
"private",
"final",
"void",
"setResult",
"(",
"Element",
"element",
",",
"int",
"start",
",",
"int",
"limit",
",",
"int",
"value",
")",
"{",
"element",
".",
"start",
"=",
"start",
";",
"element",
".",
"limit",
"=",
"limit",
";",
"element",
".",
"value"... | Set the result values
@param element return result object
@param start codepoint of range
@param limit (end + 1) codepoint of range
@param value common value of range | [
"Set",
"the",
"result",
"values"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java#L183-L189 |
33,649 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java | TrieIterator.checkNullNextTrailIndex | private final boolean checkNullNextTrailIndex()
{
if (m_nextIndex_ <= 0) {
m_nextCodepoint_ += TRAIL_SURROGATE_COUNT_ - 1;
int nextLead = UTF16.getLeadSurrogate(m_nextCodepoint_);
int leadBlock =
m_trie_.m_index_[nextLead >> Trie.INDEX_STAGE_1_SHIFT_] <<
Trie.INDEX_STAGE_2_SHIFT_;
if (m_trie_.m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
m_nextIndex_ = m_trie_.m_dataManipulate_.getFoldingOffset(
m_trie_.getValue(leadBlock +
(nextLead & Trie.INDEX_STAGE_3_MASK_)));
m_nextIndex_ --;
m_nextBlockIndex_ = DATA_BLOCK_LENGTH_;
return true;
}
return false;
} | java | private final boolean checkNullNextTrailIndex()
{
if (m_nextIndex_ <= 0) {
m_nextCodepoint_ += TRAIL_SURROGATE_COUNT_ - 1;
int nextLead = UTF16.getLeadSurrogate(m_nextCodepoint_);
int leadBlock =
m_trie_.m_index_[nextLead >> Trie.INDEX_STAGE_1_SHIFT_] <<
Trie.INDEX_STAGE_2_SHIFT_;
if (m_trie_.m_dataManipulate_ == null) {
throw new NullPointerException(
"The field DataManipulate in this Trie is null");
}
m_nextIndex_ = m_trie_.m_dataManipulate_.getFoldingOffset(
m_trie_.getValue(leadBlock +
(nextLead & Trie.INDEX_STAGE_3_MASK_)));
m_nextIndex_ --;
m_nextBlockIndex_ = DATA_BLOCK_LENGTH_;
return true;
}
return false;
} | [
"private",
"final",
"boolean",
"checkNullNextTrailIndex",
"(",
")",
"{",
"if",
"(",
"m_nextIndex_",
"<=",
"0",
")",
"{",
"m_nextCodepoint_",
"+=",
"TRAIL_SURROGATE_COUNT_",
"-",
"1",
";",
"int",
"nextLead",
"=",
"UTF16",
".",
"getLeadSurrogate",
"(",
"m_nextCode... | Checks if we are beginning at the start of a initial block.
If we are then the rest of the codepoints in this initial block
has the same values.
We increment m_nextCodepoint_ and relevant data members if so.
This is used only in for the supplementary codepoints because
the offset to the trail indexes could be 0.
@return true if we are at the start of a initial block. | [
"Checks",
"if",
"we",
"are",
"beginning",
"at",
"the",
"start",
"of",
"a",
"initial",
"block",
".",
"If",
"we",
"are",
"then",
"the",
"rest",
"of",
"the",
"codepoints",
"in",
"this",
"initial",
"block",
"has",
"the",
"same",
"values",
".",
"We",
"incre... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TrieIterator.java#L454-L474 |
33,650 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java | ObjectIdentifier.toIntArray | public int[] toIntArray() {
int length = encoding.length;
int[] result = new int[20];
int which = 0;
int fromPos = 0;
for (int i = 0; i < length; i++) {
if ((encoding[i] & 0x80) == 0) {
// one section [fromPos..i]
if (i - fromPos + 1 > 4) {
BigInteger big = new BigInteger(pack(encoding, fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
result[which++] = 2;
BigInteger second = big.subtract(BigInteger.valueOf(80));
if (second.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
return null;
} else {
result[which++] = second.intValue();
}
} else {
if (big.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
return null;
} else {
result[which++] = big.intValue();
}
}
} else {
int retval = 0;
for (int j = fromPos; j <= i; j++) {
retval <<= 7;
byte tmp = encoding[j];
retval |= (tmp & 0x07f);
}
if (fromPos == 0) {
if (retval < 80) {
result[which++] = retval / 40;
result[which++] = retval % 40;
} else {
result[which++] = 2;
result[which++] = retval - 80;
}
} else {
result[which++] = retval;
}
}
fromPos = i+1;
}
if (which >= result.length) {
result = Arrays.copyOf(result, which + 10);
}
}
return Arrays.copyOf(result, which);
} | java | public int[] toIntArray() {
int length = encoding.length;
int[] result = new int[20];
int which = 0;
int fromPos = 0;
for (int i = 0; i < length; i++) {
if ((encoding[i] & 0x80) == 0) {
// one section [fromPos..i]
if (i - fromPos + 1 > 4) {
BigInteger big = new BigInteger(pack(encoding, fromPos, i-fromPos+1, 7, 8));
if (fromPos == 0) {
result[which++] = 2;
BigInteger second = big.subtract(BigInteger.valueOf(80));
if (second.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
return null;
} else {
result[which++] = second.intValue();
}
} else {
if (big.compareTo(BigInteger.valueOf(Integer.MAX_VALUE)) == 1) {
return null;
} else {
result[which++] = big.intValue();
}
}
} else {
int retval = 0;
for (int j = fromPos; j <= i; j++) {
retval <<= 7;
byte tmp = encoding[j];
retval |= (tmp & 0x07f);
}
if (fromPos == 0) {
if (retval < 80) {
result[which++] = retval / 40;
result[which++] = retval % 40;
} else {
result[which++] = 2;
result[which++] = retval - 80;
}
} else {
result[which++] = retval;
}
}
fromPos = i+1;
}
if (which >= result.length) {
result = Arrays.copyOf(result, which + 10);
}
}
return Arrays.copyOf(result, which);
} | [
"public",
"int",
"[",
"]",
"toIntArray",
"(",
")",
"{",
"int",
"length",
"=",
"encoding",
".",
"length",
";",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"20",
"]",
";",
"int",
"which",
"=",
"0",
";",
"int",
"fromPos",
"=",
"0",
";",
"fo... | Private helper method for serialization. To be compatible with old
versions of JDK.
@return components in an int array, if all the components are less than
Integer.MAX_VALUE. Otherwise, null. | [
"Private",
"helper",
"method",
"for",
"serialization",
".",
"To",
"be",
"compatible",
"with",
"old",
"versions",
"of",
"JDK",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java#L357-L408 |
33,651 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java | ObjectIdentifier.pack7Oid | private static int pack7Oid(int input, byte[] out, int ooffset) {
byte[] b = new byte[4];
b[0] = (byte)(input >> 24);
b[1] = (byte)(input >> 16);
b[2] = (byte)(input >> 8);
b[3] = (byte)(input);
return pack7Oid(b, 0, 4, out, ooffset);
} | java | private static int pack7Oid(int input, byte[] out, int ooffset) {
byte[] b = new byte[4];
b[0] = (byte)(input >> 24);
b[1] = (byte)(input >> 16);
b[2] = (byte)(input >> 8);
b[3] = (byte)(input);
return pack7Oid(b, 0, 4, out, ooffset);
} | [
"private",
"static",
"int",
"pack7Oid",
"(",
"int",
"input",
",",
"byte",
"[",
"]",
"out",
",",
"int",
"ooffset",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"b",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"input"... | Pack the int into a OID sub-identifier DER encoding | [
"Pack",
"the",
"int",
"into",
"a",
"OID",
"sub",
"-",
"identifier",
"DER",
"encoding"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java#L572-L579 |
33,652 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java | ObjectIdentifier.pack7Oid | private static int pack7Oid(BigInteger input, byte[] out, int ooffset) {
byte[] b = input.toByteArray();
return pack7Oid(b, 0, b.length, out, ooffset);
} | java | private static int pack7Oid(BigInteger input, byte[] out, int ooffset) {
byte[] b = input.toByteArray();
return pack7Oid(b, 0, b.length, out, ooffset);
} | [
"private",
"static",
"int",
"pack7Oid",
"(",
"BigInteger",
"input",
",",
"byte",
"[",
"]",
"out",
",",
"int",
"ooffset",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"input",
".",
"toByteArray",
"(",
")",
";",
"return",
"pack7Oid",
"(",
"b",
",",
"0",
","... | Pack the BigInteger into a OID subidentifier DER encoding | [
"Pack",
"the",
"BigInteger",
"into",
"a",
"OID",
"subidentifier",
"DER",
"encoding"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java#L584-L587 |
33,653 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java | ObjectIdentifier.check | private static void check(byte[] encoding) throws IOException {
int length = encoding.length;
if (length < 1 || // too short
(encoding[length - 1] & 0x80) != 0) { // not ended
throw new IOException("ObjectIdentifier() -- " +
"Invalid DER encoding, not ended");
}
for (int i=0; i<length; i++) {
// 0x80 at the beginning of a subidentifier
if (encoding[i] == (byte)0x80 &&
(i==0 || (encoding[i-1] & 0x80) == 0)) {
throw new IOException("ObjectIdentifier() -- " +
"Invalid DER encoding, useless extra octet detected");
}
}
} | java | private static void check(byte[] encoding) throws IOException {
int length = encoding.length;
if (length < 1 || // too short
(encoding[length - 1] & 0x80) != 0) { // not ended
throw new IOException("ObjectIdentifier() -- " +
"Invalid DER encoding, not ended");
}
for (int i=0; i<length; i++) {
// 0x80 at the beginning of a subidentifier
if (encoding[i] == (byte)0x80 &&
(i==0 || (encoding[i-1] & 0x80) == 0)) {
throw new IOException("ObjectIdentifier() -- " +
"Invalid DER encoding, useless extra octet detected");
}
}
} | [
"private",
"static",
"void",
"check",
"(",
"byte",
"[",
"]",
"encoding",
")",
"throws",
"IOException",
"{",
"int",
"length",
"=",
"encoding",
".",
"length",
";",
"if",
"(",
"length",
"<",
"1",
"||",
"// too short",
"(",
"encoding",
"[",
"length",
"-",
... | Check the DER encoding. Since DER encoding defines that the integer bits
are unsigned, so there's no need to check the MSB. | [
"Check",
"the",
"DER",
"encoding",
".",
"Since",
"DER",
"encoding",
"defines",
"that",
"the",
"integer",
"bits",
"are",
"unsigned",
"so",
"there",
"s",
"no",
"need",
"to",
"check",
"the",
"MSB",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/util/ObjectIdentifier.java#L601-L616 |
33,654 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java | GenericSignatureParser.parseForClass | public void parseForClass(GenericDeclaration genericDecl, String signature) {
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
} | java | public void parseForClass(GenericDeclaration genericDecl, String signature) {
setInput(genericDecl, signature);
if (!eof) {
parseClassSignature();
} else {
if(genericDecl instanceof Class) {
Class c = (Class) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = c.getSuperclass();
Class<?>[] interfaces = c.getInterfaces();
if (interfaces.length == 0) {
this.interfaceTypes = ListOfTypes.EMPTY;
} else {
this.interfaceTypes = new ListOfTypes(interfaces);
}
} else {
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
this.superclassType = Object.class;
this.interfaceTypes = ListOfTypes.EMPTY;
}
}
} | [
"public",
"void",
"parseForClass",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"eof",
")",
"{",
"parseClassSignature",
"(",
")",
";",
"}",
"else",... | Parses the generic signature of a class and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class | [
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"class",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L123-L144 |
33,655 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java | GenericSignatureParser.parseForMethod | public void parseForMethod(GenericDeclaration genericDecl,
String signature, Class<?>[] rawExceptionTypes) {
setInput(genericDecl, signature);
if (!eof) {
parseMethodTypeSignature(rawExceptionTypes);
} else {
Method m = (Method) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
Class<?>[] parameterTypes = m.getParameterTypes();
if (parameterTypes.length == 0) {
this.parameterTypes = ListOfTypes.EMPTY;
} else {
this.parameterTypes = new ListOfTypes(parameterTypes);
}
Class<?>[] exceptionTypes = m.getExceptionTypes();
if (exceptionTypes.length == 0) {
this.exceptionTypes = ListOfTypes.EMPTY;
} else {
this.exceptionTypes = new ListOfTypes(exceptionTypes);
}
this.returnType = m.getReturnType();
}
} | java | public void parseForMethod(GenericDeclaration genericDecl,
String signature, Class<?>[] rawExceptionTypes) {
setInput(genericDecl, signature);
if (!eof) {
parseMethodTypeSignature(rawExceptionTypes);
} else {
Method m = (Method) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
Class<?>[] parameterTypes = m.getParameterTypes();
if (parameterTypes.length == 0) {
this.parameterTypes = ListOfTypes.EMPTY;
} else {
this.parameterTypes = new ListOfTypes(parameterTypes);
}
Class<?>[] exceptionTypes = m.getExceptionTypes();
if (exceptionTypes.length == 0) {
this.exceptionTypes = ListOfTypes.EMPTY;
} else {
this.exceptionTypes = new ListOfTypes(exceptionTypes);
}
this.returnType = m.getReturnType();
}
} | [
"public",
"void",
"parseForMethod",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"rawExceptionTypes",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"eof",... | Parses the generic signature of a method and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class | [
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"method",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L153-L175 |
33,656 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java | GenericSignatureParser.parseForConstructor | public void parseForConstructor(GenericDeclaration genericDecl,
String signature, Class<?>[] rawExceptionTypes) {
setInput(genericDecl, signature);
if (!eof) {
parseMethodTypeSignature(rawExceptionTypes);
} else {
Constructor c = (Constructor) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
Class<?>[] parameterTypes = c.getParameterTypes();
if (parameterTypes.length == 0) {
this.parameterTypes = ListOfTypes.EMPTY;
} else {
this.parameterTypes = new ListOfTypes(parameterTypes);
}
Class<?>[] exceptionTypes = c.getExceptionTypes();
if (exceptionTypes.length == 0) {
this.exceptionTypes = ListOfTypes.EMPTY;
} else {
this.exceptionTypes = new ListOfTypes(exceptionTypes);
}
}
} | java | public void parseForConstructor(GenericDeclaration genericDecl,
String signature, Class<?>[] rawExceptionTypes) {
setInput(genericDecl, signature);
if (!eof) {
parseMethodTypeSignature(rawExceptionTypes);
} else {
Constructor c = (Constructor) genericDecl;
this.formalTypeParameters = EmptyArray.TYPE_VARIABLE;
Class<?>[] parameterTypes = c.getParameterTypes();
if (parameterTypes.length == 0) {
this.parameterTypes = ListOfTypes.EMPTY;
} else {
this.parameterTypes = new ListOfTypes(parameterTypes);
}
Class<?>[] exceptionTypes = c.getExceptionTypes();
if (exceptionTypes.length == 0) {
this.exceptionTypes = ListOfTypes.EMPTY;
} else {
this.exceptionTypes = new ListOfTypes(exceptionTypes);
}
}
} | [
"public",
"void",
"parseForConstructor",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
",",
"Class",
"<",
"?",
">",
"[",
"]",
"rawExceptionTypes",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"... | Parses the generic signature of a constructor and creates the data
structure representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class | [
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"constructor",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L184-L205 |
33,657 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java | GenericSignatureParser.parseForField | public void parseForField(GenericDeclaration genericDecl,
String signature) {
setInput(genericDecl, signature);
if (!eof) {
this.fieldType = parseFieldTypeSignature();
}
} | java | public void parseForField(GenericDeclaration genericDecl,
String signature) {
setInput(genericDecl, signature);
if (!eof) {
this.fieldType = parseFieldTypeSignature();
}
} | [
"public",
"void",
"parseForField",
"(",
"GenericDeclaration",
"genericDecl",
",",
"String",
"signature",
")",
"{",
"setInput",
"(",
"genericDecl",
",",
"signature",
")",
";",
"if",
"(",
"!",
"eof",
")",
"{",
"this",
".",
"fieldType",
"=",
"parseFieldTypeSignat... | Parses the generic signature of a field and creates the data structure
representing the signature.
@param genericDecl the GenericDeclaration calling this method
@param signature the generic signature of the class | [
"Parses",
"the",
"generic",
"signature",
"of",
"a",
"field",
"and",
"creates",
"the",
"data",
"structure",
"representing",
"the",
"signature",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/reflect/GenericSignatureParser.java#L214-L220 |
33,658 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/AbstractExecutorService.java | AbstractExecutorService.doInvokeAny | private <T> T doInvokeAny(Collection<? extends Callable<T>> tasks,
boolean timed, long nanos)
throws InterruptedException, ExecutionException, TimeoutException {
if (tasks == null)
throw new NullPointerException();
int ntasks = tasks.size();
if (ntasks == 0)
throw new IllegalArgumentException();
ArrayList<Future<T>> futures = new ArrayList<>(ntasks);
ExecutorCompletionService<T> ecs =
new ExecutorCompletionService<T>(this);
// For efficiency, especially in executors with limited
// parallelism, check to see if previously submitted tasks are
// done before submitting more of them. This interleaving
// plus the exception mechanics account for messiness of main
// loop.
try {
// Record exceptions so that if we fail to obtain any
// result, we can throw the last exception we got.
ExecutionException ee = null;
final long deadline = timed ? System.nanoTime() + nanos : 0L;
Iterator<? extends Callable<T>> it = tasks.iterator();
// Start one task for sure; the rest incrementally
futures.add(ecs.submit(it.next()));
--ntasks;
int active = 1;
for (;;) {
Future<T> f = ecs.poll();
if (f == null) {
if (ntasks > 0) {
--ntasks;
futures.add(ecs.submit(it.next()));
++active;
}
else if (active == 0)
break;
else if (timed) {
f = ecs.poll(nanos, NANOSECONDS);
if (f == null)
throw new TimeoutException();
nanos = deadline - System.nanoTime();
}
else
f = ecs.take();
}
if (f != null) {
--active;
try {
return f.get();
} catch (ExecutionException eex) {
ee = eex;
} catch (RuntimeException rex) {
ee = new ExecutionException(rex);
}
}
}
if (ee == null)
ee = new ExecutionException();
throw ee;
} finally {
cancelAll(futures);
}
} | java | private <T> T doInvokeAny(Collection<? extends Callable<T>> tasks,
boolean timed, long nanos)
throws InterruptedException, ExecutionException, TimeoutException {
if (tasks == null)
throw new NullPointerException();
int ntasks = tasks.size();
if (ntasks == 0)
throw new IllegalArgumentException();
ArrayList<Future<T>> futures = new ArrayList<>(ntasks);
ExecutorCompletionService<T> ecs =
new ExecutorCompletionService<T>(this);
// For efficiency, especially in executors with limited
// parallelism, check to see if previously submitted tasks are
// done before submitting more of them. This interleaving
// plus the exception mechanics account for messiness of main
// loop.
try {
// Record exceptions so that if we fail to obtain any
// result, we can throw the last exception we got.
ExecutionException ee = null;
final long deadline = timed ? System.nanoTime() + nanos : 0L;
Iterator<? extends Callable<T>> it = tasks.iterator();
// Start one task for sure; the rest incrementally
futures.add(ecs.submit(it.next()));
--ntasks;
int active = 1;
for (;;) {
Future<T> f = ecs.poll();
if (f == null) {
if (ntasks > 0) {
--ntasks;
futures.add(ecs.submit(it.next()));
++active;
}
else if (active == 0)
break;
else if (timed) {
f = ecs.poll(nanos, NANOSECONDS);
if (f == null)
throw new TimeoutException();
nanos = deadline - System.nanoTime();
}
else
f = ecs.take();
}
if (f != null) {
--active;
try {
return f.get();
} catch (ExecutionException eex) {
ee = eex;
} catch (RuntimeException rex) {
ee = new ExecutionException(rex);
}
}
}
if (ee == null)
ee = new ExecutionException();
throw ee;
} finally {
cancelAll(futures);
}
} | [
"private",
"<",
"T",
">",
"T",
"doInvokeAny",
"(",
"Collection",
"<",
"?",
"extends",
"Callable",
"<",
"T",
">",
">",
"tasks",
",",
"boolean",
"timed",
",",
"long",
"nanos",
")",
"throws",
"InterruptedException",
",",
"ExecutionException",
",",
"TimeoutExcep... | the main mechanics of invokeAny. | [
"the",
"main",
"mechanics",
"of",
"invokeAny",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/AbstractExecutorService.java#L147-L215 |
33,659 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/AbstractExecutorService.java | AbstractExecutorService.cancelAll | private static <T> void cancelAll(ArrayList<Future<T>> futures, int j) {
for (int size = futures.size(); j < size; j++)
futures.get(j).cancel(true);
} | java | private static <T> void cancelAll(ArrayList<Future<T>> futures, int j) {
for (int size = futures.size(); j < size; j++)
futures.get(j).cancel(true);
} | [
"private",
"static",
"<",
"T",
">",
"void",
"cancelAll",
"(",
"ArrayList",
"<",
"Future",
"<",
"T",
">",
">",
"futures",
",",
"int",
"j",
")",
"{",
"for",
"(",
"int",
"size",
"=",
"futures",
".",
"size",
"(",
")",
";",
"j",
"<",
"size",
";",
"j... | Cancels all futures with index at least j. | [
"Cancels",
"all",
"futures",
"with",
"index",
"at",
"least",
"j",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/AbstractExecutorService.java#L308-L311 |
33,660 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/util/FileUtil.java | FileUtil.extractZipEntry | public File extractZipEntry(File dir, ZipFile zipFile, ZipEntry entry) throws IOException {
File outputFile = new File(dir, entry.getName());
File parentFile = outputFile.getParentFile();
if (!outputFile.getCanonicalPath().startsWith(dir.getCanonicalPath() + File.separator)
|| (!parentFile.isDirectory() && !parentFile.mkdirs())) {
throw new IOException("Could not extract " + entry.getName() + " to " + dir.getPath());
}
try (InputStream inputStream = zipFile.getInputStream(entry);
FileOutputStream outputStream = new FileOutputStream(outputFile)) {
byte[] buf = new byte[1024];
int n;
while ((n = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, n);
}
}
return outputFile;
} | java | public File extractZipEntry(File dir, ZipFile zipFile, ZipEntry entry) throws IOException {
File outputFile = new File(dir, entry.getName());
File parentFile = outputFile.getParentFile();
if (!outputFile.getCanonicalPath().startsWith(dir.getCanonicalPath() + File.separator)
|| (!parentFile.isDirectory() && !parentFile.mkdirs())) {
throw new IOException("Could not extract " + entry.getName() + " to " + dir.getPath());
}
try (InputStream inputStream = zipFile.getInputStream(entry);
FileOutputStream outputStream = new FileOutputStream(outputFile)) {
byte[] buf = new byte[1024];
int n;
while ((n = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, n);
}
}
return outputFile;
} | [
"public",
"File",
"extractZipEntry",
"(",
"File",
"dir",
",",
"ZipFile",
"zipFile",
",",
"ZipEntry",
"entry",
")",
"throws",
"IOException",
"{",
"File",
"outputFile",
"=",
"new",
"File",
"(",
"dir",
",",
"entry",
".",
"getName",
"(",
")",
")",
";",
"File... | Extract a ZipEntry to the specified directory. | [
"Extract",
"a",
"ZipEntry",
"to",
"the",
"specified",
"directory",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/util/FileUtil.java#L275-L291 |
33,661 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/EnumRewriter.java | EnumRewriter.isSimpleEnum | private boolean isSimpleEnum(EnumDeclaration node) {
TypeElement type = node.getTypeElement();
for (EnumConstantDeclaration constant : node.getEnumConstants()) {
ExecutableElement method = constant.getExecutableElement();
if (method.getParameters().size() > 0 || method.isVarArgs()) {
return false;
}
if (ElementUtil.hasAnnotation(method, ObjectiveCName.class)) {
return false;
}
TypeElement valueType = ElementUtil.getDeclaringClass(method);
if (valueType != type) {
return false;
}
}
return true;
} | java | private boolean isSimpleEnum(EnumDeclaration node) {
TypeElement type = node.getTypeElement();
for (EnumConstantDeclaration constant : node.getEnumConstants()) {
ExecutableElement method = constant.getExecutableElement();
if (method.getParameters().size() > 0 || method.isVarArgs()) {
return false;
}
if (ElementUtil.hasAnnotation(method, ObjectiveCName.class)) {
return false;
}
TypeElement valueType = ElementUtil.getDeclaringClass(method);
if (valueType != type) {
return false;
}
}
return true;
} | [
"private",
"boolean",
"isSimpleEnum",
"(",
"EnumDeclaration",
"node",
")",
"{",
"TypeElement",
"type",
"=",
"node",
".",
"getTypeElement",
"(",
")",
";",
"for",
"(",
"EnumConstantDeclaration",
"constant",
":",
"node",
".",
"getEnumConstants",
"(",
")",
")",
"{... | Returns true if an enum doesn't have custom or renamed constructors,
vararg constructors or constants with anonymous class extensions. | [
"Returns",
"true",
"if",
"an",
"enum",
"doesn",
"t",
"have",
"custom",
"or",
"renamed",
"constructors",
"vararg",
"constructors",
"or",
"constants",
"with",
"anonymous",
"class",
"extensions",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/EnumRewriter.java#L101-L117 |
33,662 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/EnumRewriter.java | EnumRewriter.addArcInitialization | private void addArcInitialization(EnumDeclaration node) {
String enumClassName = nameTable.getFullName(node.getTypeElement());
List<Statement> stmts = node.getClassInitStatements().subList(0, 0);
int i = 0;
for (EnumConstantDeclaration constant : node.getEnumConstants()) {
VariableElement varElement = constant.getVariableElement();
ClassInstanceCreation creation = new ClassInstanceCreation(constant.getExecutablePair());
TreeUtil.copyList(constant.getArguments(), creation.getArguments());
Expression constName = options.stripEnumConstants()
? new StringLiteral("JAVA_LANG_ENUM_NAME_STRIPPED", typeUtil)
: new NativeExpression(
UnicodeUtils.format("JreEnumConstantName(%s_class_(), %d)", enumClassName, i),
typeUtil.getJavaString().asType());
creation.addArgument(constName);
creation.addArgument(new NumberLiteral(i++, typeUtil));
creation.setHasRetainedResult(true);
stmts.add(new ExpressionStatement(new Assignment(new SimpleName(varElement), creation)));
}
} | java | private void addArcInitialization(EnumDeclaration node) {
String enumClassName = nameTable.getFullName(node.getTypeElement());
List<Statement> stmts = node.getClassInitStatements().subList(0, 0);
int i = 0;
for (EnumConstantDeclaration constant : node.getEnumConstants()) {
VariableElement varElement = constant.getVariableElement();
ClassInstanceCreation creation = new ClassInstanceCreation(constant.getExecutablePair());
TreeUtil.copyList(constant.getArguments(), creation.getArguments());
Expression constName = options.stripEnumConstants()
? new StringLiteral("JAVA_LANG_ENUM_NAME_STRIPPED", typeUtil)
: new NativeExpression(
UnicodeUtils.format("JreEnumConstantName(%s_class_(), %d)", enumClassName, i),
typeUtil.getJavaString().asType());
creation.addArgument(constName);
creation.addArgument(new NumberLiteral(i++, typeUtil));
creation.setHasRetainedResult(true);
stmts.add(new ExpressionStatement(new Assignment(new SimpleName(varElement), creation)));
}
} | [
"private",
"void",
"addArcInitialization",
"(",
"EnumDeclaration",
"node",
")",
"{",
"String",
"enumClassName",
"=",
"nameTable",
".",
"getFullName",
"(",
"node",
".",
"getTypeElement",
"(",
")",
")",
";",
"List",
"<",
"Statement",
">",
"stmts",
"=",
"node",
... | the shared allocation optimization. | [
"the",
"shared",
"allocation",
"optimization",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/EnumRewriter.java#L241-L259 |
33,663 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java | ChronoPeriodImpl.monthRange | private long monthRange() {
ValueRange startRange = chrono.range(MONTH_OF_YEAR);
if (startRange.isFixed() && startRange.isIntValue()) {
return startRange.getMaximum() - startRange.getMinimum() + 1;
}
return -1;
} | java | private long monthRange() {
ValueRange startRange = chrono.range(MONTH_OF_YEAR);
if (startRange.isFixed() && startRange.isIntValue()) {
return startRange.getMaximum() - startRange.getMinimum() + 1;
}
return -1;
} | [
"private",
"long",
"monthRange",
"(",
")",
"{",
"ValueRange",
"startRange",
"=",
"chrono",
".",
"range",
"(",
"MONTH_OF_YEAR",
")",
";",
"if",
"(",
"startRange",
".",
"isFixed",
"(",
")",
"&&",
"startRange",
".",
"isIntValue",
"(",
")",
")",
"{",
"return... | Calculates the range of months.
@return the month range, -1 if not fixed range | [
"Calculates",
"the",
"range",
"of",
"months",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/chrono/ChronoPeriodImpl.java#L248-L254 |
33,664 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java | OperatorRewriter.getRetainedWithTarget | private Expression getRetainedWithTarget(Assignment node, VariableElement var) {
Expression lhs = node.getLeftHandSide();
if (!(lhs instanceof FieldAccess)) {
return new ThisExpression(ElementUtil.getDeclaringClass(var).asType());
}
// To avoid duplicating the target expression we must save the result to a local variable.
FieldAccess fieldAccess = (FieldAccess) lhs;
Expression target = fieldAccess.getExpression();
VariableElement targetVar = GeneratedVariableElement.newLocalVar(
"__rw$" + rwCount++, target.getTypeMirror(), null);
TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs))
.add(0, new VariableDeclarationStatement(targetVar, null));
fieldAccess.setExpression(new SimpleName(targetVar));
CommaExpression commaExpr = new CommaExpression(
new Assignment(new SimpleName(targetVar), target));
node.replaceWith(commaExpr);
commaExpr.addExpression(node);
return new SimpleName(targetVar);
} | java | private Expression getRetainedWithTarget(Assignment node, VariableElement var) {
Expression lhs = node.getLeftHandSide();
if (!(lhs instanceof FieldAccess)) {
return new ThisExpression(ElementUtil.getDeclaringClass(var).asType());
}
// To avoid duplicating the target expression we must save the result to a local variable.
FieldAccess fieldAccess = (FieldAccess) lhs;
Expression target = fieldAccess.getExpression();
VariableElement targetVar = GeneratedVariableElement.newLocalVar(
"__rw$" + rwCount++, target.getTypeMirror(), null);
TreeUtil.asStatementList(TreeUtil.getOwningStatement(lhs))
.add(0, new VariableDeclarationStatement(targetVar, null));
fieldAccess.setExpression(new SimpleName(targetVar));
CommaExpression commaExpr = new CommaExpression(
new Assignment(new SimpleName(targetVar), target));
node.replaceWith(commaExpr);
commaExpr.addExpression(node);
return new SimpleName(targetVar);
} | [
"private",
"Expression",
"getRetainedWithTarget",
"(",
"Assignment",
"node",
",",
"VariableElement",
"var",
")",
"{",
"Expression",
"lhs",
"=",
"node",
".",
"getLeftHandSide",
"(",
")",
";",
"if",
"(",
"!",
"(",
"lhs",
"instanceof",
"FieldAccess",
")",
")",
... | Gets the target object for a call to the RetainedWith wrapper. | [
"Gets",
"the",
"target",
"object",
"for",
"a",
"call",
"to",
"the",
"RetainedWith",
"wrapper",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java#L297-L315 |
33,665 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java | OperatorRewriter.getPromotionSuffix | private static String getPromotionSuffix(Assignment node) {
if (!needsPromotionSuffix(node.getOperator())) {
return "";
}
TypeKind lhsKind = node.getLeftHandSide().getTypeMirror().getKind();
TypeKind rhsKind = node.getRightHandSide().getTypeMirror().getKind();
if (lhsKind == TypeKind.DOUBLE || rhsKind == TypeKind.DOUBLE) {
return "D";
}
if (lhsKind == TypeKind.FLOAT || rhsKind == TypeKind.FLOAT) {
return "F";
}
if (lhsKind == TypeKind.LONG || rhsKind == TypeKind.LONG) {
return "J";
}
return "I";
} | java | private static String getPromotionSuffix(Assignment node) {
if (!needsPromotionSuffix(node.getOperator())) {
return "";
}
TypeKind lhsKind = node.getLeftHandSide().getTypeMirror().getKind();
TypeKind rhsKind = node.getRightHandSide().getTypeMirror().getKind();
if (lhsKind == TypeKind.DOUBLE || rhsKind == TypeKind.DOUBLE) {
return "D";
}
if (lhsKind == TypeKind.FLOAT || rhsKind == TypeKind.FLOAT) {
return "F";
}
if (lhsKind == TypeKind.LONG || rhsKind == TypeKind.LONG) {
return "J";
}
return "I";
} | [
"private",
"static",
"String",
"getPromotionSuffix",
"(",
"Assignment",
"node",
")",
"{",
"if",
"(",
"!",
"needsPromotionSuffix",
"(",
"node",
".",
"getOperator",
"(",
")",
")",
")",
"{",
"return",
"\"\"",
";",
"}",
"TypeKind",
"lhsKind",
"=",
"node",
".",... | Some operator functions are given a suffix indicating the promotion type of
the operands according to JLS 5.6.2. | [
"Some",
"operator",
"functions",
"are",
"given",
"a",
"suffix",
"indicating",
"the",
"promotion",
"type",
"of",
"the",
"operands",
"according",
"to",
"JLS",
"5",
".",
"6",
".",
"2",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OperatorRewriter.java#L418-L434 |
33,666 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.join | public static String join(CharSequence delimiter, Iterable tokens) {
StringBuilder sb = new StringBuilder();
boolean firstTime = true;
for (Object token: tokens) {
if (firstTime) {
firstTime = false;
} else {
sb.append(delimiter);
}
sb.append(token);
}
return sb.toString();
} | java | public static String join(CharSequence delimiter, Iterable tokens) {
StringBuilder sb = new StringBuilder();
boolean firstTime = true;
for (Object token: tokens) {
if (firstTime) {
firstTime = false;
} else {
sb.append(delimiter);
}
sb.append(token);
}
return sb.toString();
} | [
"public",
"static",
"String",
"join",
"(",
"CharSequence",
"delimiter",
",",
"Iterable",
"tokens",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"firstTime",
"=",
"true",
";",
"for",
"(",
"Object",
"token",
":",
"t... | Returns a string containing the tokens joined by delimiters.
@param tokens an array objects to be joined. Strings will be formed from
the objects by calling object.toString(). | [
"Returns",
"a",
"string",
"containing",
"the",
"tokens",
"joined",
"by",
"delimiters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L276-L288 |
33,667 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.dumpSpans | public static void dumpSpans(CharSequence cs, Printer printer, String prefix) {
if (cs instanceof Spanned) {
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0, cs.length(), Object.class);
for (int i = 0; i < os.length; i++) {
Object o = os[i];
printer.println(prefix + cs.subSequence(sp.getSpanStart(o),
sp.getSpanEnd(o)) + ": "
+ Integer.toHexString(System.identityHashCode(o))
+ " " + o.getClass().getCanonicalName()
+ " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o)
+ ") fl=#" + sp.getSpanFlags(o));
}
} else {
printer.println(prefix + cs + ": (no spans)");
}
} | java | public static void dumpSpans(CharSequence cs, Printer printer, String prefix) {
if (cs instanceof Spanned) {
Spanned sp = (Spanned) cs;
Object[] os = sp.getSpans(0, cs.length(), Object.class);
for (int i = 0; i < os.length; i++) {
Object o = os[i];
printer.println(prefix + cs.subSequence(sp.getSpanStart(o),
sp.getSpanEnd(o)) + ": "
+ Integer.toHexString(System.identityHashCode(o))
+ " " + o.getClass().getCanonicalName()
+ " (" + sp.getSpanStart(o) + "-" + sp.getSpanEnd(o)
+ ") fl=#" + sp.getSpanFlags(o));
}
} else {
printer.println(prefix + cs + ": (no spans)");
}
} | [
"public",
"static",
"void",
"dumpSpans",
"(",
"CharSequence",
"cs",
",",
"Printer",
"printer",
",",
"String",
"prefix",
")",
"{",
"if",
"(",
"cs",
"instanceof",
"Spanned",
")",
"{",
"Spanned",
"sp",
"=",
"(",
"Spanned",
")",
"cs",
";",
"Object",
"[",
"... | Debugging tool to print the spans in a CharSequence. The output will
be printed one span per line. If the CharSequence is not a Spanned,
then the entire string will be printed on a single line. | [
"Debugging",
"tool",
"to",
"print",
"the",
"spans",
"in",
"a",
"CharSequence",
".",
"The",
"output",
"will",
"be",
"printed",
"one",
"span",
"per",
"line",
".",
"If",
"the",
"CharSequence",
"is",
"not",
"a",
"Spanned",
"then",
"the",
"entire",
"string",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L776-L793 |
33,668 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.expandTemplate | public static CharSequence expandTemplate(CharSequence template,
CharSequence... values) {
if (values.length > 9) {
throw new IllegalArgumentException("max of 9 values are supported");
}
SpannableStringBuilder ssb = new SpannableStringBuilder(template);
try {
int i = 0;
while (i < ssb.length()) {
if (ssb.charAt(i) == '^') {
char next = ssb.charAt(i+1);
if (next == '^') {
ssb.delete(i+1, i+2);
++i;
continue;
} else if (Character.isDigit(next)) {
int which = Character.getNumericValue(next) - 1;
if (which < 0) {
throw new IllegalArgumentException(
"template requests value ^" + (which+1));
}
if (which >= values.length) {
throw new IllegalArgumentException(
"template requests value ^" + (which+1) +
"; only " + values.length + " provided");
}
ssb.replace(i, i+2, values[which]);
i += values[which].length();
continue;
}
}
++i;
}
} catch (IndexOutOfBoundsException ignore) {
// happens when ^ is the last character in the string.
}
return ssb;
} | java | public static CharSequence expandTemplate(CharSequence template,
CharSequence... values) {
if (values.length > 9) {
throw new IllegalArgumentException("max of 9 values are supported");
}
SpannableStringBuilder ssb = new SpannableStringBuilder(template);
try {
int i = 0;
while (i < ssb.length()) {
if (ssb.charAt(i) == '^') {
char next = ssb.charAt(i+1);
if (next == '^') {
ssb.delete(i+1, i+2);
++i;
continue;
} else if (Character.isDigit(next)) {
int which = Character.getNumericValue(next) - 1;
if (which < 0) {
throw new IllegalArgumentException(
"template requests value ^" + (which+1));
}
if (which >= values.length) {
throw new IllegalArgumentException(
"template requests value ^" + (which+1) +
"; only " + values.length + " provided");
}
ssb.replace(i, i+2, values[which]);
i += values[which].length();
continue;
}
}
++i;
}
} catch (IndexOutOfBoundsException ignore) {
// happens when ^ is the last character in the string.
}
return ssb;
} | [
"public",
"static",
"CharSequence",
"expandTemplate",
"(",
"CharSequence",
"template",
",",
"CharSequence",
"...",
"values",
")",
"{",
"if",
"(",
"values",
".",
"length",
">",
"9",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"max of 9 values are s... | Return a new CharSequence in which each of the source strings is
replaced by the corresponding element of the destinations.
TODO(tball): enable if SpannableStringBuilder is ever implemented,
which requires android.graphics support.
public static CharSequence replace(CharSequence template,
String[] sources,
CharSequence[] destinations) {
SpannableStringBuilder tb = new SpannableStringBuilder(template);
for (int i = 0; i < sources.length; i++) {
int where = indexOf(tb, sources[i]);
if (where >= 0)
tb.setSpan(sources[i], where, where + sources[i].length(),
Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
}
for (int i = 0; i < sources.length; i++) {
int start = tb.getSpanStart(sources[i]);
int end = tb.getSpanEnd(sources[i]);
if (start >= 0) {
tb.replace(start, end, destinations[i]);
}
}
return tb;
}
Replace instances of "^1", "^2", etc. in the
<code>template</code> CharSequence with the corresponding
<code>values</code>. "^^" is used to produce a single caret in
the output. Only up to 9 replacement values are supported,
"^10" will be produce the first replacement value followed by a
'0'.
@param template the input text containing "^1"-style
placeholder values. This object is not modified; a copy is
returned.
@param values CharSequences substituted into the template. The
first is substituted for "^1", the second for "^2", and so on.
@return the new CharSequence produced by doing the replacement
@throws IllegalArgumentException if the template requests a
value that was not provided, or if more than 9 values are
provided. | [
"Return",
"a",
"new",
"CharSequence",
"in",
"which",
"each",
"of",
"the",
"source",
"strings",
"is",
"replaced",
"by",
"the",
"corresponding",
"element",
"of",
"the",
"destinations",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L847-L886 |
33,669 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.htmlEncode | public static String htmlEncode(String s) {
StringBuilder sb = new StringBuilder();
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
switch (c) {
case '<':
sb.append("<"); //$NON-NLS-1$
break;
case '>':
sb.append(">"); //$NON-NLS-1$
break;
case '&':
sb.append("&"); //$NON-NLS-1$
break;
case '\'':
//http://www.w3.org/TR/xhtml1
// The named character reference ' (the apostrophe, U+0027) was introduced in
// XML 1.0 but does not appear in HTML. Authors should therefore use ' instead
// of ' to work as expected in HTML 4 user agents.
sb.append("'"); //$NON-NLS-1$
break;
case '"':
sb.append("""); //$NON-NLS-1$
break;
default:
sb.append(c);
}
}
return sb.toString();
} | java | public static String htmlEncode(String s) {
StringBuilder sb = new StringBuilder();
char c;
for (int i = 0; i < s.length(); i++) {
c = s.charAt(i);
switch (c) {
case '<':
sb.append("<"); //$NON-NLS-1$
break;
case '>':
sb.append(">"); //$NON-NLS-1$
break;
case '&':
sb.append("&"); //$NON-NLS-1$
break;
case '\'':
//http://www.w3.org/TR/xhtml1
// The named character reference ' (the apostrophe, U+0027) was introduced in
// XML 1.0 but does not appear in HTML. Authors should therefore use ' instead
// of ' to work as expected in HTML 4 user agents.
sb.append("'"); //$NON-NLS-1$
break;
case '"':
sb.append("""); //$NON-NLS-1$
break;
default:
sb.append(c);
}
}
return sb.toString();
} | [
"public",
"static",
"String",
"htmlEncode",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"char",
"c",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i"... | Html-encode the string.
@param s the string to be encoded
@return the encoded string | [
"Html",
"-",
"encode",
"the",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L1327-L1357 |
33,670 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.concat | public static CharSequence concat(CharSequence... text) {
if (text.length == 0) {
return "";
}
if (text.length == 1) {
return text[0];
}
boolean spanned = false;
for (int i = 0; i < text.length; i++) {
if (text[i] instanceof Spanned) {
spanned = true;
break;
}
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length; i++) {
sb.append(text[i]);
}
if (!spanned) {
return sb.toString();
}
SpannableString ss = new SpannableString(sb);
int off = 0;
for (int i = 0; i < text.length; i++) {
int len = text[i].length();
if (text[i] instanceof Spanned) {
copySpansFrom((Spanned) text[i], 0, len, Object.class, ss, off);
}
off += len;
}
return new SpannedString(ss);
} | java | public static CharSequence concat(CharSequence... text) {
if (text.length == 0) {
return "";
}
if (text.length == 1) {
return text[0];
}
boolean spanned = false;
for (int i = 0; i < text.length; i++) {
if (text[i] instanceof Spanned) {
spanned = true;
break;
}
}
StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.length; i++) {
sb.append(text[i]);
}
if (!spanned) {
return sb.toString();
}
SpannableString ss = new SpannableString(sb);
int off = 0;
for (int i = 0; i < text.length; i++) {
int len = text[i].length();
if (text[i] instanceof Spanned) {
copySpansFrom((Spanned) text[i], 0, len, Object.class, ss, off);
}
off += len;
}
return new SpannedString(ss);
} | [
"public",
"static",
"CharSequence",
"concat",
"(",
"CharSequence",
"...",
"text",
")",
"{",
"if",
"(",
"text",
".",
"length",
"==",
"0",
")",
"{",
"return",
"\"\"",
";",
"}",
"if",
"(",
"text",
".",
"length",
"==",
"1",
")",
"{",
"return",
"text",
... | Returns a CharSequence concatenating the specified CharSequences,
retaining their spans if any. | [
"Returns",
"a",
"CharSequence",
"concatenating",
"the",
"specified",
"CharSequences",
"retaining",
"their",
"spans",
"if",
"any",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L1363-L1402 |
33,671 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.isGraphic | public static boolean isGraphic(CharSequence str) {
final int len = str.length();
for (int i=0; i<len; i++) {
int gc = Character.getType(str.charAt(i));
if (gc != Character.CONTROL
&& gc != Character.FORMAT
&& gc != Character.SURROGATE
&& gc != Character.UNASSIGNED
&& gc != Character.LINE_SEPARATOR
&& gc != Character.PARAGRAPH_SEPARATOR
&& gc != Character.SPACE_SEPARATOR) {
return true;
}
}
return false;
} | java | public static boolean isGraphic(CharSequence str) {
final int len = str.length();
for (int i=0; i<len; i++) {
int gc = Character.getType(str.charAt(i));
if (gc != Character.CONTROL
&& gc != Character.FORMAT
&& gc != Character.SURROGATE
&& gc != Character.UNASSIGNED
&& gc != Character.LINE_SEPARATOR
&& gc != Character.PARAGRAPH_SEPARATOR
&& gc != Character.SPACE_SEPARATOR) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isGraphic",
"(",
"CharSequence",
"str",
")",
"{",
"final",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"int",
"gc",
"=... | Returns whether the given CharSequence contains any printable characters. | [
"Returns",
"whether",
"the",
"given",
"CharSequence",
"contains",
"any",
"printable",
"characters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L1407-L1422 |
33,672 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.isGraphic | public static boolean isGraphic(char c) {
int gc = Character.getType(c);
return gc != Character.CONTROL
&& gc != Character.FORMAT
&& gc != Character.SURROGATE
&& gc != Character.UNASSIGNED
&& gc != Character.LINE_SEPARATOR
&& gc != Character.PARAGRAPH_SEPARATOR
&& gc != Character.SPACE_SEPARATOR;
} | java | public static boolean isGraphic(char c) {
int gc = Character.getType(c);
return gc != Character.CONTROL
&& gc != Character.FORMAT
&& gc != Character.SURROGATE
&& gc != Character.UNASSIGNED
&& gc != Character.LINE_SEPARATOR
&& gc != Character.PARAGRAPH_SEPARATOR
&& gc != Character.SPACE_SEPARATOR;
} | [
"public",
"static",
"boolean",
"isGraphic",
"(",
"char",
"c",
")",
"{",
"int",
"gc",
"=",
"Character",
".",
"getType",
"(",
"c",
")",
";",
"return",
"gc",
"!=",
"Character",
".",
"CONTROL",
"&&",
"gc",
"!=",
"Character",
".",
"FORMAT",
"&&",
"gc",
"!... | Returns whether this character is a printable character. | [
"Returns",
"whether",
"this",
"character",
"is",
"a",
"printable",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L1427-L1436 |
33,673 | google/j2objc | jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java | TextUtils.isDigitsOnly | public static boolean isDigitsOnly(CharSequence str) {
final int len = str.length();
for (int i = 0; i < len; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
} | java | public static boolean isDigitsOnly(CharSequence str) {
final int len = str.length();
for (int i = 0; i < len; i++) {
if (!Character.isDigit(str.charAt(i))) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"isDigitsOnly",
"(",
"CharSequence",
"str",
")",
"{",
"final",
"int",
"len",
"=",
"str",
".",
"length",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"len",
";",
"i",
"++",
")",
"{",
"if",
"(",
"... | Returns whether the given CharSequence contains only digits. | [
"Returns",
"whether",
"the",
"given",
"CharSequence",
"contains",
"only",
"digits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/android/text/TextUtils.java#L1441-L1449 |
33,674 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UtilityExtensions.java | UtilityExtensions.appendToRule | public static void appendToRule(StringBuffer rule,
UnicodeMatcher matcher,
boolean escapeUnprintable,
StringBuffer quoteBuf) {
if (matcher != null) {
appendToRule(rule, matcher.toPattern(escapeUnprintable),
true, escapeUnprintable, quoteBuf);
}
} | java | public static void appendToRule(StringBuffer rule,
UnicodeMatcher matcher,
boolean escapeUnprintable,
StringBuffer quoteBuf) {
if (matcher != null) {
appendToRule(rule, matcher.toPattern(escapeUnprintable),
true, escapeUnprintable, quoteBuf);
}
} | [
"public",
"static",
"void",
"appendToRule",
"(",
"StringBuffer",
"rule",
",",
"UnicodeMatcher",
"matcher",
",",
"boolean",
"escapeUnprintable",
",",
"StringBuffer",
"quoteBuf",
")",
"{",
"if",
"(",
"matcher",
"!=",
"null",
")",
"{",
"appendToRule",
"(",
"rule",
... | Given a matcher reference, which may be null, append its
pattern as a literal to the given rule. | [
"Given",
"a",
"matcher",
"reference",
"which",
"may",
"be",
"null",
"append",
"its",
"pattern",
"as",
"a",
"literal",
"to",
"the",
"given",
"rule",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UtilityExtensions.java#L43-L51 |
33,675 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/IssuerAlternativeNameExtension.java | IssuerAlternativeNameExtension.encodeThis | private void encodeThis() throws IOException {
if (names == null || names.isEmpty()) {
this.extensionValue = null;
return;
}
DerOutputStream os = new DerOutputStream();
names.encode(os);
this.extensionValue = os.toByteArray();
} | java | private void encodeThis() throws IOException {
if (names == null || names.isEmpty()) {
this.extensionValue = null;
return;
}
DerOutputStream os = new DerOutputStream();
names.encode(os);
this.extensionValue = os.toByteArray();
} | [
"private",
"void",
"encodeThis",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"names",
"==",
"null",
"||",
"names",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"extensionValue",
"=",
"null",
";",
"return",
";",
"}",
"DerOutputStream",
"os",
... | Encode this extension | [
"Encode",
"this",
"extension"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/IssuerAlternativeNameExtension.java#L68-L76 |
33,676 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java | ProcessorExsltFunction.startElement | public void startElement(
StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
throws SAXException
{
//System.out.println("ProcessorFunction.startElement()");
String msg = "";
if (!(handler.getElemTemplateElement() instanceof Stylesheet))
{
msg = "func:function element must be top level.";
handler.error(msg, new SAXException(msg));
}
super.startElement(handler, uri, localName, rawName, attributes);
String val = attributes.getValue("name");
int indexOfColon = val.indexOf(":");
if (indexOfColon > 0)
{
//String prefix = val.substring(0, indexOfColon);
//String localVal = val.substring(indexOfColon + 1);
//String ns = handler.getNamespaceSupport().getURI(prefix);
//if (ns.length() > 0)
// System.out.println("fullfuncname " + ns + localVal);
}
else
{
msg = "func:function name must have namespace";
handler.error(msg, new SAXException(msg));
}
} | java | public void startElement(
StylesheetHandler handler, String uri, String localName, String rawName, Attributes attributes)
throws SAXException
{
//System.out.println("ProcessorFunction.startElement()");
String msg = "";
if (!(handler.getElemTemplateElement() instanceof Stylesheet))
{
msg = "func:function element must be top level.";
handler.error(msg, new SAXException(msg));
}
super.startElement(handler, uri, localName, rawName, attributes);
String val = attributes.getValue("name");
int indexOfColon = val.indexOf(":");
if (indexOfColon > 0)
{
//String prefix = val.substring(0, indexOfColon);
//String localVal = val.substring(indexOfColon + 1);
//String ns = handler.getNamespaceSupport().getURI(prefix);
//if (ns.length() > 0)
// System.out.println("fullfuncname " + ns + localVal);
}
else
{
msg = "func:function name must have namespace";
handler.error(msg, new SAXException(msg));
}
} | [
"public",
"void",
"startElement",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"rawName",
",",
"Attributes",
"attributes",
")",
"throws",
"SAXException",
"{",
"//System.out.println(\"ProcessorFunction.startElement()... | Start an ElemExsltFunction. Verify that it is top level and that it has a name attribute with a
namespace. | [
"Start",
"an",
"ElemExsltFunction",
".",
"Verify",
"that",
"it",
"is",
"top",
"level",
"and",
"that",
"it",
"has",
"a",
"name",
"attribute",
"with",
"a",
"namespace",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java#L61-L89 |
33,677 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java | ProcessorExsltFunction.appendAndPush | protected void appendAndPush(
StylesheetHandler handler, ElemTemplateElement elem)
throws SAXException
{
//System.out.println("ProcessorFunction appendAndPush()" + elem);
super.appendAndPush(handler, elem);
//System.out.println("originating node " + handler.getOriginatingNode());
elem.setDOMBackPointer(handler.getOriginatingNode());
handler.getStylesheet().setTemplate((ElemTemplate) elem);
} | java | protected void appendAndPush(
StylesheetHandler handler, ElemTemplateElement elem)
throws SAXException
{
//System.out.println("ProcessorFunction appendAndPush()" + elem);
super.appendAndPush(handler, elem);
//System.out.println("originating node " + handler.getOriginatingNode());
elem.setDOMBackPointer(handler.getOriginatingNode());
handler.getStylesheet().setTemplate((ElemTemplate) elem);
} | [
"protected",
"void",
"appendAndPush",
"(",
"StylesheetHandler",
"handler",
",",
"ElemTemplateElement",
"elem",
")",
"throws",
"SAXException",
"{",
"//System.out.println(\"ProcessorFunction appendAndPush()\" + elem);",
"super",
".",
"appendAndPush",
"(",
"handler",
",",
"elem"... | Must include; super doesn't suffice! | [
"Must",
"include",
";",
"super",
"doesn",
"t",
"suffice!"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java#L94-L103 |
33,678 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java | ProcessorExsltFunction.endElement | public void endElement(
StylesheetHandler handler, String uri, String localName, String rawName)
throws SAXException
{
ElemTemplateElement function = handler.getElemTemplateElement();
validate(function, handler); // may throw exception
super.endElement(handler, uri, localName, rawName);
} | java | public void endElement(
StylesheetHandler handler, String uri, String localName, String rawName)
throws SAXException
{
ElemTemplateElement function = handler.getElemTemplateElement();
validate(function, handler); // may throw exception
super.endElement(handler, uri, localName, rawName);
} | [
"public",
"void",
"endElement",
"(",
"StylesheetHandler",
"handler",
",",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"rawName",
")",
"throws",
"SAXException",
"{",
"ElemTemplateElement",
"function",
"=",
"handler",
".",
"getElemTemplateElement",
"("... | End an ElemExsltFunction, and verify its validity. | [
"End",
"an",
"ElemExsltFunction",
"and",
"verify",
"its",
"validity",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java#L108-L115 |
33,679 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java | ProcessorExsltFunction.ancestorIsOk | boolean ancestorIsOk(ElemTemplateElement child)
{
while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction))
{
ElemTemplateElement parent = child.getParentElem();
if (parent instanceof ElemExsltFuncResult
|| parent instanceof ElemVariable
|| parent instanceof ElemParam
|| parent instanceof ElemMessage)
return true;
child = parent;
}
return false;
} | java | boolean ancestorIsOk(ElemTemplateElement child)
{
while (child.getParentElem() != null && !(child.getParentElem() instanceof ElemExsltFunction))
{
ElemTemplateElement parent = child.getParentElem();
if (parent instanceof ElemExsltFuncResult
|| parent instanceof ElemVariable
|| parent instanceof ElemParam
|| parent instanceof ElemMessage)
return true;
child = parent;
}
return false;
} | [
"boolean",
"ancestorIsOk",
"(",
"ElemTemplateElement",
"child",
")",
"{",
"while",
"(",
"child",
".",
"getParentElem",
"(",
")",
"!=",
"null",
"&&",
"!",
"(",
"child",
".",
"getParentElem",
"(",
")",
"instanceof",
"ElemExsltFunction",
")",
")",
"{",
"ElemTem... | Verify that a literal result belongs to a result element, a variable,
or a parameter. | [
"Verify",
"that",
"a",
"literal",
"result",
"belongs",
"to",
"a",
"result",
"element",
"a",
"variable",
"or",
"a",
"parameter",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorExsltFunction.java#L174-L187 |
33,680 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/temporal/WeekFields.java | WeekFields.readObject | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException, InvalidObjectException
{
s.defaultReadObject();
if (firstDayOfWeek == null) {
throw new InvalidObjectException("firstDayOfWeek is null");
}
if (minimalDays < 1 || minimalDays > 7) {
throw new InvalidObjectException("Minimal number of days is invalid");
}
} | java | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException, InvalidObjectException
{
s.defaultReadObject();
if (firstDayOfWeek == null) {
throw new InvalidObjectException("firstDayOfWeek is null");
}
if (minimalDays < 1 || minimalDays > 7) {
throw new InvalidObjectException("Minimal number of days is invalid");
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
",",
"InvalidObjectException",
"{",
"s",
".",
"defaultReadObject",
"(",
")",
";",
"if",
"(",
"firstDayOfWeek",
"==",
"null",
")",
"{",
"t... | Restore the state of a WeekFields from the stream.
Check that the values are valid.
@param s the stream to read
@throws InvalidObjectException if the serialized object has an invalid
value for firstDayOfWeek or minimalDays.
@throws ClassNotFoundException if a class cannot be resolved | [
"Restore",
"the",
"state",
"of",
"a",
"WeekFields",
"from",
"the",
"stream",
".",
"Check",
"that",
"the",
"values",
"are",
"valid",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/temporal/WeekFields.java#L354-L365 |
33,681 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/Exchanger.java | Exchanger.slotExchange | private final Object slotExchange(Object item, boolean timed, long ns) {
Node p = participant.get();
Thread t = Thread.currentThread();
if (t.isInterrupted()) // preserve interrupt status so caller can recheck
return null;
for (Node q;;) {
if ((q = slot) != null) {
if (U.compareAndSwapObject(this, SLOT, q, null)) {
Object v = q.item;
q.match = item;
Thread w = q.parked;
if (w != null)
U.unpark(w);
return v;
}
// create arena on contention, but continue until slot null
if (NCPU > 1 && bound == 0 &&
U.compareAndSwapInt(this, BOUND, 0, SEQ))
arena = new Node[(FULL + 2) << ASHIFT];
}
else if (arena != null)
return null; // caller must reroute to arenaExchange
else {
p.item = item;
if (U.compareAndSwapObject(this, SLOT, null, p))
break;
p.item = null;
}
}
// await release
int h = p.hash;
long end = timed ? System.nanoTime() + ns : 0L;
int spins = (NCPU > 1) ? SPINS : 1;
Object v;
while ((v = p.match) == null) {
if (spins > 0) {
h ^= h << 1; h ^= h >>> 3; h ^= h << 10;
if (h == 0)
h = SPINS | (int)t.getId();
else if (h < 0 && (--spins & ((SPINS >>> 1) - 1)) == 0)
Thread.yield();
}
else if (slot != p)
spins = SPINS;
else if (!t.isInterrupted() && arena == null &&
(!timed || (ns = end - System.nanoTime()) > 0L)) {
U.putObject(t, BLOCKER, this);
p.parked = t;
if (slot == p)
U.park(false, ns);
p.parked = null;
U.putObject(t, BLOCKER, null);
}
else if (U.compareAndSwapObject(this, SLOT, p, null)) {
v = timed && ns <= 0L && !t.isInterrupted() ? TIMED_OUT : null;
break;
}
}
U.putOrderedObject(p, MATCH, null);
p.item = null;
p.hash = h;
return v;
} | java | private final Object slotExchange(Object item, boolean timed, long ns) {
Node p = participant.get();
Thread t = Thread.currentThread();
if (t.isInterrupted()) // preserve interrupt status so caller can recheck
return null;
for (Node q;;) {
if ((q = slot) != null) {
if (U.compareAndSwapObject(this, SLOT, q, null)) {
Object v = q.item;
q.match = item;
Thread w = q.parked;
if (w != null)
U.unpark(w);
return v;
}
// create arena on contention, but continue until slot null
if (NCPU > 1 && bound == 0 &&
U.compareAndSwapInt(this, BOUND, 0, SEQ))
arena = new Node[(FULL + 2) << ASHIFT];
}
else if (arena != null)
return null; // caller must reroute to arenaExchange
else {
p.item = item;
if (U.compareAndSwapObject(this, SLOT, null, p))
break;
p.item = null;
}
}
// await release
int h = p.hash;
long end = timed ? System.nanoTime() + ns : 0L;
int spins = (NCPU > 1) ? SPINS : 1;
Object v;
while ((v = p.match) == null) {
if (spins > 0) {
h ^= h << 1; h ^= h >>> 3; h ^= h << 10;
if (h == 0)
h = SPINS | (int)t.getId();
else if (h < 0 && (--spins & ((SPINS >>> 1) - 1)) == 0)
Thread.yield();
}
else if (slot != p)
spins = SPINS;
else if (!t.isInterrupted() && arena == null &&
(!timed || (ns = end - System.nanoTime()) > 0L)) {
U.putObject(t, BLOCKER, this);
p.parked = t;
if (slot == p)
U.park(false, ns);
p.parked = null;
U.putObject(t, BLOCKER, null);
}
else if (U.compareAndSwapObject(this, SLOT, p, null)) {
v = timed && ns <= 0L && !t.isInterrupted() ? TIMED_OUT : null;
break;
}
}
U.putOrderedObject(p, MATCH, null);
p.item = null;
p.hash = h;
return v;
} | [
"private",
"final",
"Object",
"slotExchange",
"(",
"Object",
"item",
",",
"boolean",
"timed",
",",
"long",
"ns",
")",
"{",
"Node",
"p",
"=",
"participant",
".",
"get",
"(",
")",
";",
"Thread",
"t",
"=",
"Thread",
".",
"currentThread",
"(",
")",
";",
... | Exchange function used until arenas enabled. See above for explanation.
@param item the item to exchange
@param timed true if the wait is timed
@param ns if timed, the maximum wait time, else 0L
@return the other thread's item; or null if either the arena
was enabled or the thread was interrupted before completion; or
TIMED_OUT if timed and timed out | [
"Exchange",
"function",
"used",
"until",
"arenas",
"enabled",
".",
"See",
"above",
"for",
"explanation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/Exchanger.java#L451-L515 |
33,682 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamDecoder.java | StreamDecoder.forInputStreamReader | public static StreamDecoder forInputStreamReader(InputStream in,
Object lock,
String charsetName)
throws UnsupportedEncodingException
{
String csn = charsetName;
if (csn == null)
csn = Charset.defaultCharset().name();
try {
if (Charset.isSupported(csn))
return new StreamDecoder(in, lock, Charset.forName(csn));
} catch (IllegalCharsetNameException x) { }
throw new UnsupportedEncodingException (csn);
} | java | public static StreamDecoder forInputStreamReader(InputStream in,
Object lock,
String charsetName)
throws UnsupportedEncodingException
{
String csn = charsetName;
if (csn == null)
csn = Charset.defaultCharset().name();
try {
if (Charset.isSupported(csn))
return new StreamDecoder(in, lock, Charset.forName(csn));
} catch (IllegalCharsetNameException x) { }
throw new UnsupportedEncodingException (csn);
} | [
"public",
"static",
"StreamDecoder",
"forInputStreamReader",
"(",
"InputStream",
"in",
",",
"Object",
"lock",
",",
"String",
"charsetName",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"csn",
"=",
"charsetName",
";",
"if",
"(",
"csn",
"==",
"null"... | Factories for java.io.InputStreamReader | [
"Factories",
"for",
"java",
".",
"io",
".",
"InputStreamReader"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamDecoder.java#L65-L78 |
33,683 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamDecoder.java | StreamDecoder.forDecoder | public static StreamDecoder forDecoder(ReadableByteChannel ch,
CharsetDecoder dec,
int minBufferCap)
{
return new StreamDecoder(ch, dec, minBufferCap);
} | java | public static StreamDecoder forDecoder(ReadableByteChannel ch,
CharsetDecoder dec,
int minBufferCap)
{
return new StreamDecoder(ch, dec, minBufferCap);
} | [
"public",
"static",
"StreamDecoder",
"forDecoder",
"(",
"ReadableByteChannel",
"ch",
",",
"CharsetDecoder",
"dec",
",",
"int",
"minBufferCap",
")",
"{",
"return",
"new",
"StreamDecoder",
"(",
"ch",
",",
"dec",
",",
"minBufferCap",
")",
";",
"}"
] | Factory for java.nio.channels.Channels.newReader | [
"Factory",
"for",
"java",
".",
"nio",
".",
"channels",
".",
"Channels",
".",
"newReader"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/cs/StreamDecoder.java#L97-L102 |
33,684 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/J2ObjC.java | J2ObjC.run | public static void run(List<String> fileArgs, Options options) {
File preProcessorTempDir = null;
File strippedSourcesDir = null;
Parser parser = null;
try {
List<ProcessingContext> inputs = Lists.newArrayList();
GenerationBatch batch = new GenerationBatch(options);
batch.processFileArgs(fileArgs);
inputs.addAll(batch.getInputs());
if (ErrorUtil.errorCount() > 0) {
return;
}
parser = createParser(options);
Parser.ProcessingResult processingResult = parser.processAnnotations(fileArgs, inputs);
List<ProcessingContext> generatedInputs = processingResult.getGeneratedSources();
inputs.addAll(generatedInputs); // Ensure all generatedInputs are at end of input list.
preProcessorTempDir = processingResult.getSourceOutputDirectory();
if (ErrorUtil.errorCount() > 0) {
return;
}
if (preProcessorTempDir != null) {
parser.addSourcepathEntry(preProcessorTempDir.getAbsolutePath());
}
InputFilePreprocessor inputFilePreprocessor = new InputFilePreprocessor(parser);
inputFilePreprocessor.processInputs(inputs);
if (ErrorUtil.errorCount() > 0) {
return;
}
strippedSourcesDir = inputFilePreprocessor.getStrippedSourcesDir();
if (strippedSourcesDir != null) {
parser.prependSourcepathEntry(strippedSourcesDir.getPath());
}
options.getHeaderMap().loadMappings();
TranslationProcessor translationProcessor =
new TranslationProcessor(parser, loadDeadCodeMap());
translationProcessor.processInputs(inputs);
if (ErrorUtil.errorCount() > 0) {
return;
}
translationProcessor.postProcess();
options.getHeaderMap().printMappings();
} finally {
if (parser != null) {
try {
parser.close();
} catch (IOException e) {
ErrorUtil.error(e.getMessage());
}
}
Set<String> tempDirs = options.fileUtil().getTempDirs();
for (String dir : tempDirs) {
FileUtil.deleteTempDir(new File(dir));
}
FileUtil.deleteTempDir(preProcessorTempDir);
FileUtil.deleteTempDir(strippedSourcesDir);
}
} | java | public static void run(List<String> fileArgs, Options options) {
File preProcessorTempDir = null;
File strippedSourcesDir = null;
Parser parser = null;
try {
List<ProcessingContext> inputs = Lists.newArrayList();
GenerationBatch batch = new GenerationBatch(options);
batch.processFileArgs(fileArgs);
inputs.addAll(batch.getInputs());
if (ErrorUtil.errorCount() > 0) {
return;
}
parser = createParser(options);
Parser.ProcessingResult processingResult = parser.processAnnotations(fileArgs, inputs);
List<ProcessingContext> generatedInputs = processingResult.getGeneratedSources();
inputs.addAll(generatedInputs); // Ensure all generatedInputs are at end of input list.
preProcessorTempDir = processingResult.getSourceOutputDirectory();
if (ErrorUtil.errorCount() > 0) {
return;
}
if (preProcessorTempDir != null) {
parser.addSourcepathEntry(preProcessorTempDir.getAbsolutePath());
}
InputFilePreprocessor inputFilePreprocessor = new InputFilePreprocessor(parser);
inputFilePreprocessor.processInputs(inputs);
if (ErrorUtil.errorCount() > 0) {
return;
}
strippedSourcesDir = inputFilePreprocessor.getStrippedSourcesDir();
if (strippedSourcesDir != null) {
parser.prependSourcepathEntry(strippedSourcesDir.getPath());
}
options.getHeaderMap().loadMappings();
TranslationProcessor translationProcessor =
new TranslationProcessor(parser, loadDeadCodeMap());
translationProcessor.processInputs(inputs);
if (ErrorUtil.errorCount() > 0) {
return;
}
translationProcessor.postProcess();
options.getHeaderMap().printMappings();
} finally {
if (parser != null) {
try {
parser.close();
} catch (IOException e) {
ErrorUtil.error(e.getMessage());
}
}
Set<String> tempDirs = options.fileUtil().getTempDirs();
for (String dir : tempDirs) {
FileUtil.deleteTempDir(new File(dir));
}
FileUtil.deleteTempDir(preProcessorTempDir);
FileUtil.deleteTempDir(strippedSourcesDir);
}
} | [
"public",
"static",
"void",
"run",
"(",
"List",
"<",
"String",
">",
"fileArgs",
",",
"Options",
"options",
")",
"{",
"File",
"preProcessorTempDir",
"=",
"null",
";",
"File",
"strippedSourcesDir",
"=",
"null",
";",
"Parser",
"parser",
"=",
"null",
";",
"try... | Runs the entire J2ObjC pipeline.
@param fileArgs the files to process, same format as command-line args to {@link #main}. | [
"Runs",
"the",
"entire",
"J2ObjC",
"pipeline",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/J2ObjC.java#L89-L149 |
33,685 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.CopyFrom | public void CopyFrom(ToXMLStream xmlListener)
{
setWriter(xmlListener.m_writer);
// m_outputStream = xmlListener.m_outputStream;
String encoding = xmlListener.getEncoding();
setEncoding(encoding);
setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration());
m_ispreserve = xmlListener.m_ispreserve;
m_preserves = xmlListener.m_preserves;
m_isprevtext = xmlListener.m_isprevtext;
m_doIndent = xmlListener.m_doIndent;
setIndentAmount(xmlListener.getIndentAmount());
m_startNewLine = xmlListener.m_startNewLine;
m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl;
setDoctypeSystem(xmlListener.getDoctypeSystem());
setDoctypePublic(xmlListener.getDoctypePublic());
setStandalone(xmlListener.getStandalone());
setMediaType(xmlListener.getMediaType());
m_encodingInfo = xmlListener.m_encodingInfo;
m_spaceBeforeClose = xmlListener.m_spaceBeforeClose;
m_cdataStartCalled = xmlListener.m_cdataStartCalled;
} | java | public void CopyFrom(ToXMLStream xmlListener)
{
setWriter(xmlListener.m_writer);
// m_outputStream = xmlListener.m_outputStream;
String encoding = xmlListener.getEncoding();
setEncoding(encoding);
setOmitXMLDeclaration(xmlListener.getOmitXMLDeclaration());
m_ispreserve = xmlListener.m_ispreserve;
m_preserves = xmlListener.m_preserves;
m_isprevtext = xmlListener.m_isprevtext;
m_doIndent = xmlListener.m_doIndent;
setIndentAmount(xmlListener.getIndentAmount());
m_startNewLine = xmlListener.m_startNewLine;
m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl;
setDoctypeSystem(xmlListener.getDoctypeSystem());
setDoctypePublic(xmlListener.getDoctypePublic());
setStandalone(xmlListener.getStandalone());
setMediaType(xmlListener.getMediaType());
m_encodingInfo = xmlListener.m_encodingInfo;
m_spaceBeforeClose = xmlListener.m_spaceBeforeClose;
m_cdataStartCalled = xmlListener.m_cdataStartCalled;
} | [
"public",
"void",
"CopyFrom",
"(",
"ToXMLStream",
"xmlListener",
")",
"{",
"setWriter",
"(",
"xmlListener",
".",
"m_writer",
")",
";",
"// m_outputStream = xmlListener.m_outputStream;",
"String",
"encoding",
"=",
"xmlListener",
".",
"getEncoding",
"(",
")",
";",
"se... | Copy properties from another SerializerToXML.
@param xmlListener non-null reference to a SerializerToXML object. | [
"Copy",
"properties",
"from",
"another",
"SerializerToXML",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L71-L98 |
33,686 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.endPreserving | public void endPreserving() throws org.xml.sax.SAXException
{
// Not sure this is really what we want. -sb
m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
} | java | public void endPreserving() throws org.xml.sax.SAXException
{
// Not sure this is really what we want. -sb
m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
} | [
"public",
"void",
"endPreserving",
"(",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"// Not sure this is really what we want. -sb",
"m_ispreserve",
"=",
"m_preserves",
".",
"isEmpty",
"(",
")",
"?",
"false",
":",
"m_preserves",
".",
... | Ends a whitespace preserving section.
@see #startPreserving
@throws org.xml.sax.SAXException | [
"Ends",
"a",
"whitespace",
"preserving",
"section",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L233-L238 |
33,687 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.addAttribute | public void addAttribute(
String uri,
String localName,
String rawName,
String type,
String value,
boolean xslAttribute)
throws SAXException
{
if (m_elemContext.m_startTagOpen)
{
boolean was_added = addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
/*
* We don't run this block of code if:
* 1. The attribute value was only replaced (was_added is false).
* 2. The attribute is from an xsl:attribute element (that is handled
* in the addAttributeAlways() call just above.
* 3. The name starts with "xmlns", i.e. it is a namespace declaration.
*/
if (was_added && !xslAttribute && !rawName.startsWith("xmlns"))
{
String prefixUsed =
ensureAttributesNamespaceIsDeclared(
uri,
localName,
rawName);
if (prefixUsed != null
&& rawName != null
&& !rawName.startsWith(prefixUsed))
{
// use a different raw name, with the prefix used in the
// generated namespace declaration
rawName = prefixUsed + ":" + localName;
}
}
addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
}
else
{
/*
* The startTag is closed, yet we are adding an attribute?
*
* Section: 7.1.3 Creating Attributes Adding an attribute to an
* element after a PI (for example) has been added to it is an
* error. The attributes can be ignored. The spec doesn't explicitly
* say this is disallowed, as it does for child elements, but it
* makes sense to have the same treatment.
*
* We choose to ignore the attribute which is added too late.
*/
// Generate a warning of the ignored attributes
// Create the warning message
String msg = Utils.messages.createMessage(
MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,new Object[]{ localName });
try {
// Prepare to issue the warning message
Transformer tran = super.getTransformer();
ErrorListener errHandler = tran.getErrorListener();
// Issue the warning message
if (null != errHandler && m_sourceLocator != null)
errHandler.warning(new TransformerException(msg, m_sourceLocator));
else
System.out.println(msg);
}
catch (TransformerException e){
// A user defined error handler, errHandler, may throw
// a TransformerException if it chooses to, and if it does
// we will wrap it with a SAXException and re-throw.
// Of course if the handler throws another type of
// exception, like a RuntimeException, then that is OK too.
SAXException se = new SAXException(e);
throw se;
}
}
} | java | public void addAttribute(
String uri,
String localName,
String rawName,
String type,
String value,
boolean xslAttribute)
throws SAXException
{
if (m_elemContext.m_startTagOpen)
{
boolean was_added = addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
/*
* We don't run this block of code if:
* 1. The attribute value was only replaced (was_added is false).
* 2. The attribute is from an xsl:attribute element (that is handled
* in the addAttributeAlways() call just above.
* 3. The name starts with "xmlns", i.e. it is a namespace declaration.
*/
if (was_added && !xslAttribute && !rawName.startsWith("xmlns"))
{
String prefixUsed =
ensureAttributesNamespaceIsDeclared(
uri,
localName,
rawName);
if (prefixUsed != null
&& rawName != null
&& !rawName.startsWith(prefixUsed))
{
// use a different raw name, with the prefix used in the
// generated namespace declaration
rawName = prefixUsed + ":" + localName;
}
}
addAttributeAlways(uri, localName, rawName, type, value, xslAttribute);
}
else
{
/*
* The startTag is closed, yet we are adding an attribute?
*
* Section: 7.1.3 Creating Attributes Adding an attribute to an
* element after a PI (for example) has been added to it is an
* error. The attributes can be ignored. The spec doesn't explicitly
* say this is disallowed, as it does for child elements, but it
* makes sense to have the same treatment.
*
* We choose to ignore the attribute which is added too late.
*/
// Generate a warning of the ignored attributes
// Create the warning message
String msg = Utils.messages.createMessage(
MsgKey.ER_ILLEGAL_ATTRIBUTE_POSITION,new Object[]{ localName });
try {
// Prepare to issue the warning message
Transformer tran = super.getTransformer();
ErrorListener errHandler = tran.getErrorListener();
// Issue the warning message
if (null != errHandler && m_sourceLocator != null)
errHandler.warning(new TransformerException(msg, m_sourceLocator));
else
System.out.println(msg);
}
catch (TransformerException e){
// A user defined error handler, errHandler, may throw
// a TransformerException if it chooses to, and if it does
// we will wrap it with a SAXException and re-throw.
// Of course if the handler throws another type of
// exception, like a RuntimeException, then that is OK too.
SAXException se = new SAXException(e);
throw se;
}
}
} | [
"public",
"void",
"addAttribute",
"(",
"String",
"uri",
",",
"String",
"localName",
",",
"String",
"rawName",
",",
"String",
"type",
",",
"String",
"value",
",",
"boolean",
"xslAttribute",
")",
"throws",
"SAXException",
"{",
"if",
"(",
"m_elemContext",
".",
... | Add an attribute to the current element.
@param uri the URI associated with the element name
@param localName local part of the attribute name
@param rawName prefix:localName
@param type
@param value the value of the attribute
@param xslAttribute true if this attribute is from an xsl:attribute,
false if declared within the elements opening tag.
@throws SAXException | [
"Add",
"an",
"attribute",
"to",
"the",
"current",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L430-L511 |
33,688 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.pushNamespace | protected boolean pushNamespace(String prefix, String uri)
{
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | java | protected boolean pushNamespace(String prefix, String uri)
{
try
{
if (m_prefixMap.pushNamespace(
prefix, uri, m_elemContext.m_currentElemDepth))
{
startPrefixMapping(prefix, uri);
return true;
}
}
catch (SAXException e)
{
// falls through
}
return false;
} | [
"protected",
"boolean",
"pushNamespace",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"try",
"{",
"if",
"(",
"m_prefixMap",
".",
"pushNamespace",
"(",
"prefix",
",",
"uri",
",",
"m_elemContext",
".",
"m_currentElemDepth",
")",
")",
"{",
"startPre... | From XSLTC
Declare a prefix to point to a namespace URI. Inform SAX handler
if this is a new prefix mapping. | [
"From",
"XSLTC",
"Declare",
"a",
"prefix",
"to",
"point",
"to",
"a",
"namespace",
"URI",
".",
"Inform",
"SAX",
"handler",
"if",
"this",
"is",
"a",
"new",
"prefix",
"mapping",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L557-L573 |
33,689 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java | ToXMLStream.getXMLVersion | private String getXMLVersion()
{
String xmlVersion = getVersion();
if(xmlVersion == null || xmlVersion.equals(XMLVERSION10))
{
xmlVersion = XMLVERSION10;
}
else if(xmlVersion.equals(XMLVERSION11))
{
xmlVersion = XMLVERSION11;
}
else
{
String msg = Utils.messages.createMessage(
MsgKey.ER_XML_VERSION_NOT_SUPPORTED,new Object[]{ xmlVersion });
try
{
// Prepare to issue the warning message
Transformer tran = super.getTransformer();
ErrorListener errHandler = tran.getErrorListener();
// Issue the warning message
if (null != errHandler && m_sourceLocator != null)
errHandler.warning(new TransformerException(msg, m_sourceLocator));
else
System.out.println(msg);
}
catch (Exception e){}
xmlVersion = XMLVERSION10;
}
return xmlVersion;
} | java | private String getXMLVersion()
{
String xmlVersion = getVersion();
if(xmlVersion == null || xmlVersion.equals(XMLVERSION10))
{
xmlVersion = XMLVERSION10;
}
else if(xmlVersion.equals(XMLVERSION11))
{
xmlVersion = XMLVERSION11;
}
else
{
String msg = Utils.messages.createMessage(
MsgKey.ER_XML_VERSION_NOT_SUPPORTED,new Object[]{ xmlVersion });
try
{
// Prepare to issue the warning message
Transformer tran = super.getTransformer();
ErrorListener errHandler = tran.getErrorListener();
// Issue the warning message
if (null != errHandler && m_sourceLocator != null)
errHandler.warning(new TransformerException(msg, m_sourceLocator));
else
System.out.println(msg);
}
catch (Exception e){}
xmlVersion = XMLVERSION10;
}
return xmlVersion;
} | [
"private",
"String",
"getXMLVersion",
"(",
")",
"{",
"String",
"xmlVersion",
"=",
"getVersion",
"(",
")",
";",
"if",
"(",
"xmlVersion",
"==",
"null",
"||",
"xmlVersion",
".",
"equals",
"(",
"XMLVERSION10",
")",
")",
"{",
"xmlVersion",
"=",
"XMLVERSION10",
... | This method checks for the XML version of output document.
If XML version of output document is not specified, then output
document is of version XML 1.0.
If XML version of output doucment is specified, but it is not either
XML 1.0 or XML 1.1, a warning message is generated, the XML Version of
output document is set to XML 1.0 and processing continues.
@return string (XML version) | [
"This",
"method",
"checks",
"for",
"the",
"XML",
"version",
"of",
"output",
"document",
".",
"If",
"XML",
"version",
"of",
"output",
"document",
"is",
"not",
"specified",
"then",
"output",
"document",
"is",
"of",
"version",
"XML",
"1",
".",
"0",
".",
"If... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToXMLStream.java#L615-L645 |
33,690 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.append | public void append(char digit) {
if (count == digits.length) {
char[] data = new char[count + 100];
System.arraycopy(digits, 0, data, 0, count);
digits = data;
}
digits[count++] = digit;
} | java | public void append(char digit) {
if (count == digits.length) {
char[] data = new char[count + 100];
System.arraycopy(digits, 0, data, 0, count);
digits = data;
}
digits[count++] = digit;
} | [
"public",
"void",
"append",
"(",
"char",
"digit",
")",
"{",
"if",
"(",
"count",
"==",
"digits",
".",
"length",
")",
"{",
"char",
"[",
"]",
"data",
"=",
"new",
"char",
"[",
"count",
"+",
"100",
"]",
";",
"System",
".",
"arraycopy",
"(",
"digits",
... | Appends a digit to the list, extending the list when necessary. | [
"Appends",
"a",
"digit",
"to",
"the",
"list",
"extending",
"the",
"list",
"when",
"necessary",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L144-L151 |
33,691 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.fitsIntoLong | boolean fitsIntoLong(boolean isPositive, boolean ignoreNegativeZero) {
// Figure out if the result will fit in a long. We have to
// first look for nonzero digits after the decimal point;
// then check the size. If the digit count is 18 or less, then
// the value can definitely be represented as a long. If it is 19
// then it may be too large.
// Trim trailing zeros. This does not change the represented value.
while (count > 0 && digits[count - 1] == '0') {
--count;
}
if (count == 0) {
// Positive zero fits into a long, but negative zero can only
// be represented as a double. - bug 4162852
return isPositive || ignoreNegativeZero;
}
if (decimalAt < count || decimalAt > MAX_COUNT) {
return false;
}
if (decimalAt < MAX_COUNT) return true;
// At this point we have decimalAt == count, and count == MAX_COUNT.
// The number will overflow if it is larger than 9223372036854775807
// or smaller than -9223372036854775808.
for (int i=0; i<count; ++i) {
char dig = digits[i], max = LONG_MIN_REP[i];
if (dig > max) return false;
if (dig < max) return true;
}
// At this point the first count digits match. If decimalAt is less
// than count, then the remaining digits are zero, and we return true.
if (count < decimalAt) return true;
// Now we have a representation of Long.MIN_VALUE, without the leading
// negative sign. If this represents a positive value, then it does
// not fit; otherwise it fits.
return !isPositive;
} | java | boolean fitsIntoLong(boolean isPositive, boolean ignoreNegativeZero) {
// Figure out if the result will fit in a long. We have to
// first look for nonzero digits after the decimal point;
// then check the size. If the digit count is 18 or less, then
// the value can definitely be represented as a long. If it is 19
// then it may be too large.
// Trim trailing zeros. This does not change the represented value.
while (count > 0 && digits[count - 1] == '0') {
--count;
}
if (count == 0) {
// Positive zero fits into a long, but negative zero can only
// be represented as a double. - bug 4162852
return isPositive || ignoreNegativeZero;
}
if (decimalAt < count || decimalAt > MAX_COUNT) {
return false;
}
if (decimalAt < MAX_COUNT) return true;
// At this point we have decimalAt == count, and count == MAX_COUNT.
// The number will overflow if it is larger than 9223372036854775807
// or smaller than -9223372036854775808.
for (int i=0; i<count; ++i) {
char dig = digits[i], max = LONG_MIN_REP[i];
if (dig > max) return false;
if (dig < max) return true;
}
// At this point the first count digits match. If decimalAt is less
// than count, then the remaining digits are zero, and we return true.
if (count < decimalAt) return true;
// Now we have a representation of Long.MIN_VALUE, without the leading
// negative sign. If this represents a positive value, then it does
// not fit; otherwise it fits.
return !isPositive;
} | [
"boolean",
"fitsIntoLong",
"(",
"boolean",
"isPositive",
",",
"boolean",
"ignoreNegativeZero",
")",
"{",
"// Figure out if the result will fit in a long. We have to",
"// first look for nonzero digits after the decimal point;",
"// then check the size. If the digit count is 18 or less, the... | Return true if the number represented by this object can fit into
a long.
@param isPositive true if this number should be regarded as positive
@param ignoreNegativeZero true if -0 should be regarded as identical to
+0; otherwise they are considered distinct
@return true if this number fits into a Java long | [
"Return",
"true",
"if",
"the",
"number",
"represented",
"by",
"this",
"object",
"can",
"fit",
"into",
"a",
"long",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L221-L262 |
33,692 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.set | final void set(boolean isNegative, double source, int maximumDigits, boolean fixedPoint) {
set(isNegative, Double.toString(source), maximumDigits, fixedPoint);
} | java | final void set(boolean isNegative, double source, int maximumDigits, boolean fixedPoint) {
set(isNegative, Double.toString(source), maximumDigits, fixedPoint);
} | [
"final",
"void",
"set",
"(",
"boolean",
"isNegative",
",",
"double",
"source",
",",
"int",
"maximumDigits",
",",
"boolean",
"fixedPoint",
")",
"{",
"set",
"(",
"isNegative",
",",
"Double",
".",
"toString",
"(",
"source",
")",
",",
"maximumDigits",
",",
"fi... | Set the digit list to a representation of the given double value.
This method supports both fixed-point and exponential notation.
@param isNegative Boolean value indicating whether the number is negative.
@param source Value to be converted; must not be Inf, -Inf, Nan,
or a value <= 0.
@param maximumDigits The most fractional or total digits which should
be converted.
@param fixedPoint If true, then maximumDigits is the maximum
fractional digits to be converted. If false, total digits. | [
"Set",
"the",
"digit",
"list",
"to",
"a",
"representation",
"of",
"the",
"given",
"double",
"value",
".",
"This",
"method",
"supports",
"both",
"fixed",
"-",
"point",
"and",
"exponential",
"notation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L288-L290 |
33,693 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.round | private final void round(int maximumDigits) {
// Eliminate digits beyond maximum digits to be displayed.
// Round up if appropriate.
if (maximumDigits >= 0 && maximumDigits < count) {
if (shouldRoundUp(maximumDigits)) {
// Rounding up involved incrementing digits from LSD to MSD.
// In most cases this is simple, but in a worst case situation
// (9999..99) we have to adjust the decimalAt value.
for (;;) {
--maximumDigits;
if (maximumDigits < 0) {
// We have all 9's, so we increment to a single digit
// of one and adjust the exponent.
digits[0] = '1';
++decimalAt;
maximumDigits = 0; // Adjust the count
break;
}
++digits[maximumDigits];
if (digits[maximumDigits] <= '9') break;
// digits[maximumDigits] = '0'; // Unnecessary since we'll truncate this
}
++maximumDigits; // Increment for use as count
}
count = maximumDigits;
// Eliminate trailing zeros.
while (count > 1 && digits[count-1] == '0') {
--count;
}
}
} | java | private final void round(int maximumDigits) {
// Eliminate digits beyond maximum digits to be displayed.
// Round up if appropriate.
if (maximumDigits >= 0 && maximumDigits < count) {
if (shouldRoundUp(maximumDigits)) {
// Rounding up involved incrementing digits from LSD to MSD.
// In most cases this is simple, but in a worst case situation
// (9999..99) we have to adjust the decimalAt value.
for (;;) {
--maximumDigits;
if (maximumDigits < 0) {
// We have all 9's, so we increment to a single digit
// of one and adjust the exponent.
digits[0] = '1';
++decimalAt;
maximumDigits = 0; // Adjust the count
break;
}
++digits[maximumDigits];
if (digits[maximumDigits] <= '9') break;
// digits[maximumDigits] = '0'; // Unnecessary since we'll truncate this
}
++maximumDigits; // Increment for use as count
}
count = maximumDigits;
// Eliminate trailing zeros.
while (count > 1 && digits[count-1] == '0') {
--count;
}
}
} | [
"private",
"final",
"void",
"round",
"(",
"int",
"maximumDigits",
")",
"{",
"// Eliminate digits beyond maximum digits to be displayed.",
"// Round up if appropriate.",
"if",
"(",
"maximumDigits",
">=",
"0",
"&&",
"maximumDigits",
"<",
"count",
")",
"{",
"if",
"(",
"s... | Round the representation to the given number of digits.
@param maximumDigits The maximum number of digits to be shown.
Upon return, count will be less than or equal to maximumDigits. | [
"Round",
"the",
"representation",
"to",
"the",
"given",
"number",
"of",
"digits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L376-L408 |
33,694 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.set | public final void set(boolean isNegative, long source, int maximumDigits) {
this.isNegative = isNegative;
// This method does not expect a negative number. However,
// "source" can be a Long.MIN_VALUE (-9223372036854775808),
// if the number being formatted is a Long.MIN_VALUE. In that
// case, it will be formatted as -Long.MIN_VALUE, a number
// which is outside the legal range of a long, but which can
// be represented by DigitList.
if (source <= 0) {
if (source == Long.MIN_VALUE) {
decimalAt = count = MAX_COUNT;
System.arraycopy(LONG_MIN_REP, 0, digits, 0, count);
} else {
decimalAt = count = 0; // Values <= 0 format as zero
}
} else {
// Rewritten to improve performance. I used to call
// Long.toString(), which was about 4x slower than this code.
int left = MAX_COUNT;
int right;
while (source > 0) {
digits[--left] = (char)('0' + (source % 10));
source /= 10;
}
decimalAt = MAX_COUNT - left;
// Don't copy trailing zeros. We are guaranteed that there is at
// least one non-zero digit, so we don't have to check lower bounds.
for (right = MAX_COUNT - 1; digits[right] == '0'; --right)
;
count = right - left + 1;
System.arraycopy(digits, left, digits, 0, count);
}
if (maximumDigits > 0) round(maximumDigits);
} | java | public final void set(boolean isNegative, long source, int maximumDigits) {
this.isNegative = isNegative;
// This method does not expect a negative number. However,
// "source" can be a Long.MIN_VALUE (-9223372036854775808),
// if the number being formatted is a Long.MIN_VALUE. In that
// case, it will be formatted as -Long.MIN_VALUE, a number
// which is outside the legal range of a long, but which can
// be represented by DigitList.
if (source <= 0) {
if (source == Long.MIN_VALUE) {
decimalAt = count = MAX_COUNT;
System.arraycopy(LONG_MIN_REP, 0, digits, 0, count);
} else {
decimalAt = count = 0; // Values <= 0 format as zero
}
} else {
// Rewritten to improve performance. I used to call
// Long.toString(), which was about 4x slower than this code.
int left = MAX_COUNT;
int right;
while (source > 0) {
digits[--left] = (char)('0' + (source % 10));
source /= 10;
}
decimalAt = MAX_COUNT - left;
// Don't copy trailing zeros. We are guaranteed that there is at
// least one non-zero digit, so we don't have to check lower bounds.
for (right = MAX_COUNT - 1; digits[right] == '0'; --right)
;
count = right - left + 1;
System.arraycopy(digits, left, digits, 0, count);
}
if (maximumDigits > 0) round(maximumDigits);
} | [
"public",
"final",
"void",
"set",
"(",
"boolean",
"isNegative",
",",
"long",
"source",
",",
"int",
"maximumDigits",
")",
"{",
"this",
".",
"isNegative",
"=",
"isNegative",
";",
"// This method does not expect a negative number. However,",
"// \"source\" can be a Long.MIN_... | Set the digit list to a representation of the given long value.
@param isNegative Boolean value indicating whether the number is negative.
@param source Value to be converted; must be >= 0 or ==
Long.MIN_VALUE.
@param maximumDigits The most digits which should be converted.
If maximumDigits is lower than the number of significant digits
in source, the representation will be rounded. Ignored if <= 0. | [
"Set",
"the",
"digit",
"list",
"to",
"a",
"representation",
"of",
"the",
"given",
"long",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L512-L546 |
33,695 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.set | final void set(boolean isNegative, BigDecimal source, int maximumDigits, boolean fixedPoint) {
String s = source.toString();
extendDigits(s.length());
set(isNegative, s, maximumDigits, fixedPoint);
} | java | final void set(boolean isNegative, BigDecimal source, int maximumDigits, boolean fixedPoint) {
String s = source.toString();
extendDigits(s.length());
set(isNegative, s, maximumDigits, fixedPoint);
} | [
"final",
"void",
"set",
"(",
"boolean",
"isNegative",
",",
"BigDecimal",
"source",
",",
"int",
"maximumDigits",
",",
"boolean",
"fixedPoint",
")",
"{",
"String",
"s",
"=",
"source",
".",
"toString",
"(",
")",
";",
"extendDigits",
"(",
"s",
".",
"length",
... | Set the digit list to a representation of the given BigDecimal value.
This method supports both fixed-point and exponential notation.
@param isNegative Boolean value indicating whether the number is negative.
@param source Value to be converted; must not be a value <= 0.
@param maximumDigits The most fractional or total digits which should
be converted.
@param fixedPoint If true, then maximumDigits is the maximum
fractional digits to be converted. If false, total digits. | [
"Set",
"the",
"digit",
"list",
"to",
"a",
"representation",
"of",
"the",
"given",
"BigDecimal",
"value",
".",
"This",
"method",
"supports",
"both",
"fixed",
"-",
"point",
"and",
"exponential",
"notation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L558-L563 |
33,696 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java | DigitList.set | final void set(boolean isNegative, BigInteger source, int maximumDigits) {
this.isNegative = isNegative;
String s = source.toString();
int len = s.length();
extendDigits(len);
s.getChars(0, len, digits, 0);
decimalAt = len;
int right;
for (right = len - 1; right >= 0 && digits[right] == '0'; --right)
;
count = right + 1;
if (maximumDigits > 0) {
round(maximumDigits);
}
} | java | final void set(boolean isNegative, BigInteger source, int maximumDigits) {
this.isNegative = isNegative;
String s = source.toString();
int len = s.length();
extendDigits(len);
s.getChars(0, len, digits, 0);
decimalAt = len;
int right;
for (right = len - 1; right >= 0 && digits[right] == '0'; --right)
;
count = right + 1;
if (maximumDigits > 0) {
round(maximumDigits);
}
} | [
"final",
"void",
"set",
"(",
"boolean",
"isNegative",
",",
"BigInteger",
"source",
",",
"int",
"maximumDigits",
")",
"{",
"this",
".",
"isNegative",
"=",
"isNegative",
";",
"String",
"s",
"=",
"source",
".",
"toString",
"(",
")",
";",
"int",
"len",
"=",
... | Set the digit list to a representation of the given BigInteger value.
@param isNegative Boolean value indicating whether the number is negative.
@param source Value to be converted; must be >= 0.
@param maximumDigits The most digits which should be converted.
If maximumDigits is lower than the number of significant digits
in source, the representation will be rounded. Ignored if <= 0. | [
"Set",
"the",
"digit",
"list",
"to",
"a",
"representation",
"of",
"the",
"given",
"BigInteger",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DigitList.java#L573-L589 |
33,697 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemAttributeSet.java | ElemAttributeSet.execute | public void execute(
TransformerImpl transformer)
throws TransformerException
{
if (transformer.isRecursiveAttrSet(this))
{
throw new TransformerException(
XSLMessages.createMessage(
XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF,
new Object[]{ m_qname.getLocalPart() })); //"xsl:attribute-set '"+m_qname.m_localpart+
}
transformer.pushElemAttributeSet(this);
super.execute(transformer);
ElemAttribute attr = (ElemAttribute) getFirstChildElem();
while (null != attr)
{
attr.execute(transformer);
attr = (ElemAttribute) attr.getNextSiblingElem();
}
transformer.popElemAttributeSet();
} | java | public void execute(
TransformerImpl transformer)
throws TransformerException
{
if (transformer.isRecursiveAttrSet(this))
{
throw new TransformerException(
XSLMessages.createMessage(
XSLTErrorResources.ER_XSLATTRSET_USED_ITSELF,
new Object[]{ m_qname.getLocalPart() })); //"xsl:attribute-set '"+m_qname.m_localpart+
}
transformer.pushElemAttributeSet(this);
super.execute(transformer);
ElemAttribute attr = (ElemAttribute) getFirstChildElem();
while (null != attr)
{
attr.execute(transformer);
attr = (ElemAttribute) attr.getNextSiblingElem();
}
transformer.popElemAttributeSet();
} | [
"public",
"void",
"execute",
"(",
"TransformerImpl",
"transformer",
")",
"throws",
"TransformerException",
"{",
"if",
"(",
"transformer",
".",
"isRecursiveAttrSet",
"(",
"this",
")",
")",
"{",
"throw",
"new",
"TransformerException",
"(",
"XSLMessages",
".",
"creat... | Apply a set of attributes to the element.
@param transformer non-null reference to the the current transform-time state.
@throws TransformerException | [
"Apply",
"a",
"set",
"of",
"attributes",
"to",
"the",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemAttributeSet.java#L102-L128 |
33,698 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java | ConcurrentLinkedDeque.pred | final Node<E> pred(Node<E> p) {
Node<E> q = p.prev;
// j2objc: q == p.prev == sentinel means node GC-unlinked
return (sentinel() == q) ? last() : q;
} | java | final Node<E> pred(Node<E> p) {
Node<E> q = p.prev;
// j2objc: q == p.prev == sentinel means node GC-unlinked
return (sentinel() == q) ? last() : q;
} | [
"final",
"Node",
"<",
"E",
">",
"pred",
"(",
"Node",
"<",
"E",
">",
"p",
")",
"{",
"Node",
"<",
"E",
">",
"q",
"=",
"p",
".",
"prev",
";",
"// j2objc: q == p.prev == sentinel means node GC-unlinked",
"return",
"(",
"sentinel",
"(",
")",
"==",
"q",
")",... | Returns the predecessor of p, or the last node if p.prev has been
linked to self, which will only be true if traversing with a
stale pointer that is now off the list. | [
"Returns",
"the",
"predecessor",
"of",
"p",
"or",
"the",
"last",
"node",
"if",
"p",
".",
"prev",
"has",
"been",
"linked",
"to",
"self",
"which",
"will",
"only",
"be",
"true",
"if",
"traversing",
"with",
"a",
"stale",
"pointer",
"that",
"is",
"now",
"of... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/ConcurrentLinkedDeque.java#L750-L754 |
33,699 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/OlsonTimeZone.java | OlsonTimeZone.getCanonicalID | public String getCanonicalID() {
if (canonicalID == null) {
synchronized(this) {
if (canonicalID == null) {
canonicalID = getCanonicalID(getID());
assert(canonicalID != null);
if (canonicalID == null) {
// This should never happen...
canonicalID = getID();
}
}
}
}
return canonicalID;
} | java | public String getCanonicalID() {
if (canonicalID == null) {
synchronized(this) {
if (canonicalID == null) {
canonicalID = getCanonicalID(getID());
assert(canonicalID != null);
if (canonicalID == null) {
// This should never happen...
canonicalID = getID();
}
}
}
}
return canonicalID;
} | [
"public",
"String",
"getCanonicalID",
"(",
")",
"{",
"if",
"(",
"canonicalID",
"==",
"null",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"if",
"(",
"canonicalID",
"==",
"null",
")",
"{",
"canonicalID",
"=",
"getCanonicalID",
"(",
"getID",
"(",
")",
... | Returns the canonical ID of this system time zone | [
"Returns",
"the",
"canonical",
"ID",
"of",
"this",
"system",
"time",
"zone"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/OlsonTimeZone.java#L442-L457 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.