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,300 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/SunCertPathBuilder.java | SunCertPathBuilder.anchorIsTarget | private static boolean anchorIsTarget(TrustAnchor anchor,
CertSelector sel)
{
X509Certificate anchorCert = anchor.getTrustedCert();
if (anchorCert != null) {
return sel.match(anchorCert);
}
return false;
} | java | private static boolean anchorIsTarget(TrustAnchor anchor,
CertSelector sel)
{
X509Certificate anchorCert = anchor.getTrustedCert();
if (anchorCert != null) {
return sel.match(anchorCert);
}
return false;
} | [
"private",
"static",
"boolean",
"anchorIsTarget",
"(",
"TrustAnchor",
"anchor",
",",
"CertSelector",
"sel",
")",
"{",
"X509Certificate",
"anchorCert",
"=",
"anchor",
".",
"getTrustedCert",
"(",
")",
";",
"if",
"(",
"anchorCert",
"!=",
"null",
")",
"{",
"return... | Returns true if trust anchor certificate matches specified
certificate constraints. | [
"Returns",
"true",
"if",
"trust",
"anchor",
"certificate",
"matches",
"specified",
"certificate",
"constraints",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/SunCertPathBuilder.java#L795-L803 |
34,301 | google/j2objc | tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java | ElementReferenceMapper.endVisit | @Override
public void endVisit(VariableDeclarationFragment fragment) {
//TODO(malvania): Add field to elementReferenceMap when field detection is enabled and the
// ElementUtil.getBinaryName() method doesn't break when called on a static block's
// ExecutableElement.
//String fieldID = stitchFieldIdentifier(fragment);
//elementReferenceMap.putIfAbsent(fieldID, new FieldReferenceNode(fragment));
Element element = fragment.getVariableElement().getEnclosingElement();
if (element instanceof TypeElement) {
TypeElement type = (TypeElement) element;
if (ElementUtil.isPublic(fragment.getVariableElement())) {
ClassReferenceNode node = (ClassReferenceNode) elementReferenceMap
.get(stitchClassIdentifier(type));
if (node == null) {
node = new ClassReferenceNode(type);
}
node.containsPublicField = true;
elementReferenceMap.putIfAbsent(stitchClassIdentifier(type), node);
}
}
} | java | @Override
public void endVisit(VariableDeclarationFragment fragment) {
//TODO(malvania): Add field to elementReferenceMap when field detection is enabled and the
// ElementUtil.getBinaryName() method doesn't break when called on a static block's
// ExecutableElement.
//String fieldID = stitchFieldIdentifier(fragment);
//elementReferenceMap.putIfAbsent(fieldID, new FieldReferenceNode(fragment));
Element element = fragment.getVariableElement().getEnclosingElement();
if (element instanceof TypeElement) {
TypeElement type = (TypeElement) element;
if (ElementUtil.isPublic(fragment.getVariableElement())) {
ClassReferenceNode node = (ClassReferenceNode) elementReferenceMap
.get(stitchClassIdentifier(type));
if (node == null) {
node = new ClassReferenceNode(type);
}
node.containsPublicField = true;
elementReferenceMap.putIfAbsent(stitchClassIdentifier(type), node);
}
}
} | [
"@",
"Override",
"public",
"void",
"endVisit",
"(",
"VariableDeclarationFragment",
"fragment",
")",
"{",
"//TODO(malvania): Add field to elementReferenceMap when field detection is enabled and the",
"// ElementUtil.getBinaryName() method doesn't break when called on a static block's",
"// ... | and resolve the type by its name using a resolve method in the parser environment. | [
"and",
"resolve",
"the",
"type",
"by",
"its",
"name",
"using",
"a",
"resolve",
"method",
"in",
"the",
"parser",
"environment",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java#L182-L203 |
34,302 | google/j2objc | tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java | ElementReferenceMapper.handleChildMethod | private void handleChildMethod(ExecutableElement methodElement) {
String methodIdentifier = stitchMethodIdentifier(methodElement);
MethodReferenceNode node = (MethodReferenceNode) elementReferenceMap.get(methodIdentifier);
if (node == null) {
node = new MethodReferenceNode(methodElement);
}
node.invoked = true;
elementReferenceMap.put(methodIdentifier, node);
addToOverrideMap(methodElement);
} | java | private void handleChildMethod(ExecutableElement methodElement) {
String methodIdentifier = stitchMethodIdentifier(methodElement);
MethodReferenceNode node = (MethodReferenceNode) elementReferenceMap.get(methodIdentifier);
if (node == null) {
node = new MethodReferenceNode(methodElement);
}
node.invoked = true;
elementReferenceMap.put(methodIdentifier, node);
addToOverrideMap(methodElement);
} | [
"private",
"void",
"handleChildMethod",
"(",
"ExecutableElement",
"methodElement",
")",
"{",
"String",
"methodIdentifier",
"=",
"stitchMethodIdentifier",
"(",
"methodElement",
")",
";",
"MethodReferenceNode",
"node",
"=",
"(",
"MethodReferenceNode",
")",
"elementReference... | Adds a node for the child in the elementReferenceMap if it doesn't exist, marks it as declared,
and adds this method to the override map.
@param methodElement | [
"Adds",
"a",
"node",
"for",
"the",
"child",
"in",
"the",
"elementReferenceMap",
"if",
"it",
"doesn",
"t",
"exist",
"marks",
"it",
"as",
"declared",
"and",
"adds",
"this",
"method",
"to",
"the",
"override",
"map",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java#L210-L219 |
34,303 | google/j2objc | tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java | ElementReferenceMapper.handleParentMethod | private void handleParentMethod(ExecutableElement parentMethodElement, ExecutableElement
childMethodElement) {
MethodReferenceNode parentMethodNode = (MethodReferenceNode) elementReferenceMap
.get(stitchMethodIdentifier(parentMethodElement));
if (parentMethodNode == null) {
parentMethodNode = new MethodReferenceNode(parentMethodElement);
}
parentMethodNode.invokedMethods.add(stitchMethodIdentifier(childMethodElement));
elementReferenceMap.put(stitchMethodIdentifier(parentMethodElement), parentMethodNode);
addToOverrideMap(parentMethodElement);
} | java | private void handleParentMethod(ExecutableElement parentMethodElement, ExecutableElement
childMethodElement) {
MethodReferenceNode parentMethodNode = (MethodReferenceNode) elementReferenceMap
.get(stitchMethodIdentifier(parentMethodElement));
if (parentMethodNode == null) {
parentMethodNode = new MethodReferenceNode(parentMethodElement);
}
parentMethodNode.invokedMethods.add(stitchMethodIdentifier(childMethodElement));
elementReferenceMap.put(stitchMethodIdentifier(parentMethodElement), parentMethodNode);
addToOverrideMap(parentMethodElement);
} | [
"private",
"void",
"handleParentMethod",
"(",
"ExecutableElement",
"parentMethodElement",
",",
"ExecutableElement",
"childMethodElement",
")",
"{",
"MethodReferenceNode",
"parentMethodNode",
"=",
"(",
"MethodReferenceNode",
")",
"elementReferenceMap",
".",
"get",
"(",
"stit... | Adds a node for the parent in the elementReferenceMap if it doesn't exist, adds the method to
the override map, and links the child method in the invokedMethods set.
@param parentMethodElement
@param childMethodElement | [
"Adds",
"a",
"node",
"for",
"the",
"parent",
"in",
"the",
"elementReferenceMap",
"if",
"it",
"doesn",
"t",
"exist",
"adds",
"the",
"method",
"to",
"the",
"override",
"map",
"and",
"links",
"the",
"child",
"method",
"in",
"the",
"invokedMethods",
"set",
"."... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/tree_shaker/src/main/java/com/google/devtools/treeshaker/ElementReferenceMapper.java#L227-L237 |
34,304 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java | KeyTable.addValueInRefsTable | private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) {
XNodeSet nodes = (XNodeSet) m_refsTable.get(ref);
if (nodes == null)
{
nodes = new XNodeSet(node, xctxt.getDTMManager());
nodes.nextNode();
m_refsTable.put(ref, nodes);
}
else
{
// Nodes are passed to this method in document order. Since we need to
// suppress duplicates, we only need to check against the last entry
// in each nodeset. We use nodes.nextNode after each entry so we can
// easily compare node against the current node.
if (nodes.getCurrentNode() != node) {
nodes.mutableNodeset().addNode(node);
nodes.nextNode();
}
}
} | java | private void addValueInRefsTable(XPathContext xctxt, XMLString ref, int node) {
XNodeSet nodes = (XNodeSet) m_refsTable.get(ref);
if (nodes == null)
{
nodes = new XNodeSet(node, xctxt.getDTMManager());
nodes.nextNode();
m_refsTable.put(ref, nodes);
}
else
{
// Nodes are passed to this method in document order. Since we need to
// suppress duplicates, we only need to check against the last entry
// in each nodeset. We use nodes.nextNode after each entry so we can
// easily compare node against the current node.
if (nodes.getCurrentNode() != node) {
nodes.mutableNodeset().addNode(node);
nodes.nextNode();
}
}
} | [
"private",
"void",
"addValueInRefsTable",
"(",
"XPathContext",
"xctxt",
",",
"XMLString",
"ref",
",",
"int",
"node",
")",
"{",
"XNodeSet",
"nodes",
"=",
"(",
"XNodeSet",
")",
"m_refsTable",
".",
"get",
"(",
"ref",
")",
";",
"if",
"(",
"nodes",
"==",
"nul... | Add an association between a ref and a node in the m_refsTable.
Requires that m_refsTable != null
@param xctxt XPath context
@param ref the value of the use clause of the current key for the given node
@param node the node to reference | [
"Add",
"an",
"association",
"between",
"a",
"ref",
"and",
"a",
"node",
"in",
"the",
"m_refsTable",
".",
"Requires",
"that",
"m_refsTable",
"!",
"=",
"null"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/KeyTable.java#L239-L259 |
34,305 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetMatch.java | CharsetMatch.getString | public String getString(int maxLength) throws java.io.IOException {
String result = null;
if (fInputStream != null) {
StringBuilder sb = new StringBuilder();
char[] buffer = new char[1024];
Reader reader = getReader();
int max = maxLength < 0? Integer.MAX_VALUE : maxLength;
int bytesRead = 0;
while ((bytesRead = reader.read(buffer, 0, Math.min(max, 1024))) >= 0) {
sb.append(buffer, 0, bytesRead);
max -= bytesRead;
}
reader.close();
return sb.toString();
} else {
String name = getName();
/*
* getName() may return a name with a suffix 'rtl' or 'ltr'. This cannot
* be used to open a charset (e.g. IBM424_rtl). The ending '_rtl' or 'ltr'
* should be stripped off before creating the string.
*/
int startSuffix = name.indexOf("_rtl") < 0 ? name.indexOf("_ltr") : name.indexOf("_rtl");
if (startSuffix > 0) {
name = name.substring(0, startSuffix);
}
result = new String(fRawInput, name);
}
return result;
} | java | public String getString(int maxLength) throws java.io.IOException {
String result = null;
if (fInputStream != null) {
StringBuilder sb = new StringBuilder();
char[] buffer = new char[1024];
Reader reader = getReader();
int max = maxLength < 0? Integer.MAX_VALUE : maxLength;
int bytesRead = 0;
while ((bytesRead = reader.read(buffer, 0, Math.min(max, 1024))) >= 0) {
sb.append(buffer, 0, bytesRead);
max -= bytesRead;
}
reader.close();
return sb.toString();
} else {
String name = getName();
/*
* getName() may return a name with a suffix 'rtl' or 'ltr'. This cannot
* be used to open a charset (e.g. IBM424_rtl). The ending '_rtl' or 'ltr'
* should be stripped off before creating the string.
*/
int startSuffix = name.indexOf("_rtl") < 0 ? name.indexOf("_ltr") : name.indexOf("_rtl");
if (startSuffix > 0) {
name = name.substring(0, startSuffix);
}
result = new String(fRawInput, name);
}
return result;
} | [
"public",
"String",
"getString",
"(",
"int",
"maxLength",
")",
"throws",
"java",
".",
"io",
".",
"IOException",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"fInputStream",
"!=",
"null",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder"... | Create a Java String from Unicode character data corresponding
to the original byte data supplied to the Charset detect operation.
The length of the returned string is limited to the specified size;
the string will be trunctated to this length if necessary. A limit value of
zero or less is ignored, and treated as no limit.
@param maxLength The maximium length of the String to be created when the
source of the data is an input stream, or -1 for
unlimited length.
@return a String created from the converted input data. | [
"Create",
"a",
"Java",
"String",
"from",
"Unicode",
"character",
"data",
"corresponding",
"to",
"the",
"original",
"byte",
"data",
"supplied",
"to",
"the",
"Charset",
"detect",
"operation",
".",
"The",
"length",
"of",
"the",
"returned",
"string",
"is",
"limite... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetMatch.java#L84-L116 |
34,306 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/pipeline/BuildClosureQueue.java | BuildClosureQueue.getNextFile | public InputFile getNextFile() {
for (Iterator<String> iter = queuedNames.iterator(); iter.hasNext(); ) {
String name = iter.next();
iter.remove();
processedNames.add(name);
InputFile file = getFileForName(name);
if (file != null) {
return file;
}
}
return null;
} | java | public InputFile getNextFile() {
for (Iterator<String> iter = queuedNames.iterator(); iter.hasNext(); ) {
String name = iter.next();
iter.remove();
processedNames.add(name);
InputFile file = getFileForName(name);
if (file != null) {
return file;
}
}
return null;
} | [
"public",
"InputFile",
"getNextFile",
"(",
")",
"{",
"for",
"(",
"Iterator",
"<",
"String",
">",
"iter",
"=",
"queuedNames",
".",
"iterator",
"(",
")",
";",
"iter",
".",
"hasNext",
"(",
")",
";",
")",
"{",
"String",
"name",
"=",
"iter",
".",
"next",
... | Returns the next Java source file to be processed. Returns null if the
queue is empty. | [
"Returns",
"the",
"next",
"Java",
"source",
"file",
"to",
"be",
"processed",
".",
"Returns",
"null",
"if",
"the",
"queue",
"is",
"empty",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/pipeline/BuildClosureQueue.java#L48-L59 |
34,307 | google/j2objc | examples/protobuf/ListPeople.java | ListPeople.Print | static void Print(AddressBook addressBook) {
for (Person person: addressBook.getPeopleList()) {
System.out.println("Person ID: " + person.getId());
System.out.println(" Name: " + person.getName());
if (!person.getEmail().isEmpty()) {
System.out.println(" E-mail address: " + person.getEmail());
}
for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
switch (phoneNumber.getType()) {
case MOBILE:
System.out.print(" Mobile phone #: ");
break;
case HOME:
System.out.print(" Home phone #: ");
break;
case WORK:
System.out.print(" Work phone #: ");
break;
}
System.out.println(phoneNumber.getNumber());
}
}
} | java | static void Print(AddressBook addressBook) {
for (Person person: addressBook.getPeopleList()) {
System.out.println("Person ID: " + person.getId());
System.out.println(" Name: " + person.getName());
if (!person.getEmail().isEmpty()) {
System.out.println(" E-mail address: " + person.getEmail());
}
for (Person.PhoneNumber phoneNumber : person.getPhonesList()) {
switch (phoneNumber.getType()) {
case MOBILE:
System.out.print(" Mobile phone #: ");
break;
case HOME:
System.out.print(" Home phone #: ");
break;
case WORK:
System.out.print(" Work phone #: ");
break;
}
System.out.println(phoneNumber.getNumber());
}
}
} | [
"static",
"void",
"Print",
"(",
"AddressBook",
"addressBook",
")",
"{",
"for",
"(",
"Person",
"person",
":",
"addressBook",
".",
"getPeopleList",
"(",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"\"Person ID: \"",
"+",
"person",
".",
"getId",... | Iterates though all people in the AddressBook and prints info about them. | [
"Iterates",
"though",
"all",
"people",
"in",
"the",
"AddressBook",
"and",
"prints",
"info",
"about",
"them",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/examples/protobuf/ListPeople.java#L11-L34 |
34,308 | google/j2objc | examples/protobuf/ListPeople.java | ListPeople.main | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE");
System.exit(-1);
}
// Read the existing address book.
AddressBook addressBook =
AddressBook.parseFrom(new FileInputStream(args[0]));
Print(addressBook);
} | java | public static void main(String[] args) throws Exception {
if (args.length != 1) {
System.err.println("Usage: ListPeople ADDRESS_BOOK_FILE");
System.exit(-1);
}
// Read the existing address book.
AddressBook addressBook =
AddressBook.parseFrom(new FileInputStream(args[0]));
Print(addressBook);
} | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"if",
"(",
"args",
".",
"length",
"!=",
"1",
")",
"{",
"System",
".",
"err",
".",
"println",
"(",
"\"Usage: ListPeople ADDRESS_BOOK_FILE\"",
")",
";",
... | the information inside. | [
"the",
"information",
"inside",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/examples/protobuf/ListPeople.java#L38-L49 |
34,309 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/IntStack.java | IntStack.push | public int push(int i)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = i;
m_firstFree++;
return i;
} | java | public int push(int i)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
int newMap[] = new int[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = i;
m_firstFree++;
return i;
} | [
"public",
"int",
"push",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"(",
"m_firstFree",
"+",
"1",
")",
">=",
"m_mapSize",
")",
"{",
"m_mapSize",
"+=",
"m_blocksize",
";",
"int",
"newMap",
"[",
"]",
"=",
"new",
"int",
"[",
"m_mapSize",
"]",
";",
"System"... | Pushes an item onto the top of this stack.
@param i the int to be pushed onto this stack.
@return the <code>item</code> argument. | [
"Pushes",
"an",
"item",
"onto",
"the",
"top",
"of",
"this",
"stack",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/IntStack.java#L72-L91 |
34,310 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X400Address.java | X400Address.encode | public void encode(DerOutputStream out) throws IOException {
DerValue derValue = new DerValue(nameValue);
out.putDerValue(derValue);
} | java | public void encode(DerOutputStream out) throws IOException {
DerValue derValue = new DerValue(nameValue);
out.putDerValue(derValue);
} | [
"public",
"void",
"encode",
"(",
"DerOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"DerValue",
"derValue",
"=",
"new",
"DerValue",
"(",
"nameValue",
")",
";",
"out",
".",
"putDerValue",
"(",
"derValue",
")",
";",
"}"
] | Encode the X400 name into the DerOutputStream.
@param out the DER stream to encode the X400Address to.
@exception IOException on encoding errors. | [
"Encode",
"the",
"X400",
"name",
"into",
"the",
"DerOutputStream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X400Address.java#L372-L375 |
34,311 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectVector.java | ObjectVector.addElement | public final void addElement(Object value)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
Object newMap[] = new Object[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = value;
m_firstFree++;
} | java | public final void addElement(Object value)
{
if ((m_firstFree + 1) >= m_mapSize)
{
m_mapSize += m_blocksize;
Object newMap[] = new Object[m_mapSize];
System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
m_map = newMap;
}
m_map[m_firstFree] = value;
m_firstFree++;
} | [
"public",
"final",
"void",
"addElement",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"(",
"m_firstFree",
"+",
"1",
")",
">=",
"m_mapSize",
")",
"{",
"m_mapSize",
"+=",
"m_blocksize",
";",
"Object",
"newMap",
"[",
"]",
"=",
"new",
"Object",
"[",
"m_map... | Append an object onto the vector.
@param value Object to add to the list | [
"Append",
"an",
"object",
"onto",
"the",
"vector",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectVector.java#L126-L143 |
34,312 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectVector.java | ObjectVector.contains | public final boolean contains(Object s)
{
for (int i = 0; i < m_firstFree; i++)
{
if (m_map[i] == s)
return true;
}
return false;
} | java | public final boolean contains(Object s)
{
for (int i = 0; i < m_firstFree; i++)
{
if (m_map[i] == s)
return true;
}
return false;
} | [
"public",
"final",
"boolean",
"contains",
"(",
"Object",
"s",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"m_firstFree",
";",
"i",
"++",
")",
"{",
"if",
"(",
"m_map",
"[",
"i",
"]",
"==",
"s",
")",
"return",
"true",
";",
"}",
"... | Tell if the table contains the given Object.
@param s object to look for
@return true if the object is in the list | [
"Tell",
"if",
"the",
"table",
"contains",
"the",
"given",
"Object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/ObjectVector.java#L326-L336 |
34,313 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java | DebugASTDump.dumpUnit | public static void dumpUnit(CompilationUnit unit) {
String relativeOutputPath = unit.getMainTypeName().replace('.', '/') + ".ast";
File outputFile = new File(
unit.getEnv().options().fileUtil().getOutputDirectory(), relativeOutputPath);
outputFile.getParentFile().mkdirs();
try (FileOutputStream fout = new FileOutputStream(outputFile);
OutputStreamWriter out = new OutputStreamWriter(fout, "UTF-8")) {
out.write(dump(unit));
} catch (IOException e) {
ErrorUtil.fatalError(e, outputFile.getPath());
}
} | java | public static void dumpUnit(CompilationUnit unit) {
String relativeOutputPath = unit.getMainTypeName().replace('.', '/') + ".ast";
File outputFile = new File(
unit.getEnv().options().fileUtil().getOutputDirectory(), relativeOutputPath);
outputFile.getParentFile().mkdirs();
try (FileOutputStream fout = new FileOutputStream(outputFile);
OutputStreamWriter out = new OutputStreamWriter(fout, "UTF-8")) {
out.write(dump(unit));
} catch (IOException e) {
ErrorUtil.fatalError(e, outputFile.getPath());
}
} | [
"public",
"static",
"void",
"dumpUnit",
"(",
"CompilationUnit",
"unit",
")",
"{",
"String",
"relativeOutputPath",
"=",
"unit",
".",
"getMainTypeName",
"(",
")",
".",
"replace",
"(",
"'",
"'",
",",
"'",
"'",
")",
"+",
"\".ast\"",
";",
"File",
"outputFile",
... | Dumps a compilation unit to a file. The output file's path is the
same as where translated files get written, but with an "ast" suffix. | [
"Dumps",
"a",
"compilation",
"unit",
"to",
"a",
"file",
".",
"The",
"output",
"file",
"s",
"path",
"is",
"the",
"same",
"as",
"where",
"translated",
"files",
"get",
"written",
"but",
"with",
"an",
"ast",
"suffix",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java#L43-L55 |
34,314 | google/j2objc | translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java | DebugASTDump.dump | public static String dump(TreeNode node) {
DebugASTDump dumper = new DebugASTDump();
node.accept(dumper);
dumper.sb.newline();
return dumper.toString();
} | java | public static String dump(TreeNode node) {
DebugASTDump dumper = new DebugASTDump();
node.accept(dumper);
dumper.sb.newline();
return dumper.toString();
} | [
"public",
"static",
"String",
"dump",
"(",
"TreeNode",
"node",
")",
"{",
"DebugASTDump",
"dumper",
"=",
"new",
"DebugASTDump",
"(",
")",
";",
"node",
".",
"accept",
"(",
"dumper",
")",
";",
"dumper",
".",
"sb",
".",
"newline",
"(",
")",
";",
"return",
... | Dumps an AST node as a string. | [
"Dumps",
"an",
"AST",
"node",
"as",
"a",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/DebugASTDump.java#L60-L65 |
34,315 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.compareMagnitude | private int compareMagnitude(BigDecimal val) {
// Match scales, avoid unnecessary inflation
long ys = val.intCompact;
long xs = this.intCompact;
if (xs == 0)
return (ys == 0) ? 0 : -1;
if (ys == 0)
return 1;
long sdiff = (long)this.scale - val.scale;
if (sdiff != 0) {
// Avoid matching scales if the (adjusted) exponents differ
long xae = (long)this.precision() - this.scale; // [-1]
long yae = (long)val.precision() - val.scale; // [-1]
if (xae < yae)
return -1;
if (xae > yae)
return 1;
BigInteger rb = null;
if (sdiff < 0) {
// The cases sdiff <= Integer.MIN_VALUE intentionally fall through.
if ( sdiff > Integer.MIN_VALUE &&
(xs == INFLATED ||
(xs = longMultiplyPowerTen(xs, (int)-sdiff)) == INFLATED) &&
ys == INFLATED) {
rb = bigMultiplyPowerTen((int)-sdiff);
return rb.compareMagnitude(val.intVal);
}
} else { // sdiff > 0
// The cases sdiff > Integer.MAX_VALUE intentionally fall through.
if ( sdiff <= Integer.MAX_VALUE &&
(ys == INFLATED ||
(ys = longMultiplyPowerTen(ys, (int)sdiff)) == INFLATED) &&
xs == INFLATED) {
rb = val.bigMultiplyPowerTen((int)sdiff);
return this.intVal.compareMagnitude(rb);
}
}
}
if (xs != INFLATED)
return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1;
else if (ys != INFLATED)
return 1;
else
return this.intVal.compareMagnitude(val.intVal);
} | java | private int compareMagnitude(BigDecimal val) {
// Match scales, avoid unnecessary inflation
long ys = val.intCompact;
long xs = this.intCompact;
if (xs == 0)
return (ys == 0) ? 0 : -1;
if (ys == 0)
return 1;
long sdiff = (long)this.scale - val.scale;
if (sdiff != 0) {
// Avoid matching scales if the (adjusted) exponents differ
long xae = (long)this.precision() - this.scale; // [-1]
long yae = (long)val.precision() - val.scale; // [-1]
if (xae < yae)
return -1;
if (xae > yae)
return 1;
BigInteger rb = null;
if (sdiff < 0) {
// The cases sdiff <= Integer.MIN_VALUE intentionally fall through.
if ( sdiff > Integer.MIN_VALUE &&
(xs == INFLATED ||
(xs = longMultiplyPowerTen(xs, (int)-sdiff)) == INFLATED) &&
ys == INFLATED) {
rb = bigMultiplyPowerTen((int)-sdiff);
return rb.compareMagnitude(val.intVal);
}
} else { // sdiff > 0
// The cases sdiff > Integer.MAX_VALUE intentionally fall through.
if ( sdiff <= Integer.MAX_VALUE &&
(ys == INFLATED ||
(ys = longMultiplyPowerTen(ys, (int)sdiff)) == INFLATED) &&
xs == INFLATED) {
rb = val.bigMultiplyPowerTen((int)sdiff);
return this.intVal.compareMagnitude(rb);
}
}
}
if (xs != INFLATED)
return (ys != INFLATED) ? longCompareMagnitude(xs, ys) : -1;
else if (ys != INFLATED)
return 1;
else
return this.intVal.compareMagnitude(val.intVal);
} | [
"private",
"int",
"compareMagnitude",
"(",
"BigDecimal",
"val",
")",
"{",
"// Match scales, avoid unnecessary inflation",
"long",
"ys",
"=",
"val",
".",
"intCompact",
";",
"long",
"xs",
"=",
"this",
".",
"intCompact",
";",
"if",
"(",
"xs",
"==",
"0",
")",
"r... | Version of compareTo that ignores sign. | [
"Version",
"of",
"compareTo",
"that",
"ignores",
"sign",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L2646-L2691 |
34,316 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.bigDigitLength | private static int bigDigitLength(BigInteger b) {
/*
* Same idea as the long version, but we need a better
* approximation of log10(2). Using 646456993/2^31
* is accurate up to max possible reported bitLength.
*/
if (b.signum == 0)
return 1;
int r = (int)((((long)b.bitLength() + 1) * 646456993) >>> 31);
return b.compareMagnitude(bigTenToThe(r)) < 0? r : r+1;
} | java | private static int bigDigitLength(BigInteger b) {
/*
* Same idea as the long version, but we need a better
* approximation of log10(2). Using 646456993/2^31
* is accurate up to max possible reported bitLength.
*/
if (b.signum == 0)
return 1;
int r = (int)((((long)b.bitLength() + 1) * 646456993) >>> 31);
return b.compareMagnitude(bigTenToThe(r)) < 0? r : r+1;
} | [
"private",
"static",
"int",
"bigDigitLength",
"(",
"BigInteger",
"b",
")",
"{",
"/*\n * Same idea as the long version, but we need a better\n * approximation of log10(2). Using 646456993/2^31\n * is accurate up to max possible reported bitLength.\n */",
"if",
"(... | Returns the length of the absolute value of a BigInteger, in
decimal digits.
@param b the BigInteger
@return the length of the unscaled value, in decimal digits | [
"Returns",
"the",
"length",
"of",
"the",
"absolute",
"value",
"of",
"a",
"BigInteger",
"in",
"decimal",
"digits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L3813-L3823 |
34,317 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.checkScale | private int checkScale(long val) {
int asInt = (int)val;
if (asInt != val) {
asInt = val>Integer.MAX_VALUE ? Integer.MAX_VALUE : Integer.MIN_VALUE;
BigInteger b;
if (intCompact != 0 &&
((b = intVal) == null || b.signum() != 0))
throw new ArithmeticException(asInt>0 ? "Underflow":"Overflow");
}
return asInt;
} | java | private int checkScale(long val) {
int asInt = (int)val;
if (asInt != val) {
asInt = val>Integer.MAX_VALUE ? Integer.MAX_VALUE : Integer.MIN_VALUE;
BigInteger b;
if (intCompact != 0 &&
((b = intVal) == null || b.signum() != 0))
throw new ArithmeticException(asInt>0 ? "Underflow":"Overflow");
}
return asInt;
} | [
"private",
"int",
"checkScale",
"(",
"long",
"val",
")",
"{",
"int",
"asInt",
"=",
"(",
"int",
")",
"val",
";",
"if",
"(",
"asInt",
"!=",
"val",
")",
"{",
"asInt",
"=",
"val",
">",
"Integer",
".",
"MAX_VALUE",
"?",
"Integer",
".",
"MAX_VALUE",
":",... | Check a scale for Underflow or Overflow. If this BigDecimal is
nonzero, throw an exception if the scale is outof range. If this
is zero, saturate the scale to the extreme value of the right
sign if the scale is out of range.
@param val The new scale.
@throws ArithmeticException (overflow or underflow) if the new
scale is out of range.
@return validated scale as an int. | [
"Check",
"a",
"scale",
"for",
"Underflow",
"or",
"Overflow",
".",
"If",
"this",
"BigDecimal",
"is",
"nonzero",
"throw",
"an",
"exception",
"if",
"the",
"scale",
"is",
"outof",
"range",
".",
"If",
"this",
"is",
"zero",
"saturate",
"the",
"scale",
"to",
"t... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L3836-L3846 |
34,318 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java | BigDecimal.commonNeedIncrement | private static boolean commonNeedIncrement(int roundingMode, int qsign,
int cmpFracHalf, boolean oddQuot) {
switch(roundingMode) {
case ROUND_UNNECESSARY:
throw new ArithmeticException("Rounding necessary");
case ROUND_UP: // Away from zero
return true;
case ROUND_DOWN: // Towards zero
return false;
case ROUND_CEILING: // Towards +infinity
return qsign > 0;
case ROUND_FLOOR: // Towards -infinity
return qsign < 0;
default: // Some kind of half-way rounding
assert roundingMode >= ROUND_HALF_UP &&
roundingMode <= ROUND_HALF_EVEN: "Unexpected rounding mode" + RoundingMode.valueOf(roundingMode);
if (cmpFracHalf < 0 ) // We're closer to higher digit
return false;
else if (cmpFracHalf > 0 ) // We're closer to lower digit
return true;
else { // half-way
assert cmpFracHalf == 0;
switch(roundingMode) {
case ROUND_HALF_DOWN:
return false;
case ROUND_HALF_UP:
return true;
case ROUND_HALF_EVEN:
return oddQuot;
default:
throw new AssertionError("Unexpected rounding mode" + roundingMode);
}
}
}
} | java | private static boolean commonNeedIncrement(int roundingMode, int qsign,
int cmpFracHalf, boolean oddQuot) {
switch(roundingMode) {
case ROUND_UNNECESSARY:
throw new ArithmeticException("Rounding necessary");
case ROUND_UP: // Away from zero
return true;
case ROUND_DOWN: // Towards zero
return false;
case ROUND_CEILING: // Towards +infinity
return qsign > 0;
case ROUND_FLOOR: // Towards -infinity
return qsign < 0;
default: // Some kind of half-way rounding
assert roundingMode >= ROUND_HALF_UP &&
roundingMode <= ROUND_HALF_EVEN: "Unexpected rounding mode" + RoundingMode.valueOf(roundingMode);
if (cmpFracHalf < 0 ) // We're closer to higher digit
return false;
else if (cmpFracHalf > 0 ) // We're closer to lower digit
return true;
else { // half-way
assert cmpFracHalf == 0;
switch(roundingMode) {
case ROUND_HALF_DOWN:
return false;
case ROUND_HALF_UP:
return true;
case ROUND_HALF_EVEN:
return oddQuot;
default:
throw new AssertionError("Unexpected rounding mode" + roundingMode);
}
}
}
} | [
"private",
"static",
"boolean",
"commonNeedIncrement",
"(",
"int",
"roundingMode",
",",
"int",
"qsign",
",",
"int",
"cmpFracHalf",
",",
"boolean",
"oddQuot",
")",
"{",
"switch",
"(",
"roundingMode",
")",
"{",
"case",
"ROUND_UNNECESSARY",
":",
"throw",
"new",
"... | Shared logic of need increment computation. | [
"Shared",
"logic",
"of",
"need",
"increment",
"computation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/BigDecimal.java#L4146-L4190 |
34,319 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/HebrewCalendar.java | HebrewCalendar.yearType | private final int yearType(int year)
{
int yearLength = handleGetYearLength(year);
if (yearLength > 380) {
yearLength -= 30; // Subtract length of leap month.
}
int type = 0;
switch (yearLength) {
case 353:
type = 0; break;
case 354:
type = 1; break;
case 355:
type = 2; break;
default:
throw new IllegalArgumentException("Illegal year length " + yearLength + " in year " + year);
}
return type;
} | java | private final int yearType(int year)
{
int yearLength = handleGetYearLength(year);
if (yearLength > 380) {
yearLength -= 30; // Subtract length of leap month.
}
int type = 0;
switch (yearLength) {
case 353:
type = 0; break;
case 354:
type = 1; break;
case 355:
type = 2; break;
default:
throw new IllegalArgumentException("Illegal year length " + yearLength + " in year " + year);
}
return type;
} | [
"private",
"final",
"int",
"yearType",
"(",
"int",
"year",
")",
"{",
"int",
"yearLength",
"=",
"handleGetYearLength",
"(",
"year",
")",
";",
"if",
"(",
"yearLength",
">",
"380",
")",
"{",
"yearLength",
"-=",
"30",
";",
"// Subtract length of leap month.",
"}... | Returns the the type of a given year.
0 "Deficient" year with 353 or 383 days
1 "Normal" year with 354 or 384 days
2 "Complete" year with 355 or 385 days | [
"Returns",
"the",
"the",
"type",
"of",
"a",
"given",
"year",
".",
"0",
"Deficient",
"year",
"with",
"353",
"or",
"383",
"days",
"1",
"Normal",
"year",
"with",
"354",
"or",
"384",
"days",
"2",
"Complete",
"year",
"with",
"355",
"or",
"385",
"days"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/HebrewCalendar.java#L635-L657 |
34,320 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/HebrewCalendar.java | HebrewCalendar.handleGetMonthLength | protected int handleGetMonthLength(int extendedYear, int month) {
// Resolve out-of-range months. This is necessary in order to
// obtain the correct year. We correct to
// a 12- or 13-month year (add/subtract 12 or 13, depending
// on the year) but since we _always_ number from 0..12, and
// the leap year determines whether or not month 5 (Adar 1)
// is present, we allow 0..12 in any given year.
while (month < 0) {
month += monthsInYear(--extendedYear);
}
// Careful: allow 0..12 in all years
while (month > 12) {
month -= monthsInYear(extendedYear++);
}
switch (month) {
case HESHVAN:
case KISLEV:
// These two month lengths can vary
return MONTH_LENGTH[month][yearType(extendedYear)];
default:
// The rest are a fixed length
return MONTH_LENGTH[month][0];
}
} | java | protected int handleGetMonthLength(int extendedYear, int month) {
// Resolve out-of-range months. This is necessary in order to
// obtain the correct year. We correct to
// a 12- or 13-month year (add/subtract 12 or 13, depending
// on the year) but since we _always_ number from 0..12, and
// the leap year determines whether or not month 5 (Adar 1)
// is present, we allow 0..12 in any given year.
while (month < 0) {
month += monthsInYear(--extendedYear);
}
// Careful: allow 0..12 in all years
while (month > 12) {
month -= monthsInYear(extendedYear++);
}
switch (month) {
case HESHVAN:
case KISLEV:
// These two month lengths can vary
return MONTH_LENGTH[month][yearType(extendedYear)];
default:
// The rest are a fixed length
return MONTH_LENGTH[month][0];
}
} | [
"protected",
"int",
"handleGetMonthLength",
"(",
"int",
"extendedYear",
",",
"int",
"month",
")",
"{",
"// Resolve out-of-range months. This is necessary in order to",
"// obtain the correct year. We correct to",
"// a 12- or 13-month year (add/subtract 12 or 13, depending",
"// on the... | Returns the length of the given month in the given year | [
"Returns",
"the",
"length",
"of",
"the",
"given",
"month",
"in",
"the",
"given",
"year"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/HebrewCalendar.java#L692-L717 |
34,321 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.getEnvironmentHash | public Hashtable getEnvironmentHash()
{
// Setup a hash to store various environment information in
Hashtable hash = new Hashtable();
// Call various worker methods to fill in the hash
// These are explicitly separate for maintenance and so
// advanced users could call them standalone
checkJAXPVersion(hash);
checkProcessorVersion(hash);
checkParserVersion(hash);
checkAntVersion(hash);
checkDOMVersion(hash);
checkSAXVersion(hash);
checkSystemProperties(hash);
return hash;
} | java | public Hashtable getEnvironmentHash()
{
// Setup a hash to store various environment information in
Hashtable hash = new Hashtable();
// Call various worker methods to fill in the hash
// These are explicitly separate for maintenance and so
// advanced users could call them standalone
checkJAXPVersion(hash);
checkProcessorVersion(hash);
checkParserVersion(hash);
checkAntVersion(hash);
checkDOMVersion(hash);
checkSAXVersion(hash);
checkSystemProperties(hash);
return hash;
} | [
"public",
"Hashtable",
"getEnvironmentHash",
"(",
")",
"{",
"// Setup a hash to store various environment information in",
"Hashtable",
"hash",
"=",
"new",
"Hashtable",
"(",
")",
";",
"// Call various worker methods to fill in the hash",
"// These are explicitly separate for mainten... | Fill a hash with basic environment settings that affect Xalan.
<p>Worker method called from various places.</p>
<p>Various system and CLASSPATH, etc. properties are put into
the hash as keys with a brief description of the current state
of that item as the value. Any serious problems will be put in
with a key that is prefixed with {@link #ERROR 'ERROR.'} so it
stands out in any resulting report; also a key with just that
constant will be set as well for any error.</p>
<p>Note that some legitimate cases are flaged as potential
errors - namely when a developer recompiles xalan.jar on their
own - and even a non-error state doesn't guaruntee that
everything in the environment is correct. But this will help
point out the most common classpath and system property
problems that we've seen.</p>
@return Hashtable full of useful environment info about Xalan
and related system properties, etc. | [
"Fill",
"a",
"hash",
"with",
"basic",
"environment",
"settings",
"that",
"affect",
"Xalan",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L215-L232 |
34,322 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.writeEnvironmentReport | protected boolean writeEnvironmentReport(Hashtable h)
{
if (null == h)
{
logMsg("# ERROR: writeEnvironmentReport called with null Hashtable");
return false;
}
boolean errors = false;
logMsg(
"#---- BEGIN writeEnvironmentReport($Revision: 468646 $): Useful stuff found: ----");
// Fake the Properties-like output
for (Enumeration keys = h.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
String keyStr = (String) key;
try
{
// Special processing for classes found..
if (keyStr.startsWith(FOUNDCLASSES))
{
Vector v = (Vector) h.get(keyStr);
errors |= logFoundJars(v, keyStr);
}
// ..normal processing for all other entries
else
{
// Note: we could just check for the ERROR key by itself,
// since we now set that, but since we have to go
// through the whole hash anyway, do it this way,
// which is safer for maintenance
if (keyStr.startsWith(ERROR))
{
errors = true;
}
logMsg(keyStr + "=" + h.get(keyStr));
}
}
catch (Exception e)
{
logMsg("Reading-" + key + "= threw: " + e.toString());
}
}
logMsg(
"#----- END writeEnvironmentReport: Useful properties found: -----");
return errors;
} | java | protected boolean writeEnvironmentReport(Hashtable h)
{
if (null == h)
{
logMsg("# ERROR: writeEnvironmentReport called with null Hashtable");
return false;
}
boolean errors = false;
logMsg(
"#---- BEGIN writeEnvironmentReport($Revision: 468646 $): Useful stuff found: ----");
// Fake the Properties-like output
for (Enumeration keys = h.keys();
keys.hasMoreElements();
/* no increment portion */
)
{
Object key = keys.nextElement();
String keyStr = (String) key;
try
{
// Special processing for classes found..
if (keyStr.startsWith(FOUNDCLASSES))
{
Vector v = (Vector) h.get(keyStr);
errors |= logFoundJars(v, keyStr);
}
// ..normal processing for all other entries
else
{
// Note: we could just check for the ERROR key by itself,
// since we now set that, but since we have to go
// through the whole hash anyway, do it this way,
// which is safer for maintenance
if (keyStr.startsWith(ERROR))
{
errors = true;
}
logMsg(keyStr + "=" + h.get(keyStr));
}
}
catch (Exception e)
{
logMsg("Reading-" + key + "= threw: " + e.toString());
}
}
logMsg(
"#----- END writeEnvironmentReport: Useful properties found: -----");
return errors;
} | [
"protected",
"boolean",
"writeEnvironmentReport",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"{",
"logMsg",
"(",
"\"# ERROR: writeEnvironmentReport called with null Hashtable\"",
")",
";",
"return",
"false",
";",
"}",
"boolean",
"errors",
... | Dump a basic Xalan environment report to outWriter.
<p>This dumps a simple header and then each of the entries in
the Hashtable to our PrintWriter; it does special processing
for entries that are .jars found in the classpath.</p>
@param h Hashtable of items to report on; presumably
filled in by our various check*() methods
@return true if your environment appears to have no major
problems; false if potential environment problems found
@see #appendEnvironmentReport(Node, Document, Hashtable)
for an equivalent that appends to a Node instead | [
"Dump",
"a",
"basic",
"Xalan",
"environment",
"report",
"to",
"outWriter",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L248-L302 |
34,323 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkSystemProperties | protected void checkSystemProperties(Hashtable h)
{
if (null == h)
h = new Hashtable();
// Grab java version for later use
try
{
String javaVersion = System.getProperty("java.version");
h.put("java.version", javaVersion);
}
catch (SecurityException se)
{
// For applet context, etc.
h.put(
"java.version",
"WARNING: SecurityException thrown accessing system version properties");
}
// Printout jar files on classpath(s) that may affect operation
// Do this in order
try
{
// This is present in all JVM's
String cp = System.getProperty("java.class.path");
h.put("java.class.path", cp);
Vector classpathJars = checkPathForJars(cp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "java.class.path", classpathJars);
// Also check for JDK 1.2+ type classpaths
String othercp = System.getProperty("sun.boot.class.path");
if (null != othercp)
{
h.put("sun.boot.class.path", othercp);
classpathJars = checkPathForJars(othercp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
//@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated
othercp = System.getProperty("java.ext.dirs");
if (null != othercp)
{
h.put("java.ext.dirs", othercp);
classpathJars = checkPathForJars(othercp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
}
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
}
catch (SecurityException se2)
{
// For applet context, etc.
h.put(
"java.class.path",
"WARNING: SecurityException thrown accessing system classpath properties");
}
} | java | protected void checkSystemProperties(Hashtable h)
{
if (null == h)
h = new Hashtable();
// Grab java version for later use
try
{
String javaVersion = System.getProperty("java.version");
h.put("java.version", javaVersion);
}
catch (SecurityException se)
{
// For applet context, etc.
h.put(
"java.version",
"WARNING: SecurityException thrown accessing system version properties");
}
// Printout jar files on classpath(s) that may affect operation
// Do this in order
try
{
// This is present in all JVM's
String cp = System.getProperty("java.class.path");
h.put("java.class.path", cp);
Vector classpathJars = checkPathForJars(cp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "java.class.path", classpathJars);
// Also check for JDK 1.2+ type classpaths
String othercp = System.getProperty("sun.boot.class.path");
if (null != othercp)
{
h.put("sun.boot.class.path", othercp);
classpathJars = checkPathForJars(othercp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
}
//@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated
othercp = System.getProperty("java.ext.dirs");
if (null != othercp)
{
h.put("java.ext.dirs", othercp);
classpathJars = checkPathForJars(othercp, jarNames);
if (null != classpathJars)
h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
}
//@todo also check other System properties' paths?
// v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames); // ?? may not be needed
// v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames); // ?? may not be needed
}
catch (SecurityException se2)
{
// For applet context, etc.
h.put(
"java.class.path",
"WARNING: SecurityException thrown accessing system classpath properties");
}
} | [
"protected",
"void",
"checkSystemProperties",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"// Grab java version for later use",
"try",
"{",
"String",
"javaVersion",
"=",
"System",
".",
"get... | Fillin hash with info about SystemProperties.
Logs java.class.path and other likely paths; then attempts
to search those paths for .jar files with Xalan-related classes.
//@todo NOTE: We don't actually search java.ext.dirs for
// *.jar files therein! This should be updated
@param h Hashtable to put information in
@see #jarNames
@see #checkPathForJars(String, String[]) | [
"Fillin",
"hash",
"with",
"info",
"about",
"SystemProperties",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L562-L637 |
34,324 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkPathForJars | protected Vector checkPathForJars(String cp, String[] jars)
{
if ((null == cp) || (null == jars) || (0 == cp.length())
|| (0 == jars.length))
return null;
Vector v = new Vector();
StringTokenizer st = new StringTokenizer(cp, File.pathSeparator);
while (st.hasMoreTokens())
{
// Look at each classpath entry for each of our requested jarNames
String filename = st.nextToken();
for (int i = 0; i < jars.length; i++)
{
if (filename.indexOf(jars[i]) > -1)
{
File f = new File(filename);
if (f.exists())
{
// If any requested jarName exists, report on
// the details of that .jar file
try
{
Hashtable h = new Hashtable(2);
// Note "-" char is looked for in appendFoundJars
h.put(jars[i] + "-path", f.getAbsolutePath());
// We won't bother reporting on the xalan.jar apparent version
// since this requires knowing the jar size of the xalan.jar
// before we build it.
// For other jars, eg. xml-apis.jar and xercesImpl.jar, we
// report the apparent version of the file we've found
if (!("xalan.jar".equalsIgnoreCase(jars[i]))) {
h.put(jars[i] + "-apparent.version",
getApparentVersion(jars[i], f.length()));
}
v.addElement(h);
}
catch (Exception e)
{
/* no-op, don't add it */
}
}
else
{
Hashtable h = new Hashtable(2);
// Note "-" char is looked for in appendFoundJars
h.put(jars[i] + "-path", WARNING + " Classpath entry: "
+ filename + " does not exist");
h.put(jars[i] + "-apparent.version", CLASS_NOTPRESENT);
v.addElement(h);
}
}
}
}
return v;
} | java | protected Vector checkPathForJars(String cp, String[] jars)
{
if ((null == cp) || (null == jars) || (0 == cp.length())
|| (0 == jars.length))
return null;
Vector v = new Vector();
StringTokenizer st = new StringTokenizer(cp, File.pathSeparator);
while (st.hasMoreTokens())
{
// Look at each classpath entry for each of our requested jarNames
String filename = st.nextToken();
for (int i = 0; i < jars.length; i++)
{
if (filename.indexOf(jars[i]) > -1)
{
File f = new File(filename);
if (f.exists())
{
// If any requested jarName exists, report on
// the details of that .jar file
try
{
Hashtable h = new Hashtable(2);
// Note "-" char is looked for in appendFoundJars
h.put(jars[i] + "-path", f.getAbsolutePath());
// We won't bother reporting on the xalan.jar apparent version
// since this requires knowing the jar size of the xalan.jar
// before we build it.
// For other jars, eg. xml-apis.jar and xercesImpl.jar, we
// report the apparent version of the file we've found
if (!("xalan.jar".equalsIgnoreCase(jars[i]))) {
h.put(jars[i] + "-apparent.version",
getApparentVersion(jars[i], f.length()));
}
v.addElement(h);
}
catch (Exception e)
{
/* no-op, don't add it */
}
}
else
{
Hashtable h = new Hashtable(2);
// Note "-" char is looked for in appendFoundJars
h.put(jars[i] + "-path", WARNING + " Classpath entry: "
+ filename + " does not exist");
h.put(jars[i] + "-apparent.version", CLASS_NOTPRESENT);
v.addElement(h);
}
}
}
}
return v;
} | [
"protected",
"Vector",
"checkPathForJars",
"(",
"String",
"cp",
",",
"String",
"[",
"]",
"jars",
")",
"{",
"if",
"(",
"(",
"null",
"==",
"cp",
")",
"||",
"(",
"null",
"==",
"jars",
")",
"||",
"(",
"0",
"==",
"cp",
".",
"length",
"(",
")",
")",
... | Cheap-o listing of specified .jars found in the classpath.
cp should be separated by the usual File.pathSeparator. We
then do a simplistic search of the path for any requested
.jar filenames, and return a listing of their names and
where (apparently) they came from.
@param cp classpath to search
@param jars array of .jar base filenames to look for
@return Vector of Hashtables filled with info about found .jars
@see #jarNames
@see #logFoundJars(Vector, String)
@see #appendFoundJars(Node, Document, Vector, String )
@see #getApparentVersion(String, long) | [
"Cheap",
"-",
"o",
"listing",
"of",
"specified",
".",
"jars",
"found",
"in",
"the",
"classpath",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L656-L720 |
34,325 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.getApparentVersion | protected String getApparentVersion(String jarName, long jarSize)
{
// If we found a matching size and it's for our
// jar, then return it's description
// Lookup in static jarVersions Hashtable
String foundSize = (String) jarVersions.get(new Long(jarSize));
if ((null != foundSize) && (foundSize.startsWith(jarName)))
{
return foundSize;
}
else
{
if ("xerces.jar".equalsIgnoreCase(jarName)
|| "xercesImpl.jar".equalsIgnoreCase(jarName))
// || "xalan.jar".equalsIgnoreCase(jarName))
{
// For xalan.jar and xerces.jar/xercesImpl.jar, which we ship together:
// The jar is not from a shipped copy of xalan-j, so
// it's up to the user to ensure that it's compatible
return jarName + " " + WARNING + CLASS_PRESENT;
}
else
{
// Otherwise, it's just a jar we don't have the version info calculated for
return jarName + " " + CLASS_PRESENT;
}
}
} | java | protected String getApparentVersion(String jarName, long jarSize)
{
// If we found a matching size and it's for our
// jar, then return it's description
// Lookup in static jarVersions Hashtable
String foundSize = (String) jarVersions.get(new Long(jarSize));
if ((null != foundSize) && (foundSize.startsWith(jarName)))
{
return foundSize;
}
else
{
if ("xerces.jar".equalsIgnoreCase(jarName)
|| "xercesImpl.jar".equalsIgnoreCase(jarName))
// || "xalan.jar".equalsIgnoreCase(jarName))
{
// For xalan.jar and xerces.jar/xercesImpl.jar, which we ship together:
// The jar is not from a shipped copy of xalan-j, so
// it's up to the user to ensure that it's compatible
return jarName + " " + WARNING + CLASS_PRESENT;
}
else
{
// Otherwise, it's just a jar we don't have the version info calculated for
return jarName + " " + CLASS_PRESENT;
}
}
} | [
"protected",
"String",
"getApparentVersion",
"(",
"String",
"jarName",
",",
"long",
"jarSize",
")",
"{",
"// If we found a matching size and it's for our ",
"// jar, then return it's description",
"// Lookup in static jarVersions Hashtable",
"String",
"foundSize",
"=",
"(",
"Str... | Cheap-o method to determine the product version of a .jar.
Currently does a lookup into a local table of some recent
shipped Xalan builds to determine where the .jar probably
came from. Note that if you recompile Xalan or Xerces
yourself this will likely report a potential error, since
we can't certify builds other than the ones we ship.
Only reports against selected posted Xalan-J builds.
//@todo actually look up version info in manifests
@param jarName base filename of the .jarfile
@param jarSize size of the .jarfile
@return String describing where the .jar file probably
came from | [
"Cheap",
"-",
"o",
"method",
"to",
"determine",
"the",
"product",
"version",
"of",
"a",
".",
"jar",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L740-L770 |
34,326 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkJAXPVersion | protected void checkJAXPVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final Class noArgs[] = new Class[0];
Class clazz = null;
try
{
final String JAXP1_CLASS = "javax.xml.parsers.DocumentBuilder";
final String JAXP11_METHOD = "getDOMImplementation";
clazz = ObjectFactory.findProviderClass(
JAXP1_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(JAXP11_METHOD, noArgs);
// If we succeeded, we at least have JAXP 1.1 available
h.put(VERSION + "JAXP", "1.1 or higher");
}
catch (Exception e)
{
if (null != clazz)
{
// We must have found the class itself, just not the
// method, so we (probably) have JAXP 1.0.1
h.put(ERROR + VERSION + "JAXP", "1.0.1");
h.put(ERROR, ERROR_FOUND);
}
else
{
// We couldn't even find the class, and don't have
// any JAXP support at all, or only have the
// transform half of it
h.put(ERROR + VERSION + "JAXP", CLASS_NOTPRESENT);
h.put(ERROR, ERROR_FOUND);
}
}
} | java | protected void checkJAXPVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final Class noArgs[] = new Class[0];
Class clazz = null;
try
{
final String JAXP1_CLASS = "javax.xml.parsers.DocumentBuilder";
final String JAXP11_METHOD = "getDOMImplementation";
clazz = ObjectFactory.findProviderClass(
JAXP1_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(JAXP11_METHOD, noArgs);
// If we succeeded, we at least have JAXP 1.1 available
h.put(VERSION + "JAXP", "1.1 or higher");
}
catch (Exception e)
{
if (null != clazz)
{
// We must have found the class itself, just not the
// method, so we (probably) have JAXP 1.0.1
h.put(ERROR + VERSION + "JAXP", "1.0.1");
h.put(ERROR, ERROR_FOUND);
}
else
{
// We couldn't even find the class, and don't have
// any JAXP support at all, or only have the
// transform half of it
h.put(ERROR + VERSION + "JAXP", CLASS_NOTPRESENT);
h.put(ERROR, ERROR_FOUND);
}
}
} | [
"protected",
"void",
"checkJAXPVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"final",
"Class",
"noArgs",
"[",
"]",
"=",
"new",
"Class",
"[",
"0",
"]",
";",
"Class",
"clazz... | Report version information about JAXP interfaces.
Currently distinguishes between JAXP 1.0.1 and JAXP 1.1,
and not found; only tests the interfaces, and does not
check for reference implementation versions.
@param h Hashtable to put information in | [
"Report",
"version",
"information",
"about",
"JAXP",
"interfaces",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L781-L822 |
34,327 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkProcessorVersion | protected void checkProcessorVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XALAN1_VERSION_CLASS =
"org.apache.xalan.xslt.XSLProcessorVersion";
Class clazz = ObjectFactory.findProviderClass(
XALAN1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xalan-J 1.x, grab it's version fields
StringBuffer buf = new StringBuffer();
Field f = clazz.getField("PRODUCT");
buf.append(f.get(null));
buf.append(';');
f = clazz.getField("LANGUAGE");
buf.append(f.get(null));
buf.append(';');
f = clazz.getField("S_VERSION");
buf.append(f.get(null));
buf.append(';');
h.put(VERSION + "xalan1", buf.toString());
}
catch (Exception e1)
{
h.put(VERSION + "xalan1", CLASS_NOTPRESENT);
}
try
{
// NOTE: This is the old Xalan 2.0, 2.1, 2.2 version class,
// is being replaced by class below
final String XALAN2_VERSION_CLASS =
"org.apache.xalan.processor.XSLProcessorVersion";
Class clazz = ObjectFactory.findProviderClass(
XALAN2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xalan-J 2.x, grab it's version fields
StringBuffer buf = new StringBuffer();
Field f = clazz.getField("S_VERSION");
buf.append(f.get(null));
h.put(VERSION + "xalan2x", buf.toString());
}
catch (Exception e2)
{
h.put(VERSION + "xalan2x", CLASS_NOTPRESENT);
}
try
{
// NOTE: This is the new Xalan 2.2+ version class
final String XALAN2_2_VERSION_CLASS =
"org.apache.xalan.Version";
final String XALAN2_2_VERSION_METHOD = "getVersion";
final Class noArgs[] = new Class[0];
Class clazz = ObjectFactory.findProviderClass(
XALAN2_2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(XALAN2_2_VERSION_METHOD, noArgs);
Object returnValue = method.invoke(null, new Object[0]);
h.put(VERSION + "xalan2_2", (String)returnValue);
}
catch (Exception e2)
{
h.put(VERSION + "xalan2_2", CLASS_NOTPRESENT);
}
} | java | protected void checkProcessorVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XALAN1_VERSION_CLASS =
"org.apache.xalan.xslt.XSLProcessorVersion";
Class clazz = ObjectFactory.findProviderClass(
XALAN1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xalan-J 1.x, grab it's version fields
StringBuffer buf = new StringBuffer();
Field f = clazz.getField("PRODUCT");
buf.append(f.get(null));
buf.append(';');
f = clazz.getField("LANGUAGE");
buf.append(f.get(null));
buf.append(';');
f = clazz.getField("S_VERSION");
buf.append(f.get(null));
buf.append(';');
h.put(VERSION + "xalan1", buf.toString());
}
catch (Exception e1)
{
h.put(VERSION + "xalan1", CLASS_NOTPRESENT);
}
try
{
// NOTE: This is the old Xalan 2.0, 2.1, 2.2 version class,
// is being replaced by class below
final String XALAN2_VERSION_CLASS =
"org.apache.xalan.processor.XSLProcessorVersion";
Class clazz = ObjectFactory.findProviderClass(
XALAN2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xalan-J 2.x, grab it's version fields
StringBuffer buf = new StringBuffer();
Field f = clazz.getField("S_VERSION");
buf.append(f.get(null));
h.put(VERSION + "xalan2x", buf.toString());
}
catch (Exception e2)
{
h.put(VERSION + "xalan2x", CLASS_NOTPRESENT);
}
try
{
// NOTE: This is the new Xalan 2.2+ version class
final String XALAN2_2_VERSION_CLASS =
"org.apache.xalan.Version";
final String XALAN2_2_VERSION_METHOD = "getVersion";
final Class noArgs[] = new Class[0];
Class clazz = ObjectFactory.findProviderClass(
XALAN2_2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(XALAN2_2_VERSION_METHOD, noArgs);
Object returnValue = method.invoke(null, new Object[0]);
h.put(VERSION + "xalan2_2", (String)returnValue);
}
catch (Exception e2)
{
h.put(VERSION + "xalan2_2", CLASS_NOTPRESENT);
}
} | [
"protected",
"void",
"checkProcessorVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"try",
"{",
"final",
"String",
"XALAN1_VERSION_CLASS",
"=",
"\"org.apache.xalan.xslt.XSLProcessorVersio... | Report product version information from Xalan-J.
Looks for version info in xalan.jar from Xalan-J products.
@param h Hashtable to put information in | [
"Report",
"product",
"version",
"information",
"from",
"Xalan",
"-",
"J",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L831-L909 |
34,328 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkParserVersion | protected void checkParserVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 1.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces1", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces1", CLASS_NOTPRESENT);
}
// Look for xerces1 and xerces2 parsers separately
try
{
final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 2.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces2", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces2", CLASS_NOTPRESENT);
}
try
{
final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2";
Class clazz = ObjectFactory.findProviderClass(
CRIMSON_CLASS, ObjectFactory.findClassLoader(), true);
//@todo determine specific crimson version
h.put(VERSION + "crimson", CLASS_PRESENT);
}
catch (Exception e)
{
h.put(VERSION + "crimson", CLASS_NOTPRESENT);
}
} | java | protected void checkParserVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String XERCES1_VERSION_CLASS = "org.apache.xerces.framework.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES1_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 1.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces1", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces1", CLASS_NOTPRESENT);
}
// Look for xerces1 and xerces2 parsers separately
try
{
final String XERCES2_VERSION_CLASS = "org.apache.xerces.impl.Version";
Class clazz = ObjectFactory.findProviderClass(
XERCES2_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
// Found Xerces-J 2.x, grab it's version fields
Field f = clazz.getField("fVersion");
String parserVersion = (String) f.get(null);
h.put(VERSION + "xerces2", parserVersion);
}
catch (Exception e)
{
h.put(VERSION + "xerces2", CLASS_NOTPRESENT);
}
try
{
final String CRIMSON_CLASS = "org.apache.crimson.parser.Parser2";
Class clazz = ObjectFactory.findProviderClass(
CRIMSON_CLASS, ObjectFactory.findClassLoader(), true);
//@todo determine specific crimson version
h.put(VERSION + "crimson", CLASS_PRESENT);
}
catch (Exception e)
{
h.put(VERSION + "crimson", CLASS_NOTPRESENT);
}
} | [
"protected",
"void",
"checkParserVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"try",
"{",
"final",
"String",
"XERCES1_VERSION_CLASS",
"=",
"\"org.apache.xerces.framework.Version\"",
... | Report product version information from common parsers.
Looks for version info in xerces.jar/xercesImpl.jar/crimson.jar.
//@todo actually look up version info in crimson manifest
@param h Hashtable to put information in | [
"Report",
"product",
"version",
"information",
"from",
"common",
"parsers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L920-L977 |
34,329 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkAntVersion | protected void checkAntVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
final Class noArgs[] = new Class[0];
Class clazz = ObjectFactory.findProviderClass(
ANT_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
Object returnValue = method.invoke(null, new Object[0]);
h.put(VERSION + "ant", (String)returnValue);
}
catch (Exception e)
{
h.put(VERSION + "ant", CLASS_NOTPRESENT);
}
} | java | protected void checkAntVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
try
{
final String ANT_VERSION_CLASS = "org.apache.tools.ant.Main";
final String ANT_VERSION_METHOD = "getAntVersion"; // noArgs
final Class noArgs[] = new Class[0];
Class clazz = ObjectFactory.findProviderClass(
ANT_VERSION_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(ANT_VERSION_METHOD, noArgs);
Object returnValue = method.invoke(null, new Object[0]);
h.put(VERSION + "ant", (String)returnValue);
}
catch (Exception e)
{
h.put(VERSION + "ant", CLASS_NOTPRESENT);
}
} | [
"protected",
"void",
"checkAntVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"try",
"{",
"final",
"String",
"ANT_VERSION_CLASS",
"=",
"\"org.apache.tools.ant.Main\"",
";",
"final",
... | Report product version information from Ant.
@param h Hashtable to put information in | [
"Report",
"product",
"version",
"information",
"from",
"Ant",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L984-L1008 |
34,330 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkDOMVersion | protected void checkDOMVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final String DOM_LEVEL2_CLASS = "org.w3c.dom.Document";
final String DOM_LEVEL2_METHOD = "createElementNS"; // String, String
final String DOM_LEVEL2WD_CLASS = "org.w3c.dom.Node";
final String DOM_LEVEL2WD_METHOD = "supported"; // String, String
final String DOM_LEVEL2FD_CLASS = "org.w3c.dom.Node";
final String DOM_LEVEL2FD_METHOD = "isSupported"; // String, String
final Class twoStringArgs[] = { java.lang.String.class,
java.lang.String.class };
try
{
Class clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(DOM_LEVEL2_METHOD, twoStringArgs);
// If we succeeded, we have loaded interfaces from a
// level 2 DOM somewhere
h.put(VERSION + "DOM", "2.0");
try
{
// Check for the working draft version, which is
// commonly found, but won't work anymore
clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2WD_CLASS, ObjectFactory.findClassLoader(), true);
method = clazz.getMethod(DOM_LEVEL2WD_METHOD, twoStringArgs);
h.put(ERROR + VERSION + "DOM.draftlevel", "2.0wd");
h.put(ERROR, ERROR_FOUND);
}
catch (Exception e2)
{
try
{
// Check for the final draft version as well
clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2FD_CLASS, ObjectFactory.findClassLoader(), true);
method = clazz.getMethod(DOM_LEVEL2FD_METHOD, twoStringArgs);
h.put(VERSION + "DOM.draftlevel", "2.0fd");
}
catch (Exception e3)
{
h.put(ERROR + VERSION + "DOM.draftlevel", "2.0unknown");
h.put(ERROR, ERROR_FOUND);
}
}
}
catch (Exception e)
{
h.put(ERROR + VERSION + "DOM",
"ERROR attempting to load DOM level 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
}
//@todo load an actual DOM implmementation and query it as well
//@todo load an actual DOM implmementation and check if
// isNamespaceAware() == true, which is needed to parse
// xsl stylesheet files into a DOM
} | java | protected void checkDOMVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final String DOM_LEVEL2_CLASS = "org.w3c.dom.Document";
final String DOM_LEVEL2_METHOD = "createElementNS"; // String, String
final String DOM_LEVEL2WD_CLASS = "org.w3c.dom.Node";
final String DOM_LEVEL2WD_METHOD = "supported"; // String, String
final String DOM_LEVEL2FD_CLASS = "org.w3c.dom.Node";
final String DOM_LEVEL2FD_METHOD = "isSupported"; // String, String
final Class twoStringArgs[] = { java.lang.String.class,
java.lang.String.class };
try
{
Class clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(DOM_LEVEL2_METHOD, twoStringArgs);
// If we succeeded, we have loaded interfaces from a
// level 2 DOM somewhere
h.put(VERSION + "DOM", "2.0");
try
{
// Check for the working draft version, which is
// commonly found, but won't work anymore
clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2WD_CLASS, ObjectFactory.findClassLoader(), true);
method = clazz.getMethod(DOM_LEVEL2WD_METHOD, twoStringArgs);
h.put(ERROR + VERSION + "DOM.draftlevel", "2.0wd");
h.put(ERROR, ERROR_FOUND);
}
catch (Exception e2)
{
try
{
// Check for the final draft version as well
clazz = ObjectFactory.findProviderClass(
DOM_LEVEL2FD_CLASS, ObjectFactory.findClassLoader(), true);
method = clazz.getMethod(DOM_LEVEL2FD_METHOD, twoStringArgs);
h.put(VERSION + "DOM.draftlevel", "2.0fd");
}
catch (Exception e3)
{
h.put(ERROR + VERSION + "DOM.draftlevel", "2.0unknown");
h.put(ERROR, ERROR_FOUND);
}
}
}
catch (Exception e)
{
h.put(ERROR + VERSION + "DOM",
"ERROR attempting to load DOM level 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
}
//@todo load an actual DOM implmementation and query it as well
//@todo load an actual DOM implmementation and check if
// isNamespaceAware() == true, which is needed to parse
// xsl stylesheet files into a DOM
} | [
"protected",
"void",
"checkDOMVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"final",
"String",
"DOM_LEVEL2_CLASS",
"=",
"\"org.w3c.dom.Document\"",
";",
"final",
"String",
"DOM_LEVE... | Report version info from DOM interfaces.
Currently distinguishes between pre-DOM level 2, the DOM
level 2 working draft, the DOM level 2 final draft,
and not found.
@param h Hashtable to put information in | [
"Report",
"version",
"info",
"from",
"DOM",
"interfaces",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L1019-L1087 |
34,331 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java | EnvironmentCheck.checkSAXVersion | protected void checkSAXVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final String SAX_VERSION1_CLASS = "org.xml.sax.Parser";
final String SAX_VERSION1_METHOD = "parse"; // String
final String SAX_VERSION2_CLASS = "org.xml.sax.XMLReader";
final String SAX_VERSION2_METHOD = "parse"; // String
final String SAX_VERSION2BETA_CLASSNF = "org.xml.sax.helpers.AttributesImpl";
final String SAX_VERSION2BETA_METHODNF = "setAttributes"; // Attributes
final Class oneStringArg[] = { java.lang.String.class };
// Note this introduces a minor compile dependency on SAX...
final Class attributesArg[] = { org.xml.sax.Attributes.class };
try
{
// This method was only added in the final SAX 2.0 release;
// see changes.html "Changes from SAX 2.0beta2 to SAX 2.0prerelease"
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION2BETA_CLASSNF, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION2BETA_METHODNF, attributesArg);
// If we succeeded, we have loaded interfaces from a
// real, final SAX version 2.0 somewhere
h.put(VERSION + "SAX", "2.0");
}
catch (Exception e)
{
// If we didn't find the SAX 2.0 class, look for a 2.0beta2
h.put(ERROR + VERSION + "SAX",
"ERROR attempting to load SAX version 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
try
{
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION2_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION2_METHOD, oneStringArg);
// If we succeeded, we have loaded interfaces from a
// SAX version 2.0beta2 or earlier; these might work but
// you should really have the final SAX 2.0
h.put(VERSION + "SAX-backlevel", "2.0beta2-or-earlier");
}
catch (Exception e2)
{
// If we didn't find the SAX 2.0beta2 class, look for a 1.0 one
h.put(ERROR + VERSION + "SAX",
"ERROR attempting to load SAX version 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
try
{
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION1_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION1_METHOD, oneStringArg);
// If we succeeded, we have loaded interfaces from a
// SAX version 1.0 somewhere; which won't work very
// well for JAXP 1.1 or beyond!
h.put(VERSION + "SAX-backlevel", "1.0");
}
catch (Exception e3)
{
// If we didn't find the SAX 2.0 class, look for a 1.0 one
// Note that either 1.0 or no SAX are both errors
h.put(ERROR + VERSION + "SAX-backlevel",
"ERROR attempting to load SAX version 1 class: " + e3.toString());
}
}
}
} | java | protected void checkSAXVersion(Hashtable h)
{
if (null == h)
h = new Hashtable();
final String SAX_VERSION1_CLASS = "org.xml.sax.Parser";
final String SAX_VERSION1_METHOD = "parse"; // String
final String SAX_VERSION2_CLASS = "org.xml.sax.XMLReader";
final String SAX_VERSION2_METHOD = "parse"; // String
final String SAX_VERSION2BETA_CLASSNF = "org.xml.sax.helpers.AttributesImpl";
final String SAX_VERSION2BETA_METHODNF = "setAttributes"; // Attributes
final Class oneStringArg[] = { java.lang.String.class };
// Note this introduces a minor compile dependency on SAX...
final Class attributesArg[] = { org.xml.sax.Attributes.class };
try
{
// This method was only added in the final SAX 2.0 release;
// see changes.html "Changes from SAX 2.0beta2 to SAX 2.0prerelease"
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION2BETA_CLASSNF, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION2BETA_METHODNF, attributesArg);
// If we succeeded, we have loaded interfaces from a
// real, final SAX version 2.0 somewhere
h.put(VERSION + "SAX", "2.0");
}
catch (Exception e)
{
// If we didn't find the SAX 2.0 class, look for a 2.0beta2
h.put(ERROR + VERSION + "SAX",
"ERROR attempting to load SAX version 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
try
{
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION2_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION2_METHOD, oneStringArg);
// If we succeeded, we have loaded interfaces from a
// SAX version 2.0beta2 or earlier; these might work but
// you should really have the final SAX 2.0
h.put(VERSION + "SAX-backlevel", "2.0beta2-or-earlier");
}
catch (Exception e2)
{
// If we didn't find the SAX 2.0beta2 class, look for a 1.0 one
h.put(ERROR + VERSION + "SAX",
"ERROR attempting to load SAX version 2 class: " + e.toString());
h.put(ERROR, ERROR_FOUND);
try
{
Class clazz = ObjectFactory.findProviderClass(
SAX_VERSION1_CLASS, ObjectFactory.findClassLoader(), true);
Method method = clazz.getMethod(SAX_VERSION1_METHOD, oneStringArg);
// If we succeeded, we have loaded interfaces from a
// SAX version 1.0 somewhere; which won't work very
// well for JAXP 1.1 or beyond!
h.put(VERSION + "SAX-backlevel", "1.0");
}
catch (Exception e3)
{
// If we didn't find the SAX 2.0 class, look for a 1.0 one
// Note that either 1.0 or no SAX are both errors
h.put(ERROR + VERSION + "SAX-backlevel",
"ERROR attempting to load SAX version 1 class: " + e3.toString());
}
}
}
} | [
"protected",
"void",
"checkSAXVersion",
"(",
"Hashtable",
"h",
")",
"{",
"if",
"(",
"null",
"==",
"h",
")",
"h",
"=",
"new",
"Hashtable",
"(",
")",
";",
"final",
"String",
"SAX_VERSION1_CLASS",
"=",
"\"org.xml.sax.Parser\"",
";",
"final",
"String",
"SAX_VERS... | Report version info from SAX interfaces.
Currently distinguishes between SAX 2, SAX 2.0beta2,
SAX1, and not found.
@param h Hashtable to put information in | [
"Report",
"version",
"info",
"from",
"SAX",
"interfaces",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/xslt/EnvironmentCheck.java#L1097-L1174 |
34,332 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/SocksSocketImpl.java | SocksSocketImpl.authenticate | private boolean authenticate(byte method, InputStream in,
BufferedOutputStream out) throws IOException {
return authenticate(method, in, out, 0L);
} | java | private boolean authenticate(byte method, InputStream in,
BufferedOutputStream out) throws IOException {
return authenticate(method, in, out, 0L);
} | [
"private",
"boolean",
"authenticate",
"(",
"byte",
"method",
",",
"InputStream",
"in",
",",
"BufferedOutputStream",
"out",
")",
"throws",
"IOException",
"{",
"return",
"authenticate",
"(",
"method",
",",
"in",
",",
"out",
",",
"0L",
")",
";",
"}"
] | Provides the authentication machanism required by the proxy. | [
"Provides",
"the",
"authentication",
"machanism",
"required",
"by",
"the",
"proxy",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/SocksSocketImpl.java#L139-L142 |
34,333 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUDataVersion.java | ICUDataVersion.getDataVersion | public static VersionInfo getDataVersion() {
UResourceBundle icudatares = null;
try {
icudatares = UResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME,
ICUDataVersion.U_ICU_VERSION_BUNDLE,
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
icudatares = icudatares.get(ICUDataVersion.U_ICU_DATA_KEY);
} catch (MissingResourceException ex) {
return null;
}
return VersionInfo.getInstance(icudatares.getString());
} | java | public static VersionInfo getDataVersion() {
UResourceBundle icudatares = null;
try {
icudatares = UResourceBundle.getBundleInstance(
ICUData.ICU_BASE_NAME,
ICUDataVersion.U_ICU_VERSION_BUNDLE,
ICUResourceBundle.ICU_DATA_CLASS_LOADER);
icudatares = icudatares.get(ICUDataVersion.U_ICU_DATA_KEY);
} catch (MissingResourceException ex) {
return null;
}
return VersionInfo.getInstance(icudatares.getString());
} | [
"public",
"static",
"VersionInfo",
"getDataVersion",
"(",
")",
"{",
"UResourceBundle",
"icudatares",
"=",
"null",
";",
"try",
"{",
"icudatares",
"=",
"UResourceBundle",
".",
"getBundleInstance",
"(",
"ICUData",
".",
"ICU_BASE_NAME",
",",
"ICUDataVersion",
".",
"U_... | This function retrieves the data version from icuver and returns a VersionInfo object with that version information.
@return Current icu data version | [
"This",
"function",
"retrieves",
"the",
"data",
"version",
"from",
"icuver",
"and",
"returns",
"a",
"VersionInfo",
"object",
"with",
"that",
"version",
"information",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUDataVersion.java#L31-L44 |
34,334 | google/j2objc | jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java | TimeZoneNames.getDisplayName | public static String getDisplayName(String[][] zoneStrings, String id, boolean daylight, int style) {
String[] needle = new String[] { id };
int index = Arrays.binarySearch(zoneStrings, needle, ZONE_STRINGS_COMPARATOR);
if (index >= 0) {
String[] row = zoneStrings[index];
if (daylight) {
return (style == TimeZone.LONG) ? row[LONG_NAME_DST] : row[SHORT_NAME_DST];
} else {
return (style == TimeZone.LONG) ? row[LONG_NAME] : row[SHORT_NAME];
}
}
return null;
} | java | public static String getDisplayName(String[][] zoneStrings, String id, boolean daylight, int style) {
String[] needle = new String[] { id };
int index = Arrays.binarySearch(zoneStrings, needle, ZONE_STRINGS_COMPARATOR);
if (index >= 0) {
String[] row = zoneStrings[index];
if (daylight) {
return (style == TimeZone.LONG) ? row[LONG_NAME_DST] : row[SHORT_NAME_DST];
} else {
return (style == TimeZone.LONG) ? row[LONG_NAME] : row[SHORT_NAME];
}
}
return null;
} | [
"public",
"static",
"String",
"getDisplayName",
"(",
"String",
"[",
"]",
"[",
"]",
"zoneStrings",
",",
"String",
"id",
",",
"boolean",
"daylight",
",",
"int",
"style",
")",
"{",
"String",
"[",
"]",
"needle",
"=",
"new",
"String",
"[",
"]",
"{",
"id",
... | Returns the appropriate string from 'zoneStrings'. Used with getZoneStrings. | [
"Returns",
"the",
"appropriate",
"string",
"from",
"zoneStrings",
".",
"Used",
"with",
"getZoneStrings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java#L114-L126 |
34,335 | google/j2objc | jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java | TimeZoneNames.getZoneStrings | public static String[][] getZoneStrings(Locale locale) {
if (locale == null) {
locale = Locale.getDefault();
}
return cachedZoneStrings.get(locale);
} | java | public static String[][] getZoneStrings(Locale locale) {
if (locale == null) {
locale = Locale.getDefault();
}
return cachedZoneStrings.get(locale);
} | [
"public",
"static",
"String",
"[",
"]",
"[",
"]",
"getZoneStrings",
"(",
"Locale",
"locale",
")",
"{",
"if",
"(",
"locale",
"==",
"null",
")",
"{",
"locale",
"=",
"Locale",
".",
"getDefault",
"(",
")",
";",
"}",
"return",
"cachedZoneStrings",
".",
"get... | Returns an array of time zone strings, as used by DateFormatSymbols.getZoneStrings. | [
"Returns",
"an",
"array",
"of",
"time",
"zone",
"strings",
"as",
"used",
"by",
"DateFormatSymbols",
".",
"getZoneStrings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/objc/java/libcore/icu/TimeZoneNames.java#L131-L136 |
34,336 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/ProgressSource.java | ProgressSource.updateProgress | public void updateProgress(long latestProgress, long expectedProgress) {
lastProgress = progress;
progress = latestProgress;
expected = expectedProgress;
if (connected() == false)
state = State.CONNECTED;
else
state = State.UPDATE;
// The threshold effectively divides the progress into
// different set of ranges:
//
// Range 0: 0..threshold-1,
// Range 1: threshold .. 2*threshold-1
// ....
// Range n: n*threshold .. (n+1)*threshold-1
//
// To determine which range the progress belongs to, it
// would be calculated as follow:
//
// range number = progress / threshold
//
// Notification should only be triggered when the current
// progress and the last progress are in different ranges,
// i.e. they have different range numbers.
//
// Using this range scheme, notification will be generated
// only once when the progress reaches each range.
//
if (lastProgress / threshold != progress / threshold) {
progressMonitor.updateProgress(this);
}
// Detect read overrun
if (expected != -1) {
if (progress >= expected && progress != 0)
close();
}
} | java | public void updateProgress(long latestProgress, long expectedProgress) {
lastProgress = progress;
progress = latestProgress;
expected = expectedProgress;
if (connected() == false)
state = State.CONNECTED;
else
state = State.UPDATE;
// The threshold effectively divides the progress into
// different set of ranges:
//
// Range 0: 0..threshold-1,
// Range 1: threshold .. 2*threshold-1
// ....
// Range n: n*threshold .. (n+1)*threshold-1
//
// To determine which range the progress belongs to, it
// would be calculated as follow:
//
// range number = progress / threshold
//
// Notification should only be triggered when the current
// progress and the last progress are in different ranges,
// i.e. they have different range numbers.
//
// Using this range scheme, notification will be generated
// only once when the progress reaches each range.
//
if (lastProgress / threshold != progress / threshold) {
progressMonitor.updateProgress(this);
}
// Detect read overrun
if (expected != -1) {
if (progress >= expected && progress != 0)
close();
}
} | [
"public",
"void",
"updateProgress",
"(",
"long",
"latestProgress",
",",
"long",
"expectedProgress",
")",
"{",
"lastProgress",
"=",
"progress",
";",
"progress",
"=",
"latestProgress",
";",
"expected",
"=",
"expectedProgress",
";",
"if",
"(",
"connected",
"(",
")"... | Update progress. | [
"Update",
"progress",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/net/ProgressSource.java#L161-L200 |
34,337 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorCharacters.java | ProcessorCharacters.startNonText | public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException
{
if (this == handler.getCurrentProcessor())
{
handler.popProcessor();
}
int nChars = m_accumulator.length();
if ((nChars > 0)
&& ((null != m_xslTextElement)
||!XMLCharacterRecognizer.isWhiteSpace(m_accumulator))
|| handler.isSpacePreserve())
{
ElemTextLiteral elem = new ElemTextLiteral();
elem.setDOMBackPointer(m_firstBackPointer);
elem.setLocaterInfo(handler.getLocator());
try
{
elem.setPrefixes(handler.getNamespaceSupport());
}
catch(TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
boolean doe = (null != m_xslTextElement)
? m_xslTextElement.getDisableOutputEscaping() : false;
elem.setDisableOutputEscaping(doe);
elem.setPreserveSpace(true);
char[] chars = new char[nChars];
m_accumulator.getChars(0, nChars, chars, 0);
elem.setChars(chars);
ElemTemplateElement parent = handler.getElemTemplateElement();
parent.appendChild(elem);
}
m_accumulator.setLength(0);
m_firstBackPointer = null;
} | java | public void startNonText(StylesheetHandler handler) throws org.xml.sax.SAXException
{
if (this == handler.getCurrentProcessor())
{
handler.popProcessor();
}
int nChars = m_accumulator.length();
if ((nChars > 0)
&& ((null != m_xslTextElement)
||!XMLCharacterRecognizer.isWhiteSpace(m_accumulator))
|| handler.isSpacePreserve())
{
ElemTextLiteral elem = new ElemTextLiteral();
elem.setDOMBackPointer(m_firstBackPointer);
elem.setLocaterInfo(handler.getLocator());
try
{
elem.setPrefixes(handler.getNamespaceSupport());
}
catch(TransformerException te)
{
throw new org.xml.sax.SAXException(te);
}
boolean doe = (null != m_xslTextElement)
? m_xslTextElement.getDisableOutputEscaping() : false;
elem.setDisableOutputEscaping(doe);
elem.setPreserveSpace(true);
char[] chars = new char[nChars];
m_accumulator.getChars(0, nChars, chars, 0);
elem.setChars(chars);
ElemTemplateElement parent = handler.getElemTemplateElement();
parent.appendChild(elem);
}
m_accumulator.setLength(0);
m_firstBackPointer = null;
} | [
"public",
"void",
"startNonText",
"(",
"StylesheetHandler",
"handler",
")",
"throws",
"org",
".",
"xml",
".",
"sax",
".",
"SAXException",
"{",
"if",
"(",
"this",
"==",
"handler",
".",
"getCurrentProcessor",
"(",
")",
")",
"{",
"handler",
".",
"popProcessor",... | Receive notification of the start of the non-text event. This
is sent to the current processor when any non-text event occurs.
@param handler non-null reference to current StylesheetHandler that is constructing the Templates. | [
"Receive",
"notification",
"of",
"the",
"start",
"of",
"the",
"non",
"-",
"text",
"event",
".",
"This",
"is",
"sent",
"to",
"the",
"current",
"processor",
"when",
"any",
"non",
"-",
"text",
"event",
"occurs",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/processor/ProcessorCharacters.java#L47-L92 |
34,338 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.match | public double match(ULocale desired, ULocale desiredMax, ULocale supported, ULocale supportedMax) {
return matcherData.match(desired, desiredMax, supported, supportedMax);
} | java | public double match(ULocale desired, ULocale desiredMax, ULocale supported, ULocale supportedMax) {
return matcherData.match(desired, desiredMax, supported, supportedMax);
} | [
"public",
"double",
"match",
"(",
"ULocale",
"desired",
",",
"ULocale",
"desiredMax",
",",
"ULocale",
"supported",
",",
"ULocale",
"supportedMax",
")",
"{",
"return",
"matcherData",
".",
"match",
"(",
"desired",
",",
"desiredMax",
",",
"supported",
",",
"suppo... | Returns a fraction between 0 and 1, where 1 means that the languages are a
perfect match, and 0 means that they are completely different. Note that
the precise values may change over time; no code should be made dependent
on the values remaining constant.
@param desired Desired locale
@param desiredMax Maximized locale (using likely subtags)
@param supported Supported locale
@param supportedMax Maximized locale (using likely subtags)
@return value between 0 and 1, inclusive. | [
"Returns",
"a",
"fraction",
"between",
"0",
"and",
"1",
"where",
"1",
"means",
"that",
"the",
"languages",
"are",
"a",
"perfect",
"match",
"and",
"0",
"means",
"that",
"they",
"are",
"completely",
"different",
".",
"Note",
"that",
"the",
"precise",
"values... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L147-L149 |
34,339 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.getBestMatch | public ULocale getBestMatch(LocalePriorityList languageList) {
double bestWeight = 0;
ULocale bestTableMatch = null;
double penalty = 0;
OutputDouble matchWeight = new OutputDouble();
for (final ULocale language : languageList) {
final ULocale matchLocale = getBestMatchInternal(language, matchWeight);
final double weight = matchWeight.value * languageList.getWeight(language) - penalty;
if (weight > bestWeight) {
bestWeight = weight;
bestTableMatch = matchLocale;
}
penalty += 0.07000001;
}
if (bestWeight < threshold) {
bestTableMatch = defaultLanguage;
}
return bestTableMatch;
} | java | public ULocale getBestMatch(LocalePriorityList languageList) {
double bestWeight = 0;
ULocale bestTableMatch = null;
double penalty = 0;
OutputDouble matchWeight = new OutputDouble();
for (final ULocale language : languageList) {
final ULocale matchLocale = getBestMatchInternal(language, matchWeight);
final double weight = matchWeight.value * languageList.getWeight(language) - penalty;
if (weight > bestWeight) {
bestWeight = weight;
bestTableMatch = matchLocale;
}
penalty += 0.07000001;
}
if (bestWeight < threshold) {
bestTableMatch = defaultLanguage;
}
return bestTableMatch;
} | [
"public",
"ULocale",
"getBestMatch",
"(",
"LocalePriorityList",
"languageList",
")",
"{",
"double",
"bestWeight",
"=",
"0",
";",
"ULocale",
"bestTableMatch",
"=",
"null",
";",
"double",
"penalty",
"=",
"0",
";",
"OutputDouble",
"matchWeight",
"=",
"new",
"Output... | Get the best match for a LanguagePriorityList
@param languageList list to match
@return best matching language code | [
"Get",
"the",
"best",
"match",
"for",
"a",
"LanguagePriorityList"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L183-L201 |
34,340 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.getBestMatchInternal | private ULocale getBestMatchInternal(ULocale languageCode, OutputDouble outputWeight) {
languageCode = canonicalize(languageCode);
final ULocale maximized = addLikelySubtags(languageCode);
if (DEBUG) {
System.out.println("\ngetBestMatchInternal: " + languageCode + ";\t" + maximized);
}
double bestWeight = 0;
ULocale bestTableMatch = null;
String baseLanguage = maximized.getLanguage();
Set<R3<ULocale, ULocale, Double>> searchTable = desiredLanguageToPossibleLocalesToMaxLocaleToData.get(baseLanguage);
if (searchTable != null) { // we preprocessed the table so as to filter by lanugage
if (DEBUG) System.out.println("\tSearching: " + searchTable);
for (final R3<ULocale, ULocale, Double> tableKeyValue : searchTable) {
ULocale tableKey = tableKeyValue.get0();
ULocale maxLocale = tableKeyValue.get1();
Double matchedWeight = tableKeyValue.get2();
final double match = match(languageCode, maximized, tableKey, maxLocale);
if (DEBUG) {
System.out.println("\t" + tableKeyValue + ";\t" + match + "\n");
}
final double weight = match * matchedWeight;
if (weight > bestWeight) {
bestWeight = weight;
bestTableMatch = tableKey;
if (weight > 0.999d) { // bail on good enough match.
break;
}
}
}
}
if (bestWeight < threshold) {
bestTableMatch = defaultLanguage;
}
if (outputWeight != null) {
outputWeight.value = bestWeight; // only return the weight when needed
}
return bestTableMatch;
} | java | private ULocale getBestMatchInternal(ULocale languageCode, OutputDouble outputWeight) {
languageCode = canonicalize(languageCode);
final ULocale maximized = addLikelySubtags(languageCode);
if (DEBUG) {
System.out.println("\ngetBestMatchInternal: " + languageCode + ";\t" + maximized);
}
double bestWeight = 0;
ULocale bestTableMatch = null;
String baseLanguage = maximized.getLanguage();
Set<R3<ULocale, ULocale, Double>> searchTable = desiredLanguageToPossibleLocalesToMaxLocaleToData.get(baseLanguage);
if (searchTable != null) { // we preprocessed the table so as to filter by lanugage
if (DEBUG) System.out.println("\tSearching: " + searchTable);
for (final R3<ULocale, ULocale, Double> tableKeyValue : searchTable) {
ULocale tableKey = tableKeyValue.get0();
ULocale maxLocale = tableKeyValue.get1();
Double matchedWeight = tableKeyValue.get2();
final double match = match(languageCode, maximized, tableKey, maxLocale);
if (DEBUG) {
System.out.println("\t" + tableKeyValue + ";\t" + match + "\n");
}
final double weight = match * matchedWeight;
if (weight > bestWeight) {
bestWeight = weight;
bestTableMatch = tableKey;
if (weight > 0.999d) { // bail on good enough match.
break;
}
}
}
}
if (bestWeight < threshold) {
bestTableMatch = defaultLanguage;
}
if (outputWeight != null) {
outputWeight.value = bestWeight; // only return the weight when needed
}
return bestTableMatch;
} | [
"private",
"ULocale",
"getBestMatchInternal",
"(",
"ULocale",
"languageCode",
",",
"OutputDouble",
"outputWeight",
")",
"{",
"languageCode",
"=",
"canonicalize",
"(",
"languageCode",
")",
";",
"final",
"ULocale",
"maximized",
"=",
"addLikelySubtags",
"(",
"languageCod... | Get the best match for an individual language code.
@param languageCode
@return best matching language code and weight (as per
{@link #match(ULocale, ULocale)}) | [
"Get",
"the",
"best",
"match",
"for",
"an",
"individual",
"language",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L249-L286 |
34,341 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.processMapping | private void processMapping() {
for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) {
String desired = desiredToMatchingLanguages.getKey();
Set<String> supported = desiredToMatchingLanguages.getValue();
for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
final ULocale key = localeToMaxAndWeight.get0();
String lang = key.getLanguage();
if (supported.contains(lang)) {
addFiltered(desired, localeToMaxAndWeight);
}
}
}
// now put in the values directly, since languages always map to themselves
for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
final ULocale key = localeToMaxAndWeight.get0();
String lang = key.getLanguage();
addFiltered(lang, localeToMaxAndWeight);
}
} | java | private void processMapping() {
for (Entry<String, Set<String>> desiredToMatchingLanguages : matcherData.matchingLanguages().keyValuesSet()) {
String desired = desiredToMatchingLanguages.getKey();
Set<String> supported = desiredToMatchingLanguages.getValue();
for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
final ULocale key = localeToMaxAndWeight.get0();
String lang = key.getLanguage();
if (supported.contains(lang)) {
addFiltered(desired, localeToMaxAndWeight);
}
}
}
// now put in the values directly, since languages always map to themselves
for (R3<ULocale, ULocale, Double> localeToMaxAndWeight : localeToMaxLocaleAndWeight) {
final ULocale key = localeToMaxAndWeight.get0();
String lang = key.getLanguage();
addFiltered(lang, localeToMaxAndWeight);
}
} | [
"private",
"void",
"processMapping",
"(",
")",
"{",
"for",
"(",
"Entry",
"<",
"String",
",",
"Set",
"<",
"String",
">",
">",
"desiredToMatchingLanguages",
":",
"matcherData",
".",
"matchingLanguages",
"(",
")",
".",
"keyValuesSet",
"(",
")",
")",
"{",
"Str... | We preprocess the data to get just the possible matches for each desired base language. | [
"We",
"preprocess",
"the",
"data",
"to",
"get",
"just",
"the",
"possible",
"matches",
"for",
"each",
"desired",
"base",
"language",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L307-L325 |
34,342 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java | LocaleMatcher.addLikelySubtags | private ULocale addLikelySubtags(ULocale languageCode) {
// max("und") = "en_Latn_US", and since matching is based on maximized tags, the undefined
// language would normally match English. But that would produce the counterintuitive results
// that getBestMatch("und", LocaleMatcher("it,en")) would be "en", and
// getBestMatch("en", LocaleMatcher("it,und")) would be "und".
//
// To avoid that, we change the matcher's definitions of max (AddLikelySubtagsWithDefaults)
// so that max("und")="und". That produces the following, more desirable results:
if (languageCode.equals(UNKNOWN_LOCALE)) {
return UNKNOWN_LOCALE;
}
final ULocale result = ULocale.addLikelySubtags(languageCode);
// should have method on getLikelySubtags for this
if (result == null || result.equals(languageCode)) {
final String language = languageCode.getLanguage();
final String script = languageCode.getScript();
final String region = languageCode.getCountry();
return new ULocale((language.length()==0 ? "und"
: language)
+ "_"
+ (script.length()==0 ? "Zzzz" : script)
+ "_"
+ (region.length()==0 ? "ZZ" : region));
}
return result;
} | java | private ULocale addLikelySubtags(ULocale languageCode) {
// max("und") = "en_Latn_US", and since matching is based on maximized tags, the undefined
// language would normally match English. But that would produce the counterintuitive results
// that getBestMatch("und", LocaleMatcher("it,en")) would be "en", and
// getBestMatch("en", LocaleMatcher("it,und")) would be "und".
//
// To avoid that, we change the matcher's definitions of max (AddLikelySubtagsWithDefaults)
// so that max("und")="und". That produces the following, more desirable results:
if (languageCode.equals(UNKNOWN_LOCALE)) {
return UNKNOWN_LOCALE;
}
final ULocale result = ULocale.addLikelySubtags(languageCode);
// should have method on getLikelySubtags for this
if (result == null || result.equals(languageCode)) {
final String language = languageCode.getLanguage();
final String script = languageCode.getScript();
final String region = languageCode.getCountry();
return new ULocale((language.length()==0 ? "und"
: language)
+ "_"
+ (script.length()==0 ? "Zzzz" : script)
+ "_"
+ (region.length()==0 ? "ZZ" : region));
}
return result;
} | [
"private",
"ULocale",
"addLikelySubtags",
"(",
"ULocale",
"languageCode",
")",
"{",
"// max(\"und\") = \"en_Latn_US\", and since matching is based on maximized tags, the undefined",
"// language would normally match English. But that would produce the counterintuitive results",
"// that getBest... | We need to add another method to addLikelySubtags that doesn't return
null, but instead substitutes Zzzz and ZZ if unknown. There are also
a few cases where addLikelySubtags needs to have expanded data, to handle
all deprecated codes.
@param languageCode
@return "fixed" addLikelySubtags | [
"We",
"need",
"to",
"add",
"another",
"method",
"to",
"addLikelySubtags",
"that",
"doesn",
"t",
"return",
"null",
"but",
"instead",
"substitutes",
"Zzzz",
"and",
"ZZ",
"if",
"unknown",
".",
"There",
"are",
"also",
"a",
"few",
"cases",
"where",
"addLikelySubt... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/LocaleMatcher.java#L352-L377 |
34,343 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java | SliceOps.calcSize | private static long calcSize(long size, long skip, long limit) {
return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
} | java | private static long calcSize(long size, long skip, long limit) {
return size >= 0 ? Math.max(-1, Math.min(size - skip, limit)) : -1;
} | [
"private",
"static",
"long",
"calcSize",
"(",
"long",
"size",
",",
"long",
"skip",
",",
"long",
"limit",
")",
"{",
"return",
"size",
">=",
"0",
"?",
"Math",
".",
"max",
"(",
"-",
"1",
",",
"Math",
".",
"min",
"(",
"size",
"-",
"skip",
",",
"limit... | Calculates the sliced size given the current size, number of elements
skip, and the number of elements to limit.
@param size the current size
@param skip the number of elements to skip, assumed to be >= 0
@param limit the number of elements to limit, assumed to be >= 0, with
a value of {@code Long.MAX_VALUE} if there is no limit
@return the sliced size | [
"Calculates",
"the",
"sliced",
"size",
"given",
"the",
"current",
"size",
"number",
"of",
"elements",
"skip",
"and",
"the",
"number",
"of",
"elements",
"to",
"limit",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java#L52-L54 |
34,344 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java | SliceOps.calcSliceFence | private static long calcSliceFence(long skip, long limit) {
long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
// Check for overflow
return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE;
} | java | private static long calcSliceFence(long skip, long limit) {
long sliceFence = limit >= 0 ? skip + limit : Long.MAX_VALUE;
// Check for overflow
return (sliceFence >= 0) ? sliceFence : Long.MAX_VALUE;
} | [
"private",
"static",
"long",
"calcSliceFence",
"(",
"long",
"skip",
",",
"long",
"limit",
")",
"{",
"long",
"sliceFence",
"=",
"limit",
">=",
"0",
"?",
"skip",
"+",
"limit",
":",
"Long",
".",
"MAX_VALUE",
";",
"// Check for overflow",
"return",
"(",
"slice... | Calculates the slice fence, which is one past the index of the slice
range
@param skip the number of elements to skip, assumed to be >= 0
@param limit the number of elements to limit, assumed to be >= 0, with
a value of {@code Long.MAX_VALUE} if there is no limit
@return the slice fence. | [
"Calculates",
"the",
"slice",
"fence",
"which",
"is",
"one",
"past",
"the",
"index",
"of",
"the",
"slice",
"range"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java#L64-L68 |
34,345 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java | SliceOps.sliceSpliterator | @SuppressWarnings("unchecked")
private static <P_IN> Spliterator<P_IN> sliceSpliterator(StreamShape shape,
Spliterator<P_IN> s,
long skip, long limit) {
assert s.hasCharacteristics(Spliterator.SUBSIZED);
long sliceFence = calcSliceFence(skip, limit);
switch (shape) {
case REFERENCE:
return new StreamSpliterators
.SliceSpliterator.OfRef<>(s, skip, sliceFence);
case INT_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence);
case LONG_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence);
case DOUBLE_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence);
default:
throw new IllegalStateException("Unknown shape " + shape);
}
} | java | @SuppressWarnings("unchecked")
private static <P_IN> Spliterator<P_IN> sliceSpliterator(StreamShape shape,
Spliterator<P_IN> s,
long skip, long limit) {
assert s.hasCharacteristics(Spliterator.SUBSIZED);
long sliceFence = calcSliceFence(skip, limit);
switch (shape) {
case REFERENCE:
return new StreamSpliterators
.SliceSpliterator.OfRef<>(s, skip, sliceFence);
case INT_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfInt((Spliterator.OfInt) s, skip, sliceFence);
case LONG_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfLong((Spliterator.OfLong) s, skip, sliceFence);
case DOUBLE_VALUE:
return (Spliterator<P_IN>) new StreamSpliterators
.SliceSpliterator.OfDouble((Spliterator.OfDouble) s, skip, sliceFence);
default:
throw new IllegalStateException("Unknown shape " + shape);
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"<",
"P_IN",
">",
"Spliterator",
"<",
"P_IN",
">",
"sliceSpliterator",
"(",
"StreamShape",
"shape",
",",
"Spliterator",
"<",
"P_IN",
">",
"s",
",",
"long",
"skip",
",",
"long",
"limit",... | Creates a slice spliterator given a stream shape governing the
spliterator type. Requires that the underlying Spliterator
be SUBSIZED. | [
"Creates",
"a",
"slice",
"spliterator",
"given",
"a",
"stream",
"shape",
"governing",
"the",
"spliterator",
"type",
".",
"Requires",
"that",
"the",
"underlying",
"Spliterator",
"be",
"SUBSIZED",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/SliceOps.java#L75-L97 |
34,346 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundleIterator.java | UResourceBundleIterator.nextString | public String nextString()throws NoSuchElementException, UResourceTypeMismatchException{
if(index<size){
return bundle.getString(index++);
}
throw new NoSuchElementException();
} | java | public String nextString()throws NoSuchElementException, UResourceTypeMismatchException{
if(index<size){
return bundle.getString(index++);
}
throw new NoSuchElementException();
} | [
"public",
"String",
"nextString",
"(",
")",
"throws",
"NoSuchElementException",
",",
"UResourceTypeMismatchException",
"{",
"if",
"(",
"index",
"<",
"size",
")",
"{",
"return",
"bundle",
".",
"getString",
"(",
"index",
"++",
")",
";",
"}",
"throw",
"new",
"N... | Returns the next String of this iterator if this iterator object has at least one more element to provide
@return the UResourceBundle object
@throws NoSuchElementException If there does not exist such an element.
@throws UResourceTypeMismatchException If resource has a type mismatch. | [
"Returns",
"the",
"next",
"String",
"of",
"this",
"iterator",
"if",
"this",
"iterator",
"object",
"has",
"at",
"least",
"one",
"more",
"element",
"to",
"provide"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/UResourceBundleIterator.java#L71-L76 |
34,347 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.parse | public MessagePattern parse(String pattern) {
preParse(pattern);
parseMessage(0, 0, 0, ArgType.NONE);
postParse();
return this;
} | java | public MessagePattern parse(String pattern) {
preParse(pattern);
parseMessage(0, 0, 0, ArgType.NONE);
postParse();
return this;
} | [
"public",
"MessagePattern",
"parse",
"(",
"String",
"pattern",
")",
"{",
"preParse",
"(",
"pattern",
")",
";",
"parseMessage",
"(",
"0",
",",
"0",
",",
"0",
",",
"ArgType",
".",
"NONE",
")",
";",
"postParse",
"(",
")",
";",
"return",
"this",
";",
"}"... | Parses a MessageFormat pattern string.
@param pattern a MessageFormat pattern string
@return this
@throws IllegalArgumentException for syntax errors in the pattern string
@throws IndexOutOfBoundsException if certain limits are exceeded
(e.g., argument number too high, argument name too long, etc.)
@throws NumberFormatException if a number could not be parsed | [
"Parses",
"a",
"MessageFormat",
"pattern",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L177-L182 |
34,348 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.parsePluralStyle | public MessagePattern parsePluralStyle(String pattern) {
preParse(pattern);
parsePluralOrSelectStyle(ArgType.PLURAL, 0, 0);
postParse();
return this;
} | java | public MessagePattern parsePluralStyle(String pattern) {
preParse(pattern);
parsePluralOrSelectStyle(ArgType.PLURAL, 0, 0);
postParse();
return this;
} | [
"public",
"MessagePattern",
"parsePluralStyle",
"(",
"String",
"pattern",
")",
"{",
"preParse",
"(",
"pattern",
")",
";",
"parsePluralOrSelectStyle",
"(",
"ArgType",
".",
"PLURAL",
",",
"0",
",",
"0",
")",
";",
"postParse",
"(",
")",
";",
"return",
"this",
... | Parses a PluralFormat pattern string.
@param pattern a PluralFormat pattern string
@return this
@throws IllegalArgumentException for syntax errors in the pattern string
@throws IndexOutOfBoundsException if certain limits are exceeded
(e.g., argument number too high, argument name too long, etc.)
@throws NumberFormatException if a number could not be parsed | [
"Parses",
"a",
"PluralFormat",
"pattern",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L209-L214 |
34,349 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.parseSelectStyle | public MessagePattern parseSelectStyle(String pattern) {
preParse(pattern);
parsePluralOrSelectStyle(ArgType.SELECT, 0, 0);
postParse();
return this;
} | java | public MessagePattern parseSelectStyle(String pattern) {
preParse(pattern);
parsePluralOrSelectStyle(ArgType.SELECT, 0, 0);
postParse();
return this;
} | [
"public",
"MessagePattern",
"parseSelectStyle",
"(",
"String",
"pattern",
")",
"{",
"preParse",
"(",
"pattern",
")",
";",
"parsePluralOrSelectStyle",
"(",
"ArgType",
".",
"SELECT",
",",
"0",
",",
"0",
")",
";",
"postParse",
"(",
")",
";",
"return",
"this",
... | Parses a SelectFormat pattern string.
@param pattern a SelectFormat pattern string
@return this
@throws IllegalArgumentException for syntax errors in the pattern string
@throws IndexOutOfBoundsException if certain limits are exceeded
(e.g., argument number too high, argument name too long, etc.)
@throws NumberFormatException if a number could not be parsed | [
"Parses",
"a",
"SelectFormat",
"pattern",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L225-L230 |
34,350 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.validateArgumentName | public static int validateArgumentName(String name) {
if(!PatternProps.isIdentifier(name)) {
return ARG_NAME_NOT_VALID;
}
return parseArgNumber(name, 0, name.length());
} | java | public static int validateArgumentName(String name) {
if(!PatternProps.isIdentifier(name)) {
return ARG_NAME_NOT_VALID;
}
return parseArgNumber(name, 0, name.length());
} | [
"public",
"static",
"int",
"validateArgumentName",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"PatternProps",
".",
"isIdentifier",
"(",
"name",
")",
")",
"{",
"return",
"ARG_NAME_NOT_VALID",
";",
"}",
"return",
"parseArgNumber",
"(",
"name",
",",
"0",
... | Validates and parses an argument name or argument number string.
An argument name must be a "pattern identifier", that is, it must contain
no Unicode Pattern_Syntax or Pattern_White_Space characters.
If it only contains ASCII digits, then it must be a small integer with no leading zero.
@param name Input string.
@return >=0 if the name is a valid number,
ARG_NAME_NOT_NUMBER (-1) if it is a "pattern identifier" but not all ASCII digits,
ARG_NAME_NOT_VALID (-2) if it is neither. | [
"Validates",
"and",
"parses",
"an",
"argument",
"name",
"or",
"argument",
"number",
"string",
".",
"An",
"argument",
"name",
"must",
"be",
"a",
"pattern",
"identifier",
"that",
"is",
"it",
"must",
"contain",
"no",
"Unicode",
"Pattern_Syntax",
"or",
"Pattern_Wh... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L345-L350 |
34,351 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.partSubstringMatches | public boolean partSubstringMatches(Part part, String s) {
return part.length == s.length() && msg.regionMatches(part.index, s, 0, part.length);
} | java | public boolean partSubstringMatches(Part part, String s) {
return part.length == s.length() && msg.regionMatches(part.index, s, 0, part.length);
} | [
"public",
"boolean",
"partSubstringMatches",
"(",
"Part",
"part",
",",
"String",
"s",
")",
"{",
"return",
"part",
".",
"length",
"==",
"s",
".",
"length",
"(",
")",
"&&",
"msg",
".",
"regionMatches",
"(",
"part",
".",
"index",
",",
"s",
",",
"0",
","... | Compares the part's substring with the input string s.
@param part a part of this MessagePattern.
@param s a string.
@return true if getSubstring(part).equals(s). | [
"Compares",
"the",
"part",
"s",
"substring",
"with",
"the",
"input",
"string",
"s",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L456-L458 |
34,352 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.getNumericValue | public double getNumericValue(Part part) {
Part.Type type=part.type;
if(type==Part.Type.ARG_INT) {
return part.value;
} else if(type==Part.Type.ARG_DOUBLE) {
return numericValues.get(part.value);
} else {
return NO_NUMERIC_VALUE;
}
} | java | public double getNumericValue(Part part) {
Part.Type type=part.type;
if(type==Part.Type.ARG_INT) {
return part.value;
} else if(type==Part.Type.ARG_DOUBLE) {
return numericValues.get(part.value);
} else {
return NO_NUMERIC_VALUE;
}
} | [
"public",
"double",
"getNumericValue",
"(",
"Part",
"part",
")",
"{",
"Part",
".",
"Type",
"type",
"=",
"part",
".",
"type",
";",
"if",
"(",
"type",
"==",
"Part",
".",
"Type",
".",
"ARG_INT",
")",
"{",
"return",
"part",
".",
"value",
";",
"}",
"els... | Returns the numeric value associated with an ARG_INT or ARG_DOUBLE.
@param part a part of this MessagePattern.
@return the part's numeric value, or NO_NUMERIC_VALUE if this is not a numeric part. | [
"Returns",
"the",
"numeric",
"value",
"associated",
"with",
"an",
"ARG_INT",
"or",
"ARG_DOUBLE",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L465-L474 |
34,353 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.getLimitPartIndex | public int getLimitPartIndex(int start) {
int limit=parts.get(start).limitPartIndex;
if(limit<start) {
return start;
}
return limit;
} | java | public int getLimitPartIndex(int start) {
int limit=parts.get(start).limitPartIndex;
if(limit<start) {
return start;
}
return limit;
} | [
"public",
"int",
"getLimitPartIndex",
"(",
"int",
"start",
")",
"{",
"int",
"limit",
"=",
"parts",
".",
"get",
"(",
"start",
")",
".",
"limitPartIndex",
";",
"if",
"(",
"limit",
"<",
"start",
")",
"{",
"return",
"start",
";",
"}",
"return",
"limit",
... | Returns the index of the ARG|MSG_LIMIT part corresponding to the ARG|MSG_START at start.
@param start The index of some Part data (0..countParts()-1);
this Part should be of Type ARG_START or MSG_START.
@return The first i>start where getPart(i).getType()==ARG|MSG_LIMIT at the same nesting level,
or start itself if getPartType(msgStart)!=ARG|MSG_START.
@throws IndexOutOfBoundsException if start is outside the (0..countParts()-1) range | [
"Returns",
"the",
"index",
"of",
"the",
"ARG|MSG_LIMIT",
"part",
"corresponding",
"to",
"the",
"ARG|MSG_START",
"at",
"start",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L506-L512 |
34,354 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.cloneAsThawed | @Override
@SuppressWarnings("unchecked")
public MessagePattern cloneAsThawed() {
MessagePattern newMsg;
try {
newMsg=(MessagePattern)super.clone();
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException(e);
}
newMsg.parts=(ArrayList<Part>)parts.clone();
if(numericValues!=null) {
newMsg.numericValues=(ArrayList<Double>)numericValues.clone();
}
newMsg.frozen=false;
return newMsg;
} | java | @Override
@SuppressWarnings("unchecked")
public MessagePattern cloneAsThawed() {
MessagePattern newMsg;
try {
newMsg=(MessagePattern)super.clone();
} catch (CloneNotSupportedException e) {
throw new ICUCloneNotSupportedException(e);
}
newMsg.parts=(ArrayList<Part>)parts.clone();
if(numericValues!=null) {
newMsg.numericValues=(ArrayList<Double>)numericValues.clone();
}
newMsg.frozen=false;
return newMsg;
} | [
"@",
"Override",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"MessagePattern",
"cloneAsThawed",
"(",
")",
"{",
"MessagePattern",
"newMsg",
";",
"try",
"{",
"newMsg",
"=",
"(",
"MessagePattern",
")",
"super",
".",
"clone",
"(",
")",
";",
"}"... | Creates and returns an unfrozen copy of this object.
@return a copy of this object. | [
"Creates",
"and",
"returns",
"an",
"unfrozen",
"copy",
"of",
"this",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L808-L823 |
34,355 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.parseArgNumber | private static int parseArgNumber(CharSequence s, int start, int limit) {
// If the identifier contains only ASCII digits, then it is an argument _number_
// and must not have leading zeros (except "0" itself).
// Otherwise it is an argument _name_.
if(start>=limit) {
return ARG_NAME_NOT_VALID;
}
int number;
// Defer numeric errors until we know there are only digits.
boolean badNumber;
char c=s.charAt(start++);
if(c=='0') {
if(start==limit) {
return 0;
} else {
number=0;
badNumber=true; // leading zero
}
} else if('1'<=c && c<='9') {
number=c-'0';
badNumber=false;
} else {
return ARG_NAME_NOT_NUMBER;
}
while(start<limit) {
c=s.charAt(start++);
if('0'<=c && c<='9') {
if(number>=Integer.MAX_VALUE/10) {
badNumber=true; // overflow
}
number=number*10+(c-'0');
} else {
return ARG_NAME_NOT_NUMBER;
}
}
// There are only ASCII digits.
if(badNumber) {
return ARG_NAME_NOT_VALID;
} else {
return number;
}
} | java | private static int parseArgNumber(CharSequence s, int start, int limit) {
// If the identifier contains only ASCII digits, then it is an argument _number_
// and must not have leading zeros (except "0" itself).
// Otherwise it is an argument _name_.
if(start>=limit) {
return ARG_NAME_NOT_VALID;
}
int number;
// Defer numeric errors until we know there are only digits.
boolean badNumber;
char c=s.charAt(start++);
if(c=='0') {
if(start==limit) {
return 0;
} else {
number=0;
badNumber=true; // leading zero
}
} else if('1'<=c && c<='9') {
number=c-'0';
badNumber=false;
} else {
return ARG_NAME_NOT_NUMBER;
}
while(start<limit) {
c=s.charAt(start++);
if('0'<=c && c<='9') {
if(number>=Integer.MAX_VALUE/10) {
badNumber=true; // overflow
}
number=number*10+(c-'0');
} else {
return ARG_NAME_NOT_NUMBER;
}
}
// There are only ASCII digits.
if(badNumber) {
return ARG_NAME_NOT_VALID;
} else {
return number;
}
} | [
"private",
"static",
"int",
"parseArgNumber",
"(",
"CharSequence",
"s",
",",
"int",
"start",
",",
"int",
"limit",
")",
"{",
"// If the identifier contains only ASCII digits, then it is an argument _number_",
"// and must not have leading zeros (except \"0\" itself).",
"// Otherwise... | Validates and parses an argument name or argument number string.
This internal method assumes that the input substring is a "pattern identifier".
@return >=0 if the name is a valid number,
ARG_NAME_NOT_NUMBER (-1) if it is a "pattern identifier" but not all ASCII digits,
ARG_NAME_NOT_VALID (-2) if it is neither.
@see #validateArgumentName(String) | [
"Validates",
"and",
"parses",
"an",
"argument",
"name",
"or",
"argument",
"number",
"string",
".",
"This",
"internal",
"method",
"assumes",
"that",
"the",
"input",
"substring",
"is",
"a",
"pattern",
"identifier",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L1245-L1286 |
34,356 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.parseDouble | private void parseDouble(int start, int limit, boolean allowInfinity) {
assert start<limit;
// fake loop for easy exit and single throw statement
for(;;) {
// fast path for small integers and infinity
int value=0;
int isNegative=0; // not boolean so that we can easily add it to value
int index=start;
char c=msg.charAt(index++);
if(c=='-') {
isNegative=1;
if(index==limit) {
break; // no number
}
c=msg.charAt(index++);
} else if(c=='+') {
if(index==limit) {
break; // no number
}
c=msg.charAt(index++);
}
if(c==0x221e) { // infinity
if(allowInfinity && index==limit) {
addArgDoublePart(
isNegative!=0 ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY,
start, limit-start);
return;
} else {
break;
}
}
// try to parse the number as a small integer but fall back to a double
while('0'<=c && c<='9') {
value=value*10+(c-'0');
if(value>(Part.MAX_VALUE+isNegative)) {
break; // not a small-enough integer
}
if(index==limit) {
addPart(Part.Type.ARG_INT, start, limit-start, isNegative!=0 ? -value : value);
return;
}
c=msg.charAt(index++);
}
// Let Double.parseDouble() throw a NumberFormatException.
double numericValue=Double.parseDouble(msg.substring(start, limit));
addArgDoublePart(numericValue, start, limit-start);
return;
}
throw new NumberFormatException(
"Bad syntax for numeric value: "+msg.substring(start, limit));
} | java | private void parseDouble(int start, int limit, boolean allowInfinity) {
assert start<limit;
// fake loop for easy exit and single throw statement
for(;;) {
// fast path for small integers and infinity
int value=0;
int isNegative=0; // not boolean so that we can easily add it to value
int index=start;
char c=msg.charAt(index++);
if(c=='-') {
isNegative=1;
if(index==limit) {
break; // no number
}
c=msg.charAt(index++);
} else if(c=='+') {
if(index==limit) {
break; // no number
}
c=msg.charAt(index++);
}
if(c==0x221e) { // infinity
if(allowInfinity && index==limit) {
addArgDoublePart(
isNegative!=0 ? Double.NEGATIVE_INFINITY : Double.POSITIVE_INFINITY,
start, limit-start);
return;
} else {
break;
}
}
// try to parse the number as a small integer but fall back to a double
while('0'<=c && c<='9') {
value=value*10+(c-'0');
if(value>(Part.MAX_VALUE+isNegative)) {
break; // not a small-enough integer
}
if(index==limit) {
addPart(Part.Type.ARG_INT, start, limit-start, isNegative!=0 ? -value : value);
return;
}
c=msg.charAt(index++);
}
// Let Double.parseDouble() throw a NumberFormatException.
double numericValue=Double.parseDouble(msg.substring(start, limit));
addArgDoublePart(numericValue, start, limit-start);
return;
}
throw new NumberFormatException(
"Bad syntax for numeric value: "+msg.substring(start, limit));
} | [
"private",
"void",
"parseDouble",
"(",
"int",
"start",
",",
"int",
"limit",
",",
"boolean",
"allowInfinity",
")",
"{",
"assert",
"start",
"<",
"limit",
";",
"// fake loop for easy exit and single throw statement",
"for",
"(",
";",
";",
")",
"{",
"// fast path for ... | Parses a number from the specified message substring.
@param start start index into the message string
@param limit limit index into the message string, must be start<limit
@param allowInfinity true if U+221E is allowed (for ChoiceFormat) | [
"Parses",
"a",
"number",
"from",
"the",
"specified",
"message",
"substring",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L1298-L1348 |
34,357 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java | MessagePattern.skipDouble | private int skipDouble(int index) {
while(index<msg.length()) {
char c=msg.charAt(index);
// U+221E: Allow the infinity symbol, for ChoiceFormat patterns.
if((c<'0' && "+-.".indexOf(c)<0) || (c>'9' && c!='e' && c!='E' && c!=0x221e)) {
break;
}
++index;
}
return index;
} | java | private int skipDouble(int index) {
while(index<msg.length()) {
char c=msg.charAt(index);
// U+221E: Allow the infinity symbol, for ChoiceFormat patterns.
if((c<'0' && "+-.".indexOf(c)<0) || (c>'9' && c!='e' && c!='E' && c!=0x221e)) {
break;
}
++index;
}
return index;
} | [
"private",
"int",
"skipDouble",
"(",
"int",
"index",
")",
"{",
"while",
"(",
"index",
"<",
"msg",
".",
"length",
"(",
")",
")",
"{",
"char",
"c",
"=",
"msg",
".",
"charAt",
"(",
"index",
")",
";",
"// U+221E: Allow the infinity symbol, for ChoiceFormat patte... | Skips a sequence of characters that could occur in a double value.
Does not fully parse or validate the value. | [
"Skips",
"a",
"sequence",
"of",
"characters",
"that",
"could",
"occur",
"in",
"a",
"double",
"value",
".",
"Does",
"not",
"fully",
"parse",
"or",
"validate",
"the",
"value",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessagePattern.java#L1389-L1399 |
34,358 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Norm2AllModes.java | Norm2AllModes.getN2WithImpl | public static Normalizer2WithImpl getN2WithImpl(int index) {
switch(index) {
case 0: return getNFCInstance().decomp; // NFD
case 1: return getNFKCInstance().decomp; // NFKD
case 2: return getNFCInstance().comp; // NFC
case 3: return getNFKCInstance().comp; // NFKC
default: return null;
}
} | java | public static Normalizer2WithImpl getN2WithImpl(int index) {
switch(index) {
case 0: return getNFCInstance().decomp; // NFD
case 1: return getNFKCInstance().decomp; // NFKD
case 2: return getNFCInstance().comp; // NFC
case 3: return getNFKCInstance().comp; // NFKC
default: return null;
}
} | [
"public",
"static",
"Normalizer2WithImpl",
"getN2WithImpl",
"(",
"int",
"index",
")",
"{",
"switch",
"(",
"index",
")",
"{",
"case",
"0",
":",
"return",
"getNFCInstance",
"(",
")",
".",
"decomp",
";",
"// NFD",
"case",
"1",
":",
"return",
"getNFKCInstance",
... | For use in properties APIs. | [
"For",
"use",
"in",
"properties",
"APIs",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/Norm2AllModes.java#L317-L325 |
34,359 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/Parsed.java | Parsed.copy | Parsed copy() {
// only copy fields used in parsing stage
Parsed cloned = new Parsed();
cloned.fieldValues.putAll(this.fieldValues);
cloned.zone = this.zone;
cloned.chrono = this.chrono;
cloned.leapSecond = this.leapSecond;
return cloned;
} | java | Parsed copy() {
// only copy fields used in parsing stage
Parsed cloned = new Parsed();
cloned.fieldValues.putAll(this.fieldValues);
cloned.zone = this.zone;
cloned.chrono = this.chrono;
cloned.leapSecond = this.leapSecond;
return cloned;
} | [
"Parsed",
"copy",
"(",
")",
"{",
"// only copy fields used in parsing stage",
"Parsed",
"cloned",
"=",
"new",
"Parsed",
"(",
")",
";",
"cloned",
".",
"fieldValues",
".",
"putAll",
"(",
"this",
".",
"fieldValues",
")",
";",
"cloned",
".",
"zone",
"=",
"this",... | Creates a copy. | [
"Creates",
"a",
"copy",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/Parsed.java#L168-L176 |
34,360 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/Parsed.java | Parsed.resolve | TemporalAccessor resolve(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
if (resolverFields != null) {
fieldValues.keySet().retainAll(resolverFields);
}
this.resolverStyle = resolverStyle;
resolveFields();
resolveTimeLenient();
crossCheck();
resolvePeriod();
resolveFractional();
resolveInstant();
return this;
} | java | TemporalAccessor resolve(ResolverStyle resolverStyle, Set<TemporalField> resolverFields) {
if (resolverFields != null) {
fieldValues.keySet().retainAll(resolverFields);
}
this.resolverStyle = resolverStyle;
resolveFields();
resolveTimeLenient();
crossCheck();
resolvePeriod();
resolveFractional();
resolveInstant();
return this;
} | [
"TemporalAccessor",
"resolve",
"(",
"ResolverStyle",
"resolverStyle",
",",
"Set",
"<",
"TemporalField",
">",
"resolverFields",
")",
"{",
"if",
"(",
"resolverFields",
"!=",
"null",
")",
"{",
"fieldValues",
".",
"keySet",
"(",
")",
".",
"retainAll",
"(",
"resolv... | Resolves the fields in this context.
@param resolverStyle the resolver style, not null
@param resolverFields the fields to use for resolving, null for all fields
@return this, for method chaining
@throws DateTimeException if resolving one field results in a value for
another field that is in conflict | [
"Resolves",
"the",
"fields",
"in",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/Parsed.java#L239-L251 |
34,361 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.getValue | public int getValue(int ch)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
return 0;
}
int block = m_index_[ch >> SHIFT_];
return m_data_[Math.abs(block) + (ch & MASK_)];
} | java | public int getValue(int ch)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
return 0;
}
int block = m_index_[ch >> SHIFT_];
return m_data_[Math.abs(block) + (ch & MASK_)];
} | [
"public",
"int",
"getValue",
"(",
"int",
"ch",
")",
"{",
"// valid, uncompacted trie and valid c?",
"if",
"(",
"m_isCompacted_",
"||",
"ch",
">",
"UCharacter",
".",
"MAX_VALUE",
"||",
"ch",
"<",
"0",
")",
"{",
"return",
"0",
";",
"}",
"int",
"block",
"=",
... | Gets a 32 bit data from the table data
@param ch codepoint which data is to be retrieved
@return the 32 bit data | [
"Gets",
"a",
"32",
"bit",
"data",
"from",
"the",
"table",
"data"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L172-L181 |
34,362 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.getValue | public int getValue(int ch, boolean [] inBlockZero)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
if (inBlockZero != null) {
inBlockZero[0] = true;
}
return 0;
}
int block = m_index_[ch >> SHIFT_];
if (inBlockZero != null) {
inBlockZero[0] = (block == 0);
}
return m_data_[Math.abs(block) + (ch & MASK_)];
} | java | public int getValue(int ch, boolean [] inBlockZero)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
if (inBlockZero != null) {
inBlockZero[0] = true;
}
return 0;
}
int block = m_index_[ch >> SHIFT_];
if (inBlockZero != null) {
inBlockZero[0] = (block == 0);
}
return m_data_[Math.abs(block) + (ch & MASK_)];
} | [
"public",
"int",
"getValue",
"(",
"int",
"ch",
",",
"boolean",
"[",
"]",
"inBlockZero",
")",
"{",
"// valid, uncompacted trie and valid c?",
"if",
"(",
"m_isCompacted_",
"||",
"ch",
">",
"UCharacter",
".",
"MAX_VALUE",
"||",
"ch",
"<",
"0",
")",
"{",
"if",
... | Get a 32 bit data from the table data
@param ch code point for which data is to be retrieved.
@param inBlockZero Output parameter, inBlockZero[0] returns true if the
char maps into block zero, otherwise false.
@return the 32 bit data value. | [
"Get",
"a",
"32",
"bit",
"data",
"from",
"the",
"table",
"data"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L190-L205 |
34,363 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.setValue | public boolean setValue(int ch, int value)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
return false;
}
int block = getDataBlock(ch);
if (block < 0) {
return false;
}
m_data_[block + (ch & MASK_)] = value;
return true;
} | java | public boolean setValue(int ch, int value)
{
// valid, uncompacted trie and valid c?
if (m_isCompacted_ || ch > UCharacter.MAX_VALUE || ch < 0) {
return false;
}
int block = getDataBlock(ch);
if (block < 0) {
return false;
}
m_data_[block + (ch & MASK_)] = value;
return true;
} | [
"public",
"boolean",
"setValue",
"(",
"int",
"ch",
",",
"int",
"value",
")",
"{",
"// valid, uncompacted trie and valid c? ",
"if",
"(",
"m_isCompacted_",
"||",
"ch",
">",
"UCharacter",
".",
"MAX_VALUE",
"||",
"ch",
"<",
"0",
")",
"{",
"return",
"false",
";"... | Sets a 32 bit data in the table data
@param ch codepoint which data is to be set
@param value to set
@return true if the set is successful, otherwise
if the table has been compacted return false | [
"Sets",
"a",
"32",
"bit",
"data",
"in",
"the",
"table",
"data"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L215-L229 |
34,364 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.serialize | public IntTrie serialize(TrieBuilder.DataManipulate datamanipulate,
Trie.DataManipulate triedatamanipulate)
{
if (datamanipulate == null) {
throw new IllegalArgumentException("Parameters can not be null");
}
// fold and compact if necessary, also checks that indexLength is
// within limits
if (!m_isCompacted_) {
// compact once without overlap to improve folding
compact(false);
// fold the supplementary part of the index array
fold(datamanipulate);
// compact again with overlap for minimum data array length
compact(true);
m_isCompacted_ = true;
}
// is dataLength within limits?
if (m_dataLength_ >= MAX_DATA_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Data length too small");
}
char index[] = new char[m_indexLength_];
int data[] = new int[m_dataLength_];
// write the index (stage 1) array and the 32-bit data (stage 2) array
// write 16-bit index values shifted right by INDEX_SHIFT_
for (int i = 0; i < m_indexLength_; i ++) {
index[i] = (char)(m_index_[i] >>> INDEX_SHIFT_);
}
// write 32-bit data values
System.arraycopy(m_data_, 0, data, 0, m_dataLength_);
int options = SHIFT_ | (INDEX_SHIFT_ << OPTIONS_INDEX_SHIFT_);
options |= OPTIONS_DATA_IS_32_BIT_;
if (m_isLatin1Linear_) {
options |= OPTIONS_LATIN1_IS_LINEAR_;
}
return new IntTrie(index, data, m_initialValue_, options,
triedatamanipulate);
} | java | public IntTrie serialize(TrieBuilder.DataManipulate datamanipulate,
Trie.DataManipulate triedatamanipulate)
{
if (datamanipulate == null) {
throw new IllegalArgumentException("Parameters can not be null");
}
// fold and compact if necessary, also checks that indexLength is
// within limits
if (!m_isCompacted_) {
// compact once without overlap to improve folding
compact(false);
// fold the supplementary part of the index array
fold(datamanipulate);
// compact again with overlap for minimum data array length
compact(true);
m_isCompacted_ = true;
}
// is dataLength within limits?
if (m_dataLength_ >= MAX_DATA_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Data length too small");
}
char index[] = new char[m_indexLength_];
int data[] = new int[m_dataLength_];
// write the index (stage 1) array and the 32-bit data (stage 2) array
// write 16-bit index values shifted right by INDEX_SHIFT_
for (int i = 0; i < m_indexLength_; i ++) {
index[i] = (char)(m_index_[i] >>> INDEX_SHIFT_);
}
// write 32-bit data values
System.arraycopy(m_data_, 0, data, 0, m_dataLength_);
int options = SHIFT_ | (INDEX_SHIFT_ << OPTIONS_INDEX_SHIFT_);
options |= OPTIONS_DATA_IS_32_BIT_;
if (m_isLatin1Linear_) {
options |= OPTIONS_LATIN1_IS_LINEAR_;
}
return new IntTrie(index, data, m_initialValue_, options,
triedatamanipulate);
} | [
"public",
"IntTrie",
"serialize",
"(",
"TrieBuilder",
".",
"DataManipulate",
"datamanipulate",
",",
"Trie",
".",
"DataManipulate",
"triedatamanipulate",
")",
"{",
"if",
"(",
"datamanipulate",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
... | Serializes the build table with 32 bit data
@param datamanipulate builder raw fold method implementation
@param triedatamanipulate result trie fold method
@return a new trie | [
"Serializes",
"the",
"build",
"table",
"with",
"32",
"bit",
"data"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L237-L276 |
34,365 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.serialize | public int serialize(OutputStream os, boolean reduceTo16Bits,
TrieBuilder.DataManipulate datamanipulate) throws IOException {
if (datamanipulate == null) {
throw new IllegalArgumentException("Parameters can not be null");
}
// fold and compact if necessary, also checks that indexLength is
// within limits
if (!m_isCompacted_) {
// compact once without overlap to improve folding
compact(false);
// fold the supplementary part of the index array
fold(datamanipulate);
// compact again with overlap for minimum data array length
compact(true);
m_isCompacted_ = true;
}
// is dataLength within limits?
int length;
if (reduceTo16Bits) {
length = m_dataLength_ + m_indexLength_;
} else {
length = m_dataLength_;
}
if (length >= MAX_DATA_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Data length too small");
}
// struct UTrieHeader {
// int32_t signature;
// int32_t options (a bit field)
// int32_t indexLength
// int32_t dataLength
length = Trie.HEADER_LENGTH_ + 2*m_indexLength_;
if(reduceTo16Bits) {
length+=2*m_dataLength_;
} else {
length+=4*m_dataLength_;
}
if (os == null) {
// No output stream. Just return the length of the serialized Trie, in bytes.
return length;
}
DataOutputStream dos = new DataOutputStream(os);
dos.writeInt(Trie.HEADER_SIGNATURE_);
int options = Trie.INDEX_STAGE_1_SHIFT_ | (Trie.INDEX_STAGE_2_SHIFT_<<Trie.HEADER_OPTIONS_INDEX_SHIFT_);
if(!reduceTo16Bits) {
options |= Trie.HEADER_OPTIONS_DATA_IS_32_BIT_;
}
if(m_isLatin1Linear_) {
options |= Trie.HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_;
}
dos.writeInt(options);
dos.writeInt(m_indexLength_);
dos.writeInt(m_dataLength_);
/* write the index (stage 1) array and the 16/32-bit data (stage 2) array */
if(reduceTo16Bits) {
/* write 16-bit index values shifted right by UTRIE_INDEX_SHIFT, after adding indexLength */
for (int i=0; i<m_indexLength_; i++) {
int v = (m_index_[i] + m_indexLength_) >>> Trie.INDEX_STAGE_2_SHIFT_;
dos.writeChar(v);
}
/* write 16-bit data values */
for(int i=0; i<m_dataLength_; i++) {
int v = m_data_[i] & 0x0000ffff;
dos.writeChar(v);
}
} else {
/* write 16-bit index values shifted right by UTRIE_INDEX_SHIFT */
for (int i=0; i<m_indexLength_; i++) {
int v = (m_index_[i]) >>> Trie.INDEX_STAGE_2_SHIFT_;
dos.writeChar(v);
}
/* write 32-bit data values */
for(int i=0; i<m_dataLength_; i++) {
dos.writeInt(m_data_[i]);
}
}
return length;
} | java | public int serialize(OutputStream os, boolean reduceTo16Bits,
TrieBuilder.DataManipulate datamanipulate) throws IOException {
if (datamanipulate == null) {
throw new IllegalArgumentException("Parameters can not be null");
}
// fold and compact if necessary, also checks that indexLength is
// within limits
if (!m_isCompacted_) {
// compact once without overlap to improve folding
compact(false);
// fold the supplementary part of the index array
fold(datamanipulate);
// compact again with overlap for minimum data array length
compact(true);
m_isCompacted_ = true;
}
// is dataLength within limits?
int length;
if (reduceTo16Bits) {
length = m_dataLength_ + m_indexLength_;
} else {
length = m_dataLength_;
}
if (length >= MAX_DATA_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Data length too small");
}
// struct UTrieHeader {
// int32_t signature;
// int32_t options (a bit field)
// int32_t indexLength
// int32_t dataLength
length = Trie.HEADER_LENGTH_ + 2*m_indexLength_;
if(reduceTo16Bits) {
length+=2*m_dataLength_;
} else {
length+=4*m_dataLength_;
}
if (os == null) {
// No output stream. Just return the length of the serialized Trie, in bytes.
return length;
}
DataOutputStream dos = new DataOutputStream(os);
dos.writeInt(Trie.HEADER_SIGNATURE_);
int options = Trie.INDEX_STAGE_1_SHIFT_ | (Trie.INDEX_STAGE_2_SHIFT_<<Trie.HEADER_OPTIONS_INDEX_SHIFT_);
if(!reduceTo16Bits) {
options |= Trie.HEADER_OPTIONS_DATA_IS_32_BIT_;
}
if(m_isLatin1Linear_) {
options |= Trie.HEADER_OPTIONS_LATIN1_IS_LINEAR_MASK_;
}
dos.writeInt(options);
dos.writeInt(m_indexLength_);
dos.writeInt(m_dataLength_);
/* write the index (stage 1) array and the 16/32-bit data (stage 2) array */
if(reduceTo16Bits) {
/* write 16-bit index values shifted right by UTRIE_INDEX_SHIFT, after adding indexLength */
for (int i=0; i<m_indexLength_; i++) {
int v = (m_index_[i] + m_indexLength_) >>> Trie.INDEX_STAGE_2_SHIFT_;
dos.writeChar(v);
}
/* write 16-bit data values */
for(int i=0; i<m_dataLength_; i++) {
int v = m_data_[i] & 0x0000ffff;
dos.writeChar(v);
}
} else {
/* write 16-bit index values shifted right by UTRIE_INDEX_SHIFT */
for (int i=0; i<m_indexLength_; i++) {
int v = (m_index_[i]) >>> Trie.INDEX_STAGE_2_SHIFT_;
dos.writeChar(v);
}
/* write 32-bit data values */
for(int i=0; i<m_dataLength_; i++) {
dos.writeInt(m_data_[i]);
}
}
return length;
} | [
"public",
"int",
"serialize",
"(",
"OutputStream",
"os",
",",
"boolean",
"reduceTo16Bits",
",",
"TrieBuilder",
".",
"DataManipulate",
"datamanipulate",
")",
"throws",
"IOException",
"{",
"if",
"(",
"datamanipulate",
"==",
"null",
")",
"{",
"throw",
"new",
"Illeg... | Serializes the build table to an output stream.
Compacts the build-time trie after all values are set, and then
writes the serialized form onto an output stream.
After this, this build-time Trie can only be serialized again and/or closed;
no further values can be added.
This function is the rough equivalent of utrie_seriaize() in ICU4C.
@param os the output stream to which the seriaized trie will be written.
If nul, the function still returns the size of the serialized Trie.
@param reduceTo16Bits If true, reduce the data size to 16 bits. The resulting
serialized form can then be used to create a CharTrie.
@param datamanipulate builder raw fold method implementation
@return the number of bytes written to the output stream. | [
"Serializes",
"the",
"build",
"table",
"to",
"an",
"output",
"stream",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L297-L386 |
34,366 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.findSameDataBlock | private static final int findSameDataBlock(int data[], int dataLength,
int otherBlock, int step)
{
// ensure that we do not even partially get past dataLength
dataLength -= DATA_BLOCK_LENGTH;
for (int block = 0; block <= dataLength; block += step) {
if(equal_int(data, block, otherBlock, DATA_BLOCK_LENGTH)) {
return block;
}
}
return -1;
} | java | private static final int findSameDataBlock(int data[], int dataLength,
int otherBlock, int step)
{
// ensure that we do not even partially get past dataLength
dataLength -= DATA_BLOCK_LENGTH;
for (int block = 0; block <= dataLength; block += step) {
if(equal_int(data, block, otherBlock, DATA_BLOCK_LENGTH)) {
return block;
}
}
return -1;
} | [
"private",
"static",
"final",
"int",
"findSameDataBlock",
"(",
"int",
"data",
"[",
"]",
",",
"int",
"dataLength",
",",
"int",
"otherBlock",
",",
"int",
"step",
")",
"{",
"// ensure that we do not even partially get past dataLength",
"dataLength",
"-=",
"DATA_BLOCK_LEN... | Find the same data block
@param data array
@param dataLength
@param otherBlock
@param step | [
"Find",
"the",
"same",
"data",
"block"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L647-L659 |
34,367 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java | IntTrieBuilder.fold | private final void fold(DataManipulate manipulate)
{
int leadIndexes[] = new int[SURROGATE_BLOCK_COUNT_];
int index[] = m_index_;
// copy the lead surrogate indexes into a temporary array
System.arraycopy(index, 0xd800 >> SHIFT_, leadIndexes, 0,
SURROGATE_BLOCK_COUNT_);
// set all values for lead surrogate code *units* to leadUnitValue
// so that by default runtime lookups will find no data for associated
// supplementary code points, unless there is data for such code points
// which will result in a non-zero folding value below that is set for
// the respective lead units
// the above saved the indexes for surrogate code *points*
// fill the indexes with simplified code from utrie_setRange32()
int block = 0;
if (m_leadUnitValue_ == m_initialValue_) {
// leadUnitValue == initialValue, use all-initial-value block
// block = 0; if block here left empty
}
else {
// create and fill the repeatBlock
block = allocDataBlock();
if (block < 0) {
// data table overflow
throw new IllegalStateException("Internal error: Out of memory space");
}
fillBlock(block, 0, DATA_BLOCK_LENGTH, m_leadUnitValue_, true);
// negative block number to indicate that it is a repeat block
block = -block;
}
for (int c = (0xd800 >> SHIFT_); c < (0xdc00 >> SHIFT_); ++ c) {
m_index_[c] = block;
}
// Fold significant index values into the area just after the BMP
// indexes.
// In case the first lead surrogate has significant data,
// its index block must be used first (in which case the folding is a
// no-op).
// Later all folded index blocks are moved up one to insert the copied
// lead surrogate indexes.
int indexLength = BMP_INDEX_LENGTH_;
// search for any index (stage 1) entries for supplementary code points
for (int c = 0x10000; c < 0x110000;) {
if (index[c >> SHIFT_] != 0) {
// there is data, treat the full block for a lead surrogate
c &= ~0x3ff;
// is there an identical index block?
block = findSameIndexBlock(index, indexLength, c >> SHIFT_);
// get a folded value for [c..c+0x400[ and,
// if different from the value for the lead surrogate code
// point, set it for the lead surrogate code unit
int value = manipulate.getFoldedValue(c,
block + SURROGATE_BLOCK_COUNT_);
if (value != getValue(UTF16.getLeadSurrogate(c))) {
if (!setValue(UTF16.getLeadSurrogate(c), value)) {
// data table overflow
throw new ArrayIndexOutOfBoundsException(
"Data table overflow");
}
// if we did not find an identical index block...
if (block == indexLength) {
// move the actual index (stage 1) entries from the
// supplementary position to the new one
System.arraycopy(index, c >> SHIFT_, index, indexLength,
SURROGATE_BLOCK_COUNT_);
indexLength += SURROGATE_BLOCK_COUNT_;
}
}
c += 0x400;
}
else {
c += DATA_BLOCK_LENGTH;
}
}
// index array overflow?
// This is to guarantee that a folding offset is of the form
// UTRIE_BMP_INDEX_LENGTH+n*UTRIE_SURROGATE_BLOCK_COUNT with n=0..1023.
// If the index is too large, then n>=1024 and more than 10 bits are
// necessary.
// In fact, it can only ever become n==1024 with completely unfoldable
// data and the additional block of duplicated values for lead
// surrogates.
if (indexLength >= MAX_INDEX_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Index table overflow");
}
// make space for the lead surrogate index block and insert it between
// the BMP indexes and the folded ones
System.arraycopy(index, BMP_INDEX_LENGTH_, index,
BMP_INDEX_LENGTH_ + SURROGATE_BLOCK_COUNT_,
indexLength - BMP_INDEX_LENGTH_);
System.arraycopy(leadIndexes, 0, index, BMP_INDEX_LENGTH_,
SURROGATE_BLOCK_COUNT_);
indexLength += SURROGATE_BLOCK_COUNT_;
m_indexLength_ = indexLength;
} | java | private final void fold(DataManipulate manipulate)
{
int leadIndexes[] = new int[SURROGATE_BLOCK_COUNT_];
int index[] = m_index_;
// copy the lead surrogate indexes into a temporary array
System.arraycopy(index, 0xd800 >> SHIFT_, leadIndexes, 0,
SURROGATE_BLOCK_COUNT_);
// set all values for lead surrogate code *units* to leadUnitValue
// so that by default runtime lookups will find no data for associated
// supplementary code points, unless there is data for such code points
// which will result in a non-zero folding value below that is set for
// the respective lead units
// the above saved the indexes for surrogate code *points*
// fill the indexes with simplified code from utrie_setRange32()
int block = 0;
if (m_leadUnitValue_ == m_initialValue_) {
// leadUnitValue == initialValue, use all-initial-value block
// block = 0; if block here left empty
}
else {
// create and fill the repeatBlock
block = allocDataBlock();
if (block < 0) {
// data table overflow
throw new IllegalStateException("Internal error: Out of memory space");
}
fillBlock(block, 0, DATA_BLOCK_LENGTH, m_leadUnitValue_, true);
// negative block number to indicate that it is a repeat block
block = -block;
}
for (int c = (0xd800 >> SHIFT_); c < (0xdc00 >> SHIFT_); ++ c) {
m_index_[c] = block;
}
// Fold significant index values into the area just after the BMP
// indexes.
// In case the first lead surrogate has significant data,
// its index block must be used first (in which case the folding is a
// no-op).
// Later all folded index blocks are moved up one to insert the copied
// lead surrogate indexes.
int indexLength = BMP_INDEX_LENGTH_;
// search for any index (stage 1) entries for supplementary code points
for (int c = 0x10000; c < 0x110000;) {
if (index[c >> SHIFT_] != 0) {
// there is data, treat the full block for a lead surrogate
c &= ~0x3ff;
// is there an identical index block?
block = findSameIndexBlock(index, indexLength, c >> SHIFT_);
// get a folded value for [c..c+0x400[ and,
// if different from the value for the lead surrogate code
// point, set it for the lead surrogate code unit
int value = manipulate.getFoldedValue(c,
block + SURROGATE_BLOCK_COUNT_);
if (value != getValue(UTF16.getLeadSurrogate(c))) {
if (!setValue(UTF16.getLeadSurrogate(c), value)) {
// data table overflow
throw new ArrayIndexOutOfBoundsException(
"Data table overflow");
}
// if we did not find an identical index block...
if (block == indexLength) {
// move the actual index (stage 1) entries from the
// supplementary position to the new one
System.arraycopy(index, c >> SHIFT_, index, indexLength,
SURROGATE_BLOCK_COUNT_);
indexLength += SURROGATE_BLOCK_COUNT_;
}
}
c += 0x400;
}
else {
c += DATA_BLOCK_LENGTH;
}
}
// index array overflow?
// This is to guarantee that a folding offset is of the form
// UTRIE_BMP_INDEX_LENGTH+n*UTRIE_SURROGATE_BLOCK_COUNT with n=0..1023.
// If the index is too large, then n>=1024 and more than 10 bits are
// necessary.
// In fact, it can only ever become n==1024 with completely unfoldable
// data and the additional block of duplicated values for lead
// surrogates.
if (indexLength >= MAX_INDEX_LENGTH_) {
throw new ArrayIndexOutOfBoundsException("Index table overflow");
}
// make space for the lead surrogate index block and insert it between
// the BMP indexes and the folded ones
System.arraycopy(index, BMP_INDEX_LENGTH_, index,
BMP_INDEX_LENGTH_ + SURROGATE_BLOCK_COUNT_,
indexLength - BMP_INDEX_LENGTH_);
System.arraycopy(leadIndexes, 0, index, BMP_INDEX_LENGTH_,
SURROGATE_BLOCK_COUNT_);
indexLength += SURROGATE_BLOCK_COUNT_;
m_indexLength_ = indexLength;
} | [
"private",
"final",
"void",
"fold",
"(",
"DataManipulate",
"manipulate",
")",
"{",
"int",
"leadIndexes",
"[",
"]",
"=",
"new",
"int",
"[",
"SURROGATE_BLOCK_COUNT_",
"]",
";",
"int",
"index",
"[",
"]",
"=",
"m_index_",
";",
"// copy the lead surrogate indexes int... | Fold the normalization data for supplementary code points into
a compact area on top of the BMP-part of the trie index,
with the lead surrogates indexing this compact area.
Duplicate the index values for lead surrogates:
From inside the BMP area, where some may be overridden with folded values,
to just after the BMP area, where they can be retrieved for
code point lookups.
@param manipulate fold implementation | [
"Fold",
"the",
"normalization",
"data",
"for",
"supplementary",
"code",
"points",
"into",
"a",
"compact",
"area",
"on",
"top",
"of",
"the",
"BMP",
"-",
"part",
"of",
"the",
"trie",
"index",
"with",
"the",
"lead",
"surrogates",
"indexing",
"this",
"compact",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/IntTrieBuilder.java#L672-L771 |
34,368 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java | Inet6Address.readObject | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
scope_ifname = null;
scope_ifname_set = false;
if (getClass().getClassLoader() != Class.class.getClassLoader()) {
throw new SecurityException ("invalid address type");
}
s.defaultReadObject();
if (ifname != null && !"".equals (ifname)) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
scope_id_set = false;
scope_ifname_set = false;
scope_id = 0;
} else {
try {
scope_id = deriveNumericScope (scope_ifname);
} catch (UnknownHostException e) {
// typically should not happen, but it may be that
// the machine being used for deserialization has
// the same interface name but without IPv6 configured.
}
}
} catch (SocketException e) {}
}
/* if ifname was not supplied, then the numeric info is used */
ipaddress = ipaddress.clone();
// Check that our invariants are satisfied
if (ipaddress.length != INADDRSZ) {
throw new InvalidObjectException("invalid address length: "+
ipaddress.length);
}
if (holder().getFamily() != AF_INET6) {
throw new InvalidObjectException("invalid address family type");
}
} | java | private void readObject(ObjectInputStream s)
throws IOException, ClassNotFoundException {
scope_ifname = null;
scope_ifname_set = false;
if (getClass().getClassLoader() != Class.class.getClassLoader()) {
throw new SecurityException ("invalid address type");
}
s.defaultReadObject();
if (ifname != null && !"".equals (ifname)) {
try {
scope_ifname = NetworkInterface.getByName(ifname);
if (scope_ifname == null) {
/* the interface does not exist on this system, so we clear
* the scope information completely */
scope_id_set = false;
scope_ifname_set = false;
scope_id = 0;
} else {
try {
scope_id = deriveNumericScope (scope_ifname);
} catch (UnknownHostException e) {
// typically should not happen, but it may be that
// the machine being used for deserialization has
// the same interface name but without IPv6 configured.
}
}
} catch (SocketException e) {}
}
/* if ifname was not supplied, then the numeric info is used */
ipaddress = ipaddress.clone();
// Check that our invariants are satisfied
if (ipaddress.length != INADDRSZ) {
throw new InvalidObjectException("invalid address length: "+
ipaddress.length);
}
if (holder().getFamily() != AF_INET6) {
throw new InvalidObjectException("invalid address family type");
}
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"s",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"scope_ifname",
"=",
"null",
";",
"scope_ifname_set",
"=",
"false",
";",
"if",
"(",
"getClass",
"(",
")",
".",
"getClassLoader",
"("... | restore the state of this object from stream
including the scope information, only if the
scoped interface name is valid on this system | [
"restore",
"the",
"state",
"of",
"this",
"object",
"from",
"stream",
"including",
"the",
"scope",
"information",
"only",
"if",
"the",
"scoped",
"interface",
"name",
"is",
"valid",
"on",
"this",
"system"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L431-L476 |
34,369 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java | Inet6Address.isAnyLocalAddress | @Override
public boolean isAnyLocalAddress() {
byte test = 0x00;
for (int i = 0; i < INADDRSZ; i++) {
test |= ipaddress[i];
}
return (test == 0x00);
} | java | @Override
public boolean isAnyLocalAddress() {
byte test = 0x00;
for (int i = 0; i < INADDRSZ; i++) {
test |= ipaddress[i];
}
return (test == 0x00);
} | [
"@",
"Override",
"public",
"boolean",
"isAnyLocalAddress",
"(",
")",
"{",
"byte",
"test",
"=",
"0x00",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"INADDRSZ",
";",
"i",
"++",
")",
"{",
"test",
"|=",
"ipaddress",
"[",
"i",
"]",
";",
"}",... | Utility routine to check if the InetAddress in a wildcard address.
@return a <code>boolean</code> indicating if the Inetaddress is
a wildcard address.
@since 1.4 | [
"Utility",
"routine",
"to",
"check",
"if",
"the",
"InetAddress",
"in",
"a",
"wildcard",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L498-L505 |
34,370 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java | Inet6Address.isLoopbackAddress | @Override
public boolean isLoopbackAddress() {
byte test = 0x00;
for (int i = 0; i < 15; i++) {
test |= ipaddress[i];
}
return (test == 0x00) && (ipaddress[15] == 0x01);
} | java | @Override
public boolean isLoopbackAddress() {
byte test = 0x00;
for (int i = 0; i < 15; i++) {
test |= ipaddress[i];
}
return (test == 0x00) && (ipaddress[15] == 0x01);
} | [
"@",
"Override",
"public",
"boolean",
"isLoopbackAddress",
"(",
")",
"{",
"byte",
"test",
"=",
"0x00",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"15",
";",
"i",
"++",
")",
"{",
"test",
"|=",
"ipaddress",
"[",
"i",
"]",
";",
"}",
"re... | Utility routine to check if the InetAddress is a loopback address.
@return a <code>boolean</code> indicating if the InetAddress is
a loopback address; or false otherwise.
@since 1.4 | [
"Utility",
"routine",
"to",
"check",
"if",
"the",
"InetAddress",
"is",
"a",
"loopback",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L514-L521 |
34,371 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java | Inet6Address.isIPv4CompatibleAddress | public boolean isIPv4CompatibleAddress() {
if ((ipaddress[0] == 0x00) && (ipaddress[1] == 0x00) &&
(ipaddress[2] == 0x00) && (ipaddress[3] == 0x00) &&
(ipaddress[4] == 0x00) && (ipaddress[5] == 0x00) &&
(ipaddress[6] == 0x00) && (ipaddress[7] == 0x00) &&
(ipaddress[8] == 0x00) && (ipaddress[9] == 0x00) &&
(ipaddress[10] == 0x00) && (ipaddress[11] == 0x00)) {
return true;
}
return false;
} | java | public boolean isIPv4CompatibleAddress() {
if ((ipaddress[0] == 0x00) && (ipaddress[1] == 0x00) &&
(ipaddress[2] == 0x00) && (ipaddress[3] == 0x00) &&
(ipaddress[4] == 0x00) && (ipaddress[5] == 0x00) &&
(ipaddress[6] == 0x00) && (ipaddress[7] == 0x00) &&
(ipaddress[8] == 0x00) && (ipaddress[9] == 0x00) &&
(ipaddress[10] == 0x00) && (ipaddress[11] == 0x00)) {
return true;
}
return false;
} | [
"public",
"boolean",
"isIPv4CompatibleAddress",
"(",
")",
"{",
"if",
"(",
"(",
"ipaddress",
"[",
"0",
"]",
"==",
"0x00",
")",
"&&",
"(",
"ipaddress",
"[",
"1",
"]",
"==",
"0x00",
")",
"&&",
"(",
"ipaddress",
"[",
"2",
"]",
"==",
"0x00",
")",
"&&",
... | Utility routine to check if the InetAddress is an
IPv4 compatible IPv6 address.
@return a <code>boolean</code> indicating if the InetAddress is
an IPv4 compatible IPv6 address; or false if address is IPv4 address.
@since 1.4 | [
"Utility",
"routine",
"to",
"check",
"if",
"the",
"InetAddress",
"is",
"an",
"IPv4",
"compatible",
"IPv6",
"address",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L747-L757 |
34,372 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java | Inet6Address.writeObject | private synchronized void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
if (scope_ifname_set) {
ifname = scope_ifname.getName();
}
s.defaultWriteObject();
} | java | private synchronized void writeObject(java.io.ObjectOutputStream s)
throws IOException
{
if (scope_ifname_set) {
ifname = scope_ifname.getName();
}
s.defaultWriteObject();
} | [
"private",
"synchronized",
"void",
"writeObject",
"(",
"java",
".",
"io",
".",
"ObjectOutputStream",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"scope_ifname_set",
")",
"{",
"ifname",
"=",
"scope_ifname",
".",
"getName",
"(",
")",
";",
"}",
"s",
".... | default behavior is overridden in order to write the
scope_ifname field as a String, rather than a NetworkInterface
which is not serializable | [
"default",
"behavior",
"is",
"overridden",
"in",
"order",
"to",
"write",
"the",
"scope_ifname",
"field",
"as",
"a",
"String",
"rather",
"than",
"a",
"NetworkInterface",
"which",
"is",
"not",
"serializable"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet6Address.java#L793-L800 |
34,373 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | NamespaceSupport2.pushContext | public void pushContext ()
{
// JJK: Context has a parent pointer.
// That means we don't need a stack to pop.
// We may want to retain for reuse, but that can be done via
// a child pointer.
Context2 parentContext=currentContext;
currentContext = parentContext.getChild();
if (currentContext == null){
currentContext = new Context2(parentContext);
}
else{
// JJK: This will wipe out any leftover data
// if we're reusing a previously allocated Context.
currentContext.setParent(parentContext);
}
} | java | public void pushContext ()
{
// JJK: Context has a parent pointer.
// That means we don't need a stack to pop.
// We may want to retain for reuse, but that can be done via
// a child pointer.
Context2 parentContext=currentContext;
currentContext = parentContext.getChild();
if (currentContext == null){
currentContext = new Context2(parentContext);
}
else{
// JJK: This will wipe out any leftover data
// if we're reusing a previously allocated Context.
currentContext.setParent(parentContext);
}
} | [
"public",
"void",
"pushContext",
"(",
")",
"{",
"// JJK: Context has a parent pointer.",
"// That means we don't need a stack to pop.",
"// We may want to retain for reuse, but that can be done via",
"// a child pointer.",
"Context2",
"parentContext",
"=",
"currentContext",
";",
"curre... | Start a new Namespace context.
<p>Normally, you should push a new context at the beginning
of each XML element: the new context will automatically inherit
the declarations of its parent context, but it will also keep
track of which declarations were made within this context.</p>
<p>The Namespace support object always starts with a base context
already in force: in this context, only the "xml" prefix is
declared.</p>
@see #popContext | [
"Start",
"a",
"new",
"Namespace",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L118-L135 |
34,374 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | NamespaceSupport2.processName | public String [] processName (String qName, String[] parts,
boolean isAttribute)
{
String[] name=currentContext.processName(qName, isAttribute);
if(name==null)
return null;
// JJK: This recopying is required because processName may return
// a cached result. I Don't Like It. *****
System.arraycopy(name,0,parts,0,3);
return parts;
} | java | public String [] processName (String qName, String[] parts,
boolean isAttribute)
{
String[] name=currentContext.processName(qName, isAttribute);
if(name==null)
return null;
// JJK: This recopying is required because processName may return
// a cached result. I Don't Like It. *****
System.arraycopy(name,0,parts,0,3);
return parts;
} | [
"public",
"String",
"[",
"]",
"processName",
"(",
"String",
"qName",
",",
"String",
"[",
"]",
"parts",
",",
"boolean",
"isAttribute",
")",
"{",
"String",
"[",
"]",
"name",
"=",
"currentContext",
".",
"processName",
"(",
"qName",
",",
"isAttribute",
")",
... | Process a raw XML 1.0 name.
<p>This method processes a raw XML 1.0 name in the current
context by removing the prefix and looking it up among the
prefixes currently declared. The return value will be the
array supplied by the caller, filled in as follows:</p>
<dl>
<dt>parts[0]</dt>
<dd>The Namespace URI, or an empty string if none is
in use.</dd>
<dt>parts[1]</dt>
<dd>The local name (without prefix).</dd>
<dt>parts[2]</dt>
<dd>The original raw name.</dd>
</dl>
<p>All of the strings in the array will be internalized. If
the raw name has a prefix that has not been declared, then
the return value will be null.</p>
<p>Note that attribute names are processed differently than
element names: an unprefixed element name will received the
default Namespace (if any), while an unprefixed element name
will not.</p>
@param qName The raw XML 1.0 name to be processed.
@param parts A string array supplied by the caller, capable of
holding at least three members.
@param isAttribute A flag indicating whether this is an
attribute name (true) or an element name (false).
@return The supplied array holding three internalized strings
representing the Namespace URI (or empty string), the
local name, and the raw XML 1.0 name; or null if there
is an undeclared prefix.
@see #declarePrefix
@see java.lang.String#intern | [
"Process",
"a",
"raw",
"XML",
"1",
".",
"0",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L244-L255 |
34,375 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | Context2.declarePrefix | void declarePrefix (String prefix, String uri)
{
// Lazy processing...
if (!tablesDirty) {
copyTables();
}
if (declarations == null) {
declarations = new Vector();
}
prefix = prefix.intern();
uri = uri.intern();
if ("".equals(prefix)) {
if ("".equals(uri)) {
defaultNS = null;
} else {
defaultNS = uri;
}
} else {
prefixTable.put(prefix, uri);
uriTable.put(uri, prefix); // may wipe out another prefix
}
declarations.addElement(prefix);
} | java | void declarePrefix (String prefix, String uri)
{
// Lazy processing...
if (!tablesDirty) {
copyTables();
}
if (declarations == null) {
declarations = new Vector();
}
prefix = prefix.intern();
uri = uri.intern();
if ("".equals(prefix)) {
if ("".equals(uri)) {
defaultNS = null;
} else {
defaultNS = uri;
}
} else {
prefixTable.put(prefix, uri);
uriTable.put(uri, prefix); // may wipe out another prefix
}
declarations.addElement(prefix);
} | [
"void",
"declarePrefix",
"(",
"String",
"prefix",
",",
"String",
"uri",
")",
"{",
"// Lazy processing...",
"if",
"(",
"!",
"tablesDirty",
")",
"{",
"copyTables",
"(",
")",
";",
"}",
"if",
"(",
"declarations",
"==",
"null",
")",
"{",
"declarations",
"=",
... | Declare a Namespace prefix for this context.
@param prefix The prefix to declare.
@param uri The associated Namespace URI.
@see org.xml.sax.helpers.NamespaceSupport2#declarePrefix | [
"Declare",
"a",
"Namespace",
"prefix",
"for",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L535-L558 |
34,376 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | Context2.processName | String [] processName (String qName, boolean isAttribute)
{
String name[];
Hashtable table;
// Select the appropriate table.
if (isAttribute) {
if(elementNameTable==null)
elementNameTable=new Hashtable();
table = elementNameTable;
} else {
if(attributeNameTable==null)
attributeNameTable=new Hashtable();
table = attributeNameTable;
}
// Start by looking in the cache, and
// return immediately if the name
// is already known in this content
name = (String[])table.get(qName);
if (name != null) {
return name;
}
// We haven't seen this name in this
// context before.
name = new String[3];
int index = qName.indexOf(':');
// No prefix.
if (index == -1) {
if (isAttribute || defaultNS == null) {
name[0] = "";
} else {
name[0] = defaultNS;
}
name[1] = qName.intern();
name[2] = name[1];
}
// Prefix
else {
String prefix = qName.substring(0, index);
String local = qName.substring(index+1);
String uri;
if ("".equals(prefix)) {
uri = defaultNS;
} else {
uri = (String)prefixTable.get(prefix);
}
if (uri == null) {
return null;
}
name[0] = uri;
name[1] = local.intern();
name[2] = qName.intern();
}
// Save in the cache for future use.
table.put(name[2], name);
tablesDirty = true;
return name;
} | java | String [] processName (String qName, boolean isAttribute)
{
String name[];
Hashtable table;
// Select the appropriate table.
if (isAttribute) {
if(elementNameTable==null)
elementNameTable=new Hashtable();
table = elementNameTable;
} else {
if(attributeNameTable==null)
attributeNameTable=new Hashtable();
table = attributeNameTable;
}
// Start by looking in the cache, and
// return immediately if the name
// is already known in this content
name = (String[])table.get(qName);
if (name != null) {
return name;
}
// We haven't seen this name in this
// context before.
name = new String[3];
int index = qName.indexOf(':');
// No prefix.
if (index == -1) {
if (isAttribute || defaultNS == null) {
name[0] = "";
} else {
name[0] = defaultNS;
}
name[1] = qName.intern();
name[2] = name[1];
}
// Prefix
else {
String prefix = qName.substring(0, index);
String local = qName.substring(index+1);
String uri;
if ("".equals(prefix)) {
uri = defaultNS;
} else {
uri = (String)prefixTable.get(prefix);
}
if (uri == null) {
return null;
}
name[0] = uri;
name[1] = local.intern();
name[2] = qName.intern();
}
// Save in the cache for future use.
table.put(name[2], name);
tablesDirty = true;
return name;
} | [
"String",
"[",
"]",
"processName",
"(",
"String",
"qName",
",",
"boolean",
"isAttribute",
")",
"{",
"String",
"name",
"[",
"]",
";",
"Hashtable",
"table",
";",
"// Select the appropriate table.",
"if",
"(",
"isAttribute",
")",
"{",
"if",
"(",
"elementNameTable... | Process a raw XML 1.0 name in this context.
@param qName The raw XML 1.0 name.
@param isAttribute true if this is an attribute name.
@return An array of three strings containing the
URI part (or empty string), the local part,
and the raw name, all internalized, or null
if there is an undeclared prefix.
@see org.xml.sax.helpers.NamespaceSupport2#processName | [
"Process",
"a",
"raw",
"XML",
"1",
".",
"0",
"name",
"in",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L572-L635 |
34,377 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | Context2.getURI | String getURI (String prefix)
{
if ("".equals(prefix)) {
return defaultNS;
} else if (prefixTable == null) {
return null;
} else {
return (String)prefixTable.get(prefix);
}
} | java | String getURI (String prefix)
{
if ("".equals(prefix)) {
return defaultNS;
} else if (prefixTable == null) {
return null;
} else {
return (String)prefixTable.get(prefix);
}
} | [
"String",
"getURI",
"(",
"String",
"prefix",
")",
"{",
"if",
"(",
"\"\"",
".",
"equals",
"(",
"prefix",
")",
")",
"{",
"return",
"defaultNS",
";",
"}",
"else",
"if",
"(",
"prefixTable",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{... | Look up the URI associated with a prefix in this context.
@param prefix The prefix to look up.
@return The associated Namespace URI, or null if none is
declared.
@see org.xml.sax.helpers.NamespaceSupport2#getURI | [
"Look",
"up",
"the",
"URI",
"associated",
"with",
"a",
"prefix",
"in",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L646-L655 |
34,378 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | Context2.getPrefix | String getPrefix (String uri)
{
if (uriTable == null) {
return null;
} else {
return (String)uriTable.get(uri);
}
} | java | String getPrefix (String uri)
{
if (uriTable == null) {
return null;
} else {
return (String)uriTable.get(uri);
}
} | [
"String",
"getPrefix",
"(",
"String",
"uri",
")",
"{",
"if",
"(",
"uriTable",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"(",
"String",
")",
"uriTable",
".",
"get",
"(",
"uri",
")",
";",
"}",
"}"
] | Look up one of the prefixes associated with a URI in this context.
<p>Since many prefixes may be mapped to the same URI,
the return value may be unreliable.</p>
@param uri The URI to look up.
@return The associated prefix, or null if none is declared.
@see org.xml.sax.helpers.NamespaceSupport2#getPrefix | [
"Look",
"up",
"one",
"of",
"the",
"prefixes",
"associated",
"with",
"a",
"URI",
"in",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L668-L675 |
34,379 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java | Context2.copyTables | private void copyTables ()
{
// Start by copying our parent's bindings
prefixTable = (Hashtable)prefixTable.clone();
uriTable = (Hashtable)uriTable.clone();
// Replace the caches with empty ones, rather than
// trying to determine which bindings should be flushed.
// As far as I can tell, these caches are never actually
// used in Xalan... More efficient to remove the whole
// cache system? ****
if(elementNameTable!=null)
elementNameTable=new Hashtable();
if(attributeNameTable!=null)
attributeNameTable=new Hashtable();
tablesDirty = true;
} | java | private void copyTables ()
{
// Start by copying our parent's bindings
prefixTable = (Hashtable)prefixTable.clone();
uriTable = (Hashtable)uriTable.clone();
// Replace the caches with empty ones, rather than
// trying to determine which bindings should be flushed.
// As far as I can tell, these caches are never actually
// used in Xalan... More efficient to remove the whole
// cache system? ****
if(elementNameTable!=null)
elementNameTable=new Hashtable();
if(attributeNameTable!=null)
attributeNameTable=new Hashtable();
tablesDirty = true;
} | [
"private",
"void",
"copyTables",
"(",
")",
"{",
"// Start by copying our parent's bindings",
"prefixTable",
"=",
"(",
"Hashtable",
")",
"prefixTable",
".",
"clone",
"(",
")",
";",
"uriTable",
"=",
"(",
"Hashtable",
")",
"uriTable",
".",
"clone",
"(",
")",
";",... | Copy on write for the internal tables in this context.
<p>This class is optimized for the normal case where most
elements do not contain Namespace declarations. In that case,
the Context2 will share data structures with its parent.
New tables are obtained only when new declarations are issued,
so they can be popped off the stack.</p>
<p> JJK: **** Alternative: each Context2 might declare
_only_ its local bindings, and delegate upward if not found.</p> | [
"Copy",
"on",
"write",
"for",
"the",
"internal",
"tables",
"in",
"this",
"context",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/NamespaceSupport2.java#L728-L744 |
34,380 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/android/system/ErrnoException.java | ErrnoException.getMessage | @Override public String getMessage() {
String errnoName = OsConstants.errnoName(errno);
if (errnoName == null) {
errnoName = "errno " + errno;
}
String description = Libcore.os.strerror(errno);
return functionName + " failed: " + errnoName + " (" + description + ")";
} | java | @Override public String getMessage() {
String errnoName = OsConstants.errnoName(errno);
if (errnoName == null) {
errnoName = "errno " + errno;
}
String description = Libcore.os.strerror(errno);
return functionName + " failed: " + errnoName + " (" + description + ")";
} | [
"@",
"Override",
"public",
"String",
"getMessage",
"(",
")",
"{",
"String",
"errnoName",
"=",
"OsConstants",
".",
"errnoName",
"(",
"errno",
")",
";",
"if",
"(",
"errnoName",
"==",
"null",
")",
"{",
"errnoName",
"=",
"\"errno \"",
"+",
"errno",
";",
"}",... | Converts the stashed function name and errno value to a human-readable string.
We do this here rather than in the constructor so that callers only pay for
this if they need it. | [
"Converts",
"the",
"stashed",
"function",
"name",
"and",
"errno",
"value",
"to",
"a",
"human",
"-",
"readable",
"string",
".",
"We",
"do",
"this",
"here",
"rather",
"than",
"in",
"the",
"constructor",
"so",
"that",
"callers",
"only",
"pay",
"for",
"this",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/android/system/ErrnoException.java#L59-L66 |
34,381 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java | DistributionPointFetcher.getCRLs | private static Collection<X509CRL> getCRLs(X509CRLSelector selector,
X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
boolean signFlag, PublicKey prevKey, X509Certificate prevCert,
String provider, List<CertStore> certStores,
Set<TrustAnchor> trustAnchors, Date validity)
throws CertStoreException {
// check for full name
GeneralNames fullName = point.getFullName();
if (fullName == null) {
// check for relative name
RDN relativeName = point.getRelativeName();
if (relativeName == null) {
return Collections.emptySet();
}
try {
GeneralNames crlIssuers = point.getCRLIssuer();
if (crlIssuers == null) {
fullName = getFullNames
((X500Name) certImpl.getIssuerDN(), relativeName);
} else {
// should only be one CRL Issuer
if (crlIssuers.size() != 1) {
return Collections.emptySet();
} else {
fullName = getFullNames
((X500Name) crlIssuers.get(0).getName(), relativeName);
}
}
} catch (IOException ioe) {
return Collections.emptySet();
}
}
Collection<X509CRL> possibleCRLs = new ArrayList<>();
CertStoreException savedCSE = null;
for (Iterator<GeneralName> t = fullName.iterator(); t.hasNext(); ) {
try {
GeneralName name = t.next();
if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
X500Name x500Name = (X500Name) name.getName();
possibleCRLs.addAll(
getCRLs(x500Name, certImpl.getIssuerX500Principal(),
certStores));
} else if (name.getType() == GeneralNameInterface.NAME_URI) {
URIName uriName = (URIName)name.getName();
X509CRL crl = getCRL(uriName);
if (crl != null) {
possibleCRLs.add(crl);
}
}
} catch (CertStoreException cse) {
savedCSE = cse;
}
}
// only throw CertStoreException if no CRLs are retrieved
if (possibleCRLs.isEmpty() && savedCSE != null) {
throw savedCSE;
}
Collection<X509CRL> crls = new ArrayList<>(2);
for (X509CRL crl : possibleCRLs) {
try {
// make sure issuer is not set
// we check the issuer in verifyCRLs method
selector.setIssuerNames(null);
if (selector.match(crl) && verifyCRL(certImpl, point, crl,
reasonsMask, signFlag, prevKey, prevCert, provider,
trustAnchors, certStores, validity)) {
crls.add(crl);
}
} catch (IOException | CRLException e) {
// don't add the CRL
if (debug != null) {
debug.println("Exception verifying CRL: " + e.getMessage());
e.printStackTrace();
}
}
}
return crls;
} | java | private static Collection<X509CRL> getCRLs(X509CRLSelector selector,
X509CertImpl certImpl, DistributionPoint point, boolean[] reasonsMask,
boolean signFlag, PublicKey prevKey, X509Certificate prevCert,
String provider, List<CertStore> certStores,
Set<TrustAnchor> trustAnchors, Date validity)
throws CertStoreException {
// check for full name
GeneralNames fullName = point.getFullName();
if (fullName == null) {
// check for relative name
RDN relativeName = point.getRelativeName();
if (relativeName == null) {
return Collections.emptySet();
}
try {
GeneralNames crlIssuers = point.getCRLIssuer();
if (crlIssuers == null) {
fullName = getFullNames
((X500Name) certImpl.getIssuerDN(), relativeName);
} else {
// should only be one CRL Issuer
if (crlIssuers.size() != 1) {
return Collections.emptySet();
} else {
fullName = getFullNames
((X500Name) crlIssuers.get(0).getName(), relativeName);
}
}
} catch (IOException ioe) {
return Collections.emptySet();
}
}
Collection<X509CRL> possibleCRLs = new ArrayList<>();
CertStoreException savedCSE = null;
for (Iterator<GeneralName> t = fullName.iterator(); t.hasNext(); ) {
try {
GeneralName name = t.next();
if (name.getType() == GeneralNameInterface.NAME_DIRECTORY) {
X500Name x500Name = (X500Name) name.getName();
possibleCRLs.addAll(
getCRLs(x500Name, certImpl.getIssuerX500Principal(),
certStores));
} else if (name.getType() == GeneralNameInterface.NAME_URI) {
URIName uriName = (URIName)name.getName();
X509CRL crl = getCRL(uriName);
if (crl != null) {
possibleCRLs.add(crl);
}
}
} catch (CertStoreException cse) {
savedCSE = cse;
}
}
// only throw CertStoreException if no CRLs are retrieved
if (possibleCRLs.isEmpty() && savedCSE != null) {
throw savedCSE;
}
Collection<X509CRL> crls = new ArrayList<>(2);
for (X509CRL crl : possibleCRLs) {
try {
// make sure issuer is not set
// we check the issuer in verifyCRLs method
selector.setIssuerNames(null);
if (selector.match(crl) && verifyCRL(certImpl, point, crl,
reasonsMask, signFlag, prevKey, prevCert, provider,
trustAnchors, certStores, validity)) {
crls.add(crl);
}
} catch (IOException | CRLException e) {
// don't add the CRL
if (debug != null) {
debug.println("Exception verifying CRL: " + e.getMessage());
e.printStackTrace();
}
}
}
return crls;
} | [
"private",
"static",
"Collection",
"<",
"X509CRL",
">",
"getCRLs",
"(",
"X509CRLSelector",
"selector",
",",
"X509CertImpl",
"certImpl",
",",
"DistributionPoint",
"point",
",",
"boolean",
"[",
"]",
"reasonsMask",
",",
"boolean",
"signFlag",
",",
"PublicKey",
"prevK... | Download CRLs from the given distribution point, verify and return them.
See the top of the class for current limitations.
@throws CertStoreException if there is an error retrieving the CRLs
from one of the GeneralNames and no other CRLs are retrieved from
the other GeneralNames. If more than one GeneralName throws an
exception then the one from the last GeneralName is thrown. | [
"Download",
"CRLs",
"from",
"the",
"given",
"distribution",
"point",
"verify",
"and",
"return",
"them",
".",
"See",
"the",
"top",
"of",
"the",
"class",
"for",
"current",
"limitations",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java#L145-L224 |
34,382 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java | DistributionPointFetcher.getCRL | private static X509CRL getCRL(URIName name) throws CertStoreException {
URI uri = name.getURI();
if (debug != null) {
debug.println("Trying to fetch CRL from DP " + uri);
}
CertStore ucs = null;
try {
ucs = URICertStore.getInstance
(new URICertStore.URICertStoreParameters(uri));
} catch (InvalidAlgorithmParameterException |
NoSuchAlgorithmException e) {
if (debug != null) {
debug.println("Can't create URICertStore: " + e.getMessage());
}
return null;
}
Collection<? extends CRL> crls = ucs.getCRLs(null);
if (crls.isEmpty()) {
return null;
} else {
return (X509CRL) crls.iterator().next();
}
} | java | private static X509CRL getCRL(URIName name) throws CertStoreException {
URI uri = name.getURI();
if (debug != null) {
debug.println("Trying to fetch CRL from DP " + uri);
}
CertStore ucs = null;
try {
ucs = URICertStore.getInstance
(new URICertStore.URICertStoreParameters(uri));
} catch (InvalidAlgorithmParameterException |
NoSuchAlgorithmException e) {
if (debug != null) {
debug.println("Can't create URICertStore: " + e.getMessage());
}
return null;
}
Collection<? extends CRL> crls = ucs.getCRLs(null);
if (crls.isEmpty()) {
return null;
} else {
return (X509CRL) crls.iterator().next();
}
} | [
"private",
"static",
"X509CRL",
"getCRL",
"(",
"URIName",
"name",
")",
"throws",
"CertStoreException",
"{",
"URI",
"uri",
"=",
"name",
".",
"getURI",
"(",
")",
";",
"if",
"(",
"debug",
"!=",
"null",
")",
"{",
"debug",
".",
"println",
"(",
"\"Trying to fe... | Download CRL from given URI. | [
"Download",
"CRL",
"from",
"given",
"URI",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java#L229-L252 |
34,383 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java | DistributionPointFetcher.getCRLs | private static Collection<X509CRL> getCRLs(X500Name name,
X500Principal certIssuer,
List<CertStore> certStores)
throws CertStoreException
{
if (debug != null) {
debug.println("Trying to fetch CRL from DP " + name);
}
X509CRLSelector xcs = new X509CRLSelector();
xcs.addIssuer(name.asX500Principal());
xcs.addIssuer(certIssuer);
Collection<X509CRL> crls = new ArrayList<>();
CertStoreException savedCSE = null;
for (CertStore store : certStores) {
try {
for (CRL crl : store.getCRLs(xcs)) {
crls.add((X509CRL)crl);
}
} catch (CertStoreException cse) {
if (debug != null) {
debug.println("Exception while retrieving " +
"CRLs: " + cse);
cse.printStackTrace();
}
savedCSE = new PKIX.CertStoreTypeException(store.getType(),cse);
}
}
// only throw CertStoreException if no CRLs are retrieved
if (crls.isEmpty() && savedCSE != null) {
throw savedCSE;
} else {
return crls;
}
} | java | private static Collection<X509CRL> getCRLs(X500Name name,
X500Principal certIssuer,
List<CertStore> certStores)
throws CertStoreException
{
if (debug != null) {
debug.println("Trying to fetch CRL from DP " + name);
}
X509CRLSelector xcs = new X509CRLSelector();
xcs.addIssuer(name.asX500Principal());
xcs.addIssuer(certIssuer);
Collection<X509CRL> crls = new ArrayList<>();
CertStoreException savedCSE = null;
for (CertStore store : certStores) {
try {
for (CRL crl : store.getCRLs(xcs)) {
crls.add((X509CRL)crl);
}
} catch (CertStoreException cse) {
if (debug != null) {
debug.println("Exception while retrieving " +
"CRLs: " + cse);
cse.printStackTrace();
}
savedCSE = new PKIX.CertStoreTypeException(store.getType(),cse);
}
}
// only throw CertStoreException if no CRLs are retrieved
if (crls.isEmpty() && savedCSE != null) {
throw savedCSE;
} else {
return crls;
}
} | [
"private",
"static",
"Collection",
"<",
"X509CRL",
">",
"getCRLs",
"(",
"X500Name",
"name",
",",
"X500Principal",
"certIssuer",
",",
"List",
"<",
"CertStore",
">",
"certStores",
")",
"throws",
"CertStoreException",
"{",
"if",
"(",
"debug",
"!=",
"null",
")",
... | Fetch CRLs from certStores.
@throws CertStoreException if there is an error retrieving the CRLs from
one of the CertStores and no other CRLs are retrieved from
the other CertStores. If more than one CertStore throws an
exception then the one from the last CertStore is thrown. | [
"Fetch",
"CRLs",
"from",
"certStores",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java#L262-L295 |
34,384 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java | DistributionPointFetcher.getFullNames | private static GeneralNames getFullNames(X500Name issuer, RDN rdn)
throws IOException
{
List<RDN> rdns = new ArrayList<>(issuer.rdns());
rdns.add(rdn);
X500Name fullName = new X500Name(rdns.toArray(new RDN[0]));
GeneralNames fullNames = new GeneralNames();
fullNames.add(new GeneralName(fullName));
return fullNames;
} | java | private static GeneralNames getFullNames(X500Name issuer, RDN rdn)
throws IOException
{
List<RDN> rdns = new ArrayList<>(issuer.rdns());
rdns.add(rdn);
X500Name fullName = new X500Name(rdns.toArray(new RDN[0]));
GeneralNames fullNames = new GeneralNames();
fullNames.add(new GeneralName(fullName));
return fullNames;
} | [
"private",
"static",
"GeneralNames",
"getFullNames",
"(",
"X500Name",
"issuer",
",",
"RDN",
"rdn",
")",
"throws",
"IOException",
"{",
"List",
"<",
"RDN",
">",
"rdns",
"=",
"new",
"ArrayList",
"<>",
"(",
"issuer",
".",
"rdns",
"(",
")",
")",
";",
"rdns",
... | Append relative name to the issuer name and return a new
GeneralNames object. | [
"Append",
"relative",
"name",
"to",
"the",
"issuer",
"name",
"and",
"return",
"a",
"new",
"GeneralNames",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java#L708-L717 |
34,385 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java | DistributionPointFetcher.issues | private static boolean issues(X509CertImpl cert, X509CRLImpl crl,
String provider) throws IOException
{
boolean matched = false;
AdaptableX509CertSelector issuerSelector =
new AdaptableX509CertSelector();
// check certificate's key usage
boolean[] usages = cert.getKeyUsage();
if (usages != null) {
usages[6] = true; // cRLSign
issuerSelector.setKeyUsage(usages);
}
// check certificate's subject
X500Principal crlIssuer = crl.getIssuerX500Principal();
issuerSelector.setSubject(crlIssuer);
/*
* Facilitate certification path construction with authority
* key identifier and subject key identifier.
*
* In practice, conforming CAs MUST use the key identifier method,
* and MUST include authority key identifier extension in all CRLs
* issued. [section 5.2.1, RFC 2459]
*/
AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension();
if (crlAKID != null) {
issuerSelector.parseAuthorityKeyIdentifierExtension(crlAKID);
}
matched = issuerSelector.match(cert);
// if AKID is unreliable, verify the CRL signature with the cert
if (matched && (crlAKID == null ||
cert.getAuthorityKeyIdentifierExtension() == null)) {
try {
crl.verify(cert.getPublicKey(), provider);
matched = true;
} catch (GeneralSecurityException e) {
matched = false;
}
}
return matched;
} | java | private static boolean issues(X509CertImpl cert, X509CRLImpl crl,
String provider) throws IOException
{
boolean matched = false;
AdaptableX509CertSelector issuerSelector =
new AdaptableX509CertSelector();
// check certificate's key usage
boolean[] usages = cert.getKeyUsage();
if (usages != null) {
usages[6] = true; // cRLSign
issuerSelector.setKeyUsage(usages);
}
// check certificate's subject
X500Principal crlIssuer = crl.getIssuerX500Principal();
issuerSelector.setSubject(crlIssuer);
/*
* Facilitate certification path construction with authority
* key identifier and subject key identifier.
*
* In practice, conforming CAs MUST use the key identifier method,
* and MUST include authority key identifier extension in all CRLs
* issued. [section 5.2.1, RFC 2459]
*/
AuthorityKeyIdentifierExtension crlAKID = crl.getAuthKeyIdExtension();
if (crlAKID != null) {
issuerSelector.parseAuthorityKeyIdentifierExtension(crlAKID);
}
matched = issuerSelector.match(cert);
// if AKID is unreliable, verify the CRL signature with the cert
if (matched && (crlAKID == null ||
cert.getAuthorityKeyIdentifierExtension() == null)) {
try {
crl.verify(cert.getPublicKey(), provider);
matched = true;
} catch (GeneralSecurityException e) {
matched = false;
}
}
return matched;
} | [
"private",
"static",
"boolean",
"issues",
"(",
"X509CertImpl",
"cert",
",",
"X509CRLImpl",
"crl",
",",
"String",
"provider",
")",
"throws",
"IOException",
"{",
"boolean",
"matched",
"=",
"false",
";",
"AdaptableX509CertSelector",
"issuerSelector",
"=",
"new",
"Ada... | Verifies whether a CRL is issued by a certain certificate
@param cert the certificate
@param crl the CRL to be verified
@param provider the name of the signature provider | [
"Verifies",
"whether",
"a",
"CRL",
"is",
"issued",
"by",
"a",
"certain",
"certificate"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/DistributionPointFetcher.java#L726-L772 |
34,386 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Edits.java | Edits.addUnchanged | public void addUnchanged(int unchangedLength) {
if(unchangedLength < 0) {
throw new IllegalArgumentException(
"addUnchanged(" + unchangedLength + "): length must not be negative");
}
// Merge into previous unchanged-text record, if any.
int last = lastUnit();
if(last < MAX_UNCHANGED) {
int remaining = MAX_UNCHANGED - last;
if (remaining >= unchangedLength) {
setLastUnit(last + unchangedLength);
return;
}
setLastUnit(MAX_UNCHANGED);
unchangedLength -= remaining;
}
// Split large lengths into multiple units.
while(unchangedLength >= MAX_UNCHANGED_LENGTH) {
append(MAX_UNCHANGED);
unchangedLength -= MAX_UNCHANGED_LENGTH;
}
// Write a small (remaining) length.
if(unchangedLength > 0) {
append(unchangedLength - 1);
}
} | java | public void addUnchanged(int unchangedLength) {
if(unchangedLength < 0) {
throw new IllegalArgumentException(
"addUnchanged(" + unchangedLength + "): length must not be negative");
}
// Merge into previous unchanged-text record, if any.
int last = lastUnit();
if(last < MAX_UNCHANGED) {
int remaining = MAX_UNCHANGED - last;
if (remaining >= unchangedLength) {
setLastUnit(last + unchangedLength);
return;
}
setLastUnit(MAX_UNCHANGED);
unchangedLength -= remaining;
}
// Split large lengths into multiple units.
while(unchangedLength >= MAX_UNCHANGED_LENGTH) {
append(MAX_UNCHANGED);
unchangedLength -= MAX_UNCHANGED_LENGTH;
}
// Write a small (remaining) length.
if(unchangedLength > 0) {
append(unchangedLength - 1);
}
} | [
"public",
"void",
"addUnchanged",
"(",
"int",
"unchangedLength",
")",
"{",
"if",
"(",
"unchangedLength",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"addUnchanged(\"",
"+",
"unchangedLength",
"+",
"\"): length must not be negative\"",
")",
... | Adds a record for an unchanged segment of text.
Normally called from inside ICU string transformation functions, not user code.
@hide draft / provisional / internal are hidden on Android | [
"Adds",
"a",
"record",
"for",
"an",
"unchanged",
"segment",
"of",
"text",
".",
"Normally",
"called",
"from",
"inside",
"ICU",
"string",
"transformation",
"functions",
"not",
"user",
"code",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Edits.java#L69-L94 |
34,387 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java | PatternProps.skipWhiteSpace | public static int skipWhiteSpace(CharSequence s, int i) {
while(i<s.length() && isWhiteSpace(s.charAt(i))) {
++i;
}
return i;
} | java | public static int skipWhiteSpace(CharSequence s, int i) {
while(i<s.length() && isWhiteSpace(s.charAt(i))) {
++i;
}
return i;
} | [
"public",
"static",
"int",
"skipWhiteSpace",
"(",
"CharSequence",
"s",
",",
"int",
"i",
")",
"{",
"while",
"(",
"i",
"<",
"s",
".",
"length",
"(",
")",
"&&",
"isWhiteSpace",
"(",
"s",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"++",
"i",
";",
... | Skips over Pattern_White_Space starting at index i of the CharSequence.
@return The smallest index at or after i with a non-white space character. | [
"Skips",
"over",
"Pattern_White_Space",
"starting",
"at",
"index",
"i",
"of",
"the",
"CharSequence",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java#L95-L100 |
34,388 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java | PatternProps.isIdentifier | public static boolean isIdentifier(CharSequence s) {
int limit=s.length();
if(limit==0) {
return false;
}
int start=0;
do {
if(isSyntaxOrWhiteSpace(s.charAt(start++))) {
return false;
}
} while(start<limit);
return true;
} | java | public static boolean isIdentifier(CharSequence s) {
int limit=s.length();
if(limit==0) {
return false;
}
int start=0;
do {
if(isSyntaxOrWhiteSpace(s.charAt(start++))) {
return false;
}
} while(start<limit);
return true;
} | [
"public",
"static",
"boolean",
"isIdentifier",
"(",
"CharSequence",
"s",
")",
"{",
"int",
"limit",
"=",
"s",
".",
"length",
"(",
")",
";",
"if",
"(",
"limit",
"==",
"0",
")",
"{",
"return",
"false",
";",
"}",
"int",
"start",
"=",
"0",
";",
"do",
... | Tests whether the CharSequence contains a "pattern identifier", that is,
whether it contains only non-Pattern_White_Space, non-Pattern_Syntax characters.
@return true if there are no Pattern_White_Space or Pattern_Syntax characters in s. | [
"Tests",
"whether",
"the",
"CharSequence",
"contains",
"a",
"pattern",
"identifier",
"that",
"is",
"whether",
"it",
"contains",
"only",
"non",
"-",
"Pattern_White_Space",
"non",
"-",
"Pattern_Syntax",
"characters",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java#L129-L141 |
34,389 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java | PatternProps.skipIdentifier | public static int skipIdentifier(CharSequence s, int i) {
while(i<s.length() && !isSyntaxOrWhiteSpace(s.charAt(i))) {
++i;
}
return i;
} | java | public static int skipIdentifier(CharSequence s, int i) {
while(i<s.length() && !isSyntaxOrWhiteSpace(s.charAt(i))) {
++i;
}
return i;
} | [
"public",
"static",
"int",
"skipIdentifier",
"(",
"CharSequence",
"s",
",",
"int",
"i",
")",
"{",
"while",
"(",
"i",
"<",
"s",
".",
"length",
"(",
")",
"&&",
"!",
"isSyntaxOrWhiteSpace",
"(",
"s",
".",
"charAt",
"(",
"i",
")",
")",
")",
"{",
"++",
... | Skips over a "pattern identifier" starting at index i of the CharSequence.
@return The smallest index at or after i with
a Pattern_White_Space or Pattern_Syntax character. | [
"Skips",
"over",
"a",
"pattern",
"identifier",
"starting",
"at",
"index",
"i",
"of",
"the",
"CharSequence",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/PatternProps.java#L166-L171 |
34,390 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.setPeriodFormatter | @Override
public DurationFormatterFactory setPeriodFormatter(
PeriodFormatter formatter) {
if (formatter != this.formatter) {
this.formatter = formatter;
reset();
}
return this;
} | java | @Override
public DurationFormatterFactory setPeriodFormatter(
PeriodFormatter formatter) {
if (formatter != this.formatter) {
this.formatter = formatter;
reset();
}
return this;
} | [
"@",
"Override",
"public",
"DurationFormatterFactory",
"setPeriodFormatter",
"(",
"PeriodFormatter",
"formatter",
")",
"{",
"if",
"(",
"formatter",
"!=",
"this",
".",
"formatter",
")",
"{",
"this",
".",
"formatter",
"=",
"formatter",
";",
"reset",
"(",
")",
";... | Set the period formatter used by the factory. New formatters created
with this factory will use the given period formatter.
@return this BasicDurationFormatterFactory | [
"Set",
"the",
"period",
"formatter",
"used",
"by",
"the",
"factory",
".",
"New",
"formatters",
"created",
"with",
"this",
"factory",
"will",
"use",
"the",
"given",
"period",
"formatter",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L51-L59 |
34,391 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.setPeriodBuilder | @Override
public DurationFormatterFactory setPeriodBuilder(PeriodBuilder builder) {
if (builder != this.builder) {
this.builder = builder;
reset();
}
return this;
} | java | @Override
public DurationFormatterFactory setPeriodBuilder(PeriodBuilder builder) {
if (builder != this.builder) {
this.builder = builder;
reset();
}
return this;
} | [
"@",
"Override",
"public",
"DurationFormatterFactory",
"setPeriodBuilder",
"(",
"PeriodBuilder",
"builder",
")",
"{",
"if",
"(",
"builder",
"!=",
"this",
".",
"builder",
")",
"{",
"this",
".",
"builder",
"=",
"builder",
";",
"reset",
"(",
")",
";",
"}",
"r... | Set the builder used by the factory. New formatters created
with this factory will use the given locale.
@param builder the builder to use
@return this BasicDurationFormatterFactory | [
"Set",
"the",
"builder",
"used",
"by",
"the",
"factory",
".",
"New",
"formatters",
"created",
"with",
"this",
"factory",
"will",
"use",
"the",
"given",
"locale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L68-L75 |
34,392 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.setFallback | @Override
public DurationFormatterFactory setFallback(DateFormatter fallback) {
boolean doReset = fallback == null
? this.fallback != null
: !fallback.equals(this.fallback);
if (doReset) {
this.fallback = fallback;
reset();
}
return this;
} | java | @Override
public DurationFormatterFactory setFallback(DateFormatter fallback) {
boolean doReset = fallback == null
? this.fallback != null
: !fallback.equals(this.fallback);
if (doReset) {
this.fallback = fallback;
reset();
}
return this;
} | [
"@",
"Override",
"public",
"DurationFormatterFactory",
"setFallback",
"(",
"DateFormatter",
"fallback",
")",
"{",
"boolean",
"doReset",
"=",
"fallback",
"==",
"null",
"?",
"this",
".",
"fallback",
"!=",
"null",
":",
"!",
"fallback",
".",
"equals",
"(",
"this",... | Set a fallback formatter for durations over a given limit.
@param fallback the fallback formatter to use, or null
@return this BasicDurationFormatterFactory | [
"Set",
"a",
"fallback",
"formatter",
"for",
"durations",
"over",
"a",
"given",
"limit",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L83-L93 |
34,393 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.setFallbackLimit | @Override
public DurationFormatterFactory setFallbackLimit(long fallbackLimit) {
if (fallbackLimit < 0) {
fallbackLimit = 0;
}
if (fallbackLimit != this.fallbackLimit) {
this.fallbackLimit = fallbackLimit;
reset();
}
return this;
} | java | @Override
public DurationFormatterFactory setFallbackLimit(long fallbackLimit) {
if (fallbackLimit < 0) {
fallbackLimit = 0;
}
if (fallbackLimit != this.fallbackLimit) {
this.fallbackLimit = fallbackLimit;
reset();
}
return this;
} | [
"@",
"Override",
"public",
"DurationFormatterFactory",
"setFallbackLimit",
"(",
"long",
"fallbackLimit",
")",
"{",
"if",
"(",
"fallbackLimit",
"<",
"0",
")",
"{",
"fallbackLimit",
"=",
"0",
";",
"}",
"if",
"(",
"fallbackLimit",
"!=",
"this",
".",
"fallbackLimi... | Set a fallback limit for durations over a given limit.
@param fallbackLimit the fallback limit to use, or 0 if none is desired.
@return this BasicDurationFormatterFactory | [
"Set",
"a",
"fallback",
"limit",
"for",
"durations",
"over",
"a",
"given",
"limit",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L101-L111 |
34,394 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.getFormatter | @Override
public DurationFormatter getFormatter() {
if (f == null) {
if (fallback != null) {
fallback = fallback.withLocale(localeName).withTimeZone(timeZone);
}
formatter = getPeriodFormatter();
builder = getPeriodBuilder();
f = createFormatter();
}
return f;
} | java | @Override
public DurationFormatter getFormatter() {
if (f == null) {
if (fallback != null) {
fallback = fallback.withLocale(localeName).withTimeZone(timeZone);
}
formatter = getPeriodFormatter();
builder = getPeriodBuilder();
f = createFormatter();
}
return f;
} | [
"@",
"Override",
"public",
"DurationFormatter",
"getFormatter",
"(",
")",
"{",
"if",
"(",
"f",
"==",
"null",
")",
"{",
"if",
"(",
"fallback",
"!=",
"null",
")",
"{",
"fallback",
"=",
"fallback",
".",
"withLocale",
"(",
"localeName",
")",
".",
"withTimeZo... | Return a formatter based on this factory's current settings.
@return a BasicDurationFormatter | [
"Return",
"a",
"formatter",
"based",
"on",
"this",
"factory",
"s",
"current",
"settings",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L159-L171 |
34,395 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.getPeriodFormatter | public PeriodFormatter getPeriodFormatter() {
if (formatter == null) {
formatter = ps.newPeriodFormatterFactory()
.setLocale(localeName)
.getFormatter();
}
return formatter;
} | java | public PeriodFormatter getPeriodFormatter() {
if (formatter == null) {
formatter = ps.newPeriodFormatterFactory()
.setLocale(localeName)
.getFormatter();
}
return formatter;
} | [
"public",
"PeriodFormatter",
"getPeriodFormatter",
"(",
")",
"{",
"if",
"(",
"formatter",
"==",
"null",
")",
"{",
"formatter",
"=",
"ps",
".",
"newPeriodFormatterFactory",
"(",
")",
".",
"setLocale",
"(",
"localeName",
")",
".",
"getFormatter",
"(",
")",
";"... | Return the current period formatter.
@return the current period formatter | [
"Return",
"the",
"current",
"period",
"formatter",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L178-L185 |
34,396 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java | BasicDurationFormatterFactory.getPeriodBuilder | public PeriodBuilder getPeriodBuilder() {
if (builder == null) {
builder = ps.newPeriodBuilderFactory()
.setLocale(localeName)
.setTimeZone(timeZone)
.getSingleUnitBuilder();
}
return builder;
} | java | public PeriodBuilder getPeriodBuilder() {
if (builder == null) {
builder = ps.newPeriodBuilderFactory()
.setLocale(localeName)
.setTimeZone(timeZone)
.getSingleUnitBuilder();
}
return builder;
} | [
"public",
"PeriodBuilder",
"getPeriodBuilder",
"(",
")",
"{",
"if",
"(",
"builder",
"==",
"null",
")",
"{",
"builder",
"=",
"ps",
".",
"newPeriodBuilderFactory",
"(",
")",
".",
"setLocale",
"(",
"localeName",
")",
".",
"setTimeZone",
"(",
"timeZone",
")",
... | Return the current builder.
@return the current builder | [
"Return",
"the",
"current",
"builder",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/duration/BasicDurationFormatterFactory.java#L192-L200 |
34,397 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NetscapeCertTypeExtension.java | NetscapeCertTypeExtension.getKeyUsageMappedBits | public boolean[] getKeyUsageMappedBits() {
KeyUsageExtension keyUsage = new KeyUsageExtension();
Boolean val = Boolean.TRUE;
try {
if (isSet(getPosition(SSL_CLIENT)) ||
isSet(getPosition(S_MIME)) ||
isSet(getPosition(OBJECT_SIGNING)))
keyUsage.set(KeyUsageExtension.DIGITAL_SIGNATURE, val);
if (isSet(getPosition(SSL_SERVER)))
keyUsage.set(KeyUsageExtension.KEY_ENCIPHERMENT, val);
if (isSet(getPosition(SSL_CA)) ||
isSet(getPosition(S_MIME_CA)) ||
isSet(getPosition(OBJECT_SIGNING_CA)))
keyUsage.set(KeyUsageExtension.KEY_CERTSIGN, val);
} catch (IOException e) { }
return keyUsage.getBits();
} | java | public boolean[] getKeyUsageMappedBits() {
KeyUsageExtension keyUsage = new KeyUsageExtension();
Boolean val = Boolean.TRUE;
try {
if (isSet(getPosition(SSL_CLIENT)) ||
isSet(getPosition(S_MIME)) ||
isSet(getPosition(OBJECT_SIGNING)))
keyUsage.set(KeyUsageExtension.DIGITAL_SIGNATURE, val);
if (isSet(getPosition(SSL_SERVER)))
keyUsage.set(KeyUsageExtension.KEY_ENCIPHERMENT, val);
if (isSet(getPosition(SSL_CA)) ||
isSet(getPosition(S_MIME_CA)) ||
isSet(getPosition(OBJECT_SIGNING_CA)))
keyUsage.set(KeyUsageExtension.KEY_CERTSIGN, val);
} catch (IOException e) { }
return keyUsage.getBits();
} | [
"public",
"boolean",
"[",
"]",
"getKeyUsageMappedBits",
"(",
")",
"{",
"KeyUsageExtension",
"keyUsage",
"=",
"new",
"KeyUsageExtension",
"(",
")",
";",
"Boolean",
"val",
"=",
"Boolean",
".",
"TRUE",
";",
"try",
"{",
"if",
"(",
"isSet",
"(",
"getPosition",
... | Get a boolean array representing the bits of this extension,
as it maps to the KeyUsage extension.
@return the bit values of this extension mapped to the bit values
of the KeyUsage extension as an array of booleans. | [
"Get",
"a",
"boolean",
"array",
"representing",
"the",
"bits",
"of",
"this",
"extension",
"as",
"it",
"maps",
"to",
"the",
"KeyUsage",
"extension",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/NetscapeCertTypeExtension.java#L309-L328 |
34,398 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java | RuleCharacterIterator.next | public int next(int options) {
int c = DONE;
isEscaped = false;
for (;;) {
c = _current();
_advance(UTF16.getCharCount(c));
if (c == SymbolTable.SYMBOL_REF && buf == null &&
(options & PARSE_VARIABLES) != 0 && sym != null) {
String name = sym.parseReference(text, pos, text.length());
// If name == null there was an isolated SYMBOL_REF;
// return it. Caller must be prepared for this.
if (name == null) {
break;
}
bufPos = 0;
buf = sym.lookup(name);
if (buf == null) {
throw new IllegalArgumentException(
"Undefined variable: " + name);
}
// Handle empty variable value
if (buf.length == 0) {
buf = null;
}
continue;
}
if ((options & SKIP_WHITESPACE) != 0 &&
PatternProps.isWhiteSpace(c)) {
continue;
}
if (c == '\\' && (options & PARSE_ESCAPES) != 0) {
int offset[] = new int[] { 0 };
c = Utility.unescapeAt(lookahead(), offset);
jumpahead(offset[0]);
isEscaped = true;
if (c < 0) {
throw new IllegalArgumentException("Invalid escape");
}
}
break;
}
return c;
} | java | public int next(int options) {
int c = DONE;
isEscaped = false;
for (;;) {
c = _current();
_advance(UTF16.getCharCount(c));
if (c == SymbolTable.SYMBOL_REF && buf == null &&
(options & PARSE_VARIABLES) != 0 && sym != null) {
String name = sym.parseReference(text, pos, text.length());
// If name == null there was an isolated SYMBOL_REF;
// return it. Caller must be prepared for this.
if (name == null) {
break;
}
bufPos = 0;
buf = sym.lookup(name);
if (buf == null) {
throw new IllegalArgumentException(
"Undefined variable: " + name);
}
// Handle empty variable value
if (buf.length == 0) {
buf = null;
}
continue;
}
if ((options & SKIP_WHITESPACE) != 0 &&
PatternProps.isWhiteSpace(c)) {
continue;
}
if (c == '\\' && (options & PARSE_ESCAPES) != 0) {
int offset[] = new int[] { 0 };
c = Utility.unescapeAt(lookahead(), offset);
jumpahead(offset[0]);
isEscaped = true;
if (c < 0) {
throw new IllegalArgumentException("Invalid escape");
}
}
break;
}
return c;
} | [
"public",
"int",
"next",
"(",
"int",
"options",
")",
"{",
"int",
"c",
"=",
"DONE",
";",
"isEscaped",
"=",
"false",
";",
"for",
"(",
";",
";",
")",
"{",
"c",
"=",
"_current",
"(",
")",
";",
"_advance",
"(",
"UTF16",
".",
"getCharCount",
"(",
"c",
... | Returns the next character using the given options, or DONE if there
are no more characters, and advance the position to the next
character.
@param options one or more of the following options, bitwise-OR-ed
together: PARSE_VARIABLES, PARSE_ESCAPES, SKIP_WHITESPACE.
@return the current 32-bit code point, or DONE | [
"Returns",
"the",
"next",
"character",
"using",
"the",
"given",
"options",
"or",
"DONE",
"if",
"there",
"are",
"no",
"more",
"characters",
"and",
"advance",
"the",
"position",
"to",
"the",
"next",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java#L131-L179 |
34,399 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java | RuleCharacterIterator._current | private int _current() {
if (buf != null) {
return UTF16.charAt(buf, 0, buf.length, bufPos);
} else {
int i = pos.getIndex();
return (i < text.length()) ? UTF16.charAt(text, i) : DONE;
}
} | java | private int _current() {
if (buf != null) {
return UTF16.charAt(buf, 0, buf.length, bufPos);
} else {
int i = pos.getIndex();
return (i < text.length()) ? UTF16.charAt(text, i) : DONE;
}
} | [
"private",
"int",
"_current",
"(",
")",
"{",
"if",
"(",
"buf",
"!=",
"null",
")",
"{",
"return",
"UTF16",
".",
"charAt",
"(",
"buf",
",",
"0",
",",
"buf",
".",
"length",
",",
"bufPos",
")",
";",
"}",
"else",
"{",
"int",
"i",
"=",
"pos",
".",
... | Returns the current 32-bit code point without parsing escapes, parsing
variables, or skipping whitespace.
@return the current 32-bit code point | [
"Returns",
"the",
"current",
"32",
"-",
"bit",
"code",
"point",
"without",
"parsing",
"escapes",
"parsing",
"variables",
"or",
"skipping",
"whitespace",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/RuleCharacterIterator.java#L323-L330 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.