id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
34,800 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java | PKIXRevocationChecker.getOcspResponses | public Map<X509Certificate, byte[]> getOcspResponses() {
Map<X509Certificate, byte[]> copy = new HashMap<>(ocspResponses.size());
for (Map.Entry<X509Certificate, byte[]> e : ocspResponses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
return copy;
} | java | public Map<X509Certificate, byte[]> getOcspResponses() {
Map<X509Certificate, byte[]> copy = new HashMap<>(ocspResponses.size());
for (Map.Entry<X509Certificate, byte[]> e : ocspResponses.entrySet()) {
copy.put(e.getKey(), e.getValue().clone());
}
return copy;
} | [
"public",
"Map",
"<",
"X509Certificate",
",",
"byte",
"[",
"]",
">",
"getOcspResponses",
"(",
")",
"{",
"Map",
"<",
"X509Certificate",
",",
"byte",
"[",
"]",
">",
"copy",
"=",
"new",
"HashMap",
"<>",
"(",
"ocspResponses",
".",
"size",
"(",
")",
")",
... | Gets the OCSP responses. These responses are used to determine
the revocation status of the specified certificates when OCSP is used.
@return a map of OCSP responses. Each key is an
{@code X509Certificate} that maps to the corresponding
DER-encoded OCSP response for that certificate. A deep copy of
the map is returned to protect against subsequent modification.
Returns an empty map if no responses have been specified. | [
"Gets",
"the",
"OCSP",
"responses",
".",
"These",
"responses",
"are",
"used",
"to",
"determine",
"the",
"revocation",
"status",
"of",
"the",
"specified",
"certificates",
"when",
"OCSP",
"is",
"used",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java#L217-L223 |
34,801 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java | PKIXRevocationChecker.setOptions | public void setOptions(Set<Option> options) {
this.options = (options == null)
? Collections.<Option>emptySet()
: new HashSet<Option>(options);
} | java | public void setOptions(Set<Option> options) {
this.options = (options == null)
? Collections.<Option>emptySet()
: new HashSet<Option>(options);
} | [
"public",
"void",
"setOptions",
"(",
"Set",
"<",
"Option",
">",
"options",
")",
"{",
"this",
".",
"options",
"=",
"(",
"options",
"==",
"null",
")",
"?",
"Collections",
".",
"<",
"Option",
">",
"emptySet",
"(",
")",
":",
"new",
"HashSet",
"<",
"Optio... | Sets the revocation options.
@param options a set of revocation options. The set is copied to protect
against subsequent modification. | [
"Sets",
"the",
"revocation",
"options",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/PKIXRevocationChecker.java#L231-L235 |
34,802 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.runTo | public void runTo(int index)
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!");
if ((index >= 0) && (m_next < m_firstFree))
m_next = index;
else
m_next = m_firstFree - 1;
} | java | public void runTo(int index)
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!");
if ((index >= 0) && (m_next < m_firstFree))
m_next = index;
else
m_next = m_firstFree - 1;
} | [
"public",
"void",
"runTo",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"!",
"m_cacheNodes",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_CANNOT_INDEX",
",",
"null",
")",
")",
... | If an index is requested, NodeSet will call this method
to run the iterator to the index. By default this sets
m_next to the index. If the index argument is -1, this
signals that the iterator should be run to the end.
@param index Position to advance (or retreat) to, with
0 requesting the reset ("fresh") position and -1 (or indeed
any out-of-bounds value) requesting the final position.
@throws RuntimeException thrown if this NodeSet is not
one of the types which supports indexing/counting. | [
"If",
"an",
"index",
"is",
"requested",
"NodeSet",
"will",
"call",
"this",
"method",
"to",
"run",
"the",
"iterator",
"to",
"the",
"index",
".",
"By",
"default",
"this",
"sets",
"m_next",
"to",
"the",
"index",
".",
"If",
"the",
"index",
"argument",
"is",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L322-L333 |
34,803 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.addNode | public void addNode(Node n)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
this.addElement(n);
} | java | public void addNode(Node n)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
this.addElement(n);
} | [
"public",
"void",
"addNode",
"(",
"Node",
"n",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_NOT_MUTABLE",
",",
"null",
")",
")",
";",... | Add a node to the NodeSet. Not all types of NodeSets support this
operation
@param n Node to be added
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"Add",
"a",
"node",
"to",
"the",
"NodeSet",
".",
"Not",
"all",
"types",
"of",
"NodeSets",
"support",
"this",
"operation"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L379-L386 |
34,804 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.addNodesInDocOrder | private boolean addNodesInDocOrder(int start, int end, int testIndex,
NodeList nodelist, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
boolean foundit = false;
int i;
Node node = nodelist.item(testIndex);
for (i = end; i >= start; i--)
{
Node child = (Node) elementAt(i);
if (child == node)
{
i = -2; // Duplicate, suppress insert
break;
}
if (!DOM2Helper.isNodeAfter(node, child))
{
insertElementAt(node, i + 1);
testIndex--;
if (testIndex > 0)
{
boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist,
support);
if (!foundPrev)
{
addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
}
}
break;
}
}
if (i == -1)
{
insertElementAt(node, 0);
}
return foundit;
} | java | private boolean addNodesInDocOrder(int start, int end, int testIndex,
NodeList nodelist, XPathContext support)
{
if (!m_mutable)
throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_NOT_MUTABLE, null)); //"This NodeSet is not mutable!");
boolean foundit = false;
int i;
Node node = nodelist.item(testIndex);
for (i = end; i >= start; i--)
{
Node child = (Node) elementAt(i);
if (child == node)
{
i = -2; // Duplicate, suppress insert
break;
}
if (!DOM2Helper.isNodeAfter(node, child))
{
insertElementAt(node, i + 1);
testIndex--;
if (testIndex > 0)
{
boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist,
support);
if (!foundPrev)
{
addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
}
}
break;
}
}
if (i == -1)
{
insertElementAt(node, 0);
}
return foundit;
} | [
"private",
"boolean",
"addNodesInDocOrder",
"(",
"int",
"start",
",",
"int",
"end",
",",
"int",
"testIndex",
",",
"NodeList",
"nodelist",
",",
"XPathContext",
"support",
")",
"{",
"if",
"(",
"!",
"m_mutable",
")",
"throw",
"new",
"RuntimeException",
"(",
"XS... | Add the node list to this node set in document order.
@param start index.
@param end index.
@param testIndex index.
@param nodelist The nodelist to add.
@param support The XPath runtime context.
@return false always.
@throws RuntimeException thrown if this NodeSet is not of
a mutable type. | [
"Add",
"the",
"node",
"list",
"to",
"this",
"node",
"set",
"in",
"document",
"order",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L571-L620 |
34,805 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java | NodeSet.setCurrentPos | public void setCurrentPos(int i)
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!");
m_next = i;
} | java | public void setCurrentPos(int i)
{
if (!m_cacheNodes)
throw new RuntimeException(
XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESET_CANNOT_INDEX, null)); //"This NodeSet can not do indexing or counting functions!");
m_next = i;
} | [
"public",
"void",
"setCurrentPos",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"!",
"m_cacheNodes",
")",
"throw",
"new",
"RuntimeException",
"(",
"XSLMessages",
".",
"createXPATHMessage",
"(",
"XPATHErrorResources",
".",
"ER_NODESET_CANNOT_INDEX",
",",
"null",
")",
")... | Set the current position in the node set.
@param i Must be a valid index.
@throws RuntimeException thrown if this NodeSet is not of
a cached type, and thus doesn't permit indexed access. | [
"Set",
"the",
"current",
"position",
"in",
"the",
"node",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSet.java#L739-L747 |
34,806 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.objectEquals | public final static boolean objectEquals(Object a, Object b) {
return a == null ?
b == null ? true : false :
b == null ? false : a.equals(b);
} | java | public final static boolean objectEquals(Object a, Object b) {
return a == null ?
b == null ? true : false :
b == null ? false : a.equals(b);
} | [
"public",
"final",
"static",
"boolean",
"objectEquals",
"(",
"Object",
"a",
",",
"Object",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"?",
"b",
"==",
"null",
"?",
"true",
":",
"false",
":",
"b",
"==",
"null",
"?",
"false",
":",
"a",
".",
"equals",... | Convenience utility. Does null checks on objects, then calls equals. | [
"Convenience",
"utility",
".",
"Does",
"null",
"checks",
"on",
"objects",
"then",
"calls",
"equals",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L191-L195 |
34,807 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.checkCompare | public static <T extends Comparable<T>> int checkCompare(T a, T b) {
return a == null ?
b == null ? 0 : -1 :
b == null ? 1 : a.compareTo(b);
} | java | public static <T extends Comparable<T>> int checkCompare(T a, T b) {
return a == null ?
b == null ? 0 : -1 :
b == null ? 1 : a.compareTo(b);
} | [
"public",
"static",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"int",
"checkCompare",
"(",
"T",
"a",
",",
"T",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"?",
"b",
"==",
"null",
"?",
"0",
":",
"-",
"1",
":",
"b",
"==",
"null",
"?... | Convenience utility. Does null checks on objects, then calls compare. | [
"Convenience",
"utility",
".",
"Does",
"null",
"checks",
"on",
"objects",
"then",
"calls",
"compare",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L200-L204 |
34,808 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.appendEncodedByte | private static final <T extends Appendable> void appendEncodedByte(T buffer, byte value,
byte[] state) {
try {
if (state[0] != 0) {
char c = (char) ((state[1] << 8) | ((value) & 0xFF));
buffer.append(c);
state[0] = 0;
}
else {
state[0] = 1;
state[1] = value;
}
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | java | private static final <T extends Appendable> void appendEncodedByte(T buffer, byte value,
byte[] state) {
try {
if (state[0] != 0) {
char c = (char) ((state[1] << 8) | ((value) & 0xFF));
buffer.append(c);
state[0] = 0;
}
else {
state[0] = 1;
state[1] = value;
}
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | [
"private",
"static",
"final",
"<",
"T",
"extends",
"Appendable",
">",
"void",
"appendEncodedByte",
"(",
"T",
"buffer",
",",
"byte",
"value",
",",
"byte",
"[",
"]",
"state",
")",
"{",
"try",
"{",
"if",
"(",
"state",
"[",
"0",
"]",
"!=",
"0",
")",
"{... | Append a byte to the given Appendable, packing two bytes into each
character. The state parameter maintains intermediary data between
calls.
@param state A two-element array, with state[0] == 0 if this is the
first byte of a pair, or state[0] != 0 if this is the second byte
of a pair, in which case state[1] is the first byte. | [
"Append",
"a",
"byte",
"to",
"the",
"given",
"Appendable",
"packing",
"two",
"bytes",
"into",
"each",
"character",
".",
"The",
"state",
"parameter",
"maintains",
"intermediary",
"data",
"between",
"calls",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L462-L477 |
34,809 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.RLEStringToIntArray | static public final int[] RLEStringToIntArray(String s) {
int length = getInt(s, 0);
int[] array = new int[length];
int ai = 0, i = 1;
int maxI = s.length() / 2;
while (ai < length && i < maxI) {
int c = getInt(s, i++);
if (c == ESCAPE) {
c = getInt(s, i++);
if (c == ESCAPE) {
array[ai++] = c;
} else {
int runLength = c;
int runValue = getInt(s, i++);
for (int j=0; j<runLength; ++j) {
array[ai++] = runValue;
}
}
}
else {
array[ai++] = c;
}
}
if (ai != length || i != maxI) {
throw new IllegalStateException("Bad run-length encoded int array");
}
return array;
} | java | static public final int[] RLEStringToIntArray(String s) {
int length = getInt(s, 0);
int[] array = new int[length];
int ai = 0, i = 1;
int maxI = s.length() / 2;
while (ai < length && i < maxI) {
int c = getInt(s, i++);
if (c == ESCAPE) {
c = getInt(s, i++);
if (c == ESCAPE) {
array[ai++] = c;
} else {
int runLength = c;
int runValue = getInt(s, i++);
for (int j=0; j<runLength; ++j) {
array[ai++] = runValue;
}
}
}
else {
array[ai++] = c;
}
}
if (ai != length || i != maxI) {
throw new IllegalStateException("Bad run-length encoded int array");
}
return array;
} | [
"static",
"public",
"final",
"int",
"[",
"]",
"RLEStringToIntArray",
"(",
"String",
"s",
")",
"{",
"int",
"length",
"=",
"getInt",
"(",
"s",
",",
"0",
")",
";",
"int",
"[",
"]",
"array",
"=",
"new",
"int",
"[",
"length",
"]",
";",
"int",
"ai",
"=... | Construct an array of ints from a run-length encoded string. | [
"Construct",
"an",
"array",
"of",
"ints",
"from",
"a",
"run",
"-",
"length",
"encoded",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L482-L513 |
34,810 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.RLEStringToShortArray | static public final short[] RLEStringToShortArray(String s) {
int length = ((s.charAt(0)) << 16) | (s.charAt(1));
short[] array = new short[length];
int ai = 0;
for (int i=2; i<s.length(); ++i) {
char c = s.charAt(i);
if (c == ESCAPE) {
c = s.charAt(++i);
if (c == ESCAPE) {
array[ai++] = (short) c;
} else {
int runLength = c;
short runValue = (short) s.charAt(++i);
for (int j=0; j<runLength; ++j) array[ai++] = runValue;
}
}
else {
array[ai++] = (short) c;
}
}
if (ai != length)
throw new IllegalStateException("Bad run-length encoded short array");
return array;
} | java | static public final short[] RLEStringToShortArray(String s) {
int length = ((s.charAt(0)) << 16) | (s.charAt(1));
short[] array = new short[length];
int ai = 0;
for (int i=2; i<s.length(); ++i) {
char c = s.charAt(i);
if (c == ESCAPE) {
c = s.charAt(++i);
if (c == ESCAPE) {
array[ai++] = (short) c;
} else {
int runLength = c;
short runValue = (short) s.charAt(++i);
for (int j=0; j<runLength; ++j) array[ai++] = runValue;
}
}
else {
array[ai++] = (short) c;
}
}
if (ai != length)
throw new IllegalStateException("Bad run-length encoded short array");
return array;
} | [
"static",
"public",
"final",
"short",
"[",
"]",
"RLEStringToShortArray",
"(",
"String",
"s",
")",
"{",
"int",
"length",
"=",
"(",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")",
"<<",
"16",
")",
"|",
"(",
"s",
".",
"charAt",
"(",
"1",
")",
")",
";... | Construct an array of shorts from a run-length encoded string. | [
"Construct",
"an",
"array",
"of",
"shorts",
"from",
"a",
"run",
"-",
"length",
"encoded",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L521-L546 |
34,811 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.RLEStringToByteArray | static public final byte[] RLEStringToByteArray(String s) {
int length = ((s.charAt(0)) << 16) | (s.charAt(1));
byte[] array = new byte[length];
boolean nextChar = true;
char c = 0;
int node = 0;
int runLength = 0;
int i = 2;
for (int ai=0; ai<length; ) {
// This part of the loop places the next byte into the local
// variable 'b' each time through the loop. It keeps the
// current character in 'c' and uses the boolean 'nextChar'
// to see if we've taken both bytes out of 'c' yet.
byte b;
if (nextChar) {
c = s.charAt(i++);
b = (byte) (c >> 8);
nextChar = false;
}
else {
b = (byte) (c & 0xFF);
nextChar = true;
}
// This part of the loop is a tiny state machine which handles
// the parsing of the run-length encoding. This would be simpler
// if we could look ahead, but we can't, so we use 'node' to
// move between three nodes in the state machine.
switch (node) {
case 0:
// Normal idle node
if (b == ESCAPE_BYTE) {
node = 1;
}
else {
array[ai++] = b;
}
break;
case 1:
// We have seen one ESCAPE_BYTE; we expect either a second
// one, or a run length and value.
if (b == ESCAPE_BYTE) {
array[ai++] = ESCAPE_BYTE;
node = 0;
}
else {
runLength = b;
// Interpret signed byte as unsigned
if (runLength < 0) runLength += 0x100;
node = 2;
}
break;
case 2:
// We have seen an ESCAPE_BYTE and length byte. We interpret
// the next byte as the value to be repeated.
for (int j=0; j<runLength; ++j) array[ai++] = b;
node = 0;
break;
}
}
if (node != 0)
throw new IllegalStateException("Bad run-length encoded byte array");
if (i != s.length())
throw new IllegalStateException("Excess data in RLE byte array string");
return array;
} | java | static public final byte[] RLEStringToByteArray(String s) {
int length = ((s.charAt(0)) << 16) | (s.charAt(1));
byte[] array = new byte[length];
boolean nextChar = true;
char c = 0;
int node = 0;
int runLength = 0;
int i = 2;
for (int ai=0; ai<length; ) {
// This part of the loop places the next byte into the local
// variable 'b' each time through the loop. It keeps the
// current character in 'c' and uses the boolean 'nextChar'
// to see if we've taken both bytes out of 'c' yet.
byte b;
if (nextChar) {
c = s.charAt(i++);
b = (byte) (c >> 8);
nextChar = false;
}
else {
b = (byte) (c & 0xFF);
nextChar = true;
}
// This part of the loop is a tiny state machine which handles
// the parsing of the run-length encoding. This would be simpler
// if we could look ahead, but we can't, so we use 'node' to
// move between three nodes in the state machine.
switch (node) {
case 0:
// Normal idle node
if (b == ESCAPE_BYTE) {
node = 1;
}
else {
array[ai++] = b;
}
break;
case 1:
// We have seen one ESCAPE_BYTE; we expect either a second
// one, or a run length and value.
if (b == ESCAPE_BYTE) {
array[ai++] = ESCAPE_BYTE;
node = 0;
}
else {
runLength = b;
// Interpret signed byte as unsigned
if (runLength < 0) runLength += 0x100;
node = 2;
}
break;
case 2:
// We have seen an ESCAPE_BYTE and length byte. We interpret
// the next byte as the value to be repeated.
for (int j=0; j<runLength; ++j) array[ai++] = b;
node = 0;
break;
}
}
if (node != 0)
throw new IllegalStateException("Bad run-length encoded byte array");
if (i != s.length())
throw new IllegalStateException("Excess data in RLE byte array string");
return array;
} | [
"static",
"public",
"final",
"byte",
"[",
"]",
"RLEStringToByteArray",
"(",
"String",
"s",
")",
"{",
"int",
"length",
"=",
"(",
"(",
"s",
".",
"charAt",
"(",
"0",
")",
")",
"<<",
"16",
")",
"|",
"(",
"s",
".",
"charAt",
"(",
"1",
")",
")",
";",... | Construct an array of bytes from a run-length encoded string. | [
"Construct",
"an",
"array",
"of",
"bytes",
"from",
"a",
"run",
"-",
"length",
"encoded",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L581-L649 |
34,812 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.format1ForSource | static public final String format1ForSource(String s) {
StringBuilder buffer = new StringBuilder();
buffer.append("\"");
for (int i=0; i<s.length();) {
char c = s.charAt(i++);
if (c < '\u0020' || c == '"' || c == '\\') {
if (c == '\n') {
buffer.append("\\n");
} else if (c == '\t') {
buffer.append("\\t");
} else if (c == '\r') {
buffer.append("\\r");
} else {
// Represent control characters, backslash and double quote
// using octal notation; otherwise the string we form
// won't compile, since Unicode escape sequences are
// processed before tokenization.
buffer.append('\\');
buffer.append(HEX_DIGIT[(c & 0700) >> 6]); // HEX_DIGIT works for octal
buffer.append(HEX_DIGIT[(c & 0070) >> 3]);
buffer.append(HEX_DIGIT[(c & 0007)]);
}
}
else if (c <= '\u007E') {
buffer.append(c);
}
else {
buffer.append("\\u");
buffer.append(HEX_DIGIT[(c & 0xF000) >> 12]);
buffer.append(HEX_DIGIT[(c & 0x0F00) >> 8]);
buffer.append(HEX_DIGIT[(c & 0x00F0) >> 4]);
buffer.append(HEX_DIGIT[(c & 0x000F)]);
}
}
buffer.append('"');
return buffer.toString();
} | java | static public final String format1ForSource(String s) {
StringBuilder buffer = new StringBuilder();
buffer.append("\"");
for (int i=0; i<s.length();) {
char c = s.charAt(i++);
if (c < '\u0020' || c == '"' || c == '\\') {
if (c == '\n') {
buffer.append("\\n");
} else if (c == '\t') {
buffer.append("\\t");
} else if (c == '\r') {
buffer.append("\\r");
} else {
// Represent control characters, backslash and double quote
// using octal notation; otherwise the string we form
// won't compile, since Unicode escape sequences are
// processed before tokenization.
buffer.append('\\');
buffer.append(HEX_DIGIT[(c & 0700) >> 6]); // HEX_DIGIT works for octal
buffer.append(HEX_DIGIT[(c & 0070) >> 3]);
buffer.append(HEX_DIGIT[(c & 0007)]);
}
}
else if (c <= '\u007E') {
buffer.append(c);
}
else {
buffer.append("\\u");
buffer.append(HEX_DIGIT[(c & 0xF000) >> 12]);
buffer.append(HEX_DIGIT[(c & 0x0F00) >> 8]);
buffer.append(HEX_DIGIT[(c & 0x00F0) >> 4]);
buffer.append(HEX_DIGIT[(c & 0x000F)]);
}
}
buffer.append('"');
return buffer.toString();
} | [
"static",
"public",
"final",
"String",
"format1ForSource",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"buffer",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"buffer",
".",
"append",
"(",
"\"\\\"\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Format a String for representation in a source file. Like
formatForSource but does not do line breaking. | [
"Format",
"a",
"String",
"for",
"representation",
"in",
"a",
"source",
"file",
".",
"Like",
"formatForSource",
"but",
"does",
"not",
"do",
"line",
"breaking",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L713-L749 |
34,813 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.escape | public static final String escape(String s) {
StringBuilder buf = new StringBuilder();
for (int i=0; i<s.length(); ) {
int c = Character.codePointAt(s, i);
i += UTF16.getCharCount(c);
if (c >= ' ' && c <= 0x007F) {
if (c == '\\') {
buf.append("\\\\"); // That is, "\\"
} else {
buf.append((char)c);
}
} else {
boolean four = c <= 0xFFFF;
buf.append(four ? "\\u" : "\\U");
buf.append(hex(c, four ? 4 : 8));
}
}
return buf.toString();
} | java | public static final String escape(String s) {
StringBuilder buf = new StringBuilder();
for (int i=0; i<s.length(); ) {
int c = Character.codePointAt(s, i);
i += UTF16.getCharCount(c);
if (c >= ' ' && c <= 0x007F) {
if (c == '\\') {
buf.append("\\\\"); // That is, "\\"
} else {
buf.append((char)c);
}
} else {
boolean four = c <= 0xFFFF;
buf.append(four ? "\\u" : "\\U");
buf.append(hex(c, four ? 4 : 8));
}
}
return buf.toString();
} | [
"public",
"static",
"final",
"String",
"escape",
"(",
"String",
"s",
")",
"{",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
")",
"{",
"int"... | Convert characters outside the range U+0020 to U+007F to
Unicode escapes, and convert backslash to a double backslash. | [
"Convert",
"characters",
"outside",
"the",
"range",
"U",
"+",
"0020",
"to",
"U",
"+",
"007F",
"to",
"Unicode",
"escapes",
"and",
"convert",
"backslash",
"to",
"a",
"double",
"backslash",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L755-L773 |
34,814 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.lookup | public static int lookup(String source, String[] target) {
for (int i = 0; i < target.length; ++i) {
if (source.equals(target[i])) return i;
}
return -1;
} | java | public static int lookup(String source, String[] target) {
for (int i = 0; i < target.length; ++i) {
if (source.equals(target[i])) return i;
}
return -1;
} | [
"public",
"static",
"int",
"lookup",
"(",
"String",
"source",
",",
"String",
"[",
"]",
"target",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"target",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"source",
".",
"equals",
"... | Look up a given string in a string array. Returns the index at
which the first occurrence of the string was found in the
array, or -1 if it was not found.
@param source the string to search for
@param target the array of zero or more strings in which to
look for source
@return the index of target at which source first occurs, or -1
if not found | [
"Look",
"up",
"a",
"given",
"string",
"in",
"a",
"string",
"array",
".",
"Returns",
"the",
"index",
"at",
"which",
"the",
"first",
"occurrence",
"of",
"the",
"string",
"was",
"found",
"in",
"the",
"array",
"or",
"-",
"1",
"if",
"it",
"was",
"not",
"f... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1112-L1117 |
34,815 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.parseChar | public static boolean parseChar(String id, int[] pos, char ch) {
int start = pos[0];
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] == id.length() ||
id.charAt(pos[0]) != ch) {
pos[0] = start;
return false;
}
++pos[0];
return true;
} | java | public static boolean parseChar(String id, int[] pos, char ch) {
int start = pos[0];
pos[0] = PatternProps.skipWhiteSpace(id, pos[0]);
if (pos[0] == id.length() ||
id.charAt(pos[0]) != ch) {
pos[0] = start;
return false;
}
++pos[0];
return true;
} | [
"public",
"static",
"boolean",
"parseChar",
"(",
"String",
"id",
",",
"int",
"[",
"]",
"pos",
",",
"char",
"ch",
")",
"{",
"int",
"start",
"=",
"pos",
"[",
"0",
"]",
";",
"pos",
"[",
"0",
"]",
"=",
"PatternProps",
".",
"skipWhiteSpace",
"(",
"id",
... | Parse a single non-whitespace character 'ch', optionally
preceded by whitespace.
@param id the string to be parsed
@param pos INPUT-OUTPUT parameter. On input, pos[0] is the
offset of the first character to be parsed. On output, pos[0]
is the index after the last parsed character. If the parse
fails, pos[0] will be unchanged.
@param ch the non-whitespace character to be parsed.
@return true if 'ch' is seen preceded by zero or more
whitespace characters. | [
"Parse",
"a",
"single",
"non",
"-",
"whitespace",
"character",
"ch",
"optionally",
"preceded",
"by",
"whitespace",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1131-L1141 |
34,816 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.parsePattern | @SuppressWarnings("fallthrough")
public static int parsePattern(String rule, int pos, int limit,
String pattern, int[] parsedInts) {
// TODO Update this to handle surrogates
int[] p = new int[1];
int intCount = 0; // number of integers parsed
for (int i=0; i<pattern.length(); ++i) {
char cpat = pattern.charAt(i);
char c;
switch (cpat) {
case ' ':
if (pos >= limit) {
return -1;
}
c = rule.charAt(pos++);
if (!PatternProps.isWhiteSpace(c)) {
return -1;
}
// FALL THROUGH to skipWhitespace
case '~':
pos = PatternProps.skipWhiteSpace(rule, pos);
break;
case '#':
p[0] = pos;
parsedInts[intCount++] = parseInteger(rule, p, limit);
if (p[0] == pos) {
// Syntax error; failed to parse integer
return -1;
}
pos = p[0];
break;
default:
if (pos >= limit) {
return -1;
}
c = (char) UCharacter.toLowerCase(rule.charAt(pos++));
if (c != cpat) {
return -1;
}
break;
}
}
return pos;
} | java | @SuppressWarnings("fallthrough")
public static int parsePattern(String rule, int pos, int limit,
String pattern, int[] parsedInts) {
// TODO Update this to handle surrogates
int[] p = new int[1];
int intCount = 0; // number of integers parsed
for (int i=0; i<pattern.length(); ++i) {
char cpat = pattern.charAt(i);
char c;
switch (cpat) {
case ' ':
if (pos >= limit) {
return -1;
}
c = rule.charAt(pos++);
if (!PatternProps.isWhiteSpace(c)) {
return -1;
}
// FALL THROUGH to skipWhitespace
case '~':
pos = PatternProps.skipWhiteSpace(rule, pos);
break;
case '#':
p[0] = pos;
parsedInts[intCount++] = parseInteger(rule, p, limit);
if (p[0] == pos) {
// Syntax error; failed to parse integer
return -1;
}
pos = p[0];
break;
default:
if (pos >= limit) {
return -1;
}
c = (char) UCharacter.toLowerCase(rule.charAt(pos++));
if (c != cpat) {
return -1;
}
break;
}
}
return pos;
} | [
"@",
"SuppressWarnings",
"(",
"\"fallthrough\"",
")",
"public",
"static",
"int",
"parsePattern",
"(",
"String",
"rule",
",",
"int",
"pos",
",",
"int",
"limit",
",",
"String",
"pattern",
",",
"int",
"[",
"]",
"parsedInts",
")",
"{",
"// TODO Update this to hand... | Parse a pattern string starting at offset pos. Keywords are
matched case-insensitively. Spaces may be skipped and may be
optional or required. Integer values may be parsed, and if
they are, they will be returned in the given array. If
successful, the offset of the next non-space character is
returned. On failure, -1 is returned.
@param pattern must only contain lowercase characters, which
will match their uppercase equivalents as well. A space
character matches one or more required spaces. A '~' character
matches zero or more optional spaces. A '#' character matches
an integer and stores it in parsedInts, which the caller must
ensure has enough capacity.
@param parsedInts array to receive parsed integers. Caller
must ensure that parsedInts.length is >= the number of '#'
signs in 'pattern'.
@return the position after the last character parsed, or -1 if
the parse failed | [
"Parse",
"a",
"pattern",
"string",
"starting",
"at",
"offset",
"pos",
".",
"Keywords",
"are",
"matched",
"case",
"-",
"insensitively",
".",
"Spaces",
"may",
"be",
"skipped",
"and",
"may",
"be",
"optional",
"or",
"required",
".",
"Integer",
"values",
"may",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1162-L1205 |
34,817 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.parseUnicodeIdentifier | public static String parseUnicodeIdentifier(String str, int[] pos) {
// assert(pos[0] < str.length());
StringBuilder buf = new StringBuilder();
int p = pos[0];
while (p < str.length()) {
int ch = Character.codePointAt(str, p);
if (buf.length() == 0) {
if (UCharacter.isUnicodeIdentifierStart(ch)) {
buf.appendCodePoint(ch);
} else {
return null;
}
} else {
if (UCharacter.isUnicodeIdentifierPart(ch)) {
buf.appendCodePoint(ch);
} else {
break;
}
}
p += UTF16.getCharCount(ch);
}
pos[0] = p;
return buf.toString();
} | java | public static String parseUnicodeIdentifier(String str, int[] pos) {
// assert(pos[0] < str.length());
StringBuilder buf = new StringBuilder();
int p = pos[0];
while (p < str.length()) {
int ch = Character.codePointAt(str, p);
if (buf.length() == 0) {
if (UCharacter.isUnicodeIdentifierStart(ch)) {
buf.appendCodePoint(ch);
} else {
return null;
}
} else {
if (UCharacter.isUnicodeIdentifierPart(ch)) {
buf.appendCodePoint(ch);
} else {
break;
}
}
p += UTF16.getCharCount(ch);
}
pos[0] = p;
return buf.toString();
} | [
"public",
"static",
"String",
"parseUnicodeIdentifier",
"(",
"String",
"str",
",",
"int",
"[",
"]",
"pos",
")",
"{",
"// assert(pos[0] < str.length());",
"StringBuilder",
"buf",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"int",
"p",
"=",
"pos",
"[",
"0",
"]... | Parse a Unicode identifier from the given string at the given
position. Return the identifier, or null if there is no
identifier.
@param str the string to parse
@param pos INPUT-OUPUT parameter. On INPUT, pos[0] is the
first character to examine. It must be less than str.length(),
and it must not point to a whitespace character. That is, must
have pos[0] < str.length(). On
OUTPUT, the position after the last parsed character.
@return the Unicode identifier, or null if there is no valid
identifier at pos[0]. | [
"Parse",
"a",
"Unicode",
"identifier",
"from",
"the",
"given",
"string",
"at",
"the",
"given",
"position",
".",
"Return",
"the",
"identifier",
"or",
"null",
"if",
"there",
"is",
"no",
"identifier",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1333-L1356 |
34,818 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.appendNumber | public static <T extends Appendable> T appendNumber(T result, int n,
int radix, int minDigits)
{
try {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix " + radix);
}
int abs = n;
if (n < 0) {
abs = -n;
result.append("-");
}
recursiveAppendNumber(result, abs, radix, minDigits);
return result;
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | java | public static <T extends Appendable> T appendNumber(T result, int n,
int radix, int minDigits)
{
try {
if (radix < 2 || radix > 36) {
throw new IllegalArgumentException("Illegal radix " + radix);
}
int abs = n;
if (n < 0) {
abs = -n;
result.append("-");
}
recursiveAppendNumber(result, abs, radix, minDigits);
return result;
} catch (IOException e) {
throw new IllegalIcuArgumentException(e);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"Appendable",
">",
"T",
"appendNumber",
"(",
"T",
"result",
",",
"int",
"n",
",",
"int",
"radix",
",",
"int",
"minDigits",
")",
"{",
"try",
"{",
"if",
"(",
"radix",
"<",
"2",
"||",
"radix",
">",
"36",
")",
... | Append a number to the given Appendable in the given radix.
Standard digits '0'-'9' are used and letters 'A'-'Z' for
radices 11 through 36.
@param result the digits of the number are appended here
@param n the number to be converted to digits; may be negative.
If negative, a '-' is prepended to the digits.
@param radix a radix from 2 to 36 inclusive.
@param minDigits the minimum number of digits, not including
any '-', to produce. Values less than 2 have no effect. One
digit is always emitted regardless of this parameter.
@return a reference to result | [
"Append",
"a",
"number",
"to",
"the",
"given",
"Appendable",
"in",
"the",
"given",
"radix",
".",
"Standard",
"digits",
"0",
"-",
"9",
"are",
"used",
"and",
"letters",
"A",
"-",
"Z",
"for",
"radices",
"11",
"through",
"36",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1404-L1427 |
34,819 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.appendToRule | public static void appendToRule(StringBuffer rule,
String text,
boolean isLiteral,
boolean escapeUnprintable,
StringBuffer quoteBuf) {
for (int i=0; i<text.length(); ++i) {
// Okay to process in 16-bit code units here
appendToRule(rule, text.charAt(i), isLiteral, escapeUnprintable, quoteBuf);
}
} | java | public static void appendToRule(StringBuffer rule,
String text,
boolean isLiteral,
boolean escapeUnprintable,
StringBuffer quoteBuf) {
for (int i=0; i<text.length(); ++i) {
// Okay to process in 16-bit code units here
appendToRule(rule, text.charAt(i), isLiteral, escapeUnprintable, quoteBuf);
}
} | [
"public",
"static",
"void",
"appendToRule",
"(",
"StringBuffer",
"rule",
",",
"String",
"text",
",",
"boolean",
"isLiteral",
",",
"boolean",
"escapeUnprintable",
",",
"StringBuffer",
"quoteBuf",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"t... | Append the given string to the rule. Calls the single-character
version of appendToRule for each character. | [
"Append",
"the",
"given",
"string",
"to",
"the",
"rule",
".",
"Calls",
"the",
"single",
"-",
"character",
"version",
"of",
"appendToRule",
"for",
"each",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1655-L1664 |
34,820 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.compareUnsigned | public static final int compareUnsigned(int source, int target)
{
source += MAGIC_UNSIGNED;
target += MAGIC_UNSIGNED;
if (source < target) {
return -1;
}
else if (source > target) {
return 1;
}
return 0;
} | java | public static final int compareUnsigned(int source, int target)
{
source += MAGIC_UNSIGNED;
target += MAGIC_UNSIGNED;
if (source < target) {
return -1;
}
else if (source > target) {
return 1;
}
return 0;
} | [
"public",
"static",
"final",
"int",
"compareUnsigned",
"(",
"int",
"source",
",",
"int",
"target",
")",
"{",
"source",
"+=",
"MAGIC_UNSIGNED",
";",
"target",
"+=",
"MAGIC_UNSIGNED",
";",
"if",
"(",
"source",
"<",
"target",
")",
"{",
"return",
"-",
"1",
"... | Compares 2 unsigned integers
@param source 32 bit unsigned integer
@param target 32 bit unsigned integer
@return 0 if equals, 1 if source is greater than target and -1
otherwise | [
"Compares",
"2",
"unsigned",
"integers"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1687-L1698 |
34,821 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java | Utility.highBit | public static final byte highBit(int n)
{
if (n <= 0) {
return -1;
}
byte bit = 0;
if (n >= 1 << 16) {
n >>= 16;
bit += 16;
}
if (n >= 1 << 8) {
n >>= 8;
bit += 8;
}
if (n >= 1 << 4) {
n >>= 4;
bit += 4;
}
if (n >= 1 << 2) {
n >>= 2;
bit += 2;
}
if (n >= 1 << 1) {
n >>= 1;
bit += 1;
}
return bit;
} | java | public static final byte highBit(int n)
{
if (n <= 0) {
return -1;
}
byte bit = 0;
if (n >= 1 << 16) {
n >>= 16;
bit += 16;
}
if (n >= 1 << 8) {
n >>= 8;
bit += 8;
}
if (n >= 1 << 4) {
n >>= 4;
bit += 4;
}
if (n >= 1 << 2) {
n >>= 2;
bit += 2;
}
if (n >= 1 << 1) {
n >>= 1;
bit += 1;
}
return bit;
} | [
"public",
"static",
"final",
"byte",
"highBit",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"n",
"<=",
"0",
")",
"{",
"return",
"-",
"1",
";",
"}",
"byte",
"bit",
"=",
"0",
";",
"if",
"(",
"n",
">=",
"1",
"<<",
"16",
")",
"{",
"n",
">>=",
"16",
... | Find the highest bit in a positive integer. This is done
by doing a binary search through the bits.
@param n is the integer
@return the bit number of the highest bit, with 0 being
the low order bit, or -1 if <code>n</code> is not positive | [
"Find",
"the",
"highest",
"bit",
"in",
"a",
"positive",
"integer",
".",
"This",
"is",
"done",
"by",
"doing",
"a",
"binary",
"search",
"through",
"the",
"bits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Utility.java#L1709-L1743 |
34,822 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPath.java | XPath.setExpression | public void setExpression(Expression exp)
{
if(null != m_mainExp)
exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus
m_mainExp = exp;
} | java | public void setExpression(Expression exp)
{
if(null != m_mainExp)
exp.exprSetParent(m_mainExp.exprGetParent()); // a bit bogus
m_mainExp = exp;
} | [
"public",
"void",
"setExpression",
"(",
"Expression",
"exp",
")",
"{",
"if",
"(",
"null",
"!=",
"m_mainExp",
")",
"exp",
".",
"exprSetParent",
"(",
"m_mainExp",
".",
"exprGetParent",
"(",
")",
")",
";",
"// a bit bogus",
"m_mainExp",
"=",
"exp",
";",
"}"
] | Set the raw expression object for this object.
@param exp the raw Expression object, which should not normally be null. | [
"Set",
"the",
"raw",
"expression",
"object",
"for",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/XPath.java#L97-L102 |
34,823 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java | ElemContext.push | final ElemContext push()
{
ElemContext frame = this.m_next;
if (frame == null)
{
/* We have never been at this depth yet, and there is no
* stack frame to re-use, so we now make a new one.
*/
frame = new ElemContext(this);
this.m_next = frame;
}
/*
* We shouldn't need to set this true because we should just
* be pushing a dummy stack frame that will be instantly popped.
* Yet we need to be ready in case this element does have
* unexpected children.
*/
frame.m_startTagOpen = true;
return frame;
} | java | final ElemContext push()
{
ElemContext frame = this.m_next;
if (frame == null)
{
/* We have never been at this depth yet, and there is no
* stack frame to re-use, so we now make a new one.
*/
frame = new ElemContext(this);
this.m_next = frame;
}
/*
* We shouldn't need to set this true because we should just
* be pushing a dummy stack frame that will be instantly popped.
* Yet we need to be ready in case this element does have
* unexpected children.
*/
frame.m_startTagOpen = true;
return frame;
} | [
"final",
"ElemContext",
"push",
"(",
")",
"{",
"ElemContext",
"frame",
"=",
"this",
".",
"m_next",
";",
"if",
"(",
"frame",
"==",
"null",
")",
"{",
"/* We have never been at this depth yet, and there is no\n * stack frame to re-use, so we now make a new one.\n ... | This method pushes an element "stack frame"
but with no initialization of values in that frame.
This method is used for optimization purposes, like when pushing
a stack frame for an HTML "IMG" tag which has no children and
the stack frame will almost immediately be popped. | [
"This",
"method",
"pushes",
"an",
"element",
"stack",
"frame",
"but",
"with",
"no",
"initialization",
"of",
"values",
"in",
"that",
"frame",
".",
"This",
"method",
"is",
"used",
"for",
"optimization",
"purposes",
"like",
"when",
"pushing",
"a",
"stack",
"fra... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java#L165-L184 |
34,824 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java | ElemContext.push | final ElemContext push(
final String uri,
final String localName,
final String qName)
{
ElemContext frame = this.m_next;
if (frame == null)
{
/* We have never been at this depth yet, and there is no
* stack frame to re-use, so we now make a new one.
*/
frame = new ElemContext(this);
this.m_next = frame;
}
// Initialize, or reset values in the new or re-used stack frame.
frame.m_elementName = qName;
frame.m_elementLocalName = localName;
frame.m_elementURI = uri;
frame.m_isCdataSection = false;
frame.m_startTagOpen = true;
// is_Raw is already set in the HTML startElement() method
// frame.m_isRaw = false;
return frame;
} | java | final ElemContext push(
final String uri,
final String localName,
final String qName)
{
ElemContext frame = this.m_next;
if (frame == null)
{
/* We have never been at this depth yet, and there is no
* stack frame to re-use, so we now make a new one.
*/
frame = new ElemContext(this);
this.m_next = frame;
}
// Initialize, or reset values in the new or re-used stack frame.
frame.m_elementName = qName;
frame.m_elementLocalName = localName;
frame.m_elementURI = uri;
frame.m_isCdataSection = false;
frame.m_startTagOpen = true;
// is_Raw is already set in the HTML startElement() method
// frame.m_isRaw = false;
return frame;
} | [
"final",
"ElemContext",
"push",
"(",
"final",
"String",
"uri",
",",
"final",
"String",
"localName",
",",
"final",
"String",
"qName",
")",
"{",
"ElemContext",
"frame",
"=",
"this",
".",
"m_next",
";",
"if",
"(",
"frame",
"==",
"null",
")",
"{",
"/* We hav... | Push an element context on the stack. This context keeps track of
information gathered about the element.
@param uri The URI for the namespace for the element name,
can be null if it is not yet known.
@param localName The local name of the element (no prefix),
can be null.
@param qName The qualified name (with prefix, if any)
of the element, this parameter is required. | [
"Push",
"an",
"element",
"context",
"on",
"the",
"stack",
".",
"This",
"context",
"keeps",
"track",
"of",
"information",
"gathered",
"about",
"the",
"element",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ElemContext.java#L196-L221 |
34,825 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java | PBEKeySpec.clearPassword | public final void clearPassword() {
if (password != null) {
for (int i = 0; i < password.length; i++) {
password[i] = ' ';
}
password = null;
}
} | java | public final void clearPassword() {
if (password != null) {
for (int i = 0; i < password.length; i++) {
password[i] = ' ';
}
password = null;
}
} | [
"public",
"final",
"void",
"clearPassword",
"(",
")",
"{",
"if",
"(",
"password",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"password",
".",
"length",
";",
"i",
"++",
")",
"{",
"password",
"[",
"i",
"]",
"=",
"'",... | Clears the internal copy of the password. | [
"Clears",
"the",
"internal",
"copy",
"of",
"the",
"password",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/spec/PBEKeySpec.java#L175-L182 |
34,826 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterOutputStream.java | InflaterOutputStream.flush | public void flush() throws IOException {
ensureOpen();
// Finish decompressing and writing pending output data
if (!inf.finished()) {
try {
while (!inf.finished() && !inf.needsInput()) {
int n;
// Decompress pending output data
n = inf.inflate(buf, 0, buf.length);
if (n < 1) {
break;
}
// Write the uncompressed output data block
out.write(buf, 0, n);
}
super.flush();
} catch (DataFormatException ex) {
// Improperly formatted compressed (ZIP) data
String msg = ex.getMessage();
if (msg == null) {
msg = "Invalid ZLIB data format";
}
throw new ZipException(msg);
}
}
} | java | public void flush() throws IOException {
ensureOpen();
// Finish decompressing and writing pending output data
if (!inf.finished()) {
try {
while (!inf.finished() && !inf.needsInput()) {
int n;
// Decompress pending output data
n = inf.inflate(buf, 0, buf.length);
if (n < 1) {
break;
}
// Write the uncompressed output data block
out.write(buf, 0, n);
}
super.flush();
} catch (DataFormatException ex) {
// Improperly formatted compressed (ZIP) data
String msg = ex.getMessage();
if (msg == null) {
msg = "Invalid ZLIB data format";
}
throw new ZipException(msg);
}
}
} | [
"public",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"ensureOpen",
"(",
")",
";",
"// Finish decompressing and writing pending output data",
"if",
"(",
"!",
"inf",
".",
"finished",
"(",
")",
")",
"{",
"try",
"{",
"while",
"(",
"!",
"inf",
".",
... | Flushes this output stream, forcing any pending buffered output bytes to be
written.
@throws IOException if an I/O error occurs or this stream is already
closed | [
"Flushes",
"this",
"output",
"stream",
"forcing",
"any",
"pending",
"buffered",
"output",
"bytes",
"to",
"be",
"written",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterOutputStream.java#L144-L172 |
34,827 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterOutputStream.java | InflaterOutputStream.write | public void write(byte[] b, int off, int len) throws IOException {
// Sanity checks
ensureOpen();
if (b == null) {
throw new NullPointerException("Null buffer for read");
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
// Write uncompressed data to the output stream
try {
for (;;) {
int n;
// Fill the decompressor buffer with output data
if (inf.needsInput()) {
int part;
if (len < 1) {
break;
}
part = (len < 512 ? len : 512);
inf.setInput(b, off, part);
off += part;
len -= part;
}
// Decompress and write blocks of output data
do {
n = inf.inflate(buf, 0, buf.length);
if (n > 0) {
out.write(buf, 0, n);
}
} while (n > 0);
// Check the decompressor
if (inf.finished()) {
break;
}
if (inf.needsDictionary()) {
throw new ZipException("ZLIB dictionary missing");
}
}
} catch (DataFormatException ex) {
// Improperly formatted compressed (ZIP) data
String msg = ex.getMessage();
if (msg == null) {
msg = "Invalid ZLIB data format";
}
throw new ZipException(msg);
}
} | java | public void write(byte[] b, int off, int len) throws IOException {
// Sanity checks
ensureOpen();
if (b == null) {
throw new NullPointerException("Null buffer for read");
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return;
}
// Write uncompressed data to the output stream
try {
for (;;) {
int n;
// Fill the decompressor buffer with output data
if (inf.needsInput()) {
int part;
if (len < 1) {
break;
}
part = (len < 512 ? len : 512);
inf.setInput(b, off, part);
off += part;
len -= part;
}
// Decompress and write blocks of output data
do {
n = inf.inflate(buf, 0, buf.length);
if (n > 0) {
out.write(buf, 0, n);
}
} while (n > 0);
// Check the decompressor
if (inf.finished()) {
break;
}
if (inf.needsDictionary()) {
throw new ZipException("ZLIB dictionary missing");
}
}
} catch (DataFormatException ex) {
// Improperly formatted compressed (ZIP) data
String msg = ex.getMessage();
if (msg == null) {
msg = "Invalid ZLIB data format";
}
throw new ZipException(msg);
}
} | [
"public",
"void",
"write",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"// Sanity checks",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerExcepti... | Writes an array of bytes to the uncompressed output stream.
@param b buffer containing compressed data to decompress and write to
the output stream
@param off starting offset of the compressed data within {@code b}
@param len number of bytes to decompress from {@code b}
@throws IndexOutOfBoundsException if {@code off < 0}, or if
{@code len < 0}, or if {@code len > b.length - off}
@throws IOException if an I/O error occurs or this stream is already
closed
@throws NullPointerException if {@code b} is null
@throws ZipException if a compression (ZIP) format error occurs | [
"Writes",
"an",
"array",
"of",
"bytes",
"to",
"the",
"uncompressed",
"output",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/InflaterOutputStream.java#L221-L275 |
34,828 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.add | public void add(URI uri, HttpCookie cookie) {
// pre-condition : argument can't be null
if (cookie == null) {
throw new NullPointerException("cookie is null");
}
lock.lock();
try {
if (cookie.getMaxAge() != 0) {
addIndex(uriIndex, getEffectiveURI(uri), cookie);
}
} finally {
lock.unlock();
}
} | java | public void add(URI uri, HttpCookie cookie) {
// pre-condition : argument can't be null
if (cookie == null) {
throw new NullPointerException("cookie is null");
}
lock.lock();
try {
if (cookie.getMaxAge() != 0) {
addIndex(uriIndex, getEffectiveURI(uri), cookie);
}
} finally {
lock.unlock();
}
} | [
"public",
"void",
"add",
"(",
"URI",
"uri",
",",
"HttpCookie",
"cookie",
")",
"{",
"// pre-condition : argument can't be null",
"if",
"(",
"cookie",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"cookie is null\"",
")",
";",
"}",
"lock",... | Add one cookie into cookie store. | [
"Add",
"one",
"cookie",
"into",
"cookie",
"store",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L70-L84 |
34,829 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.getCookies | public List<HttpCookie> getCookies() {
List<HttpCookie> rt = new ArrayList<HttpCookie>();
lock.lock();
try {
for (List<HttpCookie> list : uriIndex.values()) {
Iterator<HttpCookie> it = list.iterator();
while (it.hasNext()) {
HttpCookie cookie = it.next();
if (cookie.hasExpired()) {
it.remove();
} else if (!rt.contains(cookie)) {
rt.add(cookie);
}
}
}
} finally {
rt = Collections.unmodifiableList(rt);
lock.unlock();
}
return rt;
} | java | public List<HttpCookie> getCookies() {
List<HttpCookie> rt = new ArrayList<HttpCookie>();
lock.lock();
try {
for (List<HttpCookie> list : uriIndex.values()) {
Iterator<HttpCookie> it = list.iterator();
while (it.hasNext()) {
HttpCookie cookie = it.next();
if (cookie.hasExpired()) {
it.remove();
} else if (!rt.contains(cookie)) {
rt.add(cookie);
}
}
}
} finally {
rt = Collections.unmodifiableList(rt);
lock.unlock();
}
return rt;
} | [
"public",
"List",
"<",
"HttpCookie",
">",
"getCookies",
"(",
")",
"{",
"List",
"<",
"HttpCookie",
">",
"rt",
"=",
"new",
"ArrayList",
"<",
"HttpCookie",
">",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"for",
"(",
"List",
"<",
... | Get all cookies in cookie store, except those have expired | [
"Get",
"all",
"cookies",
"in",
"cookie",
"store",
"except",
"those",
"have",
"expired"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L117-L139 |
34,830 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.getURIs | public List<URI> getURIs() {
List<URI> uris = new ArrayList<URI>();
lock.lock();
try {
List<URI> result = new ArrayList<URI>(uriIndex.keySet());
result.remove(null);
return Collections.unmodifiableList(result);
} finally {
uris.addAll(uriIndex.keySet());
lock.unlock();
}
} | java | public List<URI> getURIs() {
List<URI> uris = new ArrayList<URI>();
lock.lock();
try {
List<URI> result = new ArrayList<URI>(uriIndex.keySet());
result.remove(null);
return Collections.unmodifiableList(result);
} finally {
uris.addAll(uriIndex.keySet());
lock.unlock();
}
} | [
"public",
"List",
"<",
"URI",
">",
"getURIs",
"(",
")",
"{",
"List",
"<",
"URI",
">",
"uris",
"=",
"new",
"ArrayList",
"<",
"URI",
">",
"(",
")",
";",
"lock",
".",
"lock",
"(",
")",
";",
"try",
"{",
"List",
"<",
"URI",
">",
"result",
"=",
"ne... | Get all URIs, which are associated with at least one cookie
of this cookie store. | [
"Get",
"all",
"URIs",
"which",
"are",
"associated",
"with",
"at",
"least",
"one",
"cookie",
"of",
"this",
"cookie",
"store",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L145-L157 |
34,831 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.remove | public boolean remove(URI uri, HttpCookie ck) {
// argument can't be null
if (ck == null) {
throw new NullPointerException("cookie is null");
}
lock.lock();
try {
uri = getEffectiveURI(uri);
if (uriIndex.get(uri) == null) {
return false;
} else {
List<HttpCookie> cookies = uriIndex.get(uri);
if (cookies != null) {
return cookies.remove(ck);
} else {
return false;
}
}
} finally {
lock.unlock();
}
} | java | public boolean remove(URI uri, HttpCookie ck) {
// argument can't be null
if (ck == null) {
throw new NullPointerException("cookie is null");
}
lock.lock();
try {
uri = getEffectiveURI(uri);
if (uriIndex.get(uri) == null) {
return false;
} else {
List<HttpCookie> cookies = uriIndex.get(uri);
if (cookies != null) {
return cookies.remove(ck);
} else {
return false;
}
}
} finally {
lock.unlock();
}
} | [
"public",
"boolean",
"remove",
"(",
"URI",
"uri",
",",
"HttpCookie",
"ck",
")",
"{",
"// argument can't be null",
"if",
"(",
"ck",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
"\"cookie is null\"",
")",
";",
"}",
"lock",
".",
"lock",
... | Remove a cookie from store | [
"Remove",
"a",
"cookie",
"from",
"store"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L163-L185 |
34,832 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.removeAll | public boolean removeAll() {
lock.lock();
boolean result = false;
try {
result = !uriIndex.isEmpty();
uriIndex.clear();
} finally {
lock.unlock();
}
return result;
} | java | public boolean removeAll() {
lock.lock();
boolean result = false;
try {
result = !uriIndex.isEmpty();
uriIndex.clear();
} finally {
lock.unlock();
}
return result;
} | [
"public",
"boolean",
"removeAll",
"(",
")",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"boolean",
"result",
"=",
"false",
";",
"try",
"{",
"result",
"=",
"!",
"uriIndex",
".",
"isEmpty",
"(",
")",
";",
"uriIndex",
".",
"clear",
"(",
")",
";",
"}",
... | Remove all cookies in this cookie store. | [
"Remove",
"all",
"cookies",
"in",
"this",
"cookie",
"store",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L191-L203 |
34,833 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.getInternal2 | private <T extends Comparable<T>>
void getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex,
T comparator)
{
// Removed cookieJar
for (T index : cookieIndex.keySet()) {
if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) {
List<HttpCookie> indexedCookies = cookieIndex.get(index);
// check the list of cookies associated with this domain
if (indexedCookies != null) {
Iterator<HttpCookie> it = indexedCookies.iterator();
while (it.hasNext()) {
HttpCookie ck = it.next();
// the cookie still in main cookie store
if (!ck.hasExpired()) {
// don't add twice
if (!cookies.contains(ck))
cookies.add(ck);
} else {
it.remove();
}
}
} // end of indexedCookies != null
} // end of comparator.compareTo(index) == 0
} // end of cookieIndex iteration
} | java | private <T extends Comparable<T>>
void getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex,
T comparator)
{
// Removed cookieJar
for (T index : cookieIndex.keySet()) {
if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) {
List<HttpCookie> indexedCookies = cookieIndex.get(index);
// check the list of cookies associated with this domain
if (indexedCookies != null) {
Iterator<HttpCookie> it = indexedCookies.iterator();
while (it.hasNext()) {
HttpCookie ck = it.next();
// the cookie still in main cookie store
if (!ck.hasExpired()) {
// don't add twice
if (!cookies.contains(ck))
cookies.add(ck);
} else {
it.remove();
}
}
} // end of indexedCookies != null
} // end of comparator.compareTo(index) == 0
} // end of cookieIndex iteration
} | [
"private",
"<",
"T",
"extends",
"Comparable",
"<",
"T",
">",
">",
"void",
"getInternal2",
"(",
"List",
"<",
"HttpCookie",
">",
"cookies",
",",
"Map",
"<",
"T",
",",
"List",
"<",
"HttpCookie",
">",
">",
"cookieIndex",
",",
"T",
"comparator",
")",
"{",
... | a cookie in index should be returned | [
"a",
"cookie",
"in",
"index",
"should",
"be",
"returned"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L304-L329 |
34,834 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java | InMemoryCookieStore.addIndex | private <T> void addIndex(Map<T, List<HttpCookie>> indexStore,
T index,
HttpCookie cookie)
{
// Android-changed : "index" can be null. We only use the URI based
// index on Android and we want to support null URIs. The underlying
// store is a HashMap which will support null keys anyway.
List<HttpCookie> cookies = indexStore.get(index);
if (cookies != null) {
// there may already have the same cookie, so remove it first
cookies.remove(cookie);
cookies.add(cookie);
} else {
cookies = new ArrayList<HttpCookie>();
cookies.add(cookie);
indexStore.put(index, cookies);
}
} | java | private <T> void addIndex(Map<T, List<HttpCookie>> indexStore,
T index,
HttpCookie cookie)
{
// Android-changed : "index" can be null. We only use the URI based
// index on Android and we want to support null URIs. The underlying
// store is a HashMap which will support null keys anyway.
List<HttpCookie> cookies = indexStore.get(index);
if (cookies != null) {
// there may already have the same cookie, so remove it first
cookies.remove(cookie);
cookies.add(cookie);
} else {
cookies = new ArrayList<HttpCookie>();
cookies.add(cookie);
indexStore.put(index, cookies);
}
} | [
"private",
"<",
"T",
">",
"void",
"addIndex",
"(",
"Map",
"<",
"T",
",",
"List",
"<",
"HttpCookie",
">",
">",
"indexStore",
",",
"T",
"index",
",",
"HttpCookie",
"cookie",
")",
"{",
"// Android-changed : \"index\" can be null. We only use the URI based",
"// index... | add 'cookie' indexed by 'index' into 'indexStore' | [
"add",
"cookie",
"indexed",
"by",
"index",
"into",
"indexStore"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/InMemoryCookieStore.java#L332-L350 |
34,835 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CurrencyPluralInfo.java | CurrencyPluralInfo.getCurrencyPluralPattern | public String getCurrencyPluralPattern(String pluralCount) {
String currencyPluralPattern = pluralCountToCurrencyUnitPattern.get(pluralCount);
if (currencyPluralPattern == null) {
// fall back to "other"
if (!pluralCount.equals("other")) {
currencyPluralPattern = pluralCountToCurrencyUnitPattern.get("other");
}
if (currencyPluralPattern == null) {
// no currencyUnitPatterns defined,
// fallback to predefined default.
// This should never happen when ICU resource files are
// available, since currencyUnitPattern of "other" is always
// defined in root.
currencyPluralPattern = defaultCurrencyPluralPattern;
}
}
return currencyPluralPattern;
} | java | public String getCurrencyPluralPattern(String pluralCount) {
String currencyPluralPattern = pluralCountToCurrencyUnitPattern.get(pluralCount);
if (currencyPluralPattern == null) {
// fall back to "other"
if (!pluralCount.equals("other")) {
currencyPluralPattern = pluralCountToCurrencyUnitPattern.get("other");
}
if (currencyPluralPattern == null) {
// no currencyUnitPatterns defined,
// fallback to predefined default.
// This should never happen when ICU resource files are
// available, since currencyUnitPattern of "other" is always
// defined in root.
currencyPluralPattern = defaultCurrencyPluralPattern;
}
}
return currencyPluralPattern;
} | [
"public",
"String",
"getCurrencyPluralPattern",
"(",
"String",
"pluralCount",
")",
"{",
"String",
"currencyPluralPattern",
"=",
"pluralCountToCurrencyUnitPattern",
".",
"get",
"(",
"pluralCount",
")",
";",
"if",
"(",
"currencyPluralPattern",
"==",
"null",
")",
"{",
... | Given a plural count, gets currency plural pattern of this locale,
used for currency plural format
@param pluralCount currency plural count
@return a currency plural pattern based on plural count | [
"Given",
"a",
"plural",
"count",
"gets",
"currency",
"plural",
"pattern",
"of",
"this",
"locale",
"used",
"for",
"currency",
"plural",
"format"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CurrencyPluralInfo.java#L111-L128 |
34,836 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.set | private void set(int pos, String s) {
buffer.delete(pos, buffer.length());
buffer.insert(pos, s);
} | java | private void set(int pos, String s) {
buffer.delete(pos, buffer.length());
buffer.insert(pos, s);
} | [
"private",
"void",
"set",
"(",
"int",
"pos",
",",
"String",
"s",
")",
"{",
"buffer",
".",
"delete",
"(",
"pos",
",",
"buffer",
".",
"length",
"(",
")",
")",
";",
"buffer",
".",
"insert",
"(",
"pos",
",",
"s",
")",
";",
"}"
] | Set the length of the buffer to pos, then append the string. | [
"Set",
"the",
"length",
"of",
"the",
"buffer",
"to",
"pos",
"then",
"append",
"the",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L100-L103 |
34,837 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.haveKeywordAssign | private boolean haveKeywordAssign() {
// assume it is safe to start from index
for (int i = index; i < id.length; ++i) {
if (id[i] == KEYWORD_ASSIGN) {
return true;
}
}
return false;
} | java | private boolean haveKeywordAssign() {
// assume it is safe to start from index
for (int i = index; i < id.length; ++i) {
if (id[i] == KEYWORD_ASSIGN) {
return true;
}
}
return false;
} | [
"private",
"boolean",
"haveKeywordAssign",
"(",
")",
"{",
"// assume it is safe to start from index",
"for",
"(",
"int",
"i",
"=",
"index",
";",
"i",
"<",
"id",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"id",
"[",
"i",
"]",
"==",
"KEYWORD_ASSIG... | Returns true if a value separator occurs at or after index. | [
"Returns",
"true",
"if",
"a",
"value",
"separator",
"occurs",
"at",
"or",
"after",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L182-L190 |
34,838 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.parseLanguage | private int parseLanguage() {
int startLength = buffer.length();
if (haveExperimentalLanguagePrefix()) {
append(AsciiUtil.toLower(id[0]));
append(HYPHEN);
index = 2;
}
char c;
while(!isTerminatorOrIDSeparator(c = next())) {
append(AsciiUtil.toLower(c));
}
--index; // unget
if (buffer.length() - startLength == 3) {
String lang = LocaleIDs.threeToTwoLetterLanguage(getString(0));
if (lang != null) {
set(0, lang);
}
}
return 0;
} | java | private int parseLanguage() {
int startLength = buffer.length();
if (haveExperimentalLanguagePrefix()) {
append(AsciiUtil.toLower(id[0]));
append(HYPHEN);
index = 2;
}
char c;
while(!isTerminatorOrIDSeparator(c = next())) {
append(AsciiUtil.toLower(c));
}
--index; // unget
if (buffer.length() - startLength == 3) {
String lang = LocaleIDs.threeToTwoLetterLanguage(getString(0));
if (lang != null) {
set(0, lang);
}
}
return 0;
} | [
"private",
"int",
"parseLanguage",
"(",
")",
"{",
"int",
"startLength",
"=",
"buffer",
".",
"length",
"(",
")",
";",
"if",
"(",
"haveExperimentalLanguagePrefix",
"(",
")",
")",
"{",
"append",
"(",
"AsciiUtil",
".",
"toLower",
"(",
"id",
"[",
"0",
"]",
... | Advance index past language, and accumulate normalized language code in buffer.
Index must be at 0 when this is called. Index is left at a terminator or id
separator. Returns the start of the language code in the buffer. | [
"Advance",
"index",
"past",
"language",
"and",
"accumulate",
"normalized",
"language",
"code",
"in",
"buffer",
".",
"Index",
"must",
"be",
"at",
"0",
"when",
"this",
"is",
"called",
".",
"Index",
"is",
"left",
"at",
"a",
"terminator",
"or",
"id",
"separato... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L197-L220 |
34,839 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.parseVariant | private int parseVariant() {
int oldBlen = buffer.length();
boolean start = true;
boolean needSeparator = true;
boolean skipping = false;
char c;
boolean firstPass = true;
while ((c = next()) != DONE) {
if (c == DOT) {
start = false;
skipping = true;
} else if (c == KEYWORD_SEPARATOR) {
if (haveKeywordAssign()) {
break;
}
skipping = false;
start = false;
needSeparator = true; // add another underscore if we have more text
} else if (start) {
start = false;
if (c != UNDERSCORE && c != HYPHEN) {
index--;
}
} else if (!skipping) {
if (needSeparator) {
needSeparator = false;
if (firstPass && !hadCountry) { // no country, we'll need two
addSeparator();
++oldBlen; // for sure
}
addSeparator();
if (firstPass) { // only for the first separator
++oldBlen;
firstPass = false;
}
}
c = AsciiUtil.toUpper(c);
if (c == HYPHEN || c == COMMA) {
c = UNDERSCORE;
}
append(c);
}
}
--index; // unget
return oldBlen;
} | java | private int parseVariant() {
int oldBlen = buffer.length();
boolean start = true;
boolean needSeparator = true;
boolean skipping = false;
char c;
boolean firstPass = true;
while ((c = next()) != DONE) {
if (c == DOT) {
start = false;
skipping = true;
} else if (c == KEYWORD_SEPARATOR) {
if (haveKeywordAssign()) {
break;
}
skipping = false;
start = false;
needSeparator = true; // add another underscore if we have more text
} else if (start) {
start = false;
if (c != UNDERSCORE && c != HYPHEN) {
index--;
}
} else if (!skipping) {
if (needSeparator) {
needSeparator = false;
if (firstPass && !hadCountry) { // no country, we'll need two
addSeparator();
++oldBlen; // for sure
}
addSeparator();
if (firstPass) { // only for the first separator
++oldBlen;
firstPass = false;
}
}
c = AsciiUtil.toUpper(c);
if (c == HYPHEN || c == COMMA) {
c = UNDERSCORE;
}
append(c);
}
}
--index; // unget
return oldBlen;
} | [
"private",
"int",
"parseVariant",
"(",
")",
"{",
"int",
"oldBlen",
"=",
"buffer",
".",
"length",
"(",
")",
";",
"boolean",
"start",
"=",
"true",
";",
"boolean",
"needSeparator",
"=",
"true",
";",
"boolean",
"skipping",
"=",
"false",
";",
"char",
"c",
"... | Advance index past variant, and accumulate normalized variant in buffer. This ignores
the codepage information from POSIX ids. Index must be immediately after the country
or script. Index is left at the keyword separator or at the end of the text. Return
the start of the variant code in the buffer.
In standard form, we can have the following forms:
ll__VVVV
ll_CC_VVVV
ll_Ssss_VVVV
ll_Ssss_CC_VVVV
This also handles POSIX ids, which can have the following forms (pppp is code page id):
ll_CC.pppp --> ll_CC
ll_CC.pppp@VVVV --> ll_CC_VVVV
ll_CC@VVVV --> ll_CC_VVVV
We identify this use of '@' in POSIX ids by looking for an '=' following
the '@'. If there is one, we consider '@' to start a keyword list, instead of
being part of a POSIX id.
Note: since it was decided that we want an option to not handle POSIX ids, this
becomes a bit more complex. | [
"Advance",
"index",
"past",
"variant",
"and",
"accumulate",
"normalized",
"variant",
"in",
"buffer",
".",
"This",
"ignores",
"the",
"codepage",
"information",
"from",
"POSIX",
"ids",
".",
"Index",
"must",
"be",
"immediately",
"after",
"the",
"country",
"or",
"... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L394-L442 |
34,840 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.getLanguageScriptCountryVariant | public String[] getLanguageScriptCountryVariant() {
reset();
return new String[] {
getString(parseLanguage()),
getString(parseScript()),
getString(parseCountry()),
getString(parseVariant())
};
} | java | public String[] getLanguageScriptCountryVariant() {
reset();
return new String[] {
getString(parseLanguage()),
getString(parseScript()),
getString(parseCountry()),
getString(parseVariant())
};
} | [
"public",
"String",
"[",
"]",
"getLanguageScriptCountryVariant",
"(",
")",
"{",
"reset",
"(",
")",
";",
"return",
"new",
"String",
"[",
"]",
"{",
"getString",
"(",
"parseLanguage",
"(",
")",
")",
",",
"getString",
"(",
"parseScript",
"(",
")",
")",
",",
... | Returns the language, script, country, and variant as separate strings. | [
"Returns",
"the",
"language",
"script",
"country",
"and",
"variant",
"as",
"separate",
"strings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L488-L496 |
34,841 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.setToKeywordStart | private boolean setToKeywordStart() {
for (int i = index; i < id.length; ++i) {
if (id[i] == KEYWORD_SEPARATOR) {
if (canonicalize) {
for (int j = ++i; j < id.length; ++j) { // increment i past separator for return
if (id[j] == KEYWORD_ASSIGN) {
index = i;
return true;
}
}
} else {
if (++i < id.length) {
index = i;
return true;
}
}
break;
}
}
return false;
} | java | private boolean setToKeywordStart() {
for (int i = index; i < id.length; ++i) {
if (id[i] == KEYWORD_SEPARATOR) {
if (canonicalize) {
for (int j = ++i; j < id.length; ++j) { // increment i past separator for return
if (id[j] == KEYWORD_ASSIGN) {
index = i;
return true;
}
}
} else {
if (++i < id.length) {
index = i;
return true;
}
}
break;
}
}
return false;
} | [
"private",
"boolean",
"setToKeywordStart",
"(",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"index",
";",
"i",
"<",
"id",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",
"(",
"id",
"[",
"i",
"]",
"==",
"KEYWORD_SEPARATOR",
")",
"{",
"if",
"(",
"canonic... | If we have keywords, advance index to the start of the keywords and return true,
otherwise return false. | [
"If",
"we",
"have",
"keywords",
"advance",
"index",
"to",
"the",
"start",
"of",
"the",
"keywords",
"and",
"return",
"true",
"otherwise",
"return",
"false",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L548-L568 |
34,842 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.getKeywordMap | public Map<String, String> getKeywordMap() {
if (keywords == null) {
TreeMap<String, String> m = null;
if (setToKeywordStart()) {
// trim spaces and convert to lower case, both keywords and values.
do {
String key = getKeyword();
if (key.length() == 0) {
break;
}
char c = next();
if (c != KEYWORD_ASSIGN) {
// throw new IllegalArgumentException("key '" + key + "' missing a value.");
if (c == DONE) {
break;
} else {
continue;
}
}
String value = getValue();
if (value.length() == 0) {
// throw new IllegalArgumentException("key '" + key + "' missing a value.");
continue;
}
if (m == null) {
m = new TreeMap<String, String>(getKeyComparator());
} else if (m.containsKey(key)) {
// throw new IllegalArgumentException("key '" + key + "' already has a value.");
continue;
}
m.put(key, value);
} while (next() == ITEM_SEPARATOR);
}
keywords = m != null ? m : Collections.<String, String>emptyMap();
}
return keywords;
} | java | public Map<String, String> getKeywordMap() {
if (keywords == null) {
TreeMap<String, String> m = null;
if (setToKeywordStart()) {
// trim spaces and convert to lower case, both keywords and values.
do {
String key = getKeyword();
if (key.length() == 0) {
break;
}
char c = next();
if (c != KEYWORD_ASSIGN) {
// throw new IllegalArgumentException("key '" + key + "' missing a value.");
if (c == DONE) {
break;
} else {
continue;
}
}
String value = getValue();
if (value.length() == 0) {
// throw new IllegalArgumentException("key '" + key + "' missing a value.");
continue;
}
if (m == null) {
m = new TreeMap<String, String>(getKeyComparator());
} else if (m.containsKey(key)) {
// throw new IllegalArgumentException("key '" + key + "' already has a value.");
continue;
}
m.put(key, value);
} while (next() == ITEM_SEPARATOR);
}
keywords = m != null ? m : Collections.<String, String>emptyMap();
}
return keywords;
} | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getKeywordMap",
"(",
")",
"{",
"if",
"(",
"keywords",
"==",
"null",
")",
"{",
"TreeMap",
"<",
"String",
",",
"String",
">",
"m",
"=",
"null",
";",
"if",
"(",
"setToKeywordStart",
"(",
")",
")",
"... | Returns a map of the keywords and values, or null if there are none. | [
"Returns",
"a",
"map",
"of",
"the",
"keywords",
"and",
"values",
"or",
"null",
"if",
"there",
"are",
"none",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L607-L644 |
34,843 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.parseKeywords | private int parseKeywords() {
int oldBlen = buffer.length();
Map<String, String> m = getKeywordMap();
if (!m.isEmpty()) {
boolean first = true;
for (Map.Entry<String, String> e : m.entrySet()) {
append(first ? KEYWORD_SEPARATOR : ITEM_SEPARATOR);
first = false;
append(e.getKey());
append(KEYWORD_ASSIGN);
append(e.getValue());
}
if (first == false) {
++oldBlen;
}
}
return oldBlen;
} | java | private int parseKeywords() {
int oldBlen = buffer.length();
Map<String, String> m = getKeywordMap();
if (!m.isEmpty()) {
boolean first = true;
for (Map.Entry<String, String> e : m.entrySet()) {
append(first ? KEYWORD_SEPARATOR : ITEM_SEPARATOR);
first = false;
append(e.getKey());
append(KEYWORD_ASSIGN);
append(e.getValue());
}
if (first == false) {
++oldBlen;
}
}
return oldBlen;
} | [
"private",
"int",
"parseKeywords",
"(",
")",
"{",
"int",
"oldBlen",
"=",
"buffer",
".",
"length",
"(",
")",
";",
"Map",
"<",
"String",
",",
"String",
">",
"m",
"=",
"getKeywordMap",
"(",
")",
";",
"if",
"(",
"!",
"m",
".",
"isEmpty",
"(",
")",
")... | Parse the keywords and return start of the string in the buffer. | [
"Parse",
"the",
"keywords",
"and",
"return",
"start",
"of",
"the",
"string",
"in",
"the",
"buffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L650-L667 |
34,844 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.getKeywords | public Iterator<String> getKeywords() {
Map<String, String> m = getKeywordMap();
return m.isEmpty() ? null : m.keySet().iterator();
} | java | public Iterator<String> getKeywords() {
Map<String, String> m = getKeywordMap();
return m.isEmpty() ? null : m.keySet().iterator();
} | [
"public",
"Iterator",
"<",
"String",
">",
"getKeywords",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"m",
"=",
"getKeywordMap",
"(",
")",
";",
"return",
"m",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"m",
".",
"keySet",
"(",
")",
"... | Returns an iterator over the keywords, or null if we have an empty map. | [
"Returns",
"an",
"iterator",
"over",
"the",
"keywords",
"or",
"null",
"if",
"we",
"have",
"an",
"empty",
"map",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L672-L675 |
34,845 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java | LocaleIDParser.getKeywordValue | public String getKeywordValue(String keywordName) {
Map<String, String> m = getKeywordMap();
return m.isEmpty() ? null : m.get(AsciiUtil.toLowerString(keywordName.trim()));
} | java | public String getKeywordValue(String keywordName) {
Map<String, String> m = getKeywordMap();
return m.isEmpty() ? null : m.get(AsciiUtil.toLowerString(keywordName.trim()));
} | [
"public",
"String",
"getKeywordValue",
"(",
"String",
"keywordName",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"m",
"=",
"getKeywordMap",
"(",
")",
";",
"return",
"m",
".",
"isEmpty",
"(",
")",
"?",
"null",
":",
"m",
".",
"get",
"(",
"Ascii... | Returns the value for the named keyword, or null if the keyword is not
present. | [
"Returns",
"the",
"value",
"for",
"the",
"named",
"keyword",
"or",
"null",
"if",
"the",
"keyword",
"is",
"not",
"present",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/LocaleIDParser.java#L681-L684 |
34,846 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralFormat.java | PluralFormat.applyPattern | public void applyPattern(String pattern) {
this.pattern = pattern;
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
try {
msgPattern.parsePluralStyle(pattern);
offset = msgPattern.getPluralOffset(0);
} catch(RuntimeException e) {
resetPattern();
throw e;
}
} | java | public void applyPattern(String pattern) {
this.pattern = pattern;
if (msgPattern == null) {
msgPattern = new MessagePattern();
}
try {
msgPattern.parsePluralStyle(pattern);
offset = msgPattern.getPluralOffset(0);
} catch(RuntimeException e) {
resetPattern();
throw e;
}
} | [
"public",
"void",
"applyPattern",
"(",
"String",
"pattern",
")",
"{",
"this",
".",
"pattern",
"=",
"pattern",
";",
"if",
"(",
"msgPattern",
"==",
"null",
")",
"{",
"msgPattern",
"=",
"new",
"MessagePattern",
"(",
")",
";",
"}",
"try",
"{",
"msgPattern",
... | Sets the pattern used by this plural format.
The method parses the pattern and creates a map of format strings
for the plural rules.
Patterns and their interpretation are specified in the class description.
@param pattern the pattern for this plural format.
@throws IllegalArgumentException if the pattern is invalid. | [
"Sets",
"the",
"pattern",
"used",
"by",
"this",
"plural",
"format",
".",
"The",
"method",
"parses",
"the",
"pattern",
"and",
"creates",
"a",
"map",
"of",
"format",
"strings",
"for",
"the",
"plural",
"rules",
".",
"Patterns",
"and",
"their",
"interpretation",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/PluralFormat.java#L400-L412 |
34,847 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java | PKCS9Attributes.decode | private byte[] decode(DerInputStream in) throws IOException {
DerValue val = in.getDerValue();
// save the DER encoding with its proper tag byte.
byte[] derEncoding = val.toByteArray();
derEncoding[0] = DerValue.tag_SetOf;
DerInputStream derIn = new DerInputStream(derEncoding);
DerValue[] derVals = derIn.getSet(3,true);
PKCS9Attribute attrib;
ObjectIdentifier oid;
boolean reuseEncoding = true;
for (int i=0; i < derVals.length; i++) {
try {
attrib = new PKCS9Attribute(derVals[i]);
} catch (ParsingException e) {
if (ignoreUnsupportedAttributes) {
reuseEncoding = false; // cannot reuse supplied DER encoding
continue; // skip
} else {
throw e;
}
}
oid = attrib.getOID();
if (attributes.get(oid) != null)
throw new IOException("Duplicate PKCS9 attribute: " + oid);
if (permittedAttributes != null &&
!permittedAttributes.containsKey(oid))
throw new IOException("Attribute " + oid +
" not permitted in this attribute set");
attributes.put(oid, attrib);
}
return reuseEncoding ? derEncoding : generateDerEncoding();
} | java | private byte[] decode(DerInputStream in) throws IOException {
DerValue val = in.getDerValue();
// save the DER encoding with its proper tag byte.
byte[] derEncoding = val.toByteArray();
derEncoding[0] = DerValue.tag_SetOf;
DerInputStream derIn = new DerInputStream(derEncoding);
DerValue[] derVals = derIn.getSet(3,true);
PKCS9Attribute attrib;
ObjectIdentifier oid;
boolean reuseEncoding = true;
for (int i=0; i < derVals.length; i++) {
try {
attrib = new PKCS9Attribute(derVals[i]);
} catch (ParsingException e) {
if (ignoreUnsupportedAttributes) {
reuseEncoding = false; // cannot reuse supplied DER encoding
continue; // skip
} else {
throw e;
}
}
oid = attrib.getOID();
if (attributes.get(oid) != null)
throw new IOException("Duplicate PKCS9 attribute: " + oid);
if (permittedAttributes != null &&
!permittedAttributes.containsKey(oid))
throw new IOException("Attribute " + oid +
" not permitted in this attribute set");
attributes.put(oid, attrib);
}
return reuseEncoding ? derEncoding : generateDerEncoding();
} | [
"private",
"byte",
"[",
"]",
"decode",
"(",
"DerInputStream",
"in",
")",
"throws",
"IOException",
"{",
"DerValue",
"val",
"=",
"in",
".",
"getDerValue",
"(",
")",
";",
"// save the DER encoding with its proper tag byte.",
"byte",
"[",
"]",
"derEncoding",
"=",
"v... | Decode this set of PKCS9 attributes from the contents of its
DER encoding. Ignores unsupported attributes when directed.
@param in
the contents of the DER encoding of the attribute set.
@exception IOException
on i/o error, encoding syntax error, unacceptable or
unsupported attribute, or duplicate attribute. | [
"Decode",
"this",
"set",
"of",
"PKCS9",
"attributes",
"from",
"the",
"contents",
"of",
"its",
"DER",
"encoding",
".",
"Ignores",
"unsupported",
"attributes",
"when",
"directed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java#L186-L227 |
34,848 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java | PKCS9Attributes.encode | public void encode(byte tag, OutputStream out) throws IOException {
out.write(tag);
out.write(derEncoding, 1, derEncoding.length -1);
} | java | public void encode(byte tag, OutputStream out) throws IOException {
out.write(tag);
out.write(derEncoding, 1, derEncoding.length -1);
} | [
"public",
"void",
"encode",
"(",
"byte",
"tag",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"out",
".",
"write",
"(",
"tag",
")",
";",
"out",
".",
"write",
"(",
"derEncoding",
",",
"1",
",",
"derEncoding",
".",
"length",
"-",
"1",
... | Put the DER encoding of this PKCS9 attribute set on an
DerOutputStream, tagged with the given implicit tag.
@param tag the implicit tag to use in the DER encoding.
@param out the output stream on which to put the DER encoding.
@exception IOException on output error. | [
"Put",
"the",
"DER",
"encoding",
"of",
"this",
"PKCS9",
"attribute",
"set",
"on",
"an",
"DerOutputStream",
"tagged",
"with",
"the",
"given",
"implicit",
"tag",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java#L238-L241 |
34,849 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java | PKCS9Attributes.getAttributes | public PKCS9Attribute[] getAttributes() {
PKCS9Attribute[] attribs = new PKCS9Attribute[attributes.size()];
ObjectIdentifier oid;
int j = 0;
for (int i=1; i < PKCS9Attribute.PKCS9_OIDS.length &&
j < attribs.length; i++) {
attribs[j] = getAttribute(PKCS9Attribute.PKCS9_OIDS[i]);
if (attribs[j] != null)
j++;
}
return attribs;
} | java | public PKCS9Attribute[] getAttributes() {
PKCS9Attribute[] attribs = new PKCS9Attribute[attributes.size()];
ObjectIdentifier oid;
int j = 0;
for (int i=1; i < PKCS9Attribute.PKCS9_OIDS.length &&
j < attribs.length; i++) {
attribs[j] = getAttribute(PKCS9Attribute.PKCS9_OIDS[i]);
if (attribs[j] != null)
j++;
}
return attribs;
} | [
"public",
"PKCS9Attribute",
"[",
"]",
"getAttributes",
"(",
")",
"{",
"PKCS9Attribute",
"[",
"]",
"attribs",
"=",
"new",
"PKCS9Attribute",
"[",
"attributes",
".",
"size",
"(",
")",
"]",
";",
"ObjectIdentifier",
"oid",
";",
"int",
"j",
"=",
"0",
";",
"for... | Get an array of all attributes in this set, in order of OID. | [
"Get",
"an",
"array",
"of",
"all",
"attributes",
"in",
"this",
"set",
"in",
"order",
"of",
"OID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java#L279-L292 |
34,850 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java | PKCS9Attributes.getAttributeValue | public Object getAttributeValue(ObjectIdentifier oid)
throws IOException {
try {
Object value = getAttribute(oid).getValue();
return value;
} catch (NullPointerException ex) {
throw new IOException("No value found for attribute " + oid);
}
} | java | public Object getAttributeValue(ObjectIdentifier oid)
throws IOException {
try {
Object value = getAttribute(oid).getValue();
return value;
} catch (NullPointerException ex) {
throw new IOException("No value found for attribute " + oid);
}
} | [
"public",
"Object",
"getAttributeValue",
"(",
"ObjectIdentifier",
"oid",
")",
"throws",
"IOException",
"{",
"try",
"{",
"Object",
"value",
"=",
"getAttribute",
"(",
"oid",
")",
".",
"getValue",
"(",
")",
";",
"return",
"value",
";",
"}",
"catch",
"(",
"Nul... | Get an attribute value by OID. | [
"Get",
"an",
"attribute",
"value",
"by",
"OID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java#L297-L306 |
34,851 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java | PKCS9Attributes.getAttributeValue | public Object getAttributeValue(String name) throws IOException {
ObjectIdentifier oid = PKCS9Attribute.getOID(name);
if (oid == null)
throw new IOException("Attribute name " + name +
" not recognized or not supported.");
return getAttributeValue(oid);
} | java | public Object getAttributeValue(String name) throws IOException {
ObjectIdentifier oid = PKCS9Attribute.getOID(name);
if (oid == null)
throw new IOException("Attribute name " + name +
" not recognized or not supported.");
return getAttributeValue(oid);
} | [
"public",
"Object",
"getAttributeValue",
"(",
"String",
"name",
")",
"throws",
"IOException",
"{",
"ObjectIdentifier",
"oid",
"=",
"PKCS9Attribute",
".",
"getOID",
"(",
"name",
")",
";",
"if",
"(",
"oid",
"==",
"null",
")",
"throw",
"new",
"IOException",
"("... | Get an attribute value by type name. | [
"Get",
"an",
"attribute",
"value",
"by",
"type",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/pkcs/PKCS9Attributes.java#L311-L319 |
34,852 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GregorianCalendar.java | GregorianCalendar.roll | public void roll(int field, int amount) {
switch (field) {
case WEEK_OF_YEAR:
{
// Unlike WEEK_OF_MONTH, WEEK_OF_YEAR never shifts the day of the
// week. Also, rolling the week of the year can have seemingly
// strange effects simply because the year of the week of year
// may be different from the calendar year. For example, the
// date Dec 28, 1997 is the first day of week 1 of 1998 (if
// weeks start on Sunday and the minimal days in first week is
// <= 3).
int woy = get(WEEK_OF_YEAR);
// Get the ISO year, which matches the week of year. This
// may be one year before or after the calendar year.
int isoYear = get(YEAR_WOY);
int isoDoy = internalGet(DAY_OF_YEAR);
if (internalGet(MONTH) == Calendar.JANUARY) {
if (woy >= 52) {
isoDoy += handleGetYearLength(isoYear);
}
} else {
if (woy == 1) {
isoDoy -= handleGetYearLength(isoYear - 1);
}
}
woy += amount;
// Do fast checks to avoid unnecessary computation:
if (woy < 1 || woy > 52) {
// Determine the last week of the ISO year.
// We do this using the standard formula we use
// everywhere in this file. If we can see that the
// days at the end of the year are going to fall into
// week 1 of the next year, we drop the last week by
// subtracting 7 from the last day of the year.
int lastDoy = handleGetYearLength(isoYear);
int lastRelDow = (lastDoy - isoDoy + internalGet(DAY_OF_WEEK) -
getFirstDayOfWeek()) % 7;
if (lastRelDow < 0) lastRelDow += 7;
if ((6 - lastRelDow) >= getMinimalDaysInFirstWeek()) lastDoy -= 7;
int lastWoy = weekNumber(lastDoy, lastRelDow + 1);
woy = ((woy + lastWoy - 1) % lastWoy) + 1;
}
set(WEEK_OF_YEAR, woy);
set(YEAR, isoYear); // Why not YEAR_WOY? - Alan 11/6/00
return;
}
default:
super.roll(field, amount);
return;
}
} | java | public void roll(int field, int amount) {
switch (field) {
case WEEK_OF_YEAR:
{
// Unlike WEEK_OF_MONTH, WEEK_OF_YEAR never shifts the day of the
// week. Also, rolling the week of the year can have seemingly
// strange effects simply because the year of the week of year
// may be different from the calendar year. For example, the
// date Dec 28, 1997 is the first day of week 1 of 1998 (if
// weeks start on Sunday and the minimal days in first week is
// <= 3).
int woy = get(WEEK_OF_YEAR);
// Get the ISO year, which matches the week of year. This
// may be one year before or after the calendar year.
int isoYear = get(YEAR_WOY);
int isoDoy = internalGet(DAY_OF_YEAR);
if (internalGet(MONTH) == Calendar.JANUARY) {
if (woy >= 52) {
isoDoy += handleGetYearLength(isoYear);
}
} else {
if (woy == 1) {
isoDoy -= handleGetYearLength(isoYear - 1);
}
}
woy += amount;
// Do fast checks to avoid unnecessary computation:
if (woy < 1 || woy > 52) {
// Determine the last week of the ISO year.
// We do this using the standard formula we use
// everywhere in this file. If we can see that the
// days at the end of the year are going to fall into
// week 1 of the next year, we drop the last week by
// subtracting 7 from the last day of the year.
int lastDoy = handleGetYearLength(isoYear);
int lastRelDow = (lastDoy - isoDoy + internalGet(DAY_OF_WEEK) -
getFirstDayOfWeek()) % 7;
if (lastRelDow < 0) lastRelDow += 7;
if ((6 - lastRelDow) >= getMinimalDaysInFirstWeek()) lastDoy -= 7;
int lastWoy = weekNumber(lastDoy, lastRelDow + 1);
woy = ((woy + lastWoy - 1) % lastWoy) + 1;
}
set(WEEK_OF_YEAR, woy);
set(YEAR, isoYear); // Why not YEAR_WOY? - Alan 11/6/00
return;
}
default:
super.roll(field, amount);
return;
}
} | [
"public",
"void",
"roll",
"(",
"int",
"field",
",",
"int",
"amount",
")",
"{",
"switch",
"(",
"field",
")",
"{",
"case",
"WEEK_OF_YEAR",
":",
"{",
"// Unlike WEEK_OF_MONTH, WEEK_OF_YEAR never shifts the day of the",
"// week. Also, rolling the week of the year can have see... | Roll a field by a signed amount. | [
"Roll",
"a",
"field",
"by",
"a",
"signed",
"amount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GregorianCalendar.java#L538-L590 |
34,853 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GregorianCalendar.java | GregorianCalendar.getActualMaximum | public int getActualMaximum(int field) {
/* It is a known limitation that the code here (and in getActualMinimum)
* won't behave properly at the extreme limits of GregorianCalendar's
* representable range (except for the code that handles the YEAR
* field). That's because the ends of the representable range are at
* odd spots in the year. For calendars with the default Gregorian
* cutover, these limits are Sun Dec 02 16:47:04 GMT 292269055 BC to Sun
* Aug 17 07:12:55 GMT 292278994 AD, somewhat different for non-GMT
* zones. As a result, if the calendar is set to Aug 1 292278994 AD,
* the actual maximum of DAY_OF_MONTH is 17, not 30. If the date is Mar
* 31 in that year, the actual maximum month might be Jul, whereas is
* the date is Mar 15, the actual maximum might be Aug -- depending on
* the precise semantics that are desired. Similar considerations
* affect all fields. Nonetheless, this effect is sufficiently arcane
* that we permit it, rather than complicating the code to handle such
* intricacies. - liu 8/20/98
* UPDATE: No longer true, since we have pulled in the limit values on
* the year. - Liu 11/6/00 */
switch (field) {
case YEAR:
/* The year computation is no different, in principle, from the
* others, however, the range of possible maxima is large. In
* addition, the way we know we've exceeded the range is different.
* For these reasons, we use the special case code below to handle
* this field.
*
* The actual maxima for YEAR depend on the type of calendar:
*
* Gregorian = May 17, 292275056 BC - Aug 17, 292278994 AD
* Julian = Dec 2, 292269055 BC - Jan 3, 292272993 AD
* Hybrid = Dec 2, 292269055 BC - Aug 17, 292278994 AD
*
* We know we've exceeded the maximum when either the month, date,
* time, or era changes in response to setting the year. We don't
* check for month, date, and time here because the year and era are
* sufficient to detect an invalid year setting. NOTE: If code is
* added to check the month and date in the future for some reason,
* Feb 29 must be allowed to shift to Mar 1 when setting the year.
*/
{
Calendar cal = (Calendar) clone();
cal.setLenient(true);
int era = cal.get(ERA);
Date d = cal.getTime();
/* Perform a binary search, with the invariant that lowGood is a
* valid year, and highBad is an out of range year.
*/
int lowGood = LIMITS[YEAR][1];
int highBad = LIMITS[YEAR][2]+1;
while ((lowGood + 1) < highBad) {
int y = (lowGood + highBad) / 2;
cal.set(YEAR, y);
if (cal.get(YEAR) == y && cal.get(ERA) == era) {
lowGood = y;
} else {
highBad = y;
cal.setTime(d); // Restore original fields
}
}
return lowGood;
}
default:
return super.getActualMaximum(field);
}
} | java | public int getActualMaximum(int field) {
/* It is a known limitation that the code here (and in getActualMinimum)
* won't behave properly at the extreme limits of GregorianCalendar's
* representable range (except for the code that handles the YEAR
* field). That's because the ends of the representable range are at
* odd spots in the year. For calendars with the default Gregorian
* cutover, these limits are Sun Dec 02 16:47:04 GMT 292269055 BC to Sun
* Aug 17 07:12:55 GMT 292278994 AD, somewhat different for non-GMT
* zones. As a result, if the calendar is set to Aug 1 292278994 AD,
* the actual maximum of DAY_OF_MONTH is 17, not 30. If the date is Mar
* 31 in that year, the actual maximum month might be Jul, whereas is
* the date is Mar 15, the actual maximum might be Aug -- depending on
* the precise semantics that are desired. Similar considerations
* affect all fields. Nonetheless, this effect is sufficiently arcane
* that we permit it, rather than complicating the code to handle such
* intricacies. - liu 8/20/98
* UPDATE: No longer true, since we have pulled in the limit values on
* the year. - Liu 11/6/00 */
switch (field) {
case YEAR:
/* The year computation is no different, in principle, from the
* others, however, the range of possible maxima is large. In
* addition, the way we know we've exceeded the range is different.
* For these reasons, we use the special case code below to handle
* this field.
*
* The actual maxima for YEAR depend on the type of calendar:
*
* Gregorian = May 17, 292275056 BC - Aug 17, 292278994 AD
* Julian = Dec 2, 292269055 BC - Jan 3, 292272993 AD
* Hybrid = Dec 2, 292269055 BC - Aug 17, 292278994 AD
*
* We know we've exceeded the maximum when either the month, date,
* time, or era changes in response to setting the year. We don't
* check for month, date, and time here because the year and era are
* sufficient to detect an invalid year setting. NOTE: If code is
* added to check the month and date in the future for some reason,
* Feb 29 must be allowed to shift to Mar 1 when setting the year.
*/
{
Calendar cal = (Calendar) clone();
cal.setLenient(true);
int era = cal.get(ERA);
Date d = cal.getTime();
/* Perform a binary search, with the invariant that lowGood is a
* valid year, and highBad is an out of range year.
*/
int lowGood = LIMITS[YEAR][1];
int highBad = LIMITS[YEAR][2]+1;
while ((lowGood + 1) < highBad) {
int y = (lowGood + highBad) / 2;
cal.set(YEAR, y);
if (cal.get(YEAR) == y && cal.get(ERA) == era) {
lowGood = y;
} else {
highBad = y;
cal.setTime(d); // Restore original fields
}
}
return lowGood;
}
default:
return super.getActualMaximum(field);
}
} | [
"public",
"int",
"getActualMaximum",
"(",
"int",
"field",
")",
"{",
"/* It is a known limitation that the code here (and in getActualMinimum)\n * won't behave properly at the extreme limits of GregorianCalendar's\n * representable range (except for the code that handles the YEAR\n ... | Return the maximum value that this field could have, given the current date.
For example, with the date "Feb 3, 1997" and the DAY_OF_MONTH field, the actual
maximum would be 28; for "Feb 3, 1996" it s 29. Similarly for a Hebrew calendar,
for some years the actual maximum for MONTH is 12, and for others 13. | [
"Return",
"the",
"maximum",
"value",
"that",
"this",
"field",
"could",
"have",
"given",
"the",
"current",
"date",
".",
"For",
"example",
"with",
"the",
"date",
"Feb",
"3",
"1997",
"and",
"the",
"DAY_OF_MONTH",
"field",
"the",
"actual",
"maximum",
"would",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/GregorianCalendar.java#L606-L677 |
34,854 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/KeyChecker.java | KeyChecker.check | @Override
public void check(Certificate cert, Collection<String> unresCritExts)
throws CertPathValidatorException
{
X509Certificate currCert = (X509Certificate)cert;
remainingCerts--;
// if final certificate, check that target constraints are satisfied
if (remainingCerts == 0) {
if (targetConstraints != null &&
targetConstraints.match(currCert) == false) {
throw new CertPathValidatorException("target certificate " +
"constraints check failed");
}
} else {
// otherwise, verify that keyCertSign bit is set in CA certificate
verifyCAKeyUsage(currCert);
}
// remove the extensions that we have checked
if (unresCritExts != null && !unresCritExts.isEmpty()) {
unresCritExts.remove(KeyUsage_Id.toString());
unresCritExts.remove(ExtendedKeyUsage_Id.toString());
unresCritExts.remove(SubjectAlternativeName_Id.toString());
}
} | java | @Override
public void check(Certificate cert, Collection<String> unresCritExts)
throws CertPathValidatorException
{
X509Certificate currCert = (X509Certificate)cert;
remainingCerts--;
// if final certificate, check that target constraints are satisfied
if (remainingCerts == 0) {
if (targetConstraints != null &&
targetConstraints.match(currCert) == false) {
throw new CertPathValidatorException("target certificate " +
"constraints check failed");
}
} else {
// otherwise, verify that keyCertSign bit is set in CA certificate
verifyCAKeyUsage(currCert);
}
// remove the extensions that we have checked
if (unresCritExts != null && !unresCritExts.isEmpty()) {
unresCritExts.remove(KeyUsage_Id.toString());
unresCritExts.remove(ExtendedKeyUsage_Id.toString());
unresCritExts.remove(SubjectAlternativeName_Id.toString());
}
} | [
"@",
"Override",
"public",
"void",
"check",
"(",
"Certificate",
"cert",
",",
"Collection",
"<",
"String",
">",
"unresCritExts",
")",
"throws",
"CertPathValidatorException",
"{",
"X509Certificate",
"currCert",
"=",
"(",
"X509Certificate",
")",
"cert",
";",
"remaini... | Checks that keyUsage and target constraints are satisfied by
the specified certificate.
@param cert the Certificate
@param unresolvedCritExts the unresolved critical extensions
@throws CertPathValidatorException if certificate does not verify | [
"Checks",
"that",
"keyUsage",
"and",
"target",
"constraints",
"are",
"satisfied",
"by",
"the",
"specified",
"certificate",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/KeyChecker.java#L105-L131 |
34,855 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/Autoboxer.java | Autoboxer.unbox | private void unbox(Expression expr, PrimitiveType primitiveType) {
TypeElement boxedClass = findBoxedSuperclass(expr.getTypeMirror());
if (primitiveType == null && boxedClass != null) {
primitiveType = typeUtil.unboxedType(boxedClass.asType());
}
if (primitiveType == null) {
return;
}
ExecutableElement valueMethod = ElementUtil.findMethod(
boxedClass, TypeUtil.getName(primitiveType) + VALUE_METHOD);
assert valueMethod != null : "could not find value method for " + boxedClass;
MethodInvocation invocation = new MethodInvocation(new ExecutablePair(valueMethod), null);
expr.replaceWith(invocation);
invocation.setExpression(expr);
} | java | private void unbox(Expression expr, PrimitiveType primitiveType) {
TypeElement boxedClass = findBoxedSuperclass(expr.getTypeMirror());
if (primitiveType == null && boxedClass != null) {
primitiveType = typeUtil.unboxedType(boxedClass.asType());
}
if (primitiveType == null) {
return;
}
ExecutableElement valueMethod = ElementUtil.findMethod(
boxedClass, TypeUtil.getName(primitiveType) + VALUE_METHOD);
assert valueMethod != null : "could not find value method for " + boxedClass;
MethodInvocation invocation = new MethodInvocation(new ExecutablePair(valueMethod), null);
expr.replaceWith(invocation);
invocation.setExpression(expr);
} | [
"private",
"void",
"unbox",
"(",
"Expression",
"expr",
",",
"PrimitiveType",
"primitiveType",
")",
"{",
"TypeElement",
"boxedClass",
"=",
"findBoxedSuperclass",
"(",
"expr",
".",
"getTypeMirror",
"(",
")",
")",
";",
"if",
"(",
"primitiveType",
"==",
"null",
"&... | Convert a wrapper class instance to a specified primitive equivalent. | [
"Convert",
"a",
"wrapper",
"class",
"instance",
"to",
"a",
"specified",
"primitive",
"equivalent",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/Autoboxer.java#L121-L135 |
34,856 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Integer.java | Integer.getInteger | public static Integer getInteger(String nm, int val) {
Integer result = getInteger(nm, null);
return (result == null) ? Integer.valueOf(val) : result;
} | java | public static Integer getInteger(String nm, int val) {
Integer result = getInteger(nm, null);
return (result == null) ? Integer.valueOf(val) : result;
} | [
"public",
"static",
"Integer",
"getInteger",
"(",
"String",
"nm",
",",
"int",
"val",
")",
"{",
"Integer",
"result",
"=",
"getInteger",
"(",
"nm",
",",
"null",
")",
";",
"return",
"(",
"result",
"==",
"null",
")",
"?",
"Integer",
".",
"valueOf",
"(",
... | Determines the integer value of the system property with the
specified name.
<p>The first argument is treated as the name of a system
property. System properties are accessible through the {@link
java.lang.System#getProperty(java.lang.String)} method. The
string value of this property is then interpreted as an integer
value using the grammar supported by {@link Integer#decode decode} and
an {@code Integer} object representing this value is returned.
<p>The second argument is the default value. An {@code Integer} object
that represents the value of the second argument is returned if there
is no property of the specified name, if the property does not have
the correct numeric format, or if the specified name is empty or
{@code null}.
<p>In other words, this method returns an {@code Integer} object
equal to the value of:
<blockquote>
{@code getInteger(nm, new Integer(val))}
</blockquote>
but in practice it may be implemented in a manner such as:
<blockquote><pre>
Integer result = getInteger(nm, null);
return (result == null) ? new Integer(val) : result;
</pre></blockquote>
to avoid the unnecessary allocation of an {@code Integer}
object when the default value is not needed.
@param nm property name.
@param val default value.
@return the {@code Integer} value of the property.
@throws SecurityException for the same reasons as
{@link System#getProperty(String) System.getProperty}
@see java.lang.System#getProperty(java.lang.String)
@see java.lang.System#getProperty(java.lang.String, java.lang.String) | [
"Determines",
"the",
"integer",
"value",
"of",
"the",
"system",
"property",
"with",
"the",
"specified",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Integer.java#L856-L859 |
34,857 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.format | @Override
public final StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition fieldPosition)
{
if (obj instanceof Calendar)
return format( (Calendar)obj, toAppendTo, fieldPosition );
else if (obj instanceof Date)
return format( (Date)obj, toAppendTo, fieldPosition );
else if (obj instanceof Number)
return format( new Date(((Number)obj).longValue()),
toAppendTo, fieldPosition );
else
throw new IllegalArgumentException("Cannot format given Object (" +
obj.getClass().getName() + ") as a Date");
} | java | @Override
public final StringBuffer format(Object obj, StringBuffer toAppendTo,
FieldPosition fieldPosition)
{
if (obj instanceof Calendar)
return format( (Calendar)obj, toAppendTo, fieldPosition );
else if (obj instanceof Date)
return format( (Date)obj, toAppendTo, fieldPosition );
else if (obj instanceof Number)
return format( new Date(((Number)obj).longValue()),
toAppendTo, fieldPosition );
else
throw new IllegalArgumentException("Cannot format given Object (" +
obj.getClass().getName() + ") as a Date");
} | [
"@",
"Override",
"public",
"final",
"StringBuffer",
"format",
"(",
"Object",
"obj",
",",
"StringBuffer",
"toAppendTo",
",",
"FieldPosition",
"fieldPosition",
")",
"{",
"if",
"(",
"obj",
"instanceof",
"Calendar",
")",
"return",
"format",
"(",
"(",
"Calendar",
"... | Formats a time object into a time string. Examples of time objects
are a time value expressed in milliseconds and a Date object.
@param obj must be a Number or a Date or a Calendar.
@param toAppendTo the string buffer for the returning time string.
@return the formatted time string.
@param fieldPosition keeps track of the position of the field
within the returned string.
On input: an alignment field,
if desired. On output: the offsets of the alignment field. For
example, given a time text "1996.07.10 AD at 15:08:56 PDT",
if the given fieldPosition is DateFormat.YEAR_FIELD, the
begin index and end index of fieldPosition will be set to
0 and 4, respectively.
Notice that if the same time field appears
more than once in a pattern, the fieldPosition will be set for the first
occurrence of that time field. For instance, formatting a Date to
the time string "1 PM PDT (Pacific Daylight Time)" using the pattern
"h a z (zzzz)" and the alignment field DateFormat.TIMEZONE_FIELD,
the begin index and end index of fieldPosition will be set to
5 and 8, respectively, for the first occurrence of the timezone
pattern character 'z'.
@see java.text.Format | [
"Formats",
"a",
"time",
"object",
"into",
"a",
"time",
"string",
".",
"Examples",
"of",
"time",
"objects",
"are",
"a",
"time",
"value",
"expressed",
"in",
"milliseconds",
"and",
"a",
"Date",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L549-L563 |
34,858 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getDateInstance | public final static DateFormat getDateInstance(int style,
Locale aLocale)
{
return get(style, -1, ULocale.forLocale(aLocale), null);
} | java | public final static DateFormat getDateInstance(int style,
Locale aLocale)
{
return get(style, -1, ULocale.forLocale(aLocale), null);
} | [
"public",
"final",
"static",
"DateFormat",
"getDateInstance",
"(",
"int",
"style",
",",
"Locale",
"aLocale",
")",
"{",
"return",
"get",
"(",
"style",
",",
"-",
"1",
",",
"ULocale",
".",
"forLocale",
"(",
"aLocale",
")",
",",
"null",
")",
";",
"}"
] | Returns the date formatter with the given formatting style
for the given locale.
@param style the given formatting style. For example,
SHORT for "M/d/yy" in the US locale. As currently implemented, relative date
formatting only affects a limited range of calendar days before or after the
current date, based on the CLDR <field type="day">/<relative> data: For example,
in English, "Yesterday", "Today", and "Tomorrow". Outside of this range, relative
dates are formatted using the corresponding non-relative style.
@param aLocale the given locale.
@return a date formatter. | [
"Returns",
"the",
"date",
"formatter",
"with",
"the",
"given",
"formatting",
"style",
"for",
"the",
"given",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1316-L1320 |
34,859 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.setBooleanAttribute | public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value)
{
if(key.equals(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) {
key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
}
if(value)
{
booleanAttributes.add(key);
}
else
{
booleanAttributes.remove(key);
}
return this;
} | java | public DateFormat setBooleanAttribute(BooleanAttribute key, boolean value)
{
if(key.equals(DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH)) {
key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
}
if(value)
{
booleanAttributes.add(key);
}
else
{
booleanAttributes.remove(key);
}
return this;
} | [
"public",
"DateFormat",
"setBooleanAttribute",
"(",
"BooleanAttribute",
"key",
",",
"boolean",
"value",
")",
"{",
"if",
"(",
"key",
".",
"equals",
"(",
"DateFormat",
".",
"BooleanAttribute",
".",
"PARSE_PARTIAL_MATCH",
")",
")",
"{",
"key",
"=",
"DateFormat",
... | Sets a boolean attribute for this instance. Aspects of DateFormat leniency are controlled by
boolean attributes.
@see BooleanAttribute | [
"Sets",
"a",
"boolean",
"attribute",
"for",
"this",
"instance",
".",
"Aspects",
"of",
"DateFormat",
"leniency",
"are",
"controlled",
"by",
"boolean",
"attributes",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1564-L1579 |
34,860 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java | DateFormat.getBooleanAttribute | public boolean getBooleanAttribute(BooleanAttribute key)
{
if(key == DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH) {
key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
}
return booleanAttributes.contains(key);
} | java | public boolean getBooleanAttribute(BooleanAttribute key)
{
if(key == DateFormat.BooleanAttribute.PARSE_PARTIAL_MATCH) {
key = DateFormat.BooleanAttribute.PARSE_PARTIAL_LITERAL_MATCH;
}
return booleanAttributes.contains(key);
} | [
"public",
"boolean",
"getBooleanAttribute",
"(",
"BooleanAttribute",
"key",
")",
"{",
"if",
"(",
"key",
"==",
"DateFormat",
".",
"BooleanAttribute",
".",
"PARSE_PARTIAL_MATCH",
")",
"{",
"key",
"=",
"DateFormat",
".",
"BooleanAttribute",
".",
"PARSE_PARTIAL_LITERAL_... | Returns the current value for the specified BooleanAttribute for this instance
if attribute is missing false is returned.
@see BooleanAttribute | [
"Returns",
"the",
"current",
"value",
"for",
"the",
"specified",
"BooleanAttribute",
"for",
"this",
"instance"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/DateFormat.java#L1588-L1594 |
34,861 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/HasPositionalPredChecker.java | HasPositionalPredChecker.check | public static boolean check(LocPathIterator path)
{
HasPositionalPredChecker hppc = new HasPositionalPredChecker();
path.callVisitors(null, hppc);
return hppc.m_hasPositionalPred;
} | java | public static boolean check(LocPathIterator path)
{
HasPositionalPredChecker hppc = new HasPositionalPredChecker();
path.callVisitors(null, hppc);
return hppc.m_hasPositionalPred;
} | [
"public",
"static",
"boolean",
"check",
"(",
"LocPathIterator",
"path",
")",
"{",
"HasPositionalPredChecker",
"hppc",
"=",
"new",
"HasPositionalPredChecker",
"(",
")",
";",
"path",
".",
"callVisitors",
"(",
"null",
",",
"hppc",
")",
";",
"return",
"hppc",
".",... | Process the LocPathIterator to see if it contains variables
or functions that may make it context dependent.
@param path LocPathIterator that is assumed to be absolute, but needs checking.
@return true if the path is confirmed to be absolute, false if it
may contain context dependencies. | [
"Process",
"the",
"LocPathIterator",
"to",
"see",
"if",
"it",
"contains",
"variables",
"or",
"functions",
"that",
"may",
"make",
"it",
"context",
"dependent",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/axes/HasPositionalPredChecker.java#L50-L55 |
34,862 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Nodes.java | Nodes.emptyNode | @SuppressWarnings("unchecked")
static <T> Node<T> emptyNode(StreamShape shape) {
switch (shape) {
case REFERENCE: return (Node<T>) EMPTY_NODE;
case INT_VALUE: return (Node<T>) EMPTY_INT_NODE;
case LONG_VALUE: return (Node<T>) EMPTY_LONG_NODE;
case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
default:
throw new IllegalStateException("Unknown shape " + shape);
}
} | java | @SuppressWarnings("unchecked")
static <T> Node<T> emptyNode(StreamShape shape) {
switch (shape) {
case REFERENCE: return (Node<T>) EMPTY_NODE;
case INT_VALUE: return (Node<T>) EMPTY_INT_NODE;
case LONG_VALUE: return (Node<T>) EMPTY_LONG_NODE;
case DOUBLE_VALUE: return (Node<T>) EMPTY_DOUBLE_NODE;
default:
throw new IllegalStateException("Unknown shape " + shape);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"static",
"<",
"T",
">",
"Node",
"<",
"T",
">",
"emptyNode",
"(",
"StreamShape",
"shape",
")",
"{",
"switch",
"(",
"shape",
")",
"{",
"case",
"REFERENCE",
":",
"return",
"(",
"Node",
"<",
"T",
">",
... | Produces an empty node whose count is zero, has no children and no content.
@param <T> the type of elements of the created node
@param shape the shape of the node to be created
@return an empty node. | [
"Produces",
"an",
"empty",
"node",
"whose",
"count",
"is",
"zero",
"has",
"no",
"children",
"and",
"no",
"content",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/Nodes.java#L81-L91 |
34,863 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java | USerializedSet.getSet | public final boolean getSet(char src[], int srcStart) {
// leave most argument checking up to Java exceptions
array=null;
arrayOffset=bmpLength=length=0;
length=src[srcStart++];
if ((length&0x8000) != 0) {
/* there are supplementary values */
length&=0x7fff;
if(src.length<(srcStart+1+length)) {
length=0;
throw new IndexOutOfBoundsException();
}
bmpLength=src[srcStart++];
} else {
/* only BMP values */
if(src.length<(srcStart+length)) {
length=0;
throw new IndexOutOfBoundsException();
}
bmpLength=length;
}
array = new char[length];
System.arraycopy(src,srcStart,array,0,length);
//arrayOffset=srcStart;
return true;
} | java | public final boolean getSet(char src[], int srcStart) {
// leave most argument checking up to Java exceptions
array=null;
arrayOffset=bmpLength=length=0;
length=src[srcStart++];
if ((length&0x8000) != 0) {
/* there are supplementary values */
length&=0x7fff;
if(src.length<(srcStart+1+length)) {
length=0;
throw new IndexOutOfBoundsException();
}
bmpLength=src[srcStart++];
} else {
/* only BMP values */
if(src.length<(srcStart+length)) {
length=0;
throw new IndexOutOfBoundsException();
}
bmpLength=length;
}
array = new char[length];
System.arraycopy(src,srcStart,array,0,length);
//arrayOffset=srcStart;
return true;
} | [
"public",
"final",
"boolean",
"getSet",
"(",
"char",
"src",
"[",
"]",
",",
"int",
"srcStart",
")",
"{",
"// leave most argument checking up to Java exceptions",
"array",
"=",
"null",
";",
"arrayOffset",
"=",
"bmpLength",
"=",
"length",
"=",
"0",
";",
"length",
... | Fill in the given serialized set object.
@param src pointer to start of array
@param srcStart pointer to start of serialized data (length value)
@return true if the given array is valid, otherwise false | [
"Fill",
"in",
"the",
"given",
"serialized",
"set",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java#L32-L59 |
34,864 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java | USerializedSet.getRange | public final boolean getRange(int rangeIndex, int[] range) {
if( rangeIndex<0) {
return false;
}
if(array==null){
array = new char[8];
}
if(range==null || range.length <2){
throw new IllegalArgumentException();
}
rangeIndex*=2; /* address start/limit pairs */
if(rangeIndex<bmpLength) {
range[0]=array[rangeIndex++];
if(rangeIndex<bmpLength) {
range[1]=array[rangeIndex]-1;
} else if(rangeIndex<length) {
range[1]=((((int)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
} else {
range[1]=0x10ffff;
}
return true;
} else {
rangeIndex-=bmpLength;
rangeIndex*=2; /* address pairs of pairs of units */
int suppLength=length-bmpLength;
if(rangeIndex<suppLength) {
int offset=arrayOffset+bmpLength;
range[0]=(((int)array[offset+rangeIndex])<<16)|array[offset+rangeIndex+1];
rangeIndex+=2;
if(rangeIndex<suppLength) {
range[1]=((((int)array[offset+rangeIndex])<<16)|array[offset+rangeIndex+1])-1;
} else {
range[1]=0x10ffff;
}
return true;
} else {
return false;
}
}
} | java | public final boolean getRange(int rangeIndex, int[] range) {
if( rangeIndex<0) {
return false;
}
if(array==null){
array = new char[8];
}
if(range==null || range.length <2){
throw new IllegalArgumentException();
}
rangeIndex*=2; /* address start/limit pairs */
if(rangeIndex<bmpLength) {
range[0]=array[rangeIndex++];
if(rangeIndex<bmpLength) {
range[1]=array[rangeIndex]-1;
} else if(rangeIndex<length) {
range[1]=((((int)array[rangeIndex])<<16)|array[rangeIndex+1])-1;
} else {
range[1]=0x10ffff;
}
return true;
} else {
rangeIndex-=bmpLength;
rangeIndex*=2; /* address pairs of pairs of units */
int suppLength=length-bmpLength;
if(rangeIndex<suppLength) {
int offset=arrayOffset+bmpLength;
range[0]=(((int)array[offset+rangeIndex])<<16)|array[offset+rangeIndex+1];
rangeIndex+=2;
if(rangeIndex<suppLength) {
range[1]=((((int)array[offset+rangeIndex])<<16)|array[offset+rangeIndex+1])-1;
} else {
range[1]=0x10ffff;
}
return true;
} else {
return false;
}
}
} | [
"public",
"final",
"boolean",
"getRange",
"(",
"int",
"rangeIndex",
",",
"int",
"[",
"]",
"range",
")",
"{",
"if",
"(",
"rangeIndex",
"<",
"0",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"array",
"==",
"null",
")",
"{",
"array",
"=",
"new",
... | Returns a range of characters contained in the given serialized
set.
@param rangeIndex a non-negative integer in the range <code>0..
getSerializedRangeCount()-1</code>
@param range variable to receive the data in the range
@return true if rangeIndex is valid, otherwise false | [
"Returns",
"a",
"range",
"of",
"characters",
"contained",
"in",
"the",
"given",
"serialized",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java#L104-L143 |
34,865 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java | USerializedSet.contains | public final boolean contains(int c) {
if(c>0x10ffff) {
return false;
}
if(c<=0xffff) {
int i;
/* find c in the BMP part */
for(i=0; i<bmpLength && (char)c>=array[i]; ++i) {}
return ((i&1) != 0);
} else {
int i;
/* find c in the supplementary part */
char high=(char)(c>>16), low=(char)c;
for(i=bmpLength;
i<length && (high>array[i] || (high==array[i] && low>=array[i+1]));
i+=2) {}
/* count pairs of 16-bit units even per BMP and check if the number of pairs is odd */
return (((i+bmpLength)&2)!=0);
}
} | java | public final boolean contains(int c) {
if(c>0x10ffff) {
return false;
}
if(c<=0xffff) {
int i;
/* find c in the BMP part */
for(i=0; i<bmpLength && (char)c>=array[i]; ++i) {}
return ((i&1) != 0);
} else {
int i;
/* find c in the supplementary part */
char high=(char)(c>>16), low=(char)c;
for(i=bmpLength;
i<length && (high>array[i] || (high==array[i] && low>=array[i+1]));
i+=2) {}
/* count pairs of 16-bit units even per BMP and check if the number of pairs is odd */
return (((i+bmpLength)&2)!=0);
}
} | [
"public",
"final",
"boolean",
"contains",
"(",
"int",
"c",
")",
"{",
"if",
"(",
"c",
">",
"0x10ffff",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"c",
"<=",
"0xffff",
")",
"{",
"int",
"i",
";",
"/* find c in the BMP part */",
"for",
"(",
"i",
... | Returns true if the given USerializedSet contains the given
character.
@param c the character to test for
@return true if set contains c | [
"Returns",
"true",
"if",
"the",
"given",
"USerializedSet",
"contains",
"the",
"given",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/USerializedSet.java#L151-L173 |
34,866 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicStampedReference.java | AtomicStampedReference.set | public void set(V newReference, int newStamp) {
Pair<V> current = pair;
if (newReference != current.reference || newStamp != current.stamp)
this.pair = Pair.of(newReference, newStamp);
} | java | public void set(V newReference, int newStamp) {
Pair<V> current = pair;
if (newReference != current.reference || newStamp != current.stamp)
this.pair = Pair.of(newReference, newStamp);
} | [
"public",
"void",
"set",
"(",
"V",
"newReference",
",",
"int",
"newStamp",
")",
"{",
"Pair",
"<",
"V",
">",
"current",
"=",
"pair",
";",
"if",
"(",
"newReference",
"!=",
"current",
".",
"reference",
"||",
"newStamp",
"!=",
"current",
".",
"stamp",
")",... | Unconditionally sets the value of both the reference and stamp.
@param newReference the new value for the reference
@param newStamp the new value for the stamp | [
"Unconditionally",
"sets",
"the",
"value",
"of",
"both",
"the",
"reference",
"and",
"stamp",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicStampedReference.java#L164-L168 |
34,867 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/spec/EllipticCurve.java | EllipticCurve.checkValidity | private static void checkValidity(ECField field, BigInteger c,
String cName) {
// can only perform check if field is ECFieldFp or ECFieldF2m.
if (field instanceof ECFieldFp) {
BigInteger p = ((ECFieldFp)field).getP();
if (p.compareTo(c) != 1) {
throw new IllegalArgumentException(cName + " is too large");
} else if (c.signum() < 0) {
throw new IllegalArgumentException(cName + " is negative");
}
} else if (field instanceof ECFieldF2m) {
int m = ((ECFieldF2m)field).getM();
if (c.bitLength() > m) {
throw new IllegalArgumentException(cName + " is too large");
}
}
} | java | private static void checkValidity(ECField field, BigInteger c,
String cName) {
// can only perform check if field is ECFieldFp or ECFieldF2m.
if (field instanceof ECFieldFp) {
BigInteger p = ((ECFieldFp)field).getP();
if (p.compareTo(c) != 1) {
throw new IllegalArgumentException(cName + " is too large");
} else if (c.signum() < 0) {
throw new IllegalArgumentException(cName + " is negative");
}
} else if (field instanceof ECFieldF2m) {
int m = ((ECFieldF2m)field).getM();
if (c.bitLength() > m) {
throw new IllegalArgumentException(cName + " is too large");
}
}
} | [
"private",
"static",
"void",
"checkValidity",
"(",
"ECField",
"field",
",",
"BigInteger",
"c",
",",
"String",
"cName",
")",
"{",
"// can only perform check if field is ECFieldFp or ECFieldF2m.",
"if",
"(",
"field",
"instanceof",
"ECFieldFp",
")",
"{",
"BigInteger",
"p... | Check coefficient c is a valid element in ECField field. | [
"Check",
"coefficient",
"c",
"is",
"a",
"valid",
"element",
"in",
"ECField",
"field",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/spec/EllipticCurve.java#L51-L67 |
34,868 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneRegion.java | ZoneRegion.checkName | private static void checkName(String zoneId) {
int n = zoneId.length();
if (n < 2) {
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
}
for (int i = 0; i < n; i++) {
char c = zoneId.charAt(i);
if (c >= 'a' && c <= 'z') continue;
if (c >= 'A' && c <= 'Z') continue;
if (c == '/' && i != 0) continue;
if (c >= '0' && c <= '9' && i != 0) continue;
if (c == '~' && i != 0) continue;
if (c == '.' && i != 0) continue;
if (c == '_' && i != 0) continue;
if (c == '+' && i != 0) continue;
if (c == '-' && i != 0) continue;
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
}
} | java | private static void checkName(String zoneId) {
int n = zoneId.length();
if (n < 2) {
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
}
for (int i = 0; i < n; i++) {
char c = zoneId.charAt(i);
if (c >= 'a' && c <= 'z') continue;
if (c >= 'A' && c <= 'Z') continue;
if (c == '/' && i != 0) continue;
if (c >= '0' && c <= '9' && i != 0) continue;
if (c == '~' && i != 0) continue;
if (c == '.' && i != 0) continue;
if (c == '_' && i != 0) continue;
if (c == '+' && i != 0) continue;
if (c == '-' && i != 0) continue;
throw new DateTimeException("Invalid ID for region-based ZoneId, invalid format: " + zoneId);
}
} | [
"private",
"static",
"void",
"checkName",
"(",
"String",
"zoneId",
")",
"{",
"int",
"n",
"=",
"zoneId",
".",
"length",
"(",
")",
";",
"if",
"(",
"n",
"<",
"2",
")",
"{",
"throw",
"new",
"DateTimeException",
"(",
"\"Invalid ID for region-based ZoneId, invalid... | Checks that the given string is a legal ZondId name.
@param zoneId the time-zone ID, not null
@throws DateTimeException if the ID format is invalid | [
"Checks",
"that",
"the",
"given",
"string",
"is",
"a",
"legal",
"ZondId",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/ZoneRegion.java#L135-L153 |
34,869 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java | TreeMap.compare | @SuppressWarnings("unchecked")
final int compare(Object k1, Object k2) {
return comparator==null ? ((Comparable<? super K>)k1).compareTo((K)k2)
: comparator.compare((K)k1, (K)k2);
} | java | @SuppressWarnings("unchecked")
final int compare(Object k1, Object k2) {
return comparator==null ? ((Comparable<? super K>)k1).compareTo((K)k2)
: comparator.compare((K)k1, (K)k2);
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"final",
"int",
"compare",
"(",
"Object",
"k1",
",",
"Object",
"k2",
")",
"{",
"return",
"comparator",
"==",
"null",
"?",
"(",
"(",
"Comparable",
"<",
"?",
"super",
"K",
">",
")",
"k1",
")",
".",
"c... | Compares two keys using the correct comparison method for this TreeMap. | [
"Compares",
"two",
"keys",
"using",
"the",
"correct",
"comparison",
"method",
"for",
"this",
"TreeMap",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java#L1345-L1349 |
34,870 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java | TreeMap.readTreeSet | void readTreeSet(int size, java.io.ObjectInputStream s, V defaultVal)
throws java.io.IOException, ClassNotFoundException {
buildFromSorted(size, null, s, defaultVal);
} | java | void readTreeSet(int size, java.io.ObjectInputStream s, V defaultVal)
throws java.io.IOException, ClassNotFoundException {
buildFromSorted(size, null, s, defaultVal);
} | [
"void",
"readTreeSet",
"(",
"int",
"size",
",",
"java",
".",
"io",
".",
"ObjectInputStream",
"s",
",",
"V",
"defaultVal",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
",",
"ClassNotFoundException",
"{",
"buildFromSorted",
"(",
"size",
",",
"null",
... | Intended to be called only from TreeSet.readObject | [
"Intended",
"to",
"be",
"called",
"only",
"from",
"TreeSet",
".",
"readObject"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java#L2541-L2544 |
34,871 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java | TreeMap.keySpliteratorFor | static <K> Spliterator<K> keySpliteratorFor(NavigableMap<K,?> m) {
if (m instanceof TreeMap) {
@SuppressWarnings("unchecked") TreeMap<K,Object> t =
(TreeMap<K,Object>) m;
return t.keySpliterator();
}
if (m instanceof DescendingSubMap) {
@SuppressWarnings("unchecked") DescendingSubMap<K,?> dm =
(DescendingSubMap<K,?>) m;
TreeMap<K,?> tm = dm.m;
if (dm == tm.descendingMap) {
@SuppressWarnings("unchecked") TreeMap<K,Object> t =
(TreeMap<K,Object>) tm;
return t.descendingKeySpliterator();
}
}
@SuppressWarnings("unchecked") NavigableSubMap<K,?> sm =
(NavigableSubMap<K,?>) m;
return sm.keySpliterator();
} | java | static <K> Spliterator<K> keySpliteratorFor(NavigableMap<K,?> m) {
if (m instanceof TreeMap) {
@SuppressWarnings("unchecked") TreeMap<K,Object> t =
(TreeMap<K,Object>) m;
return t.keySpliterator();
}
if (m instanceof DescendingSubMap) {
@SuppressWarnings("unchecked") DescendingSubMap<K,?> dm =
(DescendingSubMap<K,?>) m;
TreeMap<K,?> tm = dm.m;
if (dm == tm.descendingMap) {
@SuppressWarnings("unchecked") TreeMap<K,Object> t =
(TreeMap<K,Object>) tm;
return t.descendingKeySpliterator();
}
}
@SuppressWarnings("unchecked") NavigableSubMap<K,?> sm =
(NavigableSubMap<K,?>) m;
return sm.keySpliterator();
} | [
"static",
"<",
"K",
">",
"Spliterator",
"<",
"K",
">",
"keySpliteratorFor",
"(",
"NavigableMap",
"<",
"K",
",",
"?",
">",
"m",
")",
"{",
"if",
"(",
"m",
"instanceof",
"TreeMap",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"TreeMap",
"... | Currently, we support Spliterator-based versions only for the
full map, in either plain of descending form, otherwise relying
on defaults because size estimation for submaps would dominate
costs. The type tests needed to check these for key views are
not very nice but avoid disrupting existing class
structures. Callers must use plain default spliterators if this
returns null. | [
"Currently",
"we",
"support",
"Spliterator",
"-",
"based",
"versions",
"only",
"for",
"the",
"full",
"map",
"in",
"either",
"plain",
"of",
"descending",
"form",
"otherwise",
"relying",
"on",
"defaults",
"because",
"size",
"estimation",
"for",
"submaps",
"would",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/TreeMap.java#L2700-L2719 |
34,872 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringPrep.java | StringPrep.getInstance | public static StringPrep getInstance(int profile) {
if (profile < 0 || profile > MAX_PROFILE) {
throw new IllegalArgumentException("Bad profile type");
}
StringPrep instance = null;
// A StringPrep instance is immutable. We use a single instance
// per type and store it in the internal cache.
synchronized (CACHE) {
WeakReference<StringPrep> ref = CACHE[profile];
if (ref != null) {
instance = ref.get();
}
if (instance == null) {
ByteBuffer bytes = ICUBinary.getRequiredData(PROFILE_NAMES[profile] + ".spp");
if (bytes != null) {
try {
instance = new StringPrep(bytes);
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
if (instance != null) {
CACHE[profile] = new WeakReference<StringPrep>(instance);
}
}
}
return instance;
} | java | public static StringPrep getInstance(int profile) {
if (profile < 0 || profile > MAX_PROFILE) {
throw new IllegalArgumentException("Bad profile type");
}
StringPrep instance = null;
// A StringPrep instance is immutable. We use a single instance
// per type and store it in the internal cache.
synchronized (CACHE) {
WeakReference<StringPrep> ref = CACHE[profile];
if (ref != null) {
instance = ref.get();
}
if (instance == null) {
ByteBuffer bytes = ICUBinary.getRequiredData(PROFILE_NAMES[profile] + ".spp");
if (bytes != null) {
try {
instance = new StringPrep(bytes);
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
if (instance != null) {
CACHE[profile] = new WeakReference<StringPrep>(instance);
}
}
}
return instance;
} | [
"public",
"static",
"StringPrep",
"getInstance",
"(",
"int",
"profile",
")",
"{",
"if",
"(",
"profile",
"<",
"0",
"||",
"profile",
">",
"MAX_PROFILE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Bad profile type\"",
")",
";",
"}",
"StringPrep... | Gets a StringPrep instance for the specified profile
@param profile The profile passed to find the StringPrep instance. | [
"Gets",
"a",
"StringPrep",
"instance",
"for",
"the",
"specified",
"profile"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/StringPrep.java#L295-L325 |
34,873 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java | X509CertPath.parsePKIPATH | private static List<X509Certificate> parsePKIPATH(InputStream is)
throws CertificateException {
List<X509Certificate> certList = null;
CertificateFactory certFac = null;
if (is == null) {
throw new CertificateException("input stream is null");
}
try {
DerInputStream dis = new DerInputStream(readAllBytes(is));
DerValue[] seq = dis.getSequence(3);
if (seq.length == 0) {
return Collections.<X509Certificate>emptyList();
}
certFac = CertificateFactory.getInstance("X.509");
certList = new ArrayList<X509Certificate>(seq.length);
// append certs in reverse order (target to trust anchor)
for (int i = seq.length-1; i >= 0; i--) {
certList.add((X509Certificate)certFac.generateCertificate
(new ByteArrayInputStream(seq[i].toByteArray())));
}
return Collections.unmodifiableList(certList);
} catch (IOException ioe) {
throw new CertificateException("IOException parsing PkiPath data: "
+ ioe, ioe);
}
} | java | private static List<X509Certificate> parsePKIPATH(InputStream is)
throws CertificateException {
List<X509Certificate> certList = null;
CertificateFactory certFac = null;
if (is == null) {
throw new CertificateException("input stream is null");
}
try {
DerInputStream dis = new DerInputStream(readAllBytes(is));
DerValue[] seq = dis.getSequence(3);
if (seq.length == 0) {
return Collections.<X509Certificate>emptyList();
}
certFac = CertificateFactory.getInstance("X.509");
certList = new ArrayList<X509Certificate>(seq.length);
// append certs in reverse order (target to trust anchor)
for (int i = seq.length-1; i >= 0; i--) {
certList.add((X509Certificate)certFac.generateCertificate
(new ByteArrayInputStream(seq[i].toByteArray())));
}
return Collections.unmodifiableList(certList);
} catch (IOException ioe) {
throw new CertificateException("IOException parsing PkiPath data: "
+ ioe, ioe);
}
} | [
"private",
"static",
"List",
"<",
"X509Certificate",
">",
"parsePKIPATH",
"(",
"InputStream",
"is",
")",
"throws",
"CertificateException",
"{",
"List",
"<",
"X509Certificate",
">",
"certList",
"=",
"null",
";",
"CertificateFactory",
"certFac",
"=",
"null",
";",
... | Parse a PKIPATH format CertPath from an InputStream. Return an
unmodifiable List of the certificates.
@param is the <code>InputStream</code> to read the data from
@return an unmodifiable List of the certificates
@exception CertificateException if an exception occurs | [
"Parse",
"a",
"PKIPATH",
"format",
"CertPath",
"from",
"an",
"InputStream",
".",
"Return",
"an",
"unmodifiable",
"List",
"of",
"the",
"certificates",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java#L176-L207 |
34,874 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java | X509CertPath.encodePKIPATH | private byte[] encodePKIPATH() throws CertificateEncodingException {
ListIterator<X509Certificate> li = certs.listIterator(certs.size());
try {
DerOutputStream bytes = new DerOutputStream();
// encode certs in reverse order (trust anchor to target)
// according to PkiPath format
while (li.hasPrevious()) {
X509Certificate cert = li.previous();
// check for duplicate cert
if (certs.lastIndexOf(cert) != certs.indexOf(cert)) {
throw new CertificateEncodingException
("Duplicate Certificate");
}
// get encoded certificates
byte[] encoded = cert.getEncoded();
bytes.write(encoded);
}
// Wrap the data in a SEQUENCE
DerOutputStream derout = new DerOutputStream();
derout.write(DerValue.tag_SequenceOf, bytes);
return derout.toByteArray();
} catch (IOException ioe) {
throw new CertificateEncodingException("IOException encoding " +
"PkiPath data: " + ioe, ioe);
}
} | java | private byte[] encodePKIPATH() throws CertificateEncodingException {
ListIterator<X509Certificate> li = certs.listIterator(certs.size());
try {
DerOutputStream bytes = new DerOutputStream();
// encode certs in reverse order (trust anchor to target)
// according to PkiPath format
while (li.hasPrevious()) {
X509Certificate cert = li.previous();
// check for duplicate cert
if (certs.lastIndexOf(cert) != certs.indexOf(cert)) {
throw new CertificateEncodingException
("Duplicate Certificate");
}
// get encoded certificates
byte[] encoded = cert.getEncoded();
bytes.write(encoded);
}
// Wrap the data in a SEQUENCE
DerOutputStream derout = new DerOutputStream();
derout.write(DerValue.tag_SequenceOf, bytes);
return derout.toByteArray();
} catch (IOException ioe) {
throw new CertificateEncodingException("IOException encoding " +
"PkiPath data: " + ioe, ioe);
}
} | [
"private",
"byte",
"[",
"]",
"encodePKIPATH",
"(",
")",
"throws",
"CertificateEncodingException",
"{",
"ListIterator",
"<",
"X509Certificate",
">",
"li",
"=",
"certs",
".",
"listIterator",
"(",
"certs",
".",
"size",
"(",
")",
")",
";",
"try",
"{",
"DerOutput... | Encode the CertPath using PKIPATH format.
@return a byte array containing the binary encoding of the PkiPath object
@exception CertificateEncodingException if an exception occurs | [
"Encode",
"the",
"CertPath",
"using",
"PKIPATH",
"format",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java#L287-L315 |
34,875 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java | X509CertPath.getEncoded | @Override
public byte[] getEncoded(String encoding)
throws CertificateEncodingException {
switch (encoding) {
case PKIPATH_ENCODING:
return encodePKIPATH();
case PKCS7_ENCODING:
return encodePKCS7();
default:
throw new CertificateEncodingException("unsupported encoding");
}
} | java | @Override
public byte[] getEncoded(String encoding)
throws CertificateEncodingException {
switch (encoding) {
case PKIPATH_ENCODING:
return encodePKIPATH();
case PKCS7_ENCODING:
return encodePKCS7();
default:
throw new CertificateEncodingException("unsupported encoding");
}
} | [
"@",
"Override",
"public",
"byte",
"[",
"]",
"getEncoded",
"(",
"String",
"encoding",
")",
"throws",
"CertificateEncodingException",
"{",
"switch",
"(",
"encoding",
")",
"{",
"case",
"PKIPATH_ENCODING",
":",
"return",
"encodePKIPATH",
"(",
")",
";",
"case",
"P... | Returns the encoded form of this certification path, using the
specified encoding.
@param encoding the name of the encoding to use
@return the encoded bytes
@exception CertificateEncodingException if an encoding error occurs or
the encoding requested is not supported | [
"Returns",
"the",
"encoded",
"form",
"of",
"this",
"certification",
"path",
"using",
"the",
"specified",
"encoding",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/X509CertPath.java#L346-L357 |
34,876 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java | ReferenceQueue.enqueueLocked | private boolean enqueueLocked(Reference<? extends T> r) {
// Verify the reference has not already been enqueued.
if (r.queueNext != null) {
return false;
}
/* J2ObjC removed.
if (r instanceof Cleaner) {
// If this reference is a Cleaner, then simply invoke the clean method instead
// of enqueueing it in the queue. Cleaners are associated with dummy queues that
// are never polled and objects are never enqueued on them.
Cleaner cl = (sun.misc.Cleaner) r;
cl.clean();
// Update queueNext to indicate that the reference has been
// enqueued, but is now removed from the queue.
r.queueNext = sQueueNextUnenqueued;
return true;
}
*/
if (tail == null) {
head = r;
} else {
tail.queueNext = r;
}
tail = r;
tail.queueNext = SENTINEL;
return true;
} | java | private boolean enqueueLocked(Reference<? extends T> r) {
// Verify the reference has not already been enqueued.
if (r.queueNext != null) {
return false;
}
/* J2ObjC removed.
if (r instanceof Cleaner) {
// If this reference is a Cleaner, then simply invoke the clean method instead
// of enqueueing it in the queue. Cleaners are associated with dummy queues that
// are never polled and objects are never enqueued on them.
Cleaner cl = (sun.misc.Cleaner) r;
cl.clean();
// Update queueNext to indicate that the reference has been
// enqueued, but is now removed from the queue.
r.queueNext = sQueueNextUnenqueued;
return true;
}
*/
if (tail == null) {
head = r;
} else {
tail.queueNext = r;
}
tail = r;
tail.queueNext = SENTINEL;
return true;
} | [
"private",
"boolean",
"enqueueLocked",
"(",
"Reference",
"<",
"?",
"extends",
"T",
">",
"r",
")",
"{",
"// Verify the reference has not already been enqueued.",
"if",
"(",
"r",
".",
"queueNext",
"!=",
"null",
")",
"{",
"return",
"false",
";",
"}",
"/* J2ObjC rem... | Enqueue the given reference onto this queue.
The caller is responsible for ensuring the lock is held on this queue,
and for calling notifyAll on this queue after the reference has been
enqueued. Returns true if the reference was enqueued successfully,
false if the reference had already been enqueued.
@GuardedBy("lock") | [
"Enqueue",
"the",
"given",
"reference",
"onto",
"this",
"queue",
".",
"The",
"caller",
"is",
"responsible",
"for",
"ensuring",
"the",
"lock",
"is",
"held",
"on",
"this",
"queue",
"and",
"for",
"calling",
"notifyAll",
"on",
"this",
"queue",
"after",
"the",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java#L67-L96 |
34,877 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java | ReferenceQueue.isEnqueued | boolean isEnqueued(Reference<? extends T> reference) {
synchronized (lock) {
return reference.queueNext != null && reference.queueNext != sQueueNextUnenqueued;
}
} | java | boolean isEnqueued(Reference<? extends T> reference) {
synchronized (lock) {
return reference.queueNext != null && reference.queueNext != sQueueNextUnenqueued;
}
} | [
"boolean",
"isEnqueued",
"(",
"Reference",
"<",
"?",
"extends",
"T",
">",
"reference",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"return",
"reference",
".",
"queueNext",
"!=",
"null",
"&&",
"reference",
".",
"queueNext",
"!=",
"sQueueNextUnenqueued",
... | Test if the given reference object has been enqueued but not yet
removed from the queue, assuming this is the reference object's queue. | [
"Test",
"if",
"the",
"given",
"reference",
"object",
"has",
"been",
"enqueued",
"but",
"not",
"yet",
"removed",
"from",
"the",
"queue",
"assuming",
"this",
"is",
"the",
"reference",
"object",
"s",
"queue",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java#L102-L106 |
34,878 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java | ReferenceQueue.enqueue | boolean enqueue(Reference<? extends T> reference) {
synchronized (lock) {
if (enqueueLocked(reference)) {
lock.notifyAll();
return true;
}
return false;
}
} | java | boolean enqueue(Reference<? extends T> reference) {
synchronized (lock) {
if (enqueueLocked(reference)) {
lock.notifyAll();
return true;
}
return false;
}
} | [
"boolean",
"enqueue",
"(",
"Reference",
"<",
"?",
"extends",
"T",
">",
"reference",
")",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"if",
"(",
"enqueueLocked",
"(",
"reference",
")",
")",
"{",
"lock",
".",
"notifyAll",
"(",
")",
";",
"return",
"true",... | Enqueue the reference object on the receiver.
@param reference
reference object to be enqueued.
@return true if the reference was enqueued. | [
"Enqueue",
"the",
"reference",
"object",
"on",
"the",
"receiver",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java#L115-L123 |
34,879 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java | ReferenceQueue.remove | public Reference<? extends T> remove(long timeout)
throws IllegalArgumentException, InterruptedException
{
if (timeout < 0) {
throw new IllegalArgumentException("Negative timeout value");
}
synchronized (lock) {
Reference<? extends T> r = reallyPollLocked();
if (r != null) return r;
long start = (timeout == 0) ? 0 : System.nanoTime();
for (;;) {
lock.wait(timeout);
r = reallyPollLocked();
if (r != null) return r;
if (timeout != 0) {
long end = System.nanoTime();
timeout -= (end - start) / 1000_000;
if (timeout <= 0) return null;
start = end;
}
}
}
} | java | public Reference<? extends T> remove(long timeout)
throws IllegalArgumentException, InterruptedException
{
if (timeout < 0) {
throw new IllegalArgumentException("Negative timeout value");
}
synchronized (lock) {
Reference<? extends T> r = reallyPollLocked();
if (r != null) return r;
long start = (timeout == 0) ? 0 : System.nanoTime();
for (;;) {
lock.wait(timeout);
r = reallyPollLocked();
if (r != null) return r;
if (timeout != 0) {
long end = System.nanoTime();
timeout -= (end - start) / 1000_000;
if (timeout <= 0) return null;
start = end;
}
}
}
} | [
"public",
"Reference",
"<",
"?",
"extends",
"T",
">",
"remove",
"(",
"long",
"timeout",
")",
"throws",
"IllegalArgumentException",
",",
"InterruptedException",
"{",
"if",
"(",
"timeout",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"N... | Removes the next reference object in this queue, blocking until either
one becomes available or the given timeout period expires.
<p> This method does not offer real-time guarantees: It schedules the
timeout as if by invoking the {@link Object#wait(long)} method.
@param timeout If positive, block for up to <code>timeout</code>
milliseconds while waiting for a reference to be
added to this queue. If zero, block indefinitely.
@return A reference object, if one was available within the specified
timeout period, otherwise <code>null</code>
@throws IllegalArgumentException
If the value of the timeout argument is negative
@throws InterruptedException
If the timeout wait is interrupted | [
"Removes",
"the",
"next",
"reference",
"object",
"in",
"this",
"queue",
"blocking",
"until",
"either",
"one",
"becomes",
"available",
"or",
"the",
"given",
"timeout",
"period",
"expires",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/ref/ReferenceQueue.java#L182-L204 |
34,880 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedWriter.java | PipedWriter.flush | public synchronized void flush() throws IOException {
if (sink != null) {
if (sink.closedByReader || closed) {
throw new IOException("Pipe closed");
}
synchronized (sink) {
sink.notifyAll();
}
}
} | java | public synchronized void flush() throws IOException {
if (sink != null) {
if (sink.closedByReader || closed) {
throw new IOException("Pipe closed");
}
synchronized (sink) {
sink.notifyAll();
}
}
} | [
"public",
"synchronized",
"void",
"flush",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sink",
"!=",
"null",
")",
"{",
"if",
"(",
"sink",
".",
"closedByReader",
"||",
"closed",
")",
"{",
"throw",
"new",
"IOException",
"(",
"\"Pipe closed\"",
")",
... | Flushes this output stream and forces any buffered output characters
to be written out.
This will notify any readers that characters are waiting in the pipe.
@exception IOException if the pipe is closed, or an I/O error occurs. | [
"Flushes",
"this",
"output",
"stream",
"and",
"forces",
"any",
"buffered",
"output",
"characters",
"to",
"be",
"written",
"out",
".",
"This",
"will",
"notify",
"any",
"readers",
"that",
"characters",
"are",
"waiting",
"in",
"the",
"pipe",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedWriter.java#L160-L169 |
34,881 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.getDefault | public static ULocale getDefault(Category category) {
synchronized (ULocale.class) {
int idx = category.ordinal();
if (defaultCategoryULocales[idx] == null) {
// Just in case this method is called during ULocale class
// initialization. Unlike getDefault(), we do not have
// cyclic dependency for category default.
return ULocale.ROOT;
}
if (JDKLocaleHelper.hasLocaleCategories()) {
Locale currentCategoryDefault = JDKLocaleHelper.getDefault(category);
if (!defaultCategoryLocales[idx].equals(currentCategoryDefault)) {
defaultCategoryLocales[idx] = currentCategoryDefault;
defaultCategoryULocales[idx] = forLocale(currentCategoryDefault);
}
} else {
// java.util.Locale.setDefault(Locale) in Java 7 updates
// category locale defaults. On Java 6 or older environment,
// ICU4J checks if the default locale has changed and update
// category ULocales here if necessary.
// Note: When java.util.Locale.setDefault(Locale) is called
// with a Locale same with the previous one, Java 7 still
// updates category locale defaults. On Java 6 or older env,
// there is no good way to detect the event, ICU4J simply
// check if the default Java Locale has changed since last
// time.
Locale currentDefault = Locale.getDefault();
if (!defaultLocale.equals(currentDefault)) {
defaultLocale = currentDefault;
defaultULocale = forLocale(currentDefault);
for (Category cat : Category.values()) {
int tmpIdx = cat.ordinal();
defaultCategoryLocales[tmpIdx] = currentDefault;
defaultCategoryULocales[tmpIdx] = forLocale(currentDefault);
}
}
// No synchronization with JDK Locale, because category default
// is not supported in Java 6 or older versions
}
return defaultCategoryULocales[idx];
}
} | java | public static ULocale getDefault(Category category) {
synchronized (ULocale.class) {
int idx = category.ordinal();
if (defaultCategoryULocales[idx] == null) {
// Just in case this method is called during ULocale class
// initialization. Unlike getDefault(), we do not have
// cyclic dependency for category default.
return ULocale.ROOT;
}
if (JDKLocaleHelper.hasLocaleCategories()) {
Locale currentCategoryDefault = JDKLocaleHelper.getDefault(category);
if (!defaultCategoryLocales[idx].equals(currentCategoryDefault)) {
defaultCategoryLocales[idx] = currentCategoryDefault;
defaultCategoryULocales[idx] = forLocale(currentCategoryDefault);
}
} else {
// java.util.Locale.setDefault(Locale) in Java 7 updates
// category locale defaults. On Java 6 or older environment,
// ICU4J checks if the default locale has changed and update
// category ULocales here if necessary.
// Note: When java.util.Locale.setDefault(Locale) is called
// with a Locale same with the previous one, Java 7 still
// updates category locale defaults. On Java 6 or older env,
// there is no good way to detect the event, ICU4J simply
// check if the default Java Locale has changed since last
// time.
Locale currentDefault = Locale.getDefault();
if (!defaultLocale.equals(currentDefault)) {
defaultLocale = currentDefault;
defaultULocale = forLocale(currentDefault);
for (Category cat : Category.values()) {
int tmpIdx = cat.ordinal();
defaultCategoryLocales[tmpIdx] = currentDefault;
defaultCategoryULocales[tmpIdx] = forLocale(currentDefault);
}
}
// No synchronization with JDK Locale, because category default
// is not supported in Java 6 or older versions
}
return defaultCategoryULocales[idx];
}
} | [
"public",
"static",
"ULocale",
"getDefault",
"(",
"Category",
"category",
")",
"{",
"synchronized",
"(",
"ULocale",
".",
"class",
")",
"{",
"int",
"idx",
"=",
"category",
".",
"ordinal",
"(",
")",
";",
"if",
"(",
"defaultCategoryULocales",
"[",
"idx",
"]",... | Returns the current default ULocale for the specified category.
@param category the category
@return the default ULocale for the specified category. | [
"Returns",
"the",
"current",
"default",
"ULocale",
"for",
"the",
"specified",
"category",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L656-L701 |
34,882 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.appendTag | private static void appendTag(String tag, StringBuilder buffer) {
if (buffer.length() != 0) {
buffer.append(UNDERSCORE);
}
buffer.append(tag);
} | java | private static void appendTag(String tag, StringBuilder buffer) {
if (buffer.length() != 0) {
buffer.append(UNDERSCORE);
}
buffer.append(tag);
} | [
"private",
"static",
"void",
"appendTag",
"(",
"String",
"tag",
",",
"StringBuilder",
"buffer",
")",
"{",
"if",
"(",
"buffer",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"buffer",
".",
"append",
"(",
"UNDERSCORE",
")",
";",
"}",
"buffer",
".",
"ap... | Append a tag to a StringBuilder, adding the separator if necessary.The tag must
not be a zero-length string.
@param tag The tag to add.
@param buffer The output buffer. | [
"Append",
"a",
"tag",
"to",
"a",
"StringBuilder",
"adding",
"the",
"separator",
"if",
"necessary",
".",
"The",
"tag",
"must",
"not",
"be",
"a",
"zero",
"-",
"length",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L2603-L2609 |
34,883 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.createTagString | private static String createTagString(String lang, String script, String region,
String trailing, String alternateTags) {
LocaleIDParser parser = null;
boolean regionAppended = false;
StringBuilder tag = new StringBuilder();
if (!isEmptyString(lang)) {
appendTag(
lang,
tag);
}
else if (isEmptyString(alternateTags)) {
/*
* Append the value for an unknown language, if
* we found no language.
*/
appendTag(
UNDEFINED_LANGUAGE,
tag);
}
else {
parser = new LocaleIDParser(alternateTags);
String alternateLang = parser.getLanguage();
/*
* Append the value for an unknown language, if
* we found no language.
*/
appendTag(
!isEmptyString(alternateLang) ? alternateLang : UNDEFINED_LANGUAGE,
tag);
}
if (!isEmptyString(script)) {
appendTag(
script,
tag);
}
else if (!isEmptyString(alternateTags)) {
/*
* Parse the alternateTags string for the script.
*/
if (parser == null) {
parser = new LocaleIDParser(alternateTags);
}
String alternateScript = parser.getScript();
if (!isEmptyString(alternateScript)) {
appendTag(
alternateScript,
tag);
}
}
if (!isEmptyString(region)) {
appendTag(
region,
tag);
regionAppended = true;
}
else if (!isEmptyString(alternateTags)) {
/*
* Parse the alternateTags string for the region.
*/
if (parser == null) {
parser = new LocaleIDParser(alternateTags);
}
String alternateRegion = parser.getCountry();
if (!isEmptyString(alternateRegion)) {
appendTag(
alternateRegion,
tag);
regionAppended = true;
}
}
if (trailing != null && trailing.length() > 1) {
/*
* The current ICU format expects two underscores
* will separate the variant from the preceeding
* parts of the tag, if there is no region.
*/
int separators = 0;
if (trailing.charAt(0) == UNDERSCORE) {
if (trailing.charAt(1) == UNDERSCORE) {
separators = 2;
}
}
else {
separators = 1;
}
if (regionAppended) {
/*
* If we appended a region, we may need to strip
* the extra separator from the variant portion.
*/
if (separators == 2) {
tag.append(trailing.substring(1));
}
else {
tag.append(trailing);
}
}
else {
/*
* If we did not append a region, we may need to add
* an extra separator to the variant portion.
*/
if (separators == 1) {
tag.append(UNDERSCORE);
}
tag.append(trailing);
}
}
return tag.toString();
} | java | private static String createTagString(String lang, String script, String region,
String trailing, String alternateTags) {
LocaleIDParser parser = null;
boolean regionAppended = false;
StringBuilder tag = new StringBuilder();
if (!isEmptyString(lang)) {
appendTag(
lang,
tag);
}
else if (isEmptyString(alternateTags)) {
/*
* Append the value for an unknown language, if
* we found no language.
*/
appendTag(
UNDEFINED_LANGUAGE,
tag);
}
else {
parser = new LocaleIDParser(alternateTags);
String alternateLang = parser.getLanguage();
/*
* Append the value for an unknown language, if
* we found no language.
*/
appendTag(
!isEmptyString(alternateLang) ? alternateLang : UNDEFINED_LANGUAGE,
tag);
}
if (!isEmptyString(script)) {
appendTag(
script,
tag);
}
else if (!isEmptyString(alternateTags)) {
/*
* Parse the alternateTags string for the script.
*/
if (parser == null) {
parser = new LocaleIDParser(alternateTags);
}
String alternateScript = parser.getScript();
if (!isEmptyString(alternateScript)) {
appendTag(
alternateScript,
tag);
}
}
if (!isEmptyString(region)) {
appendTag(
region,
tag);
regionAppended = true;
}
else if (!isEmptyString(alternateTags)) {
/*
* Parse the alternateTags string for the region.
*/
if (parser == null) {
parser = new LocaleIDParser(alternateTags);
}
String alternateRegion = parser.getCountry();
if (!isEmptyString(alternateRegion)) {
appendTag(
alternateRegion,
tag);
regionAppended = true;
}
}
if (trailing != null && trailing.length() > 1) {
/*
* The current ICU format expects two underscores
* will separate the variant from the preceeding
* parts of the tag, if there is no region.
*/
int separators = 0;
if (trailing.charAt(0) == UNDERSCORE) {
if (trailing.charAt(1) == UNDERSCORE) {
separators = 2;
}
}
else {
separators = 1;
}
if (regionAppended) {
/*
* If we appended a region, we may need to strip
* the extra separator from the variant portion.
*/
if (separators == 2) {
tag.append(trailing.substring(1));
}
else {
tag.append(trailing);
}
}
else {
/*
* If we did not append a region, we may need to add
* an extra separator to the variant portion.
*/
if (separators == 1) {
tag.append(UNDERSCORE);
}
tag.append(trailing);
}
}
return tag.toString();
} | [
"private",
"static",
"String",
"createTagString",
"(",
"String",
"lang",
",",
"String",
"script",
",",
"String",
"region",
",",
"String",
"trailing",
",",
"String",
"alternateTags",
")",
"{",
"LocaleIDParser",
"parser",
"=",
"null",
";",
"boolean",
"regionAppend... | Create a tag string from the supplied parameters. The lang, script and region
parameters may be null references.
If any of the language, script or region parameters are empty, and the alternateTags
parameter is not null, it will be parsed for potential language, script and region tags
to be used when constructing the new tag. If the alternateTags parameter is null, or
it contains no language tag, the default tag for the unknown language is used.
@param lang The language tag to use.
@param script The script tag to use.
@param region The region tag to use.
@param trailing Any trailing data to append to the new tag.
@param alternateTags A string containing any alternate tags.
@return The new tag string. | [
"Create",
"a",
"tag",
"string",
"from",
"the",
"supplied",
"parameters",
".",
"The",
"lang",
"script",
"and",
"region",
"parameters",
"may",
"be",
"null",
"references",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L2627-L2753 |
34,884 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.createTagString | static String createTagString(String lang, String script, String region, String trailing) {
return createTagString(lang, script, region, trailing, null);
} | java | static String createTagString(String lang, String script, String region, String trailing) {
return createTagString(lang, script, region, trailing, null);
} | [
"static",
"String",
"createTagString",
"(",
"String",
"lang",
",",
"String",
"script",
",",
"String",
"region",
",",
"String",
"trailing",
")",
"{",
"return",
"createTagString",
"(",
"lang",
",",
"script",
",",
"region",
",",
"trailing",
",",
"null",
")",
... | Create a tag string from the supplied parameters. The lang, script and region
parameters may be null references.If the lang parameter is an empty string, the
default value for an unknown language is written to the output buffer.
@param lang The language tag to use.
@param script The script tag to use.
@param region The region tag to use.
@param trailing Any trailing data to append to the new tag.
@return The new String. | [
"Create",
"a",
"tag",
"string",
"from",
"the",
"supplied",
"parameters",
".",
"The",
"lang",
"script",
"and",
"region",
"parameters",
"may",
"be",
"null",
"references",
".",
"If",
"the",
"lang",
"parameter",
"is",
"an",
"empty",
"string",
"the",
"default",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L2766-L2768 |
34,885 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java | ULocale.parseTagString | private static int parseTagString(String localeID, String tags[]) {
LocaleIDParser parser = new LocaleIDParser(localeID);
String lang = parser.getLanguage();
String script = parser.getScript();
String region = parser.getCountry();
if (isEmptyString(lang)) {
tags[0] = UNDEFINED_LANGUAGE;
}
else {
tags[0] = lang;
}
if (script.equals(UNDEFINED_SCRIPT)) {
tags[1] = "";
}
else {
tags[1] = script;
}
if (region.equals(UNDEFINED_REGION)) {
tags[2] = "";
}
else {
tags[2] = region;
}
/*
* Search for the variant. If there is one, then return the index of
* the preceeding separator.
* If there's no variant, search for the keyword delimiter,
* and return its index. Otherwise, return the length of the
* string.
*
* $TOTO(dbertoni) we need to take into account that we might
* find a part of the language as the variant, since it can
* can have a variant portion that is long enough to contain
* the same characters as the variant.
*/
String variant = parser.getVariant();
if (!isEmptyString(variant)){
int index = localeID.indexOf(variant);
return index > 0 ? index - 1 : index;
}
else
{
int index = localeID.indexOf('@');
return index == -1 ? localeID.length() : index;
}
} | java | private static int parseTagString(String localeID, String tags[]) {
LocaleIDParser parser = new LocaleIDParser(localeID);
String lang = parser.getLanguage();
String script = parser.getScript();
String region = parser.getCountry();
if (isEmptyString(lang)) {
tags[0] = UNDEFINED_LANGUAGE;
}
else {
tags[0] = lang;
}
if (script.equals(UNDEFINED_SCRIPT)) {
tags[1] = "";
}
else {
tags[1] = script;
}
if (region.equals(UNDEFINED_REGION)) {
tags[2] = "";
}
else {
tags[2] = region;
}
/*
* Search for the variant. If there is one, then return the index of
* the preceeding separator.
* If there's no variant, search for the keyword delimiter,
* and return its index. Otherwise, return the length of the
* string.
*
* $TOTO(dbertoni) we need to take into account that we might
* find a part of the language as the variant, since it can
* can have a variant portion that is long enough to contain
* the same characters as the variant.
*/
String variant = parser.getVariant();
if (!isEmptyString(variant)){
int index = localeID.indexOf(variant);
return index > 0 ? index - 1 : index;
}
else
{
int index = localeID.indexOf('@');
return index == -1 ? localeID.length() : index;
}
} | [
"private",
"static",
"int",
"parseTagString",
"(",
"String",
"localeID",
",",
"String",
"tags",
"[",
"]",
")",
"{",
"LocaleIDParser",
"parser",
"=",
"new",
"LocaleIDParser",
"(",
"localeID",
")",
";",
"String",
"lang",
"=",
"parser",
".",
"getLanguage",
"(",... | Parse the language, script, and region subtags from a tag string, and return the results.
This function does not return the canonical strings for the unknown script and region.
@param localeID The locale ID to parse.
@param tags An array of three String references to return the subtag strings.
@return The number of chars of the localeID parameter consumed. | [
"Parse",
"the",
"language",
"script",
"and",
"region",
"subtags",
"from",
"a",
"tag",
"string",
"and",
"return",
"the",
"results",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/ULocale.java#L2779-L2833 |
34,886 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java | TreeConverter.convertWithoutParens | private Expression convertWithoutParens(ExpressionTree condition, TreePath parent) {
Expression result = (Expression) convert(condition, parent);
if (result.getKind() == TreeNode.Kind.PARENTHESIZED_EXPRESSION) {
result = TreeUtil.remove(((ParenthesizedExpression) result).getExpression());
}
return result;
} | java | private Expression convertWithoutParens(ExpressionTree condition, TreePath parent) {
Expression result = (Expression) convert(condition, parent);
if (result.getKind() == TreeNode.Kind.PARENTHESIZED_EXPRESSION) {
result = TreeUtil.remove(((ParenthesizedExpression) result).getExpression());
}
return result;
} | [
"private",
"Expression",
"convertWithoutParens",
"(",
"ExpressionTree",
"condition",
",",
"TreePath",
"parent",
")",
"{",
"Expression",
"result",
"=",
"(",
"Expression",
")",
"convert",
"(",
"condition",
",",
"parent",
")",
";",
"if",
"(",
"result",
".",
"getK... | javac uses a ParenthesizedExpression for the if, do, and while statements, while JDT doesn't. | [
"javac",
"uses",
"a",
"ParenthesizedExpression",
"for",
"the",
"if",
"do",
"and",
"while",
"statements",
"while",
"JDT",
"doesn",
"t",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java#L1502-L1508 |
34,887 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java | TreeConverter.getNamePosition | private SourcePosition getNamePosition(Tree node) {
int start = (int) sourcePositions.getStartPosition(unit, node);
if (start == -1) {
return SourcePosition.NO_POSITION;
}
String src = newUnit.getSource();
Kind kind = node.getKind();
if (kind == Kind.ANNOTATION_TYPE
|| kind == Kind.CLASS
|| kind == Kind.ENUM
|| kind == Kind.INTERFACE) {
// Skip the class/enum/interface token.
while (src.charAt(start++) != ' ') {}
} else if (kind != Kind.METHOD && kind != Kind.VARIABLE) {
return getPosition(node);
}
if (!Character.isJavaIdentifierStart(src.charAt(start))) {
return getPosition(node);
}
int endPos = start + 1;
while (Character.isJavaIdentifierPart(src.charAt(endPos))) {
endPos++;
}
return getSourcePosition(start, endPos);
} | java | private SourcePosition getNamePosition(Tree node) {
int start = (int) sourcePositions.getStartPosition(unit, node);
if (start == -1) {
return SourcePosition.NO_POSITION;
}
String src = newUnit.getSource();
Kind kind = node.getKind();
if (kind == Kind.ANNOTATION_TYPE
|| kind == Kind.CLASS
|| kind == Kind.ENUM
|| kind == Kind.INTERFACE) {
// Skip the class/enum/interface token.
while (src.charAt(start++) != ' ') {}
} else if (kind != Kind.METHOD && kind != Kind.VARIABLE) {
return getPosition(node);
}
if (!Character.isJavaIdentifierStart(src.charAt(start))) {
return getPosition(node);
}
int endPos = start + 1;
while (Character.isJavaIdentifierPart(src.charAt(endPos))) {
endPos++;
}
return getSourcePosition(start, endPos);
} | [
"private",
"SourcePosition",
"getNamePosition",
"(",
"Tree",
"node",
")",
"{",
"int",
"start",
"=",
"(",
"int",
")",
"sourcePositions",
".",
"getStartPosition",
"(",
"unit",
",",
"node",
")",
";",
"if",
"(",
"start",
"==",
"-",
"1",
")",
"{",
"return",
... | Return best guess for the position of a declaration node's name. | [
"Return",
"best",
"guess",
"for",
"the",
"position",
"of",
"a",
"declaration",
"node",
"s",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/javac/TreeConverter.java#L1520-L1544 |
34,888 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java | OcniExtractor.findBlockComments | private static ListMultimap<TreeNode, Comment> findBlockComments(CompilationUnit unit) {
ListMultimap<TreeNode, Comment> blockComments =
MultimapBuilder.hashKeys().arrayListValues().build();
for (Comment comment : unit.getCommentList()) {
if (!comment.isBlockComment()) {
continue;
}
int commentPos = comment.getStartPosition();
AbstractTypeDeclaration containingType = null;
int containingTypePos = -1;
for (AbstractTypeDeclaration type : unit.getTypes()) {
int typePos = type.getStartPosition();
if (typePos < 0) {
continue;
}
int typeEnd = typePos + type.getLength();
if (commentPos > typePos && commentPos < typeEnd && typePos > containingTypePos) {
containingType = type;
containingTypePos = typePos;
}
}
blockComments.put(containingType != null ? containingType : unit, comment);
}
return blockComments;
} | java | private static ListMultimap<TreeNode, Comment> findBlockComments(CompilationUnit unit) {
ListMultimap<TreeNode, Comment> blockComments =
MultimapBuilder.hashKeys().arrayListValues().build();
for (Comment comment : unit.getCommentList()) {
if (!comment.isBlockComment()) {
continue;
}
int commentPos = comment.getStartPosition();
AbstractTypeDeclaration containingType = null;
int containingTypePos = -1;
for (AbstractTypeDeclaration type : unit.getTypes()) {
int typePos = type.getStartPosition();
if (typePos < 0) {
continue;
}
int typeEnd = typePos + type.getLength();
if (commentPos > typePos && commentPos < typeEnd && typePos > containingTypePos) {
containingType = type;
containingTypePos = typePos;
}
}
blockComments.put(containingType != null ? containingType : unit, comment);
}
return blockComments;
} | [
"private",
"static",
"ListMultimap",
"<",
"TreeNode",
",",
"Comment",
">",
"findBlockComments",
"(",
"CompilationUnit",
"unit",
")",
"{",
"ListMultimap",
"<",
"TreeNode",
",",
"Comment",
">",
"blockComments",
"=",
"MultimapBuilder",
".",
"hashKeys",
"(",
")",
".... | Finds all block comments and associates them with their containing type.
This is trickier than you might expect because of inner types. | [
"Finds",
"all",
"block",
"comments",
"and",
"associates",
"them",
"with",
"their",
"containing",
"type",
".",
"This",
"is",
"trickier",
"than",
"you",
"might",
"expect",
"because",
"of",
"inner",
"types",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java#L69-L93 |
34,889 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java | OcniExtractor.findMethodSignatures | private static void findMethodSignatures(String code, Set<String> signatures) {
if (code == null) {
return;
}
Matcher matcher = OBJC_METHOD_DECL_PATTERN.matcher(code);
while (matcher.find()) {
StringBuilder signature = new StringBuilder();
signature.append(matcher.group(1));
if (matcher.group(2) != null) {
signature.append(':');
String additionalParams = matcher.group(3);
if (additionalParams != null) {
Matcher paramsMatcher = ADDITIONAL_PARAM_PATTERN.matcher(additionalParams);
while (paramsMatcher.find()) {
signature.append(paramsMatcher.group(1)).append(':');
}
}
}
signatures.add(signature.toString());
}
} | java | private static void findMethodSignatures(String code, Set<String> signatures) {
if (code == null) {
return;
}
Matcher matcher = OBJC_METHOD_DECL_PATTERN.matcher(code);
while (matcher.find()) {
StringBuilder signature = new StringBuilder();
signature.append(matcher.group(1));
if (matcher.group(2) != null) {
signature.append(':');
String additionalParams = matcher.group(3);
if (additionalParams != null) {
Matcher paramsMatcher = ADDITIONAL_PARAM_PATTERN.matcher(additionalParams);
while (paramsMatcher.find()) {
signature.append(paramsMatcher.group(1)).append(':');
}
}
}
signatures.add(signature.toString());
}
} | [
"private",
"static",
"void",
"findMethodSignatures",
"(",
"String",
"code",
",",
"Set",
"<",
"String",
">",
"signatures",
")",
"{",
"if",
"(",
"code",
"==",
"null",
")",
"{",
"return",
";",
"}",
"Matcher",
"matcher",
"=",
"OBJC_METHOD_DECL_PATTERN",
".",
"... | Finds the signatures of methods defined in the native code. | [
"Finds",
"the",
"signatures",
"of",
"methods",
"defined",
"in",
"the",
"native",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/OcniExtractor.java#L195-L215 |
34,890 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.escape | private static int escape(char[] cc, char c, int index) {
cc[index++] = '%';
cc[index++] = Character.forDigit((c >> 4) & 0xF, 16);
cc[index++] = Character.forDigit(c & 0xF, 16);
return index;
} | java | private static int escape(char[] cc, char c, int index) {
cc[index++] = '%';
cc[index++] = Character.forDigit((c >> 4) & 0xF, 16);
cc[index++] = Character.forDigit(c & 0xF, 16);
return index;
} | [
"private",
"static",
"int",
"escape",
"(",
"char",
"[",
"]",
"cc",
",",
"char",
"c",
",",
"int",
"index",
")",
"{",
"cc",
"[",
"index",
"++",
"]",
"=",
"'",
"'",
";",
"cc",
"[",
"index",
"++",
"]",
"=",
"Character",
".",
"forDigit",
"(",
"(",
... | Appends the URL escape sequence for the specified char to the
specified StringBuffer. | [
"Appends",
"the",
"URL",
"escape",
"sequence",
"for",
"the",
"specified",
"char",
"to",
"the",
"specified",
"StringBuffer",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L153-L158 |
34,891 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.unescape | private static byte unescape(String s, int i) {
return (byte) Integer.parseInt(s.substring(i+1,i+3),16);
} | java | private static byte unescape(String s, int i) {
return (byte) Integer.parseInt(s.substring(i+1,i+3),16);
} | [
"private",
"static",
"byte",
"unescape",
"(",
"String",
"s",
",",
"int",
"i",
")",
"{",
"return",
"(",
"byte",
")",
"Integer",
".",
"parseInt",
"(",
"s",
".",
"substring",
"(",
"i",
"+",
"1",
",",
"i",
"+",
"3",
")",
",",
"16",
")",
";",
"}"
] | Un-escape and return the character at position i in string s. | [
"Un",
"-",
"escape",
"and",
"return",
"the",
"character",
"at",
"position",
"i",
"in",
"string",
"s",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L163-L165 |
34,892 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.decode | public static String decode(String s) {
int n = s.length();
if ((n == 0) || (s.indexOf('%') < 0))
return s;
StringBuilder sb = new StringBuilder(n);
ByteBuffer bb = ByteBuffer.allocate(n);
CharBuffer cb = CharBuffer.allocate(n);
CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8")
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
char c = s.charAt(0);
for (int i = 0; i < n;) {
assert c == s.charAt(i);
if (c != '%') {
sb.append(c);
if (++i >= n)
break;
c = s.charAt(i);
continue;
}
bb.clear();
int ui = i;
for (;;) {
assert (n - i >= 2);
try {
bb.put(unescape(s, i));
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
}
i += 3;
if (i >= n)
break;
c = s.charAt(i);
if (c != '%')
break;
}
bb.flip();
cb.clear();
dec.reset();
CoderResult cr = dec.decode(bb, cb, true);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
cr = dec.flush(cb);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
sb.append(cb.flip().toString());
}
return sb.toString();
} | java | public static String decode(String s) {
int n = s.length();
if ((n == 0) || (s.indexOf('%') < 0))
return s;
StringBuilder sb = new StringBuilder(n);
ByteBuffer bb = ByteBuffer.allocate(n);
CharBuffer cb = CharBuffer.allocate(n);
CharsetDecoder dec = ThreadLocalCoders.decoderFor("UTF-8")
.onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
char c = s.charAt(0);
for (int i = 0; i < n;) {
assert c == s.charAt(i);
if (c != '%') {
sb.append(c);
if (++i >= n)
break;
c = s.charAt(i);
continue;
}
bb.clear();
int ui = i;
for (;;) {
assert (n - i >= 2);
try {
bb.put(unescape(s, i));
} catch (NumberFormatException e) {
throw new IllegalArgumentException();
}
i += 3;
if (i >= n)
break;
c = s.charAt(i);
if (c != '%')
break;
}
bb.flip();
cb.clear();
dec.reset();
CoderResult cr = dec.decode(bb, cb, true);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
cr = dec.flush(cb);
if (cr.isError())
throw new IllegalArgumentException("Error decoding percent encoded characters");
sb.append(cb.flip().toString());
}
return sb.toString();
} | [
"public",
"static",
"String",
"decode",
"(",
"String",
"s",
")",
"{",
"int",
"n",
"=",
"s",
".",
"length",
"(",
")",
";",
"if",
"(",
"(",
"n",
"==",
"0",
")",
"||",
"(",
"s",
".",
"indexOf",
"(",
"'",
"'",
")",
"<",
"0",
")",
")",
"return",... | Returns a new String constructed from the specified String by replacing
the URL escape sequences and UTF8 encoding with the characters they
represent. | [
"Returns",
"a",
"new",
"String",
"constructed",
"from",
"the",
"specified",
"String",
"by",
"replacing",
"the",
"URL",
"escape",
"sequences",
"and",
"UTF8",
"encoding",
"with",
"the",
"characters",
"they",
"represent",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L173-L224 |
34,893 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.canonizeString | public String canonizeString(String file) {
int i = 0;
int lim = file.length();
// Remove embedded /../
while ((i = file.indexOf("/../")) >= 0) {
if ((lim = file.lastIndexOf('/', i - 1)) >= 0) {
file = file.substring(0, lim) + file.substring(i + 3);
} else {
file = file.substring(i + 3);
}
}
// Remove embedded /./
while ((i = file.indexOf("/./")) >= 0) {
file = file.substring(0, i) + file.substring(i + 2);
}
// Remove trailing ..
while (file.endsWith("/..")) {
i = file.indexOf("/..");
if ((lim = file.lastIndexOf('/', i - 1)) >= 0) {
file = file.substring(0, lim+1);
} else {
file = file.substring(0, i);
}
}
// Remove trailing .
if (file.endsWith("/."))
file = file.substring(0, file.length() -1);
return file;
} | java | public String canonizeString(String file) {
int i = 0;
int lim = file.length();
// Remove embedded /../
while ((i = file.indexOf("/../")) >= 0) {
if ((lim = file.lastIndexOf('/', i - 1)) >= 0) {
file = file.substring(0, lim) + file.substring(i + 3);
} else {
file = file.substring(i + 3);
}
}
// Remove embedded /./
while ((i = file.indexOf("/./")) >= 0) {
file = file.substring(0, i) + file.substring(i + 2);
}
// Remove trailing ..
while (file.endsWith("/..")) {
i = file.indexOf("/..");
if ((lim = file.lastIndexOf('/', i - 1)) >= 0) {
file = file.substring(0, lim+1);
} else {
file = file.substring(0, i);
}
}
// Remove trailing .
if (file.endsWith("/."))
file = file.substring(0, file.length() -1);
return file;
} | [
"public",
"String",
"canonizeString",
"(",
"String",
"file",
")",
"{",
"int",
"i",
"=",
"0",
";",
"int",
"lim",
"=",
"file",
".",
"length",
"(",
")",
";",
"// Remove embedded /../",
"while",
"(",
"(",
"i",
"=",
"file",
".",
"indexOf",
"(",
"\"/../\"",
... | Returns a canonical version of the specified string. | [
"Returns",
"a",
"canonical",
"version",
"of",
"the",
"specified",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L229-L259 |
34,894 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.match | private static boolean match(char c, long lowMask, long highMask) {
if (c < 64)
return ((1L << c) & lowMask) != 0;
if (c < 128)
return ((1L << (c - 64)) & highMask) != 0;
return false;
} | java | private static boolean match(char c, long lowMask, long highMask) {
if (c < 64)
return ((1L << c) & lowMask) != 0;
if (c < 128)
return ((1L << (c - 64)) & highMask) != 0;
return false;
} | [
"private",
"static",
"boolean",
"match",
"(",
"char",
"c",
",",
"long",
"lowMask",
",",
"long",
"highMask",
")",
"{",
"if",
"(",
"c",
"<",
"64",
")",
"return",
"(",
"(",
"1L",
"<<",
"c",
")",
"&",
"lowMask",
")",
"!=",
"0",
";",
"if",
"(",
"c",... | Tell whether the given character is permitted by the given mask pair | [
"Tell",
"whether",
"the",
"given",
"character",
"is",
"permitted",
"by",
"the",
"given",
"mask",
"pair"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L519-L525 |
34,895 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.lowMask | private static long lowMask(char first, char last) {
long m = 0;
int f = Math.max(Math.min(first, 63), 0);
int l = Math.max(Math.min(last, 63), 0);
for (int i = f; i <= l; i++)
m |= 1L << i;
return m;
} | java | private static long lowMask(char first, char last) {
long m = 0;
int f = Math.max(Math.min(first, 63), 0);
int l = Math.max(Math.min(last, 63), 0);
for (int i = f; i <= l; i++)
m |= 1L << i;
return m;
} | [
"private",
"static",
"long",
"lowMask",
"(",
"char",
"first",
",",
"char",
"last",
")",
"{",
"long",
"m",
"=",
"0",
";",
"int",
"f",
"=",
"Math",
".",
"max",
"(",
"Math",
".",
"min",
"(",
"first",
",",
"63",
")",
",",
"0",
")",
";",
"int",
"l... | between first and last, inclusive | [
"between",
"first",
"and",
"last",
"inclusive"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L545-L552 |
34,896 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java | ParseUtil.lowMask | private static long lowMask(String chars) {
int n = chars.length();
long m = 0;
for (int i = 0; i < n; i++) {
char c = chars.charAt(i);
if (c < 64)
m |= (1L << c);
}
return m;
} | java | private static long lowMask(String chars) {
int n = chars.length();
long m = 0;
for (int i = 0; i < n; i++) {
char c = chars.charAt(i);
if (c < 64)
m |= (1L << c);
}
return m;
} | [
"private",
"static",
"long",
"lowMask",
"(",
"String",
"chars",
")",
"{",
"int",
"n",
"=",
"chars",
".",
"length",
"(",
")",
";",
"long",
"m",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"n",
";",
"i",
"++",
")",
"{",
"c... | Compute the low-order mask for the characters in the given string | [
"Compute",
"the",
"low",
"-",
"order",
"mask",
"for",
"the",
"characters",
"in",
"the",
"given",
"string"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/www/ParseUtil.java#L555-L564 |
34,897 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java | Net.anyInet4Address | static Inet4Address anyInet4Address(final NetworkInterface interf) {
return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() {
public Inet4Address run() {
Enumeration<InetAddress> addrs = interf.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
if (addr instanceof Inet4Address) {
return (Inet4Address)addr;
}
}
return null;
}
});
} | java | static Inet4Address anyInet4Address(final NetworkInterface interf) {
return AccessController.doPrivileged(new PrivilegedAction<Inet4Address>() {
public Inet4Address run() {
Enumeration<InetAddress> addrs = interf.getInetAddresses();
while (addrs.hasMoreElements()) {
InetAddress addr = addrs.nextElement();
if (addr instanceof Inet4Address) {
return (Inet4Address)addr;
}
}
return null;
}
});
} | [
"static",
"Inet4Address",
"anyInet4Address",
"(",
"final",
"NetworkInterface",
"interf",
")",
"{",
"return",
"AccessController",
".",
"doPrivileged",
"(",
"new",
"PrivilegedAction",
"<",
"Inet4Address",
">",
"(",
")",
"{",
"public",
"Inet4Address",
"run",
"(",
")"... | Returns any IPv4 address of the given network interface, or
null if the interface does not have any IPv4 addresses. | [
"Returns",
"any",
"IPv4",
"address",
"of",
"the",
"given",
"network",
"interface",
"or",
"null",
"if",
"the",
"interface",
"does",
"not",
"have",
"any",
"IPv4",
"addresses",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L258-L271 |
34,898 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java | Net.inet4AsInt | static int inet4AsInt(InetAddress ia) {
if (ia instanceof Inet4Address) {
byte[] addr = ia.getAddress();
int address = addr[3] & 0xFF;
address |= ((addr[2] << 8) & 0xFF00);
address |= ((addr[1] << 16) & 0xFF0000);
address |= ((addr[0] << 24) & 0xFF000000);
return address;
}
throw new AssertionError("Should not reach here");
} | java | static int inet4AsInt(InetAddress ia) {
if (ia instanceof Inet4Address) {
byte[] addr = ia.getAddress();
int address = addr[3] & 0xFF;
address |= ((addr[2] << 8) & 0xFF00);
address |= ((addr[1] << 16) & 0xFF0000);
address |= ((addr[0] << 24) & 0xFF000000);
return address;
}
throw new AssertionError("Should not reach here");
} | [
"static",
"int",
"inet4AsInt",
"(",
"InetAddress",
"ia",
")",
"{",
"if",
"(",
"ia",
"instanceof",
"Inet4Address",
")",
"{",
"byte",
"[",
"]",
"addr",
"=",
"ia",
".",
"getAddress",
"(",
")",
";",
"int",
"address",
"=",
"addr",
"[",
"3",
"]",
"&",
"0... | Returns an IPv4 address as an int. | [
"Returns",
"an",
"IPv4",
"address",
"as",
"an",
"int",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L276-L286 |
34,899 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java | Net.inet4FromInt | static InetAddress inet4FromInt(int address) {
byte[] addr = new byte[4];
addr[0] = (byte) ((address >>> 24) & 0xFF);
addr[1] = (byte) ((address >>> 16) & 0xFF);
addr[2] = (byte) ((address >>> 8) & 0xFF);
addr[3] = (byte) (address & 0xFF);
try {
return InetAddress.getByAddress(addr);
} catch (UnknownHostException uhe) {
throw new AssertionError("Should not reach here");
}
} | java | static InetAddress inet4FromInt(int address) {
byte[] addr = new byte[4];
addr[0] = (byte) ((address >>> 24) & 0xFF);
addr[1] = (byte) ((address >>> 16) & 0xFF);
addr[2] = (byte) ((address >>> 8) & 0xFF);
addr[3] = (byte) (address & 0xFF);
try {
return InetAddress.getByAddress(addr);
} catch (UnknownHostException uhe) {
throw new AssertionError("Should not reach here");
}
} | [
"static",
"InetAddress",
"inet4FromInt",
"(",
"int",
"address",
")",
"{",
"byte",
"[",
"]",
"addr",
"=",
"new",
"byte",
"[",
"4",
"]",
";",
"addr",
"[",
"0",
"]",
"=",
"(",
"byte",
")",
"(",
"(",
"address",
">>>",
"24",
")",
"&",
"0xFF",
")",
"... | Returns an InetAddress from the given IPv4 address
represented as an int. | [
"Returns",
"an",
"InetAddress",
"from",
"the",
"given",
"IPv4",
"address",
"represented",
"as",
"an",
"int",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/Net.java#L292-L303 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.