id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1 value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
33,900 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.declareNamespaceInContext | protected void declareNamespaceInContext(int elementNodeIndex,int namespaceNodeIndex)
{
SuballocatedIntVector nsList=null;
if(m_namespaceDeclSets==null)
{
// First
m_namespaceDeclSetElements=new SuballocatedIntVector(32);
m_namespaceDeclSetElements.addElement(elementNodeIndex);
m_namespaceDeclSets=new Vector();
nsList=new SuballocatedIntVector(32);
m_namespaceDeclSets.addElement(nsList);
}
else
{
// Most recent. May be -1 (none) if DTM was pruned.
// %OPT% Is there a lastElement() method? Should there be?
int last=m_namespaceDeclSetElements.size()-1;
if(last>=0 && elementNodeIndex==m_namespaceDeclSetElements.elementAt(last))
{
nsList=(SuballocatedIntVector)m_namespaceDeclSets.elementAt(last);
}
}
if(nsList==null)
{
m_namespaceDeclSetElements.addElement(elementNodeIndex);
SuballocatedIntVector inherited =
findNamespaceContext(_parent(elementNodeIndex));
if (inherited!=null) {
// %OPT% Count-down might be faster, but debuggability may
// be better this way, and if we ever decide we want to
// keep this ordered by expanded-type...
int isize=inherited.size();
// Base the size of a new namespace list on the
// size of the inherited list - but within reason!
nsList=new SuballocatedIntVector(Math.max(Math.min(isize+16,2048),
32));
for(int i=0;i<isize;++i)
{
nsList.addElement(inherited.elementAt(i));
}
} else {
nsList=new SuballocatedIntVector(32);
}
m_namespaceDeclSets.addElement(nsList);
}
// Handle overwriting inherited.
// %OPT% Keep sorted? (By expanded-name rather than by doc order...)
// Downside: Would require insertElementAt if not found,
// which has recopying costs. But these are generally short lists...
int newEType=_exptype(namespaceNodeIndex);
for(int i=nsList.size()-1;i>=0;--i)
{
if(newEType==getExpandedTypeID(nsList.elementAt(i)))
{
nsList.setElementAt(makeNodeHandle(namespaceNodeIndex),i);
return;
}
}
nsList.addElement(makeNodeHandle(namespaceNodeIndex));
} | java | protected void declareNamespaceInContext(int elementNodeIndex,int namespaceNodeIndex)
{
SuballocatedIntVector nsList=null;
if(m_namespaceDeclSets==null)
{
// First
m_namespaceDeclSetElements=new SuballocatedIntVector(32);
m_namespaceDeclSetElements.addElement(elementNodeIndex);
m_namespaceDeclSets=new Vector();
nsList=new SuballocatedIntVector(32);
m_namespaceDeclSets.addElement(nsList);
}
else
{
// Most recent. May be -1 (none) if DTM was pruned.
// %OPT% Is there a lastElement() method? Should there be?
int last=m_namespaceDeclSetElements.size()-1;
if(last>=0 && elementNodeIndex==m_namespaceDeclSetElements.elementAt(last))
{
nsList=(SuballocatedIntVector)m_namespaceDeclSets.elementAt(last);
}
}
if(nsList==null)
{
m_namespaceDeclSetElements.addElement(elementNodeIndex);
SuballocatedIntVector inherited =
findNamespaceContext(_parent(elementNodeIndex));
if (inherited!=null) {
// %OPT% Count-down might be faster, but debuggability may
// be better this way, and if we ever decide we want to
// keep this ordered by expanded-type...
int isize=inherited.size();
// Base the size of a new namespace list on the
// size of the inherited list - but within reason!
nsList=new SuballocatedIntVector(Math.max(Math.min(isize+16,2048),
32));
for(int i=0;i<isize;++i)
{
nsList.addElement(inherited.elementAt(i));
}
} else {
nsList=new SuballocatedIntVector(32);
}
m_namespaceDeclSets.addElement(nsList);
}
// Handle overwriting inherited.
// %OPT% Keep sorted? (By expanded-name rather than by doc order...)
// Downside: Would require insertElementAt if not found,
// which has recopying costs. But these are generally short lists...
int newEType=_exptype(namespaceNodeIndex);
for(int i=nsList.size()-1;i>=0;--i)
{
if(newEType==getExpandedTypeID(nsList.elementAt(i)))
{
nsList.setElementAt(makeNodeHandle(namespaceNodeIndex),i);
return;
}
}
nsList.addElement(makeNodeHandle(namespaceNodeIndex));
} | [
"protected",
"void",
"declareNamespaceInContext",
"(",
"int",
"elementNodeIndex",
",",
"int",
"namespaceNodeIndex",
")",
"{",
"SuballocatedIntVector",
"nsList",
"=",
"null",
";",
"if",
"(",
"m_namespaceDeclSets",
"==",
"null",
")",
"{",
"// First",
"m_namespaceDeclSet... | Build table of namespace declaration
locations during DTM construction. Table is a Vector of
SuballocatedIntVectors containing the namespace node HANDLES declared at
that ID, plus an SuballocatedIntVector of the element node INDEXES at which
these declarations appeared.
NOTE: Since this occurs during model build, nodes will be encountered
in doucment order and thus the table will be ordered by element,
permitting binary-search as a possible retrieval optimization.
%REVIEW% Directly managed arrays rather than vectors?
%REVIEW% Handles or IDs? Given usage, I think handles. | [
"Build",
"table",
"of",
"namespace",
"declaration",
"locations",
"during",
"DTM",
"construction",
".",
"Table",
"is",
"a",
"Vector",
"of",
"SuballocatedIntVectors",
"containing",
"the",
"namespace",
"node",
"HANDLES",
"declared",
"at",
"that",
"ID",
"plus",
"an",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1262-L1330 |
33,901 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.findNamespaceContext | protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex)
{
if (null!=m_namespaceDeclSetElements)
{
// %OPT% Is binary-search really saving us a lot versus linear?
// (... It may be, in large docs with many NS decls.)
int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements,
elementNodeIndex);
if(wouldBeAt>=0) // Found it
return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt);
if(wouldBeAt == -1) // -1-wouldbeat == 0
return null; // Not after anything; definitely not found
// Not found, but we know where it should have been.
// Search back until we find an ancestor or run out.
wouldBeAt=-1-wouldBeAt;
// Decrement wouldBeAt to find last possible ancestor
int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt);
int ancestor=_parent(elementNodeIndex);
// Special case: if the candidate is before the given node, and
// is in the earliest possible position in the document, it
// must have the namespace declarations we're interested in.
if (wouldBeAt == 0 && candidate < ancestor) {
int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex));
int rootID = makeNodeIdentity(rootHandle);
int uppermostNSCandidateID;
if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) {
int ch = _firstch(rootID);
uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID;
} else {
uppermostNSCandidateID = rootID;
}
if (candidate == uppermostNSCandidateID) {
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
}
}
while(wouldBeAt>=0 && ancestor>0)
{
if (candidate==ancestor) {
// Found ancestor in list
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
} else if (candidate<ancestor) {
// Too deep in tree
do {
ancestor=_parent(ancestor);
} while (candidate < ancestor);
} else if(wouldBeAt > 0){
// Too late in list
candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt);
}
else
break;
}
}
return null; // No namespaces known at this node
} | java | protected SuballocatedIntVector findNamespaceContext(int elementNodeIndex)
{
if (null!=m_namespaceDeclSetElements)
{
// %OPT% Is binary-search really saving us a lot versus linear?
// (... It may be, in large docs with many NS decls.)
int wouldBeAt=findInSortedSuballocatedIntVector(m_namespaceDeclSetElements,
elementNodeIndex);
if(wouldBeAt>=0) // Found it
return (SuballocatedIntVector) m_namespaceDeclSets.elementAt(wouldBeAt);
if(wouldBeAt == -1) // -1-wouldbeat == 0
return null; // Not after anything; definitely not found
// Not found, but we know where it should have been.
// Search back until we find an ancestor or run out.
wouldBeAt=-1-wouldBeAt;
// Decrement wouldBeAt to find last possible ancestor
int candidate=m_namespaceDeclSetElements.elementAt(-- wouldBeAt);
int ancestor=_parent(elementNodeIndex);
// Special case: if the candidate is before the given node, and
// is in the earliest possible position in the document, it
// must have the namespace declarations we're interested in.
if (wouldBeAt == 0 && candidate < ancestor) {
int rootHandle = getDocumentRoot(makeNodeHandle(elementNodeIndex));
int rootID = makeNodeIdentity(rootHandle);
int uppermostNSCandidateID;
if (getNodeType(rootHandle) == DTM.DOCUMENT_NODE) {
int ch = _firstch(rootID);
uppermostNSCandidateID = (ch != DTM.NULL) ? ch : rootID;
} else {
uppermostNSCandidateID = rootID;
}
if (candidate == uppermostNSCandidateID) {
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
}
}
while(wouldBeAt>=0 && ancestor>0)
{
if (candidate==ancestor) {
// Found ancestor in list
return (SuballocatedIntVector)m_namespaceDeclSets.elementAt(wouldBeAt);
} else if (candidate<ancestor) {
// Too deep in tree
do {
ancestor=_parent(ancestor);
} while (candidate < ancestor);
} else if(wouldBeAt > 0){
// Too late in list
candidate=m_namespaceDeclSetElements.elementAt(--wouldBeAt);
}
else
break;
}
}
return null; // No namespaces known at this node
} | [
"protected",
"SuballocatedIntVector",
"findNamespaceContext",
"(",
"int",
"elementNodeIndex",
")",
"{",
"if",
"(",
"null",
"!=",
"m_namespaceDeclSetElements",
")",
"{",
"// %OPT% Is binary-search really saving us a lot versus linear?",
"// (... It may be, in large docs with many NS d... | Retrieve list of namespace declaration locations
active at this node. List is an SuballocatedIntVector whose
entries are the namespace node HANDLES declared at that ID.
%REVIEW% Directly managed arrays rather than vectors?
%REVIEW% Handles or IDs? Given usage, I think handles. | [
"Retrieve",
"list",
"of",
"namespace",
"declaration",
"locations",
"active",
"at",
"this",
"node",
".",
"List",
"is",
"an",
"SuballocatedIntVector",
"whose",
"entries",
"are",
"the",
"namespace",
"node",
"HANDLES",
"declared",
"at",
"that",
"ID",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1339-L1400 |
33,902 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getFirstNamespaceNode | public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
{
if(inScope)
{
int identity = makeNodeIdentity(nodeHandle);
if (_type(identity) == DTM.ELEMENT_NODE)
{
SuballocatedIntVector nsContext=findNamespaceContext(identity);
if(nsContext==null || nsContext.size()<1)
return NULL;
return nsContext.elementAt(0);
}
else
return NULL;
}
else
{
// Assume that attributes and namespaces immediately
// follow the element.
//
// %OPT% Would things be faster if all NS nodes were built
// before all Attr nodes? Some costs at build time for 2nd
// pass...
int identity = makeNodeIdentity(nodeHandle);
if (_type(identity) == DTM.ELEMENT_NODE)
{
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
int type = _type(identity);
if (type == DTM.NAMESPACE_NODE)
return makeNodeHandle(identity);
else if (DTM.ATTRIBUTE_NODE != type)
break;
}
return NULL;
}
else
return NULL;
}
} | java | public int getFirstNamespaceNode(int nodeHandle, boolean inScope)
{
if(inScope)
{
int identity = makeNodeIdentity(nodeHandle);
if (_type(identity) == DTM.ELEMENT_NODE)
{
SuballocatedIntVector nsContext=findNamespaceContext(identity);
if(nsContext==null || nsContext.size()<1)
return NULL;
return nsContext.elementAt(0);
}
else
return NULL;
}
else
{
// Assume that attributes and namespaces immediately
// follow the element.
//
// %OPT% Would things be faster if all NS nodes were built
// before all Attr nodes? Some costs at build time for 2nd
// pass...
int identity = makeNodeIdentity(nodeHandle);
if (_type(identity) == DTM.ELEMENT_NODE)
{
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
int type = _type(identity);
if (type == DTM.NAMESPACE_NODE)
return makeNodeHandle(identity);
else if (DTM.ATTRIBUTE_NODE != type)
break;
}
return NULL;
}
else
return NULL;
}
} | [
"public",
"int",
"getFirstNamespaceNode",
"(",
"int",
"nodeHandle",
",",
"boolean",
"inScope",
")",
"{",
"if",
"(",
"inScope",
")",
"{",
"int",
"identity",
"=",
"makeNodeIdentity",
"(",
"nodeHandle",
")",
";",
"if",
"(",
"_type",
"(",
"identity",
")",
"=="... | Given a node handle, get the index of the node's first child.
If not yet resolved, waits for more nodes to be added to the document and
tries again
@param nodeHandle handle to node, which should probably be an element
node, but need not be.
@param inScope true if all namespaces in scope should be returned,
false if only the namespace declarations should be
returned.
@return handle of first namespace, or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"get",
"the",
"index",
"of",
"the",
"node",
"s",
"first",
"child",
".",
"If",
"not",
"yet",
"resolved",
"waits",
"for",
"more",
"nodes",
"to",
"be",
"added",
"to",
"the",
"document",
"and",
"tries",
"again"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1459-L1499 |
33,903 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getNextNamespaceNode | public int getNextNamespaceNode(int baseHandle, int nodeHandle,
boolean inScope)
{
if(inScope)
{
//Since we've been given the base, try direct lookup
//(could look from nodeHandle but this is at least one
//comparison/get-parent faster)
//SuballocatedIntVector nsContext=findNamespaceContext(nodeHandle & m_mask);
SuballocatedIntVector nsContext=findNamespaceContext(makeNodeIdentity(baseHandle));
if(nsContext==null)
return NULL;
int i=1 + nsContext.indexOf(nodeHandle);
if(i<=0 || i==nsContext.size())
return NULL;
return nsContext.elementAt(i);
}
else
{
// Assume that attributes and namespace nodes immediately follow the element.
int identity = makeNodeIdentity(nodeHandle);
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
int type = _type(identity);
if (type == DTM.NAMESPACE_NODE)
{
return makeNodeHandle(identity);
}
else if (type != DTM.ATTRIBUTE_NODE)
{
break;
}
}
}
return DTM.NULL;
} | java | public int getNextNamespaceNode(int baseHandle, int nodeHandle,
boolean inScope)
{
if(inScope)
{
//Since we've been given the base, try direct lookup
//(could look from nodeHandle but this is at least one
//comparison/get-parent faster)
//SuballocatedIntVector nsContext=findNamespaceContext(nodeHandle & m_mask);
SuballocatedIntVector nsContext=findNamespaceContext(makeNodeIdentity(baseHandle));
if(nsContext==null)
return NULL;
int i=1 + nsContext.indexOf(nodeHandle);
if(i<=0 || i==nsContext.size())
return NULL;
return nsContext.elementAt(i);
}
else
{
// Assume that attributes and namespace nodes immediately follow the element.
int identity = makeNodeIdentity(nodeHandle);
while (DTM.NULL != (identity = getNextNodeIdentity(identity)))
{
int type = _type(identity);
if (type == DTM.NAMESPACE_NODE)
{
return makeNodeHandle(identity);
}
else if (type != DTM.ATTRIBUTE_NODE)
{
break;
}
}
}
return DTM.NULL;
} | [
"public",
"int",
"getNextNamespaceNode",
"(",
"int",
"baseHandle",
",",
"int",
"nodeHandle",
",",
"boolean",
"inScope",
")",
"{",
"if",
"(",
"inScope",
")",
"{",
"//Since we've been given the base, try direct lookup",
"//(could look from nodeHandle but this is at least one",
... | Given a namespace handle, advance to the next namespace.
@param baseHandle handle to original node from where the first namespace
was relative to (needed to return nodes in document order).
@param nodeHandle A namespace handle for which we will find the next node.
@param inScope true if all namespaces that are in scope should be processed,
otherwise just process the nodes in the given element handle.
@return handle of next namespace, or DTM.NULL to indicate none exists. | [
"Given",
"a",
"namespace",
"handle",
"advance",
"to",
"the",
"next",
"namespace",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1511-L1549 |
33,904 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getParent | public int getParent(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
if (identity > 0)
return makeNodeHandle(_parent(identity));
else
return DTM.NULL;
} | java | public int getParent(int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
if (identity > 0)
return makeNodeHandle(_parent(identity));
else
return DTM.NULL;
} | [
"public",
"int",
"getParent",
"(",
"int",
"nodeHandle",
")",
"{",
"int",
"identity",
"=",
"makeNodeIdentity",
"(",
"nodeHandle",
")",
";",
"if",
"(",
"identity",
">",
"0",
")",
"return",
"makeNodeHandle",
"(",
"_parent",
"(",
"identity",
")",
")",
";",
"... | Given a node handle, find its parent node.
@param nodeHandle the id of the node.
@return int Node-number of parent,
or DTM.NULL to indicate none exists. | [
"Given",
"a",
"node",
"handle",
"find",
"its",
"parent",
"node",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1558-L1567 |
33,905 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getOwnerDocument | public int getOwnerDocument(int nodeHandle)
{
if (DTM.DOCUMENT_NODE == getNodeType(nodeHandle))
return DTM.NULL;
return getDocumentRoot(nodeHandle);
} | java | public int getOwnerDocument(int nodeHandle)
{
if (DTM.DOCUMENT_NODE == getNodeType(nodeHandle))
return DTM.NULL;
return getDocumentRoot(nodeHandle);
} | [
"public",
"int",
"getOwnerDocument",
"(",
"int",
"nodeHandle",
")",
"{",
"if",
"(",
"DTM",
".",
"DOCUMENT_NODE",
"==",
"getNodeType",
"(",
"nodeHandle",
")",
")",
"return",
"DTM",
".",
"NULL",
";",
"return",
"getDocumentRoot",
"(",
"nodeHandle",
")",
";",
... | Given a node handle, find the owning document node. This has the exact
same semantics as the DOM Document method of the same name, in that if
the nodeHandle is a document node, it will return NULL.
<p>%REVIEW% Since this is DOM-specific, it may belong at the DOM
binding layer. Included here as a convenience function and to
aid porting of DOM code to DTM.</p>
@param nodeHandle the id of the node.
@return int Node handle of owning document, or -1 if the node was a Docment | [
"Given",
"a",
"node",
"handle",
"find",
"the",
"owning",
"document",
"node",
".",
"This",
"has",
"the",
"exact",
"same",
"semantics",
"as",
"the",
"DOM",
"Document",
"method",
"of",
"the",
"same",
"name",
"in",
"that",
"if",
"the",
"nodeHandle",
"is",
"a... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1594-L1601 |
33,906 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.getNamespaceType | public int getNamespaceType(final int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
int expandedNameID = _exptype(identity);
return m_expandedNameTable.getNamespaceID(expandedNameID);
} | java | public int getNamespaceType(final int nodeHandle)
{
int identity = makeNodeIdentity(nodeHandle);
int expandedNameID = _exptype(identity);
return m_expandedNameTable.getNamespaceID(expandedNameID);
} | [
"public",
"int",
"getNamespaceType",
"(",
"final",
"int",
"nodeHandle",
")",
"{",
"int",
"identity",
"=",
"makeNodeIdentity",
"(",
"nodeHandle",
")",
";",
"int",
"expandedNameID",
"=",
"_exptype",
"(",
"identity",
")",
";",
"return",
"m_expandedNameTable",
".",
... | Returns the namespace type of a specific node
@param nodeHandle the id of the node.
@return the ID of the namespace. | [
"Returns",
"the",
"namespace",
"type",
"of",
"a",
"specific",
"node"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L1740-L1747 |
33,907 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.appendChild | public void appendChild(int newChild, boolean clone, boolean cloneDepth)
{
error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendChild not yet supported!");
} | java | public void appendChild(int newChild, boolean clone, boolean cloneDepth)
{
error(XMLMessages.createXMLMessage(XMLErrorResources.ER_METHOD_NOT_SUPPORTED, null));//"appendChild not yet supported!");
} | [
"public",
"void",
"appendChild",
"(",
"int",
"newChild",
",",
"boolean",
"clone",
",",
"boolean",
"cloneDepth",
")",
"{",
"error",
"(",
"XMLMessages",
".",
"createXMLMessage",
"(",
"XMLErrorResources",
".",
"ER_METHOD_NOT_SUPPORTED",
",",
"null",
")",
")",
";",
... | Append a child to the end of the document. Please note that the node
is always cloned if it is owned by another document.
<p>%REVIEW% "End of the document" needs to be defined more clearly.
Does it become the last child of the Document? Of the root element?</p>
@param newChild Must be a valid new node handle.
@param clone true if the child should be cloned into the document.
@param cloneDepth if the clone argument is true, specifies that the
clone should include all it's children. | [
"Append",
"a",
"child",
"to",
"the",
"end",
"of",
"the",
"document",
".",
"Please",
"note",
"that",
"the",
"node",
"is",
"always",
"cloned",
"if",
"it",
"is",
"owned",
"by",
"another",
"document",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L2235-L2238 |
33,908 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java | DTMDefaultBase.migrateTo | public void migrateTo(DTMManager mgr)
{
m_mgr = mgr;
if(mgr instanceof DTMManagerDefault)
m_mgrDefault=(DTMManagerDefault)mgr;
} | java | public void migrateTo(DTMManager mgr)
{
m_mgr = mgr;
if(mgr instanceof DTMManagerDefault)
m_mgrDefault=(DTMManagerDefault)mgr;
} | [
"public",
"void",
"migrateTo",
"(",
"DTMManager",
"mgr",
")",
"{",
"m_mgr",
"=",
"mgr",
";",
"if",
"(",
"mgr",
"instanceof",
"DTMManagerDefault",
")",
"m_mgrDefault",
"=",
"(",
"DTMManagerDefault",
")",
"mgr",
";",
"}"
] | Migrate a DTM built with an old DTMManager to a new DTMManager.
After the migration, the new DTMManager will treat the DTM as
one that is built by itself.
This is used to support DTM sharing between multiple transformations.
@param mgr the DTMManager | [
"Migrate",
"a",
"DTM",
"built",
"with",
"an",
"old",
"DTMManager",
"to",
"a",
"new",
"DTMManager",
".",
"After",
"the",
"migration",
"the",
"new",
"DTMManager",
"will",
"treat",
"the",
"DTM",
"as",
"one",
"that",
"is",
"built",
"by",
"itself",
".",
"This... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBase.java#L2342-L2347 |
33,909 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/CharArrayReader.java | CharArrayReader.skip | public long skip(long n) throws IOException {
synchronized (lock) {
ensureOpen();
long avail = count - pos;
if (n > avail) {
n = avail;
}
if (n < 0) {
return 0;
}
pos += n;
return n;
}
} | java | public long skip(long n) throws IOException {
synchronized (lock) {
ensureOpen();
long avail = count - pos;
if (n > avail) {
n = avail;
}
if (n < 0) {
return 0;
}
pos += n;
return n;
}
} | [
"public",
"long",
"skip",
"(",
"long",
"n",
")",
"throws",
"IOException",
"{",
"synchronized",
"(",
"lock",
")",
"{",
"ensureOpen",
"(",
")",
";",
"long",
"avail",
"=",
"count",
"-",
"pos",
";",
"if",
"(",
"n",
">",
"avail",
")",
"{",
"n",
"=",
"... | Skips characters. Returns the number of characters that were skipped.
<p>The <code>n</code> parameter may be negative, even though the
<code>skip</code> method of the {@link Reader} superclass throws
an exception in this case. If <code>n</code> is negative, then
this method does nothing and returns <code>0</code>.
@param n The number of characters to skip
@return The number of characters actually skipped
@exception IOException If the stream is closed, or an I/O error occurs | [
"Skips",
"characters",
".",
"Returns",
"the",
"number",
"of",
"characters",
"that",
"were",
"skipped",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/CharArrayReader.java#L159-L173 |
33,910 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java | TextImpl.firstTextNodeInCurrentRun | private TextImpl firstTextNodeInCurrentRun() {
TextImpl firstTextInCurrentRun = this;
for (Node p = getPreviousSibling(); p != null; p = p.getPreviousSibling()) {
short nodeType = p.getNodeType();
if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
firstTextInCurrentRun = (TextImpl) p;
} else {
break;
}
}
return firstTextInCurrentRun;
} | java | private TextImpl firstTextNodeInCurrentRun() {
TextImpl firstTextInCurrentRun = this;
for (Node p = getPreviousSibling(); p != null; p = p.getPreviousSibling()) {
short nodeType = p.getNodeType();
if (nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE) {
firstTextInCurrentRun = (TextImpl) p;
} else {
break;
}
}
return firstTextInCurrentRun;
} | [
"private",
"TextImpl",
"firstTextNodeInCurrentRun",
"(",
")",
"{",
"TextImpl",
"firstTextInCurrentRun",
"=",
"this",
";",
"for",
"(",
"Node",
"p",
"=",
"getPreviousSibling",
"(",
")",
";",
"p",
"!=",
"null",
";",
"p",
"=",
"p",
".",
"getPreviousSibling",
"("... | Returns the first text or CDATA node in the current sequence of text and
CDATA nodes. | [
"Returns",
"the",
"first",
"text",
"or",
"CDATA",
"node",
"in",
"the",
"current",
"sequence",
"of",
"text",
"and",
"CDATA",
"nodes",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java#L115-L126 |
33,911 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java | TextImpl.nextTextNode | private TextImpl nextTextNode() {
Node nextSibling = getNextSibling();
if (nextSibling == null) {
return null;
}
short nodeType = nextSibling.getNodeType();
return nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE
? (TextImpl) nextSibling
: null;
} | java | private TextImpl nextTextNode() {
Node nextSibling = getNextSibling();
if (nextSibling == null) {
return null;
}
short nodeType = nextSibling.getNodeType();
return nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE
? (TextImpl) nextSibling
: null;
} | [
"private",
"TextImpl",
"nextTextNode",
"(",
")",
"{",
"Node",
"nextSibling",
"=",
"getNextSibling",
"(",
")",
";",
"if",
"(",
"nextSibling",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"short",
"nodeType",
"=",
"nextSibling",
".",
"getNodeType",
"(... | Returns the next sibling node if it exists and it is text or CDATA.
Otherwise returns null. | [
"Returns",
"the",
"next",
"sibling",
"node",
"if",
"it",
"exists",
"and",
"it",
"is",
"text",
"or",
"CDATA",
".",
"Otherwise",
"returns",
"null",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java#L132-L142 |
33,912 | google/j2objc | jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java | TextImpl.minimize | public final TextImpl minimize() {
if (getLength() == 0) {
parent.removeChild(this);
return null;
}
Node previous = getPreviousSibling();
if (previous == null || previous.getNodeType() != Node.TEXT_NODE) {
return this;
}
TextImpl previousText = (TextImpl) previous;
previousText.buffer.append(buffer);
parent.removeChild(this);
return previousText;
} | java | public final TextImpl minimize() {
if (getLength() == 0) {
parent.removeChild(this);
return null;
}
Node previous = getPreviousSibling();
if (previous == null || previous.getNodeType() != Node.TEXT_NODE) {
return this;
}
TextImpl previousText = (TextImpl) previous;
previousText.buffer.append(buffer);
parent.removeChild(this);
return previousText;
} | [
"public",
"final",
"TextImpl",
"minimize",
"(",
")",
"{",
"if",
"(",
"getLength",
"(",
")",
"==",
"0",
")",
"{",
"parent",
".",
"removeChild",
"(",
"this",
")",
";",
"return",
"null",
";",
"}",
"Node",
"previous",
"=",
"getPreviousSibling",
"(",
")",
... | Tries to remove this node using itself and the previous node as context.
If this node's text is empty, this node is removed and null is returned.
If the previous node exists and is a text node, this node's text will be
appended to that node's text and this node will be removed.
<p>Although this method alters the structure of the DOM tree, it does
not alter the document's semantics.
@return the node holding this node's text and the end of the operation.
Can be null if this node contained the empty string. | [
"Tries",
"to",
"remove",
"this",
"node",
"using",
"itself",
"and",
"the",
"previous",
"node",
"as",
"context",
".",
"If",
"this",
"node",
"s",
"text",
"is",
"empty",
"this",
"node",
"is",
"removed",
"and",
"null",
"is",
"returned",
".",
"If",
"the",
"p... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/TextImpl.java#L156-L171 |
33,913 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/PatternSyntaxException.java | PatternSyntaxException.getMessage | public String getMessage() {
StringBuffer sb = new StringBuffer();
sb.append(desc);
if (index >= 0) {
sb.append(" near index ");
sb.append(index);
}
sb.append(nl);
sb.append(pattern);
if (index >= 0) {
sb.append(nl);
for (int i = 0; i < index; i++) sb.append(' ');
sb.append('^');
}
return sb.toString();
} | java | public String getMessage() {
StringBuffer sb = new StringBuffer();
sb.append(desc);
if (index >= 0) {
sb.append(" near index ");
sb.append(index);
}
sb.append(nl);
sb.append(pattern);
if (index >= 0) {
sb.append(nl);
for (int i = 0; i < index; i++) sb.append(' ');
sb.append('^');
}
return sb.toString();
} | [
"public",
"String",
"getMessage",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
")",
";",
"sb",
".",
"append",
"(",
"desc",
")",
";",
"if",
"(",
"index",
">=",
"0",
")",
"{",
"sb",
".",
"append",
"(",
"\" near index \"",
")",
... | Returns a multi-line string containing the description of the syntax
error and its index, the erroneous regular-expression pattern, and a
visual indication of the error index within the pattern.
@return The full detail message | [
"Returns",
"a",
"multi",
"-",
"line",
"string",
"containing",
"the",
"description",
"of",
"the",
"syntax",
"error",
"and",
"its",
"index",
"the",
"erroneous",
"regular",
"-",
"expression",
"pattern",
"and",
"a",
"visual",
"indication",
"of",
"the",
"error",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/regex/PatternSyntaxException.java#L112-L127 |
33,914 | google/j2objc | jre_emul/android/frameworks/base/core/java/com/android/internal/util/ArrayUtils.java | ArrayUtils.appendElement | @SuppressWarnings("unchecked")
public static <T> T[] appendElement(Class<T> kind, T[] array, T element) {
final T[] result;
final int end;
if (array != null) {
end = array.length;
result = (T[])Array.newInstance(kind, end + 1);
System.arraycopy(array, 0, result, 0, end);
} else {
end = 0;
result = (T[])Array.newInstance(kind, 1);
}
result[end] = element;
return result;
} | java | @SuppressWarnings("unchecked")
public static <T> T[] appendElement(Class<T> kind, T[] array, T element) {
final T[] result;
final int end;
if (array != null) {
end = array.length;
result = (T[])Array.newInstance(kind, end + 1);
System.arraycopy(array, 0, result, 0, end);
} else {
end = 0;
result = (T[])Array.newInstance(kind, 1);
}
result[end] = element;
return result;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"appendElement",
"(",
"Class",
"<",
"T",
">",
"kind",
",",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"{",
"final",
"T",
"[",
"]",
"result"... | Appends an element to a copy of the array and returns the copy.
@param array The original array, or null to represent an empty array.
@param element The element to add.
@return A new array that contains all of the elements of the original array
with the specified element added at the end. | [
"Appends",
"an",
"element",
"to",
"a",
"copy",
"of",
"the",
"array",
"and",
"returns",
"the",
"copy",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/com/android/internal/util/ArrayUtils.java#L184-L198 |
33,915 | google/j2objc | jre_emul/android/frameworks/base/core/java/com/android/internal/util/ArrayUtils.java | ArrayUtils.removeElement | @SuppressWarnings("unchecked")
public static <T> T[] removeElement(Class<T> kind, T[] array, T element) {
if (array != null) {
final int length = array.length;
for (int i = 0; i < length; i++) {
if (array[i] == element) {
if (length == 1) {
return null;
}
T[] result = (T[])Array.newInstance(kind, length - 1);
System.arraycopy(array, 0, result, 0, i);
System.arraycopy(array, i + 1, result, i, length - i - 1);
return result;
}
}
}
return array;
} | java | @SuppressWarnings("unchecked")
public static <T> T[] removeElement(Class<T> kind, T[] array, T element) {
if (array != null) {
final int length = array.length;
for (int i = 0; i < length; i++) {
if (array[i] == element) {
if (length == 1) {
return null;
}
T[] result = (T[])Array.newInstance(kind, length - 1);
System.arraycopy(array, 0, result, 0, i);
System.arraycopy(array, i + 1, result, i, length - i - 1);
return result;
}
}
}
return array;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"removeElement",
"(",
"Class",
"<",
"T",
">",
"kind",
",",
"T",
"[",
"]",
"array",
",",
"T",
"element",
")",
"{",
"if",
"(",
"array",
"!=",
"null"... | Removes an element from a copy of the array and returns the copy.
If the element is not present, then the original array is returned unmodified.
@param array The original array, or null to represent an empty array.
@param element The element to remove.
@return A new array that contains all of the elements of the original array
except the first copy of the specified element removed. If the specified element
was not present, then returns the original array. Returns null if the result
would be an empty array. | [
"Removes",
"an",
"element",
"from",
"a",
"copy",
"of",
"the",
"array",
"and",
"returns",
"the",
"copy",
".",
"If",
"the",
"element",
"is",
"not",
"present",
"then",
"the",
"original",
"array",
"is",
"returned",
"unmodified",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/frameworks/base/core/java/com/android/internal/util/ArrayUtils.java#L210-L227 |
33,916 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/DeflaterInputStream.java | DeflaterInputStream.close | public void close() throws IOException {
if (in != null) {
try {
// Clean up
if (usesDefaultDeflater) {
def.end();
}
in.close();
} finally {
in = null;
}
}
} | java | public void close() throws IOException {
if (in != null) {
try {
// Clean up
if (usesDefaultDeflater) {
def.end();
}
in.close();
} finally {
in = null;
}
}
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"in",
"!=",
"null",
")",
"{",
"try",
"{",
"// Clean up",
"if",
"(",
"usesDefaultDeflater",
")",
"{",
"def",
".",
"end",
"(",
")",
";",
"}",
"in",
".",
"close",
"(",
")",
... | Closes this input stream and its underlying input stream, discarding
any pending uncompressed data.
@throws IOException if an I/O error occurs | [
"Closes",
"this",
"input",
"stream",
"and",
"its",
"underlying",
"input",
"stream",
"discarding",
"any",
"pending",
"uncompressed",
"data",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/DeflaterInputStream.java#L126-L139 |
33,917 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/DeflaterInputStream.java | DeflaterInputStream.read | public int read(byte[] b, int off, int len) throws IOException {
// Sanity checks
ensureOpen();
if (b == null) {
throw new NullPointerException("Null buffer for read");
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
// Read and compress (deflate) input data bytes
int cnt = 0;
while (len > 0 && !def.finished()) {
int n;
// Read data from the input stream
if (def.needsInput()) {
n = in.read(buf, 0, buf.length);
if (n < 0) {
// End of the input stream reached
def.finish();
} else if (n > 0) {
def.setInput(buf, 0, n);
}
}
// Compress the input data, filling the read buffer
n = def.deflate(b, off, len);
cnt += n;
off += n;
len -= n;
}
// Android-changed: set reachEOF eagerly (not just when the number of bytes is zero).
// so that available is more accurate.
if (def.finished()) {
reachEOF =true;
if (cnt == 0) {
cnt = -1;
}
}
return cnt;
} | java | public int read(byte[] b, int off, int len) throws IOException {
// Sanity checks
ensureOpen();
if (b == null) {
throw new NullPointerException("Null buffer for read");
} else if (off < 0 || len < 0 || len > b.length - off) {
throw new IndexOutOfBoundsException();
} else if (len == 0) {
return 0;
}
// Read and compress (deflate) input data bytes
int cnt = 0;
while (len > 0 && !def.finished()) {
int n;
// Read data from the input stream
if (def.needsInput()) {
n = in.read(buf, 0, buf.length);
if (n < 0) {
// End of the input stream reached
def.finish();
} else if (n > 0) {
def.setInput(buf, 0, n);
}
}
// Compress the input data, filling the read buffer
n = def.deflate(b, off, len);
cnt += n;
off += n;
len -= n;
}
// Android-changed: set reachEOF eagerly (not just when the number of bytes is zero).
// so that available is more accurate.
if (def.finished()) {
reachEOF =true;
if (cnt == 0) {
cnt = -1;
}
}
return cnt;
} | [
"public",
"int",
"read",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"// Sanity checks",
"ensureOpen",
"(",
")",
";",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException... | Reads compressed data into a byte array.
This method will block until some input can be read and compressed.
@param b buffer into which the data is read
@param off starting offset of the data within {@code b}
@param len maximum number of compressed bytes to read into {@code b}
@return the actual number of bytes read, or -1 if the end of the
uncompressed input stream is reached
@throws IndexOutOfBoundsException if {@code len > b.length - off}
@throws IOException if an I/O error occurs or if this input stream is
already closed | [
"Reads",
"compressed",
"data",
"into",
"a",
"byte",
"array",
".",
"This",
"method",
"will",
"block",
"until",
"some",
"input",
"can",
"be",
"read",
"and",
"compressed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/DeflaterInputStream.java#L171-L214 |
33,918 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/NetworkInterface.java | NetworkInterface.getByName | public static NetworkInterface getByName(String name) throws SocketException {
if (name == null)
throw new NullPointerException();
return getByName0(name);
} | java | public static NetworkInterface getByName(String name) throws SocketException {
if (name == null)
throw new NullPointerException();
return getByName0(name);
} | [
"public",
"static",
"NetworkInterface",
"getByName",
"(",
"String",
"name",
")",
"throws",
"SocketException",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"return",
"getByName0",
"(",
"name",
")",
";",
"}"... | Searches for the network interface with the specified name.
@param name
The name of the network interface.
@return A <tt>NetworkInterface</tt> with the specified name,
or <tt>null</tt> if there is no network interface
with the specified name.
@throws SocketException
If an I/O error occurs.
@throws NullPointerException
If the specified name is <tt>null</tt>. | [
"Searches",
"for",
"the",
"network",
"interface",
"with",
"the",
"specified",
"name",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/NetworkInterface.java#L267-L271 |
33,919 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/NetworkInterface.java | NetworkInterface.getNetworkInterfaces | public static Enumeration<NetworkInterface> getNetworkInterfaces()
throws SocketException {
final NetworkInterface[] netifs = getAll();
// specified to return null if no network interfaces
if (netifs == null)
return null;
return new Enumeration<NetworkInterface>() {
private int i = 0;
public NetworkInterface nextElement() {
if (netifs != null && i < netifs.length) {
NetworkInterface netif = netifs[i++];
return netif;
} else {
throw new NoSuchElementException();
}
}
public boolean hasMoreElements() {
return (netifs != null && i < netifs.length);
}
};
} | java | public static Enumeration<NetworkInterface> getNetworkInterfaces()
throws SocketException {
final NetworkInterface[] netifs = getAll();
// specified to return null if no network interfaces
if (netifs == null)
return null;
return new Enumeration<NetworkInterface>() {
private int i = 0;
public NetworkInterface nextElement() {
if (netifs != null && i < netifs.length) {
NetworkInterface netif = netifs[i++];
return netif;
} else {
throw new NoSuchElementException();
}
}
public boolean hasMoreElements() {
return (netifs != null && i < netifs.length);
}
};
} | [
"public",
"static",
"Enumeration",
"<",
"NetworkInterface",
">",
"getNetworkInterfaces",
"(",
")",
"throws",
"SocketException",
"{",
"final",
"NetworkInterface",
"[",
"]",
"netifs",
"=",
"getAll",
"(",
")",
";",
"// specified to return null if no network interfaces",
"i... | Returns all the interfaces on this machine. Returns null if no
network interfaces could be found on this machine.
NOTE: can use getNetworkInterfaces()+getInetAddresses()
to obtain all IP addresses for this node
@return an Enumeration of NetworkInterfaces found on this machine
@exception SocketException if an I/O error occurs. | [
"Returns",
"all",
"the",
"interfaces",
"on",
"this",
"machine",
".",
"Returns",
"null",
"if",
"no",
"network",
"interfaces",
"could",
"be",
"found",
"on",
"this",
"machine",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/NetworkInterface.java#L333-L356 |
33,920 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.getYearOffsetInMillis | private long getYearOffsetInMillis() {
long t = (internalGet(DAY_OF_YEAR) - 1) * 24;
t += internalGet(HOUR_OF_DAY);
t *= 60;
t += internalGet(MINUTE);
t *= 60;
t += internalGet(SECOND);
t *= 1000;
return t + internalGet(MILLISECOND) -
(internalGet(ZONE_OFFSET) + internalGet(DST_OFFSET));
} | java | private long getYearOffsetInMillis() {
long t = (internalGet(DAY_OF_YEAR) - 1) * 24;
t += internalGet(HOUR_OF_DAY);
t *= 60;
t += internalGet(MINUTE);
t *= 60;
t += internalGet(SECOND);
t *= 1000;
return t + internalGet(MILLISECOND) -
(internalGet(ZONE_OFFSET) + internalGet(DST_OFFSET));
} | [
"private",
"long",
"getYearOffsetInMillis",
"(",
")",
"{",
"long",
"t",
"=",
"(",
"internalGet",
"(",
"DAY_OF_YEAR",
")",
"-",
"1",
")",
"*",
"24",
";",
"t",
"+=",
"internalGet",
"(",
"HOUR_OF_DAY",
")",
";",
"t",
"*=",
"60",
";",
"t",
"+=",
"interna... | Returns the millisecond offset from the beginning of this
year. This Calendar object must have been normalized. | [
"Returns",
"the",
"millisecond",
"offset",
"from",
"the",
"beginning",
"of",
"this",
"year",
".",
"This",
"Calendar",
"object",
"must",
"have",
"been",
"normalized",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L1975-L1985 |
33,921 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.getWeekNumber | private int getWeekNumber(long fixedDay1, long fixedDate) {
// We can always use `gcal' since Julian and Gregorian are the
// same thing for this calculation.
long fixedDay1st = Gregorian.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
getFirstDayOfWeek());
int ndays = (int)(fixedDay1st - fixedDay1);
assert ndays <= 7;
if (ndays >= getMinimalDaysInFirstWeek()) {
fixedDay1st -= 7;
}
int normalizedDayOfPeriod = (int)(fixedDate - fixedDay1st);
if (normalizedDayOfPeriod >= 0) {
return normalizedDayOfPeriod / 7 + 1;
}
return CalendarUtils.floorDivide(normalizedDayOfPeriod, 7) + 1;
} | java | private int getWeekNumber(long fixedDay1, long fixedDate) {
// We can always use `gcal' since Julian and Gregorian are the
// same thing for this calculation.
long fixedDay1st = Gregorian.getDayOfWeekDateOnOrBefore(fixedDay1 + 6,
getFirstDayOfWeek());
int ndays = (int)(fixedDay1st - fixedDay1);
assert ndays <= 7;
if (ndays >= getMinimalDaysInFirstWeek()) {
fixedDay1st -= 7;
}
int normalizedDayOfPeriod = (int)(fixedDate - fixedDay1st);
if (normalizedDayOfPeriod >= 0) {
return normalizedDayOfPeriod / 7 + 1;
}
return CalendarUtils.floorDivide(normalizedDayOfPeriod, 7) + 1;
} | [
"private",
"int",
"getWeekNumber",
"(",
"long",
"fixedDay1",
",",
"long",
"fixedDate",
")",
"{",
"// We can always use `gcal' since Julian and Gregorian are the",
"// same thing for this calculation.",
"long",
"fixedDay1st",
"=",
"Gregorian",
".",
"getDayOfWeekDateOnOrBefore",
... | Returns the number of weeks in a period between fixedDay1 and
fixedDate. The getFirstDayOfWeek-getMinimalDaysInFirstWeek rule
is applied to calculate the number of weeks.
@param fixedDay1 the fixed date of the first day of the period
@param fixedDate the fixed date of the last day of the period
@return the number of weeks of the given period | [
"Returns",
"the",
"number",
"of",
"weeks",
"in",
"a",
"period",
"between",
"fixedDay1",
"and",
"fixedDate",
".",
"The",
"getFirstDayOfWeek",
"-",
"getMinimalDaysInFirstWeek",
"rule",
"is",
"applied",
"to",
"calculate",
"the",
"number",
"of",
"weeks",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L2598-L2613 |
33,922 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.getCalendarDate | private BaseCalendar.Date getCalendarDate(long fd) {
BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem();
BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE);
cal.getCalendarDateFromFixedDate(d, fd);
return d;
} | java | private BaseCalendar.Date getCalendarDate(long fd) {
BaseCalendar cal = (fd >= gregorianCutoverDate) ? gcal : getJulianCalendarSystem();
BaseCalendar.Date d = (BaseCalendar.Date) cal.newCalendarDate(TimeZone.NO_TIMEZONE);
cal.getCalendarDateFromFixedDate(d, fd);
return d;
} | [
"private",
"BaseCalendar",
".",
"Date",
"getCalendarDate",
"(",
"long",
"fd",
")",
"{",
"BaseCalendar",
"cal",
"=",
"(",
"fd",
">=",
"gregorianCutoverDate",
")",
"?",
"gcal",
":",
"getJulianCalendarSystem",
"(",
")",
";",
"BaseCalendar",
".",
"Date",
"d",
"=... | Returns a CalendarDate produced from the specified fixed date.
@param fd the fixed date | [
"Returns",
"a",
"CalendarDate",
"produced",
"from",
"the",
"specified",
"fixed",
"date",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3231-L3236 |
33,923 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.getRolledValue | private static int getRolledValue(int value, int amount, int min, int max) {
assert value >= min && value <= max;
int range = max - min + 1;
amount %= range;
int n = value + amount;
if (n > max) {
n -= range;
} else if (n < min) {
n += range;
}
assert n >= min && n <= max;
return n;
} | java | private static int getRolledValue(int value, int amount, int min, int max) {
assert value >= min && value <= max;
int range = max - min + 1;
amount %= range;
int n = value + amount;
if (n > max) {
n -= range;
} else if (n < min) {
n += range;
}
assert n >= min && n <= max;
return n;
} | [
"private",
"static",
"int",
"getRolledValue",
"(",
"int",
"value",
",",
"int",
"amount",
",",
"int",
"min",
",",
"int",
"max",
")",
"{",
"assert",
"value",
">=",
"min",
"&&",
"value",
"<=",
"max",
";",
"int",
"range",
"=",
"max",
"-",
"min",
"+",
"... | Returns the new value after 'roll'ing the specified value and amount. | [
"Returns",
"the",
"new",
"value",
"after",
"roll",
"ing",
"the",
"specified",
"value",
"and",
"amount",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3350-L3362 |
33,924 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java | GregorianCalendar.readObject | private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if (gdate == null) {
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
cachedFixedDate = Long.MIN_VALUE;
}
setGregorianChange(gregorianCutover);
} | java | private void readObject(ObjectInputStream stream)
throws IOException, ClassNotFoundException {
stream.defaultReadObject();
if (gdate == null) {
gdate = (BaseCalendar.Date) gcal.newCalendarDate(getZone());
cachedFixedDate = Long.MIN_VALUE;
}
setGregorianChange(gregorianCutover);
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"stream",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"stream",
".",
"defaultReadObject",
"(",
")",
";",
"if",
"(",
"gdate",
"==",
"null",
")",
"{",
"gdate",
"=",
"(",
"BaseCalend... | Updates internal state. | [
"Updates",
"internal",
"state",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/GregorianCalendar.java#L3375-L3383 |
33,925 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.elementAt | @Deprecated
public char elementAt(char index)
{
int ix = (indices[index >> BLOCKSHIFT] & 0xFFFF)
+ (index & BLOCKMASK);
return ix >= values.length ? defaultValue : values[ix];
} | java | @Deprecated
public char elementAt(char index)
{
int ix = (indices[index >> BLOCKSHIFT] & 0xFFFF)
+ (index & BLOCKMASK);
return ix >= values.length ? defaultValue : values[ix];
} | [
"@",
"Deprecated",
"public",
"char",
"elementAt",
"(",
"char",
"index",
")",
"{",
"int",
"ix",
"=",
"(",
"indices",
"[",
"index",
">>",
"BLOCKSHIFT",
"]",
"&",
"0xFFFF",
")",
"+",
"(",
"index",
"&",
"BLOCKMASK",
")",
";",
"return",
"ix",
">=",
"value... | Get the mapped value of a Unicode character.
@param index the character to get the mapped value with
@return the mapped value of the given character
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Get",
"the",
"mapped",
"value",
"of",
"a",
"Unicode",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L136-L142 |
33,926 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.setElementAt | @Deprecated
public void setElementAt(char index, char value)
{
if (isCompact)
expand();
values[index] = value;
touchBlock(index >> BLOCKSHIFT, value);
} | java | @Deprecated
public void setElementAt(char index, char value)
{
if (isCompact)
expand();
values[index] = value;
touchBlock(index >> BLOCKSHIFT, value);
} | [
"@",
"Deprecated",
"public",
"void",
"setElementAt",
"(",
"char",
"index",
",",
"char",
"value",
")",
"{",
"if",
"(",
"isCompact",
")",
"expand",
"(",
")",
";",
"values",
"[",
"index",
"]",
"=",
"value",
";",
"touchBlock",
"(",
"index",
">>",
"BLOCKSHI... | Set a new value for a Unicode character.
Set automatically expands the array if it is compacted.
@param index the character to set the mapped value with
@param value the new mapped value
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Set",
"a",
"new",
"value",
"for",
"a",
"Unicode",
"character",
".",
"Set",
"automatically",
"expands",
"the",
"array",
"if",
"it",
"is",
"compacted",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L152-L159 |
33,927 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.setElementAt | @Deprecated
public void setElementAt(char start, char end, char value)
{
int i;
if (isCompact) {
expand();
}
for (i = start; i <= end; ++i) {
values[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
} | java | @Deprecated
public void setElementAt(char start, char end, char value)
{
int i;
if (isCompact) {
expand();
}
for (i = start; i <= end; ++i) {
values[i] = value;
touchBlock(i >> BLOCKSHIFT, value);
}
} | [
"@",
"Deprecated",
"public",
"void",
"setElementAt",
"(",
"char",
"start",
",",
"char",
"end",
",",
"char",
"value",
")",
"{",
"int",
"i",
";",
"if",
"(",
"isCompact",
")",
"{",
"expand",
"(",
")",
";",
"}",
"for",
"(",
"i",
"=",
"start",
";",
"i... | Set new values for a range of Unicode character.
@param start the starting offset of the range
@param end the ending offset of the range
@param value the new mapped value
@deprecated This API is ICU internal only.
@hide draft / provisional / internal are hidden on Android | [
"Set",
"new",
"values",
"for",
"a",
"range",
"of",
"Unicode",
"character",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L170-L181 |
33,928 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java | CompactCharArray.arrayRegionMatches | final static boolean arrayRegionMatches(char[] source, int sourceStart,
char[] target, int targetStart,
int len)
{
int sourceEnd = sourceStart + len;
int delta = targetStart - sourceStart;
for (int i = sourceStart; i < sourceEnd; i++) {
if (source[i] != target[i + delta])
return false;
}
return true;
} | java | final static boolean arrayRegionMatches(char[] source, int sourceStart,
char[] target, int targetStart,
int len)
{
int sourceEnd = sourceStart + len;
int delta = targetStart - sourceStart;
for (int i = sourceStart; i < sourceEnd; i++) {
if (source[i] != target[i + delta])
return false;
}
return true;
} | [
"final",
"static",
"boolean",
"arrayRegionMatches",
"(",
"char",
"[",
"]",
"source",
",",
"int",
"sourceStart",
",",
"char",
"[",
"]",
"target",
",",
"int",
"targetStart",
",",
"int",
"len",
")",
"{",
"int",
"sourceEnd",
"=",
"sourceStart",
"+",
"len",
"... | Convenience utility to compare two arrays of doubles.
@param len the length to compare.
The start indices and start+len must be valid. | [
"Convenience",
"utility",
"to",
"compare",
"two",
"arrays",
"of",
"doubles",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/CompactCharArray.java#L278-L289 |
33,929 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFieldsForDumping.java | EmulatedFieldsForDumping.write | @Override
@Deprecated
public void write(ObjectOutput output) throws IOException {
if (!output.equals(oos)) {
throw new IllegalArgumentException("Attempting to write to a different stream than the one that created this PutField");
}
for (EmulatedFields.ObjectSlot slot : emulatedFields.slots()) {
Object fieldValue = slot.getFieldValue();
Class<?> type = slot.getField().getType();
if (type == int.class) {
output.writeInt(fieldValue != null ? ((Integer) fieldValue).intValue() : 0);
} else if (type == byte.class) {
output.writeByte(fieldValue != null ? ((Byte) fieldValue).byteValue() : 0);
} else if (type == char.class) {
output.writeChar(fieldValue != null ? ((Character) fieldValue).charValue() : 0);
} else if (type == short.class) {
output.writeShort(fieldValue != null ? ((Short) fieldValue).shortValue() : 0);
} else if (type == boolean.class) {
output.writeBoolean(fieldValue != null ? ((Boolean) fieldValue).booleanValue() : false);
} else if (type == long.class) {
output.writeLong(fieldValue != null ? ((Long) fieldValue).longValue() : 0);
} else if (type == float.class) {
output.writeFloat(fieldValue != null ? ((Float) fieldValue).floatValue() : 0);
} else if (type == double.class) {
output.writeDouble(fieldValue != null ? ((Double) fieldValue).doubleValue() : 0);
} else {
// Either array or Object
output.writeObject(fieldValue);
}
}
} | java | @Override
@Deprecated
public void write(ObjectOutput output) throws IOException {
if (!output.equals(oos)) {
throw new IllegalArgumentException("Attempting to write to a different stream than the one that created this PutField");
}
for (EmulatedFields.ObjectSlot slot : emulatedFields.slots()) {
Object fieldValue = slot.getFieldValue();
Class<?> type = slot.getField().getType();
if (type == int.class) {
output.writeInt(fieldValue != null ? ((Integer) fieldValue).intValue() : 0);
} else if (type == byte.class) {
output.writeByte(fieldValue != null ? ((Byte) fieldValue).byteValue() : 0);
} else if (type == char.class) {
output.writeChar(fieldValue != null ? ((Character) fieldValue).charValue() : 0);
} else if (type == short.class) {
output.writeShort(fieldValue != null ? ((Short) fieldValue).shortValue() : 0);
} else if (type == boolean.class) {
output.writeBoolean(fieldValue != null ? ((Boolean) fieldValue).booleanValue() : false);
} else if (type == long.class) {
output.writeLong(fieldValue != null ? ((Long) fieldValue).longValue() : 0);
} else if (type == float.class) {
output.writeFloat(fieldValue != null ? ((Float) fieldValue).floatValue() : 0);
} else if (type == double.class) {
output.writeDouble(fieldValue != null ? ((Double) fieldValue).doubleValue() : 0);
} else {
// Either array or Object
output.writeObject(fieldValue);
}
}
} | [
"@",
"Override",
"@",
"Deprecated",
"public",
"void",
"write",
"(",
"ObjectOutput",
"output",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"output",
".",
"equals",
"(",
"oos",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Attemptin... | Write the field values to the specified ObjectOutput.
@param output
the ObjectOutput
@throws IOException
If an IO exception happened when writing the field values. | [
"Write",
"the",
"field",
"values",
"to",
"the",
"specified",
"ObjectOutput",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/EmulatedFieldsForDumping.java#L194-L224 |
33,930 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java | AbstractQueuedLongSynchronizer.setHeadAndPropagate | private void setHeadAndPropagate(Node node, long propagate) {
Node h = head; // Record old head for check below
setHead(node);
/*
* Try to signal next queued node if:
* Propagation was indicated by caller,
* or was recorded (as h.waitStatus either before
* or after setHead) by a previous operation
* (note: this uses sign-check of waitStatus because
* PROPAGATE status may transition to SIGNAL.)
* and
* The next node is waiting in shared mode,
* or we don't know, because it appears null
*
* The conservatism in both of these checks may cause
* unnecessary wake-ups, but only when there are multiple
* racing acquires/releases, so most need signals now or soon
* anyway.
*/
if (propagate > 0 || h == null || h.waitStatus < 0 ||
(h = head) == null || h.waitStatus < 0) {
Node s = node.next;
if (s == null || s.isShared())
doReleaseShared();
}
} | java | private void setHeadAndPropagate(Node node, long propagate) {
Node h = head; // Record old head for check below
setHead(node);
/*
* Try to signal next queued node if:
* Propagation was indicated by caller,
* or was recorded (as h.waitStatus either before
* or after setHead) by a previous operation
* (note: this uses sign-check of waitStatus because
* PROPAGATE status may transition to SIGNAL.)
* and
* The next node is waiting in shared mode,
* or we don't know, because it appears null
*
* The conservatism in both of these checks may cause
* unnecessary wake-ups, but only when there are multiple
* racing acquires/releases, so most need signals now or soon
* anyway.
*/
if (propagate > 0 || h == null || h.waitStatus < 0 ||
(h = head) == null || h.waitStatus < 0) {
Node s = node.next;
if (s == null || s.isShared())
doReleaseShared();
}
} | [
"private",
"void",
"setHeadAndPropagate",
"(",
"Node",
"node",
",",
"long",
"propagate",
")",
"{",
"Node",
"h",
"=",
"head",
";",
"// Record old head for check below",
"setHead",
"(",
"node",
")",
";",
"/*\n * Try to signal next queued node if:\n * Propa... | Sets head of queue, and checks if successor may be waiting
in shared mode, if so propagating if either propagate > 0 or
PROPAGATE status was set.
@param node the node
@param propagate the return value from a tryAcquireShared | [
"Sets",
"head",
"of",
"queue",
"and",
"checks",
"if",
"successor",
"may",
"be",
"waiting",
"in",
"shared",
"mode",
"if",
"so",
"propagating",
"if",
"either",
"propagate",
">",
"0",
"or",
"PROPAGATE",
"status",
"was",
"set",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java#L277-L302 |
33,931 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java | AbstractQueuedLongSynchronizer.doAcquireInterruptibly | private void doAcquireInterruptibly(long arg)
throws InterruptedException {
final Node node = addWaiter(Node.EXCLUSIVE);
try {
for (;;) {
final Node p = node.predecessor();
if (p == head && tryAcquire(arg)) {
setHead(node);
p.next = null; // help GC
return;
}
if (shouldParkAfterFailedAcquire(p, node) &&
parkAndCheckInterrupt())
throw new InterruptedException();
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | java | private void doAcquireInterruptibly(long arg)
throws InterruptedException {
final Node node = addWaiter(Node.EXCLUSIVE);
try {
for (;;) {
final Node p = node.predecessor();
if (p == head && tryAcquire(arg)) {
setHead(node);
p.next = null; // help GC
return;
}
if (shouldParkAfterFailedAcquire(p, node) &&
parkAndCheckInterrupt())
throw new InterruptedException();
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | [
"private",
"void",
"doAcquireInterruptibly",
"(",
"long",
"arg",
")",
"throws",
"InterruptedException",
"{",
"final",
"Node",
"node",
"=",
"addWaiter",
"(",
"Node",
".",
"EXCLUSIVE",
")",
";",
"try",
"{",
"for",
"(",
";",
";",
")",
"{",
"final",
"Node",
... | Acquires in exclusive interruptible mode.
@param arg the acquire argument | [
"Acquires",
"in",
"exclusive",
"interruptible",
"mode",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java#L450-L469 |
33,932 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java | AbstractQueuedLongSynchronizer.doAcquireNanos | private boolean doAcquireNanos(long arg, long nanosTimeout)
throws InterruptedException {
if (nanosTimeout <= 0L)
return false;
final long deadline = System.nanoTime() + nanosTimeout;
final Node node = addWaiter(Node.EXCLUSIVE);
try {
for (;;) {
final Node p = node.predecessor();
if (p == head && tryAcquire(arg)) {
setHead(node);
p.next = null; // help GC
return true;
}
nanosTimeout = deadline - System.nanoTime();
if (nanosTimeout <= 0L) {
cancelAcquire(node);
return false;
}
if (shouldParkAfterFailedAcquire(p, node) &&
nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
LockSupport.parkNanos(this, nanosTimeout);
if (Thread.interrupted())
throw new InterruptedException();
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | java | private boolean doAcquireNanos(long arg, long nanosTimeout)
throws InterruptedException {
if (nanosTimeout <= 0L)
return false;
final long deadline = System.nanoTime() + nanosTimeout;
final Node node = addWaiter(Node.EXCLUSIVE);
try {
for (;;) {
final Node p = node.predecessor();
if (p == head && tryAcquire(arg)) {
setHead(node);
p.next = null; // help GC
return true;
}
nanosTimeout = deadline - System.nanoTime();
if (nanosTimeout <= 0L) {
cancelAcquire(node);
return false;
}
if (shouldParkAfterFailedAcquire(p, node) &&
nanosTimeout > SPIN_FOR_TIMEOUT_THRESHOLD)
LockSupport.parkNanos(this, nanosTimeout);
if (Thread.interrupted())
throw new InterruptedException();
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | [
"private",
"boolean",
"doAcquireNanos",
"(",
"long",
"arg",
",",
"long",
"nanosTimeout",
")",
"throws",
"InterruptedException",
"{",
"if",
"(",
"nanosTimeout",
"<=",
"0L",
")",
"return",
"false",
";",
"final",
"long",
"deadline",
"=",
"System",
".",
"nanoTime"... | Acquires in exclusive timed mode.
@param arg the acquire argument
@param nanosTimeout max wait time
@return {@code true} if acquired | [
"Acquires",
"in",
"exclusive",
"timed",
"mode",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java#L478-L507 |
33,933 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java | AbstractQueuedLongSynchronizer.doAcquireShared | private void doAcquireShared(long arg) {
final Node node = addWaiter(Node.SHARED);
try {
boolean interrupted = false;
for (;;) {
final Node p = node.predecessor();
if (p == head) {
long r = tryAcquireShared(arg);
if (r >= 0) {
setHeadAndPropagate(node, r);
p.next = null; // help GC
if (interrupted)
selfInterrupt();
return;
}
}
if (shouldParkAfterFailedAcquire(p, node) &&
parkAndCheckInterrupt())
interrupted = true;
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | java | private void doAcquireShared(long arg) {
final Node node = addWaiter(Node.SHARED);
try {
boolean interrupted = false;
for (;;) {
final Node p = node.predecessor();
if (p == head) {
long r = tryAcquireShared(arg);
if (r >= 0) {
setHeadAndPropagate(node, r);
p.next = null; // help GC
if (interrupted)
selfInterrupt();
return;
}
}
if (shouldParkAfterFailedAcquire(p, node) &&
parkAndCheckInterrupt())
interrupted = true;
}
} catch (Throwable t) {
cancelAcquire(node);
throw t;
}
} | [
"private",
"void",
"doAcquireShared",
"(",
"long",
"arg",
")",
"{",
"final",
"Node",
"node",
"=",
"addWaiter",
"(",
"Node",
".",
"SHARED",
")",
";",
"try",
"{",
"boolean",
"interrupted",
"=",
"false",
";",
"for",
"(",
";",
";",
")",
"{",
"final",
"No... | Acquires in shared uninterruptible mode.
@param arg the acquire argument | [
"Acquires",
"in",
"shared",
"uninterruptible",
"mode",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java#L513-L537 |
33,934 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java | AbstractQueuedLongSynchronizer.fullyRelease | final long fullyRelease(Node node) {
try {
long savedState = getState();
if (release(savedState))
return savedState;
throw new IllegalMonitorStateException();
} catch (Throwable t) {
node.waitStatus = Node.CANCELLED;
throw t;
}
} | java | final long fullyRelease(Node node) {
try {
long savedState = getState();
if (release(savedState))
return savedState;
throw new IllegalMonitorStateException();
} catch (Throwable t) {
node.waitStatus = Node.CANCELLED;
throw t;
}
} | [
"final",
"long",
"fullyRelease",
"(",
"Node",
"node",
")",
"{",
"try",
"{",
"long",
"savedState",
"=",
"getState",
"(",
")",
";",
"if",
"(",
"release",
"(",
"savedState",
")",
")",
"return",
"savedState",
";",
"throw",
"new",
"IllegalMonitorStateException",
... | Invokes release with current state value; returns saved state.
Cancels node and throws exception on failure.
@param node the condition node for this wait
@return previous sync state | [
"Invokes",
"release",
"with",
"current",
"state",
"value",
";",
"returns",
"saved",
"state",
".",
"Cancels",
"node",
"and",
"throws",
"exception",
"on",
"failure",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/locks/AbstractQueuedLongSynchronizer.java#L1278-L1288 |
33,935 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet4Address.java | Inet4Address.writeReplace | private Object writeReplace() throws ObjectStreamException {
// will replace the to be serialized 'this' object
InetAddress inet = new InetAddress();
inet.holder().hostName = holder().getHostName();
inet.holder().address = holder().getAddress();
/**
* Prior to 1.4 an InetAddress was created with a family
* based on the platform AF_INET value (usually 2).
* For compatibility reasons we must therefore write the
* the InetAddress with this family.
*/
inet.holder().family = 2;
return inet;
} | java | private Object writeReplace() throws ObjectStreamException {
// will replace the to be serialized 'this' object
InetAddress inet = new InetAddress();
inet.holder().hostName = holder().getHostName();
inet.holder().address = holder().getAddress();
/**
* Prior to 1.4 an InetAddress was created with a family
* based on the platform AF_INET value (usually 2).
* For compatibility reasons we must therefore write the
* the InetAddress with this family.
*/
inet.holder().family = 2;
return inet;
} | [
"private",
"Object",
"writeReplace",
"(",
")",
"throws",
"ObjectStreamException",
"{",
"// will replace the to be serialized 'this' object",
"InetAddress",
"inet",
"=",
"new",
"InetAddress",
"(",
")",
";",
"inet",
".",
"holder",
"(",
")",
".",
"hostName",
"=",
"hold... | Replaces the object to be serialized with an InetAddress object.
@return the alternate object to be serialized.
@throws ObjectStreamException if a new object replacing this
object could not be created | [
"Replaces",
"the",
"object",
"to",
"be",
"serialized",
"with",
"an",
"InetAddress",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/Inet4Address.java#L143-L158 |
33,936 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeDecompressor.java | UnicodeDecompressor.decompress | public static String decompress(byte [] buffer){
char [] buf = decompress(buffer, 0, buffer.length);
return new String(buf);
} | java | public static String decompress(byte [] buffer){
char [] buf = decompress(buffer, 0, buffer.length);
return new String(buf);
} | [
"public",
"static",
"String",
"decompress",
"(",
"byte",
"[",
"]",
"buffer",
")",
"{",
"char",
"[",
"]",
"buf",
"=",
"decompress",
"(",
"buffer",
",",
"0",
",",
"buffer",
".",
"length",
")",
";",
"return",
"new",
"String",
"(",
"buf",
")",
";",
"}"... | Decompress a byte array into a String.
@param buffer The byte array to decompress.
@return A String containing the decompressed characters.
@see #decompress(byte [], int, int) | [
"Decompress",
"a",
"byte",
"array",
"into",
"a",
"String",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeDecompressor.java#L115-L118 |
33,937 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeDecompressor.java | UnicodeDecompressor.reset | public void reset()
{
// reset dynamic windows
fOffsets[0] = 0x0080; // Latin-1
fOffsets[1] = 0x00C0; // Latin-1 Supplement + Latin Extended-A
fOffsets[2] = 0x0400; // Cyrillic
fOffsets[3] = 0x0600; // Arabic
fOffsets[4] = 0x0900; // Devanagari
fOffsets[5] = 0x3040; // Hiragana
fOffsets[6] = 0x30A0; // Katakana
fOffsets[7] = 0xFF00; // Fullwidth ASCII
fCurrentWindow = 0; // Make current window Latin-1
fMode = SINGLEBYTEMODE; // Always start in single-byte mode
fBufferLength = 0; // Empty buffer
} | java | public void reset()
{
// reset dynamic windows
fOffsets[0] = 0x0080; // Latin-1
fOffsets[1] = 0x00C0; // Latin-1 Supplement + Latin Extended-A
fOffsets[2] = 0x0400; // Cyrillic
fOffsets[3] = 0x0600; // Arabic
fOffsets[4] = 0x0900; // Devanagari
fOffsets[5] = 0x3040; // Hiragana
fOffsets[6] = 0x30A0; // Katakana
fOffsets[7] = 0xFF00; // Fullwidth ASCII
fCurrentWindow = 0; // Make current window Latin-1
fMode = SINGLEBYTEMODE; // Always start in single-byte mode
fBufferLength = 0; // Empty buffer
} | [
"public",
"void",
"reset",
"(",
")",
"{",
"// reset dynamic windows",
"fOffsets",
"[",
"0",
"]",
"=",
"0x0080",
";",
"// Latin-1",
"fOffsets",
"[",
"1",
"]",
"=",
"0x00C0",
";",
"// Latin-1 Supplement + Latin Extended-A",
"fOffsets",
"[",
"2",
"]",
"=",
"0x040... | Reset the decompressor to its initial state. | [
"Reset",
"the",
"decompressor",
"to",
"its",
"initial",
"state",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/UnicodeDecompressor.java#L538-L554 |
33,938 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java | Vector.elementAt | public synchronized E elementAt(int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
}
return elementData(index);
} | java | public synchronized E elementAt(int index) {
if (index >= elementCount) {
throw new ArrayIndexOutOfBoundsException(index + " >= " + elementCount);
}
return elementData(index);
} | [
"public",
"synchronized",
"E",
"elementAt",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"elementCount",
")",
"{",
"throw",
"new",
"ArrayIndexOutOfBoundsException",
"(",
"index",
"+",
"\" >= \"",
"+",
"elementCount",
")",
";",
"}",
"return",
"ele... | Returns the component at the specified index.
<p>This method is identical in functionality to the {@link #get(int)}
method (which is part of the {@link List} interface).
@param index an index into this vector
@return the component at the specified index
@throws ArrayIndexOutOfBoundsException if the index is out of range
({@code index < 0 || index >= size()}) | [
"Returns",
"the",
"component",
"at",
"the",
"specified",
"index",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java#L472-L478 |
33,939 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java | Vector.removeAllElements | public synchronized void removeAllElements() {
modCount++;
// Let gc do its work
for (int i = 0; i < elementCount; i++)
elementData[i] = null;
elementCount = 0;
} | java | public synchronized void removeAllElements() {
modCount++;
// Let gc do its work
for (int i = 0; i < elementCount; i++)
elementData[i] = null;
elementCount = 0;
} | [
"public",
"synchronized",
"void",
"removeAllElements",
"(",
")",
"{",
"modCount",
"++",
";",
"// Let gc do its work",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"elementCount",
";",
"i",
"++",
")",
"elementData",
"[",
"i",
"]",
"=",
"null",
";",
... | Removes all components from this vector and sets its size to zero.
<p>This method is identical in functionality to the {@link #clear}
method (which is part of the {@link List} interface). | [
"Removes",
"all",
"components",
"from",
"this",
"vector",
"and",
"sets",
"its",
"size",
"to",
"zero",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java#L655-L662 |
33,940 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java | Vector.toArray | @SuppressWarnings("unchecked")
public synchronized <T> T[] toArray(T[] a) {
if (a.length < elementCount)
return (T[]) Arrays.copyOf(elementData, elementCount, a.getClass());
System.arraycopy(elementData, 0, a, 0, elementCount);
if (a.length > elementCount)
a[elementCount] = null;
return a;
} | java | @SuppressWarnings("unchecked")
public synchronized <T> T[] toArray(T[] a) {
if (a.length < elementCount)
return (T[]) Arrays.copyOf(elementData, elementCount, a.getClass());
System.arraycopy(elementData, 0, a, 0, elementCount);
if (a.length > elementCount)
a[elementCount] = null;
return a;
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"synchronized",
"<",
"T",
">",
"T",
"[",
"]",
"toArray",
"(",
"T",
"[",
"]",
"a",
")",
"{",
"if",
"(",
"a",
".",
"length",
"<",
"elementCount",
")",
"return",
"(",
"T",
"[",
"]",
")",
... | Returns an array containing all of the elements in this Vector in the
correct order; the runtime type of the returned array is that of the
specified array. If the Vector fits in the specified array, it is
returned therein. Otherwise, a new array is allocated with the runtime
type of the specified array and the size of this Vector.
<p>If the Vector fits in the specified array with room to spare
(i.e., the array has more elements than the Vector),
the element in the array immediately following the end of the
Vector is set to null. (This is useful in determining the length
of the Vector <em>only</em> if the caller knows that the Vector
does not contain any null elements.)
@param a the array into which the elements of the Vector are to
be stored, if it is big enough; otherwise, a new array of the
same runtime type is allocated for this purpose.
@return an array containing the elements of the Vector
@throws ArrayStoreException if the runtime type of a is not a supertype
of the runtime type of every element in this Vector
@throws NullPointerException if the given array is null
@since 1.2 | [
"Returns",
"an",
"array",
"containing",
"all",
"of",
"the",
"elements",
"in",
"this",
"Vector",
"in",
"the",
"correct",
"order",
";",
"the",
"runtime",
"type",
"of",
"the",
"returned",
"array",
"is",
"that",
"of",
"the",
"specified",
"array",
".",
"If",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java#L717-L728 |
33,941 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java | Vector.add | public synchronized boolean add(E e) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = e;
return true;
} | java | public synchronized boolean add(E e) {
modCount++;
ensureCapacityHelper(elementCount + 1);
elementData[elementCount++] = e;
return true;
} | [
"public",
"synchronized",
"boolean",
"add",
"(",
"E",
"e",
")",
"{",
"modCount",
"++",
";",
"ensureCapacityHelper",
"(",
"elementCount",
"+",
"1",
")",
";",
"elementData",
"[",
"elementCount",
"++",
"]",
"=",
"e",
";",
"return",
"true",
";",
"}"
] | Appends the specified element to the end of this Vector.
@param e element to be appended to this Vector
@return {@code true} (as specified by {@link Collection#add})
@since 1.2 | [
"Appends",
"the",
"specified",
"element",
"to",
"the",
"end",
"of",
"this",
"Vector",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Vector.java#L780-L785 |
33,942 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java | BuildStep.getIssuerName | public String getIssuerName(String defaultName) {
return (cert == null ? defaultName
: cert.getIssuerX500Principal().toString());
} | java | public String getIssuerName(String defaultName) {
return (cert == null ? defaultName
: cert.getIssuerX500Principal().toString());
} | [
"public",
"String",
"getIssuerName",
"(",
"String",
"defaultName",
")",
"{",
"return",
"(",
"cert",
"==",
"null",
"?",
"defaultName",
":",
"cert",
".",
"getIssuerX500Principal",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}"
] | return string form of issuer name from certificate associated with this
build step, or a default name if no certificate associated with this
build step, or if issuer name could not be obtained from the certificate.
@param defaultName name to use as default if unable to return an issuer
name from the certificate, or if no certificate.
@returns String form of issuer name or defaultName, if no certificate or
exception received while trying to extract issuer name from certificate. | [
"return",
"string",
"form",
"of",
"issuer",
"name",
"from",
"certificate",
"associated",
"with",
"this",
"build",
"step",
"or",
"a",
"default",
"name",
"if",
"no",
"certificate",
"associated",
"with",
"this",
"build",
"step",
"or",
"if",
"issuer",
"name",
"c... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java#L131-L134 |
33,943 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java | BuildStep.getSubjectName | public String getSubjectName(String defaultName) {
return (cert == null ? defaultName
: cert.getSubjectX500Principal().toString());
} | java | public String getSubjectName(String defaultName) {
return (cert == null ? defaultName
: cert.getSubjectX500Principal().toString());
} | [
"public",
"String",
"getSubjectName",
"(",
"String",
"defaultName",
")",
"{",
"return",
"(",
"cert",
"==",
"null",
"?",
"defaultName",
":",
"cert",
".",
"getSubjectX500Principal",
"(",
")",
".",
"toString",
"(",
")",
")",
";",
"}"
] | return string form of subject name from certificate associated with this
build step, or a default name if no certificate associated with this
build step, or if subject name could not be obtained from the
certificate.
@param defaultName name to use as default if unable to return a subject
name from the certificate, or if no certificate.
@returns String form of subject name or defaultName, if no certificate or
if an exception was received while attempting to extract the subject name
from the certificate. | [
"return",
"string",
"form",
"of",
"subject",
"name",
"from",
"certificate",
"associated",
"with",
"this",
"build",
"step",
"or",
"a",
"default",
"name",
"if",
"no",
"certificate",
"associated",
"with",
"this",
"build",
"step",
"or",
"if",
"subject",
"name",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java#L158-L161 |
33,944 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java | BuildStep.resultToString | public String resultToString(int res) {
String resultString = "";
switch (res) {
case POSSIBLE:
resultString = "Certificate to be tried.\n";
break;
case BACK:
resultString = "Certificate backed out since path does not "
+ "satisfy build requirements.\n";
break;
case FOLLOW:
resultString = "Certificate satisfies conditions.\n";
break;
case FAIL:
resultString = "Certificate backed out since path does not "
+ "satisfy conditions.\n";
break;
case SUCCEED:
resultString = "Certificate satisfies conditions.\n";
break;
default:
resultString = "Internal error: Invalid step result value.\n";
}
return resultString;
} | java | public String resultToString(int res) {
String resultString = "";
switch (res) {
case POSSIBLE:
resultString = "Certificate to be tried.\n";
break;
case BACK:
resultString = "Certificate backed out since path does not "
+ "satisfy build requirements.\n";
break;
case FOLLOW:
resultString = "Certificate satisfies conditions.\n";
break;
case FAIL:
resultString = "Certificate backed out since path does not "
+ "satisfy conditions.\n";
break;
case SUCCEED:
resultString = "Certificate satisfies conditions.\n";
break;
default:
resultString = "Internal error: Invalid step result value.\n";
}
return resultString;
} | [
"public",
"String",
"resultToString",
"(",
"int",
"res",
")",
"{",
"String",
"resultString",
"=",
"\"\"",
";",
"switch",
"(",
"res",
")",
"{",
"case",
"POSSIBLE",
":",
"resultString",
"=",
"\"Certificate to be tried.\\n\"",
";",
"break",
";",
"case",
"BACK",
... | return a string representing the meaning of the result code associated
with this build step.
@param res result code
@returns String string representing meaning of the result code | [
"return",
"a",
"string",
"representing",
"the",
"meaning",
"of",
"the",
"result",
"code",
"associated",
"with",
"this",
"build",
"step",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java#L189-L213 |
33,945 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java | BuildStep.verboseToString | public String verboseToString() {
String out = resultToString(getResult());
switch (result) {
case BACK:
case FAIL:
out = out + vertex.throwableToString();
break;
case FOLLOW:
case SUCCEED:
out = out + vertex.moreToString();
break;
case POSSIBLE:
break;
default:
break;
}
out = out + "Certificate contains:\n" + vertex.certToString();
return out;
} | java | public String verboseToString() {
String out = resultToString(getResult());
switch (result) {
case BACK:
case FAIL:
out = out + vertex.throwableToString();
break;
case FOLLOW:
case SUCCEED:
out = out + vertex.moreToString();
break;
case POSSIBLE:
break;
default:
break;
}
out = out + "Certificate contains:\n" + vertex.certToString();
return out;
} | [
"public",
"String",
"verboseToString",
"(",
")",
"{",
"String",
"out",
"=",
"resultToString",
"(",
"getResult",
"(",
")",
")",
";",
"switch",
"(",
"result",
")",
"{",
"case",
"BACK",
":",
"case",
"FAIL",
":",
"out",
"=",
"out",
"+",
"vertex",
".",
"t... | return a string representation of this build step, showing all detail of
the vertex state appropriate to the result of this build step, and the
certificate contents.
@returns String | [
"return",
"a",
"string",
"representation",
"of",
"this",
"build",
"step",
"showing",
"all",
"detail",
"of",
"the",
"vertex",
"state",
"appropriate",
"to",
"the",
"result",
"of",
"this",
"build",
"step",
"and",
"the",
"certificate",
"contents",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/BuildStep.java#L248-L266 |
33,946 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.getMagnitudeArray | private int[] getMagnitudeArray() {
if (offset > 0 || value.length != intLen)
return Arrays.copyOfRange(value, offset, offset + intLen);
return value;
} | java | private int[] getMagnitudeArray() {
if (offset > 0 || value.length != intLen)
return Arrays.copyOfRange(value, offset, offset + intLen);
return value;
} | [
"private",
"int",
"[",
"]",
"getMagnitudeArray",
"(",
")",
"{",
"if",
"(",
"offset",
">",
"0",
"||",
"value",
".",
"length",
"!=",
"intLen",
")",
"return",
"Arrays",
".",
"copyOfRange",
"(",
"value",
",",
"offset",
",",
"offset",
"+",
"intLen",
")",
... | Internal helper method to return the magnitude array. The caller is not
supposed to modify the returned array. | [
"Internal",
"helper",
"method",
"to",
"return",
"the",
"magnitude",
"array",
".",
"The",
"caller",
"is",
"not",
"supposed",
"to",
"modify",
"the",
"returned",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L162-L166 |
33,947 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.toLong | private long toLong() {
assert (intLen <= 2) : "this MutableBigInteger exceeds the range of long";
if (intLen == 0)
return 0;
long d = value[offset] & LONG_MASK;
return (intLen == 2) ? d << 32 | (value[offset + 1] & LONG_MASK) : d;
} | java | private long toLong() {
assert (intLen <= 2) : "this MutableBigInteger exceeds the range of long";
if (intLen == 0)
return 0;
long d = value[offset] & LONG_MASK;
return (intLen == 2) ? d << 32 | (value[offset + 1] & LONG_MASK) : d;
} | [
"private",
"long",
"toLong",
"(",
")",
"{",
"assert",
"(",
"intLen",
"<=",
"2",
")",
":",
"\"this MutableBigInteger exceeds the range of long\"",
";",
"if",
"(",
"intLen",
"==",
"0",
")",
"return",
"0",
";",
"long",
"d",
"=",
"value",
"[",
"offset",
"]",
... | Convert this MutableBigInteger to a long value. The caller has to make
sure this MutableBigInteger can be fit into long. | [
"Convert",
"this",
"MutableBigInteger",
"to",
"a",
"long",
"value",
".",
"The",
"caller",
"has",
"to",
"make",
"sure",
"this",
"MutableBigInteger",
"can",
"be",
"fit",
"into",
"long",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L172-L178 |
33,948 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.toBigInteger | BigInteger toBigInteger(int sign) {
if (intLen == 0 || sign == 0)
return BigInteger.ZERO;
return new BigInteger(getMagnitudeArray(), sign);
} | java | BigInteger toBigInteger(int sign) {
if (intLen == 0 || sign == 0)
return BigInteger.ZERO;
return new BigInteger(getMagnitudeArray(), sign);
} | [
"BigInteger",
"toBigInteger",
"(",
"int",
"sign",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
"||",
"sign",
"==",
"0",
")",
"return",
"BigInteger",
".",
"ZERO",
";",
"return",
"new",
"BigInteger",
"(",
"getMagnitudeArray",
"(",
")",
",",
"sign",
")",
";"... | Convert this MutableBigInteger to a BigInteger object. | [
"Convert",
"this",
"MutableBigInteger",
"to",
"a",
"BigInteger",
"object",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L183-L187 |
33,949 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.toBigDecimal | BigDecimal toBigDecimal(int sign, int scale) {
if (intLen == 0 || sign == 0)
return BigDecimal.zeroValueOf(scale);
int[] mag = getMagnitudeArray();
int len = mag.length;
int d = mag[0];
// If this MutableBigInteger can't be fit into long, we need to
// make a BigInteger object for the resultant BigDecimal object.
if (len > 2 || (d < 0 && len == 2))
return new BigDecimal(new BigInteger(mag, sign), INFLATED, scale, 0);
long v = (len == 2) ?
((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) :
d & LONG_MASK;
return BigDecimal.valueOf(sign == -1 ? -v : v, scale);
} | java | BigDecimal toBigDecimal(int sign, int scale) {
if (intLen == 0 || sign == 0)
return BigDecimal.zeroValueOf(scale);
int[] mag = getMagnitudeArray();
int len = mag.length;
int d = mag[0];
// If this MutableBigInteger can't be fit into long, we need to
// make a BigInteger object for the resultant BigDecimal object.
if (len > 2 || (d < 0 && len == 2))
return new BigDecimal(new BigInteger(mag, sign), INFLATED, scale, 0);
long v = (len == 2) ?
((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) :
d & LONG_MASK;
return BigDecimal.valueOf(sign == -1 ? -v : v, scale);
} | [
"BigDecimal",
"toBigDecimal",
"(",
"int",
"sign",
",",
"int",
"scale",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
"||",
"sign",
"==",
"0",
")",
"return",
"BigDecimal",
".",
"zeroValueOf",
"(",
"scale",
")",
";",
"int",
"[",
"]",
"mag",
"=",
"getMagnit... | Convert this MutableBigInteger to BigDecimal object with the specified sign
and scale. | [
"Convert",
"this",
"MutableBigInteger",
"to",
"BigDecimal",
"object",
"with",
"the",
"specified",
"sign",
"and",
"scale",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L201-L215 |
33,950 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.toCompactValue | long toCompactValue(int sign) {
if (intLen == 0 || sign == 0)
return 0L;
int[] mag = getMagnitudeArray();
int len = mag.length;
int d = mag[0];
// If this MutableBigInteger can not be fitted into long, we need to
// make a BigInteger object for the resultant BigDecimal object.
if (len > 2 || (d < 0 && len == 2))
return INFLATED;
long v = (len == 2) ?
((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) :
d & LONG_MASK;
return sign == -1 ? -v : v;
} | java | long toCompactValue(int sign) {
if (intLen == 0 || sign == 0)
return 0L;
int[] mag = getMagnitudeArray();
int len = mag.length;
int d = mag[0];
// If this MutableBigInteger can not be fitted into long, we need to
// make a BigInteger object for the resultant BigDecimal object.
if (len > 2 || (d < 0 && len == 2))
return INFLATED;
long v = (len == 2) ?
((mag[1] & LONG_MASK) | (d & LONG_MASK) << 32) :
d & LONG_MASK;
return sign == -1 ? -v : v;
} | [
"long",
"toCompactValue",
"(",
"int",
"sign",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
"||",
"sign",
"==",
"0",
")",
"return",
"0L",
";",
"int",
"[",
"]",
"mag",
"=",
"getMagnitudeArray",
"(",
")",
";",
"int",
"len",
"=",
"mag",
".",
"length",
"... | This is for internal use in converting from a MutableBigInteger
object into a long value given a specified sign.
returns INFLATED if value is not fit into long | [
"This",
"is",
"for",
"internal",
"use",
"in",
"converting",
"from",
"a",
"MutableBigInteger",
"object",
"into",
"a",
"long",
"value",
"given",
"a",
"specified",
"sign",
".",
"returns",
"INFLATED",
"if",
"value",
"is",
"not",
"fit",
"into",
"long"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L222-L236 |
33,951 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.clear | void clear() {
offset = intLen = 0;
for (int index=0, n=value.length; index < n; index++)
value[index] = 0;
} | java | void clear() {
offset = intLen = 0;
for (int index=0, n=value.length; index < n; index++)
value[index] = 0;
} | [
"void",
"clear",
"(",
")",
"{",
"offset",
"=",
"intLen",
"=",
"0",
";",
"for",
"(",
"int",
"index",
"=",
"0",
",",
"n",
"=",
"value",
".",
"length",
";",
"index",
"<",
"n",
";",
"index",
"++",
")",
"value",
"[",
"index",
"]",
"=",
"0",
";",
... | Clear out a MutableBigInteger for reuse. | [
"Clear",
"out",
"a",
"MutableBigInteger",
"for",
"reuse",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L241-L245 |
33,952 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.getLowestSetBit | private final int getLowestSetBit() {
if (intLen == 0)
return -1;
int j, b;
for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--)
;
b = value[j+offset];
if (b == 0)
return -1;
return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
} | java | private final int getLowestSetBit() {
if (intLen == 0)
return -1;
int j, b;
for (j=intLen-1; (j > 0) && (value[j+offset] == 0); j--)
;
b = value[j+offset];
if (b == 0)
return -1;
return ((intLen-1-j)<<5) + Integer.numberOfTrailingZeros(b);
} | [
"private",
"final",
"int",
"getLowestSetBit",
"(",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
")",
"return",
"-",
"1",
";",
"int",
"j",
",",
"b",
";",
"for",
"(",
"j",
"=",
"intLen",
"-",
"1",
";",
"(",
"j",
">",
"0",
")",
"&&",
"(",
"value",
... | Return the index of the lowest set bit in this MutableBigInteger. If the
magnitude of this MutableBigInteger is zero, -1 is returned. | [
"Return",
"the",
"index",
"of",
"the",
"lowest",
"set",
"bit",
"in",
"this",
"MutableBigInteger",
".",
"If",
"the",
"magnitude",
"of",
"this",
"MutableBigInteger",
"is",
"zero",
"-",
"1",
"is",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L350-L360 |
33,953 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.normalize | final void normalize() {
if (intLen == 0) {
offset = 0;
return;
}
int index = offset;
if (value[index] != 0)
return;
int indexBound = index+intLen;
do {
index++;
} while(index < indexBound && value[index] == 0);
int numZeros = index - offset;
intLen -= numZeros;
offset = (intLen == 0 ? 0 : offset+numZeros);
} | java | final void normalize() {
if (intLen == 0) {
offset = 0;
return;
}
int index = offset;
if (value[index] != 0)
return;
int indexBound = index+intLen;
do {
index++;
} while(index < indexBound && value[index] == 0);
int numZeros = index - offset;
intLen -= numZeros;
offset = (intLen == 0 ? 0 : offset+numZeros);
} | [
"final",
"void",
"normalize",
"(",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
")",
"{",
"offset",
"=",
"0",
";",
"return",
";",
"}",
"int",
"index",
"=",
"offset",
";",
"if",
"(",
"value",
"[",
"index",
"]",
"!=",
"0",
")",
"return",
";",
"int",... | Ensure that the MutableBigInteger is in normal form, specifically
making sure that there are no leading zeros, and that if the
magnitude is zero, then intLen is zero. | [
"Ensure",
"that",
"the",
"MutableBigInteger",
"is",
"in",
"normal",
"form",
"specifically",
"making",
"sure",
"that",
"there",
"are",
"no",
"leading",
"zeros",
"and",
"that",
"if",
"the",
"magnitude",
"is",
"zero",
"then",
"intLen",
"is",
"zero",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L385-L403 |
33,954 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.ensureCapacity | private final void ensureCapacity(int len) {
if (value.length < len) {
value = new int[len];
offset = 0;
intLen = len;
}
} | java | private final void ensureCapacity(int len) {
if (value.length < len) {
value = new int[len];
offset = 0;
intLen = len;
}
} | [
"private",
"final",
"void",
"ensureCapacity",
"(",
"int",
"len",
")",
"{",
"if",
"(",
"value",
".",
"length",
"<",
"len",
")",
"{",
"value",
"=",
"new",
"int",
"[",
"len",
"]",
";",
"offset",
"=",
"0",
";",
"intLen",
"=",
"len",
";",
"}",
"}"
] | If this MutableBigInteger cannot hold len words, increase the size
of the value array to len words. | [
"If",
"this",
"MutableBigInteger",
"cannot",
"hold",
"len",
"words",
"increase",
"the",
"size",
"of",
"the",
"value",
"array",
"to",
"len",
"words",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L409-L415 |
33,955 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.toIntArray | int[] toIntArray() {
int[] result = new int[intLen];
for(int i=0; i < intLen; i++)
result[i] = value[offset+i];
return result;
} | java | int[] toIntArray() {
int[] result = new int[intLen];
for(int i=0; i < intLen; i++)
result[i] = value[offset+i];
return result;
} | [
"int",
"[",
"]",
"toIntArray",
"(",
")",
"{",
"int",
"[",
"]",
"result",
"=",
"new",
"int",
"[",
"intLen",
"]",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"intLen",
";",
"i",
"++",
")",
"result",
"[",
"i",
"]",
"=",
"value",
"[",... | Convert this MutableBigInteger into an int array with no leading
zeros, of a length that is equal to this MutableBigInteger's intLen. | [
"Convert",
"this",
"MutableBigInteger",
"into",
"an",
"int",
"array",
"with",
"no",
"leading",
"zeros",
"of",
"a",
"length",
"that",
"is",
"equal",
"to",
"this",
"MutableBigInteger",
"s",
"intLen",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L421-L426 |
33,956 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.copyValue | void copyValue(MutableBigInteger src) {
int len = src.intLen;
if (value.length < len)
value = new int[len];
System.arraycopy(src.value, src.offset, value, 0, len);
intLen = len;
offset = 0;
} | java | void copyValue(MutableBigInteger src) {
int len = src.intLen;
if (value.length < len)
value = new int[len];
System.arraycopy(src.value, src.offset, value, 0, len);
intLen = len;
offset = 0;
} | [
"void",
"copyValue",
"(",
"MutableBigInteger",
"src",
")",
"{",
"int",
"len",
"=",
"src",
".",
"intLen",
";",
"if",
"(",
"value",
".",
"length",
"<",
"len",
")",
"value",
"=",
"new",
"int",
"[",
"len",
"]",
";",
"System",
".",
"arraycopy",
"(",
"sr... | Sets this MutableBigInteger's value array to a copy of the specified
array. The intLen is set to the length of the new array. | [
"Sets",
"this",
"MutableBigInteger",
"s",
"value",
"array",
"to",
"a",
"copy",
"of",
"the",
"specified",
"array",
".",
"The",
"intLen",
"is",
"set",
"to",
"the",
"length",
"of",
"the",
"new",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L451-L458 |
33,957 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.copyValue | void copyValue(int[] val) {
int len = val.length;
if (value.length < len)
value = new int[len];
System.arraycopy(val, 0, value, 0, len);
intLen = len;
offset = 0;
} | java | void copyValue(int[] val) {
int len = val.length;
if (value.length < len)
value = new int[len];
System.arraycopy(val, 0, value, 0, len);
intLen = len;
offset = 0;
} | [
"void",
"copyValue",
"(",
"int",
"[",
"]",
"val",
")",
"{",
"int",
"len",
"=",
"val",
".",
"length",
";",
"if",
"(",
"value",
".",
"length",
"<",
"len",
")",
"value",
"=",
"new",
"int",
"[",
"len",
"]",
";",
"System",
".",
"arraycopy",
"(",
"va... | Sets this MutableBigInteger's value array to a copy of the specified
array. The intLen is set to the length of the specified array. | [
"Sets",
"this",
"MutableBigInteger",
"s",
"value",
"array",
"to",
"a",
"copy",
"of",
"the",
"specified",
"array",
".",
"The",
"intLen",
"is",
"set",
"to",
"the",
"length",
"of",
"the",
"specified",
"array",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L464-L471 |
33,958 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.isNormal | boolean isNormal() {
if (intLen + offset > value.length)
return false;
if (intLen == 0)
return true;
return (value[offset] != 0);
} | java | boolean isNormal() {
if (intLen + offset > value.length)
return false;
if (intLen == 0)
return true;
return (value[offset] != 0);
} | [
"boolean",
"isNormal",
"(",
")",
"{",
"if",
"(",
"intLen",
"+",
"offset",
">",
"value",
".",
"length",
")",
"return",
"false",
";",
"if",
"(",
"intLen",
"==",
"0",
")",
"return",
"true",
";",
"return",
"(",
"value",
"[",
"offset",
"]",
"!=",
"0",
... | Returns true iff this MutableBigInteger is in normal form. A
MutableBigInteger is in normal form if it has no leading zeros
after the offset, and intLen + offset <= value.length. | [
"Returns",
"true",
"iff",
"this",
"MutableBigInteger",
"is",
"in",
"normal",
"form",
".",
"A",
"MutableBigInteger",
"is",
"in",
"normal",
"form",
"if",
"it",
"has",
"no",
"leading",
"zeros",
"after",
"the",
"offset",
"and",
"intLen",
"+",
"offset",
"<",
"=... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L506-L512 |
33,959 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.rightShift | void rightShift(int n) {
if (intLen == 0)
return;
int nInts = n >>> 5;
int nBits = n & 0x1F;
this.intLen -= nInts;
if (nBits == 0)
return;
int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
if (nBits >= bitsInHighWord) {
this.primitiveLeftShift(32 - nBits);
this.intLen--;
} else {
primitiveRightShift(nBits);
}
} | java | void rightShift(int n) {
if (intLen == 0)
return;
int nInts = n >>> 5;
int nBits = n & 0x1F;
this.intLen -= nInts;
if (nBits == 0)
return;
int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
if (nBits >= bitsInHighWord) {
this.primitiveLeftShift(32 - nBits);
this.intLen--;
} else {
primitiveRightShift(nBits);
}
} | [
"void",
"rightShift",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"intLen",
"==",
"0",
")",
"return",
";",
"int",
"nInts",
"=",
"n",
">>>",
"5",
";",
"int",
"nBits",
"=",
"n",
"&",
"0x1F",
";",
"this",
".",
"intLen",
"-=",
"nInts",
";",
"if",
"(",
... | Right shift this MutableBigInteger n bits. The MutableBigInteger is left
in normal form. | [
"Right",
"shift",
"this",
"MutableBigInteger",
"n",
"bits",
".",
"The",
"MutableBigInteger",
"is",
"left",
"in",
"normal",
"form",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L537-L552 |
33,960 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.leftShift | void leftShift(int n) {
/*
* If there is enough storage space in this MutableBigInteger already
* the available space will be used. Space to the right of the used
* ints in the value array is faster to utilize, so the extra space
* will be taken from the right if possible.
*/
if (intLen == 0)
return;
int nInts = n >>> 5;
int nBits = n&0x1F;
int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
// If shift can be done without moving words, do so
if (n <= (32-bitsInHighWord)) {
primitiveLeftShift(nBits);
return;
}
int newLen = intLen + nInts +1;
if (nBits <= (32-bitsInHighWord))
newLen--;
if (value.length < newLen) {
// The array must grow
int[] result = new int[newLen];
for (int i=0; i < intLen; i++)
result[i] = value[offset+i];
setValue(result, newLen);
} else if (value.length - offset >= newLen) {
// Use space on right
for(int i=0; i < newLen - intLen; i++)
value[offset+intLen+i] = 0;
} else {
// Must use space on left
for (int i=0; i < intLen; i++)
value[i] = value[offset+i];
for (int i=intLen; i < newLen; i++)
value[i] = 0;
offset = 0;
}
intLen = newLen;
if (nBits == 0)
return;
if (nBits <= (32-bitsInHighWord))
primitiveLeftShift(nBits);
else
primitiveRightShift(32 -nBits);
} | java | void leftShift(int n) {
/*
* If there is enough storage space in this MutableBigInteger already
* the available space will be used. Space to the right of the used
* ints in the value array is faster to utilize, so the extra space
* will be taken from the right if possible.
*/
if (intLen == 0)
return;
int nInts = n >>> 5;
int nBits = n&0x1F;
int bitsInHighWord = BigInteger.bitLengthForInt(value[offset]);
// If shift can be done without moving words, do so
if (n <= (32-bitsInHighWord)) {
primitiveLeftShift(nBits);
return;
}
int newLen = intLen + nInts +1;
if (nBits <= (32-bitsInHighWord))
newLen--;
if (value.length < newLen) {
// The array must grow
int[] result = new int[newLen];
for (int i=0; i < intLen; i++)
result[i] = value[offset+i];
setValue(result, newLen);
} else if (value.length - offset >= newLen) {
// Use space on right
for(int i=0; i < newLen - intLen; i++)
value[offset+intLen+i] = 0;
} else {
// Must use space on left
for (int i=0; i < intLen; i++)
value[i] = value[offset+i];
for (int i=intLen; i < newLen; i++)
value[i] = 0;
offset = 0;
}
intLen = newLen;
if (nBits == 0)
return;
if (nBits <= (32-bitsInHighWord))
primitiveLeftShift(nBits);
else
primitiveRightShift(32 -nBits);
} | [
"void",
"leftShift",
"(",
"int",
"n",
")",
"{",
"/*\n * If there is enough storage space in this MutableBigInteger already\n * the available space will be used. Space to the right of the used\n * ints in the value array is faster to utilize, so the extra space\n * will ... | Left shift this MutableBigInteger n bits. | [
"Left",
"shift",
"this",
"MutableBigInteger",
"n",
"bits",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L566-L613 |
33,961 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.divadd | private int divadd(int[] a, int[] result, int offset) {
long carry = 0;
for (int j=a.length-1; j >= 0; j--) {
long sum = (a[j] & LONG_MASK) +
(result[j+offset] & LONG_MASK) + carry;
result[j+offset] = (int)sum;
carry = sum >>> 32;
}
return (int)carry;
} | java | private int divadd(int[] a, int[] result, int offset) {
long carry = 0;
for (int j=a.length-1; j >= 0; j--) {
long sum = (a[j] & LONG_MASK) +
(result[j+offset] & LONG_MASK) + carry;
result[j+offset] = (int)sum;
carry = sum >>> 32;
}
return (int)carry;
} | [
"private",
"int",
"divadd",
"(",
"int",
"[",
"]",
"a",
",",
"int",
"[",
"]",
"result",
",",
"int",
"offset",
")",
"{",
"long",
"carry",
"=",
"0",
";",
"for",
"(",
"int",
"j",
"=",
"a",
".",
"length",
"-",
"1",
";",
"j",
">=",
"0",
";",
"j",... | A primitive used for division. This method adds in one multiple of the
divisor a back to the dividend result at a specified offset. It is used
when qhat was estimated too large, and must be adjusted. | [
"A",
"primitive",
"used",
"for",
"division",
".",
"This",
"method",
"adds",
"in",
"one",
"multiple",
"of",
"the",
"divisor",
"a",
"back",
"to",
"the",
"dividend",
"result",
"at",
"a",
"specified",
"offset",
".",
"It",
"is",
"used",
"when",
"qhat",
"was",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L620-L630 |
33,962 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.primitiveRightShift | private final void primitiveRightShift(int n) {
int[] val = value;
int n2 = 32 - n;
for (int i=offset+intLen-1, c=val[i]; i > offset; i--) {
int b = c;
c = val[i-1];
val[i] = (c << n2) | (b >>> n);
}
val[offset] >>>= n;
} | java | private final void primitiveRightShift(int n) {
int[] val = value;
int n2 = 32 - n;
for (int i=offset+intLen-1, c=val[i]; i > offset; i--) {
int b = c;
c = val[i-1];
val[i] = (c << n2) | (b >>> n);
}
val[offset] >>>= n;
} | [
"private",
"final",
"void",
"primitiveRightShift",
"(",
"int",
"n",
")",
"{",
"int",
"[",
"]",
"val",
"=",
"value",
";",
"int",
"n2",
"=",
"32",
"-",
"n",
";",
"for",
"(",
"int",
"i",
"=",
"offset",
"+",
"intLen",
"-",
"1",
",",
"c",
"=",
"val"... | Right shift this MutableBigInteger n bits, where n is
less than 32.
Assumes that intLen > 0, n > 0 for speed | [
"Right",
"shift",
"this",
"MutableBigInteger",
"n",
"bits",
"where",
"n",
"is",
"less",
"than",
"32",
".",
"Assumes",
"that",
"intLen",
">",
"0",
"n",
">",
"0",
"for",
"speed"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L676-L685 |
33,963 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.primitiveLeftShift | private final void primitiveLeftShift(int n) {
int[] val = value;
int n2 = 32 - n;
for (int i=offset, c=val[i], m=i+intLen-1; i < m; i++) {
int b = c;
c = val[i+1];
val[i] = (b << n) | (c >>> n2);
}
val[offset+intLen-1] <<= n;
} | java | private final void primitiveLeftShift(int n) {
int[] val = value;
int n2 = 32 - n;
for (int i=offset, c=val[i], m=i+intLen-1; i < m; i++) {
int b = c;
c = val[i+1];
val[i] = (b << n) | (c >>> n2);
}
val[offset+intLen-1] <<= n;
} | [
"private",
"final",
"void",
"primitiveLeftShift",
"(",
"int",
"n",
")",
"{",
"int",
"[",
"]",
"val",
"=",
"value",
";",
"int",
"n2",
"=",
"32",
"-",
"n",
";",
"for",
"(",
"int",
"i",
"=",
"offset",
",",
"c",
"=",
"val",
"[",
"i",
"]",
",",
"m... | Left shift this MutableBigInteger n bits, where n is
less than 32.
Assumes that intLen > 0, n > 0 for speed | [
"Left",
"shift",
"this",
"MutableBigInteger",
"n",
"bits",
"where",
"n",
"is",
"less",
"than",
"32",
".",
"Assumes",
"that",
"intLen",
">",
"0",
"n",
">",
"0",
"for",
"speed"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L692-L701 |
33,964 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.add | void add(MutableBigInteger addend) {
int x = intLen;
int y = addend.intLen;
int resultLen = (intLen > addend.intLen ? intLen : addend.intLen);
int[] result = (value.length < resultLen ? new int[resultLen] : value);
int rstart = result.length-1;
long sum;
long carry = 0;
// Add common parts of both numbers
while(x > 0 && y > 0) {
x--; y--;
sum = (value[x+offset] & LONG_MASK) +
(addend.value[y+addend.offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
// Add remainder of the longer number
while(x > 0) {
x--;
if (carry == 0 && result == value && rstart == (x + offset))
return;
sum = (value[x+offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
while(y > 0) {
y--;
sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
if (carry > 0) { // Result must grow in length
resultLen++;
if (result.length < resultLen) {
int temp[] = new int[resultLen];
// Result one word longer from carry-out; copy low-order
// bits into new result.
System.arraycopy(result, 0, temp, 1, result.length);
temp[0] = 1;
result = temp;
} else {
result[rstart--] = 1;
}
}
value = result;
intLen = resultLen;
offset = result.length - resultLen;
} | java | void add(MutableBigInteger addend) {
int x = intLen;
int y = addend.intLen;
int resultLen = (intLen > addend.intLen ? intLen : addend.intLen);
int[] result = (value.length < resultLen ? new int[resultLen] : value);
int rstart = result.length-1;
long sum;
long carry = 0;
// Add common parts of both numbers
while(x > 0 && y > 0) {
x--; y--;
sum = (value[x+offset] & LONG_MASK) +
(addend.value[y+addend.offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
// Add remainder of the longer number
while(x > 0) {
x--;
if (carry == 0 && result == value && rstart == (x + offset))
return;
sum = (value[x+offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
while(y > 0) {
y--;
sum = (addend.value[y+addend.offset] & LONG_MASK) + carry;
result[rstart--] = (int)sum;
carry = sum >>> 32;
}
if (carry > 0) { // Result must grow in length
resultLen++;
if (result.length < resultLen) {
int temp[] = new int[resultLen];
// Result one word longer from carry-out; copy low-order
// bits into new result.
System.arraycopy(result, 0, temp, 1, result.length);
temp[0] = 1;
result = temp;
} else {
result[rstart--] = 1;
}
}
value = result;
intLen = resultLen;
offset = result.length - resultLen;
} | [
"void",
"add",
"(",
"MutableBigInteger",
"addend",
")",
"{",
"int",
"x",
"=",
"intLen",
";",
"int",
"y",
"=",
"addend",
".",
"intLen",
";",
"int",
"resultLen",
"=",
"(",
"intLen",
">",
"addend",
".",
"intLen",
"?",
"intLen",
":",
"addend",
".",
"intL... | Adds the contents of two MutableBigInteger objects.The result
is placed within this MutableBigInteger.
The contents of the addend are not changed. | [
"Adds",
"the",
"contents",
"of",
"two",
"MutableBigInteger",
"objects",
".",
"The",
"result",
"is",
"placed",
"within",
"this",
"MutableBigInteger",
".",
"The",
"contents",
"of",
"the",
"addend",
"are",
"not",
"changed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L737-L789 |
33,965 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.subtract | int subtract(MutableBigInteger b) {
MutableBigInteger a = this;
int[] result = value;
int sign = a.compare(b);
if (sign == 0) {
reset();
return 0;
}
if (sign < 0) {
MutableBigInteger tmp = a;
a = b;
b = tmp;
}
int resultLen = a.intLen;
if (result.length < resultLen)
result = new int[resultLen];
long diff = 0;
int x = a.intLen;
int y = b.intLen;
int rstart = result.length - 1;
// Subtract common parts of both numbers
while (y > 0) {
x--; y--;
diff = (a.value[x+a.offset] & LONG_MASK) -
(b.value[y+b.offset] & LONG_MASK) - ((int)-(diff>>32));
result[rstart--] = (int)diff;
}
// Subtract remainder of longer number
while (x > 0) {
x--;
diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32));
result[rstart--] = (int)diff;
}
value = result;
intLen = resultLen;
offset = value.length - resultLen;
normalize();
return sign;
} | java | int subtract(MutableBigInteger b) {
MutableBigInteger a = this;
int[] result = value;
int sign = a.compare(b);
if (sign == 0) {
reset();
return 0;
}
if (sign < 0) {
MutableBigInteger tmp = a;
a = b;
b = tmp;
}
int resultLen = a.intLen;
if (result.length < resultLen)
result = new int[resultLen];
long diff = 0;
int x = a.intLen;
int y = b.intLen;
int rstart = result.length - 1;
// Subtract common parts of both numbers
while (y > 0) {
x--; y--;
diff = (a.value[x+a.offset] & LONG_MASK) -
(b.value[y+b.offset] & LONG_MASK) - ((int)-(diff>>32));
result[rstart--] = (int)diff;
}
// Subtract remainder of longer number
while (x > 0) {
x--;
diff = (a.value[x+a.offset] & LONG_MASK) - ((int)-(diff>>32));
result[rstart--] = (int)diff;
}
value = result;
intLen = resultLen;
offset = value.length - resultLen;
normalize();
return sign;
} | [
"int",
"subtract",
"(",
"MutableBigInteger",
"b",
")",
"{",
"MutableBigInteger",
"a",
"=",
"this",
";",
"int",
"[",
"]",
"result",
"=",
"value",
";",
"int",
"sign",
"=",
"a",
".",
"compare",
"(",
"b",
")",
";",
"if",
"(",
"sign",
"==",
"0",
")",
... | Subtracts the smaller of this and b from the larger and places the
result into this MutableBigInteger. | [
"Subtracts",
"the",
"smaller",
"of",
"this",
"and",
"b",
"from",
"the",
"larger",
"and",
"places",
"the",
"result",
"into",
"this",
"MutableBigInteger",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L913-L958 |
33,966 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.difference | private int difference(MutableBigInteger b) {
MutableBigInteger a = this;
int sign = a.compare(b);
if (sign == 0)
return 0;
if (sign < 0) {
MutableBigInteger tmp = a;
a = b;
b = tmp;
}
long diff = 0;
int x = a.intLen;
int y = b.intLen;
// Subtract common parts of both numbers
while (y > 0) {
x--; y--;
diff = (a.value[a.offset+ x] & LONG_MASK) -
(b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff;
}
// Subtract remainder of longer number
while (x > 0) {
x--;
diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff;
}
a.normalize();
return sign;
} | java | private int difference(MutableBigInteger b) {
MutableBigInteger a = this;
int sign = a.compare(b);
if (sign == 0)
return 0;
if (sign < 0) {
MutableBigInteger tmp = a;
a = b;
b = tmp;
}
long diff = 0;
int x = a.intLen;
int y = b.intLen;
// Subtract common parts of both numbers
while (y > 0) {
x--; y--;
diff = (a.value[a.offset+ x] & LONG_MASK) -
(b.value[b.offset+ y] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff;
}
// Subtract remainder of longer number
while (x > 0) {
x--;
diff = (a.value[a.offset+ x] & LONG_MASK) - ((int)-(diff>>32));
a.value[a.offset+x] = (int)diff;
}
a.normalize();
return sign;
} | [
"private",
"int",
"difference",
"(",
"MutableBigInteger",
"b",
")",
"{",
"MutableBigInteger",
"a",
"=",
"this",
";",
"int",
"sign",
"=",
"a",
".",
"compare",
"(",
"b",
")",
";",
"if",
"(",
"sign",
"==",
"0",
")",
"return",
"0",
";",
"if",
"(",
"sig... | Subtracts the smaller of a and b from the larger and places the result
into the larger. Returns 1 if the answer is in a, -1 if in b, 0 if no
operation was performed. | [
"Subtracts",
"the",
"smaller",
"of",
"a",
"and",
"b",
"from",
"the",
"larger",
"and",
"places",
"the",
"result",
"into",
"the",
"larger",
".",
"Returns",
"1",
"if",
"the",
"answer",
"is",
"in",
"a",
"-",
"1",
"if",
"in",
"b",
"0",
"if",
"no",
"oper... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L965-L996 |
33,967 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.multiply | void multiply(MutableBigInteger y, MutableBigInteger z) {
int xLen = intLen;
int yLen = y.intLen;
int newLen = xLen + yLen;
// Put z into an appropriate state to receive product
if (z.value.length < newLen)
z.value = new int[newLen];
z.offset = 0;
z.intLen = newLen;
// The first iteration is hoisted out of the loop to avoid extra add
long carry = 0;
for (int j=yLen-1, k=yLen+xLen-1; j >= 0; j--, k--) {
long product = (y.value[j+y.offset] & LONG_MASK) *
(value[xLen-1+offset] & LONG_MASK) + carry;
z.value[k] = (int)product;
carry = product >>> 32;
}
z.value[xLen-1] = (int)carry;
// Perform the multiplication word by word
for (int i = xLen-2; i >= 0; i--) {
carry = 0;
for (int j=yLen-1, k=yLen+i; j >= 0; j--, k--) {
long product = (y.value[j+y.offset] & LONG_MASK) *
(value[i+offset] & LONG_MASK) +
(z.value[k] & LONG_MASK) + carry;
z.value[k] = (int)product;
carry = product >>> 32;
}
z.value[i] = (int)carry;
}
// Remove leading zeros from product
z.normalize();
} | java | void multiply(MutableBigInteger y, MutableBigInteger z) {
int xLen = intLen;
int yLen = y.intLen;
int newLen = xLen + yLen;
// Put z into an appropriate state to receive product
if (z.value.length < newLen)
z.value = new int[newLen];
z.offset = 0;
z.intLen = newLen;
// The first iteration is hoisted out of the loop to avoid extra add
long carry = 0;
for (int j=yLen-1, k=yLen+xLen-1; j >= 0; j--, k--) {
long product = (y.value[j+y.offset] & LONG_MASK) *
(value[xLen-1+offset] & LONG_MASK) + carry;
z.value[k] = (int)product;
carry = product >>> 32;
}
z.value[xLen-1] = (int)carry;
// Perform the multiplication word by word
for (int i = xLen-2; i >= 0; i--) {
carry = 0;
for (int j=yLen-1, k=yLen+i; j >= 0; j--, k--) {
long product = (y.value[j+y.offset] & LONG_MASK) *
(value[i+offset] & LONG_MASK) +
(z.value[k] & LONG_MASK) + carry;
z.value[k] = (int)product;
carry = product >>> 32;
}
z.value[i] = (int)carry;
}
// Remove leading zeros from product
z.normalize();
} | [
"void",
"multiply",
"(",
"MutableBigInteger",
"y",
",",
"MutableBigInteger",
"z",
")",
"{",
"int",
"xLen",
"=",
"intLen",
";",
"int",
"yLen",
"=",
"y",
".",
"intLen",
";",
"int",
"newLen",
"=",
"xLen",
"+",
"yLen",
";",
"// Put z into an appropriate state to... | Multiply the contents of two MutableBigInteger objects. The result is
placed into MutableBigInteger z. The contents of y are not changed. | [
"Multiply",
"the",
"contents",
"of",
"two",
"MutableBigInteger",
"objects",
".",
"The",
"result",
"is",
"placed",
"into",
"MutableBigInteger",
"z",
".",
"The",
"contents",
"of",
"y",
"are",
"not",
"changed",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1002-L1038 |
33,968 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.mul | void mul(int y, MutableBigInteger z) {
if (y == 1) {
z.copyValue(this);
return;
}
if (y == 0) {
z.clear();
return;
}
// Perform the multiplication word by word
long ylong = y & LONG_MASK;
int[] zval = (z.value.length < intLen+1 ? new int[intLen + 1]
: z.value);
long carry = 0;
for (int i = intLen-1; i >= 0; i--) {
long product = ylong * (value[i+offset] & LONG_MASK) + carry;
zval[i+1] = (int)product;
carry = product >>> 32;
}
if (carry == 0) {
z.offset = 1;
z.intLen = intLen;
} else {
z.offset = 0;
z.intLen = intLen + 1;
zval[0] = (int)carry;
}
z.value = zval;
} | java | void mul(int y, MutableBigInteger z) {
if (y == 1) {
z.copyValue(this);
return;
}
if (y == 0) {
z.clear();
return;
}
// Perform the multiplication word by word
long ylong = y & LONG_MASK;
int[] zval = (z.value.length < intLen+1 ? new int[intLen + 1]
: z.value);
long carry = 0;
for (int i = intLen-1; i >= 0; i--) {
long product = ylong * (value[i+offset] & LONG_MASK) + carry;
zval[i+1] = (int)product;
carry = product >>> 32;
}
if (carry == 0) {
z.offset = 1;
z.intLen = intLen;
} else {
z.offset = 0;
z.intLen = intLen + 1;
zval[0] = (int)carry;
}
z.value = zval;
} | [
"void",
"mul",
"(",
"int",
"y",
",",
"MutableBigInteger",
"z",
")",
"{",
"if",
"(",
"y",
"==",
"1",
")",
"{",
"z",
".",
"copyValue",
"(",
"this",
")",
";",
"return",
";",
"}",
"if",
"(",
"y",
"==",
"0",
")",
"{",
"z",
".",
"clear",
"(",
")"... | Multiply the contents of this MutableBigInteger by the word y. The
result is placed into z. | [
"Multiply",
"the",
"contents",
"of",
"this",
"MutableBigInteger",
"by",
"the",
"word",
"y",
".",
"The",
"result",
"is",
"placed",
"into",
"z",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1044-L1075 |
33,969 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.divideOneWord | int divideOneWord(int divisor, MutableBigInteger quotient) {
long divisorLong = divisor & LONG_MASK;
// Special case of one word dividend
if (intLen == 1) {
long dividendValue = value[offset] & LONG_MASK;
int q = (int) (dividendValue / divisorLong);
int r = (int) (dividendValue - q * divisorLong);
quotient.value[0] = q;
quotient.intLen = (q == 0) ? 0 : 1;
quotient.offset = 0;
return r;
}
if (quotient.value.length < intLen)
quotient.value = new int[intLen];
quotient.offset = 0;
quotient.intLen = intLen;
// Normalize the divisor
int shift = Integer.numberOfLeadingZeros(divisor);
int rem = value[offset];
long remLong = rem & LONG_MASK;
if (remLong < divisorLong) {
quotient.value[0] = 0;
} else {
quotient.value[0] = (int)(remLong / divisorLong);
rem = (int) (remLong - (quotient.value[0] * divisorLong));
remLong = rem & LONG_MASK;
}
int xlen = intLen;
while (--xlen > 0) {
long dividendEstimate = (remLong << 32) |
(value[offset + intLen - xlen] & LONG_MASK);
int q;
if (dividendEstimate >= 0) {
q = (int) (dividendEstimate / divisorLong);
rem = (int) (dividendEstimate - q * divisorLong);
} else {
long tmp = divWord(dividendEstimate, divisor);
q = (int) (tmp & LONG_MASK);
rem = (int) (tmp >>> 32);
}
quotient.value[intLen - xlen] = q;
remLong = rem & LONG_MASK;
}
quotient.normalize();
// Unnormalize
if (shift > 0)
return rem % divisor;
else
return rem;
} | java | int divideOneWord(int divisor, MutableBigInteger quotient) {
long divisorLong = divisor & LONG_MASK;
// Special case of one word dividend
if (intLen == 1) {
long dividendValue = value[offset] & LONG_MASK;
int q = (int) (dividendValue / divisorLong);
int r = (int) (dividendValue - q * divisorLong);
quotient.value[0] = q;
quotient.intLen = (q == 0) ? 0 : 1;
quotient.offset = 0;
return r;
}
if (quotient.value.length < intLen)
quotient.value = new int[intLen];
quotient.offset = 0;
quotient.intLen = intLen;
// Normalize the divisor
int shift = Integer.numberOfLeadingZeros(divisor);
int rem = value[offset];
long remLong = rem & LONG_MASK;
if (remLong < divisorLong) {
quotient.value[0] = 0;
} else {
quotient.value[0] = (int)(remLong / divisorLong);
rem = (int) (remLong - (quotient.value[0] * divisorLong));
remLong = rem & LONG_MASK;
}
int xlen = intLen;
while (--xlen > 0) {
long dividendEstimate = (remLong << 32) |
(value[offset + intLen - xlen] & LONG_MASK);
int q;
if (dividendEstimate >= 0) {
q = (int) (dividendEstimate / divisorLong);
rem = (int) (dividendEstimate - q * divisorLong);
} else {
long tmp = divWord(dividendEstimate, divisor);
q = (int) (tmp & LONG_MASK);
rem = (int) (tmp >>> 32);
}
quotient.value[intLen - xlen] = q;
remLong = rem & LONG_MASK;
}
quotient.normalize();
// Unnormalize
if (shift > 0)
return rem % divisor;
else
return rem;
} | [
"int",
"divideOneWord",
"(",
"int",
"divisor",
",",
"MutableBigInteger",
"quotient",
")",
"{",
"long",
"divisorLong",
"=",
"divisor",
"&",
"LONG_MASK",
";",
"// Special case of one word dividend",
"if",
"(",
"intLen",
"==",
"1",
")",
"{",
"long",
"dividendValue",
... | This method is used for division of an n word dividend by a one word
divisor. The quotient is placed into quotient. The one word divisor is
specified by divisor.
@return the remainder of the division is returned. | [
"This",
"method",
"is",
"used",
"for",
"division",
"of",
"an",
"n",
"word",
"dividend",
"by",
"a",
"one",
"word",
"divisor",
".",
"The",
"quotient",
"is",
"placed",
"into",
"quotient",
".",
"The",
"one",
"word",
"divisor",
"is",
"specified",
"by",
"divis... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1085-L1139 |
33,970 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.divide | long divide(long v, MutableBigInteger quotient) {
if (v == 0)
throw new ArithmeticException("BigInteger divide by zero");
// Dividend is zero
if (intLen == 0) {
quotient.intLen = quotient.offset = 0;
return 0;
}
if (v < 0)
v = -v;
int d = (int)(v >>> 32);
quotient.clear();
// Special case on word divisor
if (d == 0)
return divideOneWord((int)v, quotient) & LONG_MASK;
else {
return divideLongMagnitude(v, quotient).toLong();
}
} | java | long divide(long v, MutableBigInteger quotient) {
if (v == 0)
throw new ArithmeticException("BigInteger divide by zero");
// Dividend is zero
if (intLen == 0) {
quotient.intLen = quotient.offset = 0;
return 0;
}
if (v < 0)
v = -v;
int d = (int)(v >>> 32);
quotient.clear();
// Special case on word divisor
if (d == 0)
return divideOneWord((int)v, quotient) & LONG_MASK;
else {
return divideLongMagnitude(v, quotient).toLong();
}
} | [
"long",
"divide",
"(",
"long",
"v",
",",
"MutableBigInteger",
"quotient",
")",
"{",
"if",
"(",
"v",
"==",
"0",
")",
"throw",
"new",
"ArithmeticException",
"(",
"\"BigInteger divide by zero\"",
")",
";",
"// Dividend is zero",
"if",
"(",
"intLen",
"==",
"0",
... | Internally used to calculate the quotient of this div v and places the
quotient in the provided MutableBigInteger object and the remainder is
returned.
@return the remainder of the division will be returned. | [
"Internally",
"used",
"to",
"calculate",
"the",
"quotient",
"of",
"this",
"div",
"v",
"and",
"places",
"the",
"quotient",
"in",
"the",
"provided",
"MutableBigInteger",
"object",
"and",
"the",
"remainder",
"is",
"returned",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1437-L1457 |
33,971 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.divaddLong | private int divaddLong(int dh, int dl, int[] result, int offset) {
long carry = 0;
long sum = (dl & LONG_MASK) + (result[1+offset] & LONG_MASK);
result[1+offset] = (int)sum;
sum = (dh & LONG_MASK) + (result[offset] & LONG_MASK) + carry;
result[offset] = (int)sum;
carry = sum >>> 32;
return (int)carry;
} | java | private int divaddLong(int dh, int dl, int[] result, int offset) {
long carry = 0;
long sum = (dl & LONG_MASK) + (result[1+offset] & LONG_MASK);
result[1+offset] = (int)sum;
sum = (dh & LONG_MASK) + (result[offset] & LONG_MASK) + carry;
result[offset] = (int)sum;
carry = sum >>> 32;
return (int)carry;
} | [
"private",
"int",
"divaddLong",
"(",
"int",
"dh",
",",
"int",
"dl",
",",
"int",
"[",
"]",
"result",
",",
"int",
"offset",
")",
"{",
"long",
"carry",
"=",
"0",
";",
"long",
"sum",
"=",
"(",
"dl",
"&",
"LONG_MASK",
")",
"+",
"(",
"result",
"[",
"... | A primitive used for division by long.
Specialized version of the method divadd.
dh is a high part of the divisor, dl is a low part | [
"A",
"primitive",
"used",
"for",
"division",
"by",
"long",
".",
"Specialized",
"version",
"of",
"the",
"method",
"divadd",
".",
"dh",
"is",
"a",
"high",
"part",
"of",
"the",
"divisor",
"dl",
"is",
"a",
"low",
"part"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1791-L1801 |
33,972 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.mulsubLong | private int mulsubLong(int[] q, int dh, int dl, int x, int offset) {
long xLong = x & LONG_MASK;
offset += 2;
long product = (dl & LONG_MASK) * xLong;
long difference = q[offset] - product;
q[offset--] = (int)difference;
long carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
product = (dh & LONG_MASK) * xLong + carry;
difference = q[offset] - product;
q[offset--] = (int)difference;
carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
return (int)carry;
} | java | private int mulsubLong(int[] q, int dh, int dl, int x, int offset) {
long xLong = x & LONG_MASK;
offset += 2;
long product = (dl & LONG_MASK) * xLong;
long difference = q[offset] - product;
q[offset--] = (int)difference;
long carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
product = (dh & LONG_MASK) * xLong + carry;
difference = q[offset] - product;
q[offset--] = (int)difference;
carry = (product >>> 32)
+ (((difference & LONG_MASK) >
(((~(int)product) & LONG_MASK))) ? 1:0);
return (int)carry;
} | [
"private",
"int",
"mulsubLong",
"(",
"int",
"[",
"]",
"q",
",",
"int",
"dh",
",",
"int",
"dl",
",",
"int",
"x",
",",
"int",
"offset",
")",
"{",
"long",
"xLong",
"=",
"x",
"&",
"LONG_MASK",
";",
"offset",
"+=",
"2",
";",
"long",
"product",
"=",
... | This method is used for division by long.
Specialized version of the method sulsub.
dh is a high part of the divisor, dl is a low part | [
"This",
"method",
"is",
"used",
"for",
"division",
"by",
"long",
".",
"Specialized",
"version",
"of",
"the",
"method",
"sulsub",
".",
"dh",
"is",
"a",
"high",
"part",
"of",
"the",
"divisor",
"dl",
"is",
"a",
"low",
"part"
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1808-L1824 |
33,973 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.hybridGCD | MutableBigInteger hybridGCD(MutableBigInteger b) {
// Use Euclid's algorithm until the numbers are approximately the
// same length, then use the binary GCD algorithm to find the GCD.
MutableBigInteger a = this;
MutableBigInteger q = new MutableBigInteger();
while (b.intLen != 0) {
if (Math.abs(a.intLen - b.intLen) < 2)
return a.binaryGCD(b);
MutableBigInteger r = a.divide(b, q);
a = b;
b = r;
}
return a;
} | java | MutableBigInteger hybridGCD(MutableBigInteger b) {
// Use Euclid's algorithm until the numbers are approximately the
// same length, then use the binary GCD algorithm to find the GCD.
MutableBigInteger a = this;
MutableBigInteger q = new MutableBigInteger();
while (b.intLen != 0) {
if (Math.abs(a.intLen - b.intLen) < 2)
return a.binaryGCD(b);
MutableBigInteger r = a.divide(b, q);
a = b;
b = r;
}
return a;
} | [
"MutableBigInteger",
"hybridGCD",
"(",
"MutableBigInteger",
"b",
")",
"{",
"// Use Euclid's algorithm until the numbers are approximately the",
"// same length, then use the binary GCD algorithm to find the GCD.",
"MutableBigInteger",
"a",
"=",
"this",
";",
"MutableBigInteger",
"q",
... | Calculate GCD of this and b. This and b are changed by the computation. | [
"Calculate",
"GCD",
"of",
"this",
"and",
"b",
".",
"This",
"and",
"b",
"are",
"changed",
"by",
"the",
"computation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1871-L1886 |
33,974 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.binaryGCD | private MutableBigInteger binaryGCD(MutableBigInteger v) {
// Algorithm B from Knuth section 4.5.2
MutableBigInteger u = this;
MutableBigInteger r = new MutableBigInteger();
// step B1
int s1 = u.getLowestSetBit();
int s2 = v.getLowestSetBit();
int k = (s1 < s2) ? s1 : s2;
if (k != 0) {
u.rightShift(k);
v.rightShift(k);
}
// step B2
boolean uOdd = (k == s1);
MutableBigInteger t = uOdd ? v: u;
int tsign = uOdd ? -1 : 1;
int lb;
while ((lb = t.getLowestSetBit()) >= 0) {
// steps B3 and B4
t.rightShift(lb);
// step B5
if (tsign > 0)
u = t;
else
v = t;
// Special case one word numbers
if (u.intLen < 2 && v.intLen < 2) {
int x = u.value[u.offset];
int y = v.value[v.offset];
x = binaryGcd(x, y);
r.value[0] = x;
r.intLen = 1;
r.offset = 0;
if (k > 0)
r.leftShift(k);
return r;
}
// step B6
if ((tsign = u.difference(v)) == 0)
break;
t = (tsign >= 0) ? u : v;
}
if (k > 0)
u.leftShift(k);
return u;
} | java | private MutableBigInteger binaryGCD(MutableBigInteger v) {
// Algorithm B from Knuth section 4.5.2
MutableBigInteger u = this;
MutableBigInteger r = new MutableBigInteger();
// step B1
int s1 = u.getLowestSetBit();
int s2 = v.getLowestSetBit();
int k = (s1 < s2) ? s1 : s2;
if (k != 0) {
u.rightShift(k);
v.rightShift(k);
}
// step B2
boolean uOdd = (k == s1);
MutableBigInteger t = uOdd ? v: u;
int tsign = uOdd ? -1 : 1;
int lb;
while ((lb = t.getLowestSetBit()) >= 0) {
// steps B3 and B4
t.rightShift(lb);
// step B5
if (tsign > 0)
u = t;
else
v = t;
// Special case one word numbers
if (u.intLen < 2 && v.intLen < 2) {
int x = u.value[u.offset];
int y = v.value[v.offset];
x = binaryGcd(x, y);
r.value[0] = x;
r.intLen = 1;
r.offset = 0;
if (k > 0)
r.leftShift(k);
return r;
}
// step B6
if ((tsign = u.difference(v)) == 0)
break;
t = (tsign >= 0) ? u : v;
}
if (k > 0)
u.leftShift(k);
return u;
} | [
"private",
"MutableBigInteger",
"binaryGCD",
"(",
"MutableBigInteger",
"v",
")",
"{",
"// Algorithm B from Knuth section 4.5.2",
"MutableBigInteger",
"u",
"=",
"this",
";",
"MutableBigInteger",
"r",
"=",
"new",
"MutableBigInteger",
"(",
")",
";",
"// step B1",
"int",
... | Calculate GCD of this and v.
Assumes that this and v are not zero. | [
"Calculate",
"GCD",
"of",
"this",
"and",
"v",
".",
"Assumes",
"that",
"this",
"and",
"v",
"are",
"not",
"zero",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1892-L1943 |
33,975 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.binaryGcd | static int binaryGcd(int a, int b) {
if (b == 0)
return a;
if (a == 0)
return b;
// Right shift a & b till their last bits equal to 1.
int aZeros = Integer.numberOfTrailingZeros(a);
int bZeros = Integer.numberOfTrailingZeros(b);
a >>>= aZeros;
b >>>= bZeros;
int t = (aZeros < bZeros ? aZeros : bZeros);
while (a != b) {
if ((a+0x80000000) > (b+0x80000000)) { // a > b as unsigned
a -= b;
a >>>= Integer.numberOfTrailingZeros(a);
} else {
b -= a;
b >>>= Integer.numberOfTrailingZeros(b);
}
}
return a<<t;
} | java | static int binaryGcd(int a, int b) {
if (b == 0)
return a;
if (a == 0)
return b;
// Right shift a & b till their last bits equal to 1.
int aZeros = Integer.numberOfTrailingZeros(a);
int bZeros = Integer.numberOfTrailingZeros(b);
a >>>= aZeros;
b >>>= bZeros;
int t = (aZeros < bZeros ? aZeros : bZeros);
while (a != b) {
if ((a+0x80000000) > (b+0x80000000)) { // a > b as unsigned
a -= b;
a >>>= Integer.numberOfTrailingZeros(a);
} else {
b -= a;
b >>>= Integer.numberOfTrailingZeros(b);
}
}
return a<<t;
} | [
"static",
"int",
"binaryGcd",
"(",
"int",
"a",
",",
"int",
"b",
")",
"{",
"if",
"(",
"b",
"==",
"0",
")",
"return",
"a",
";",
"if",
"(",
"a",
"==",
"0",
")",
"return",
"b",
";",
"// Right shift a & b till their last bits equal to 1.",
"int",
"aZeros",
... | Calculate GCD of a and b interpreted as unsigned integers. | [
"Calculate",
"GCD",
"of",
"a",
"and",
"b",
"interpreted",
"as",
"unsigned",
"integers",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1948-L1972 |
33,976 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.mutableModInverse | MutableBigInteger mutableModInverse(MutableBigInteger p) {
// Modulus is odd, use Schroeppel's algorithm
if (p.isOdd())
return modInverse(p);
// Base and modulus are even, throw exception
if (isEven())
throw new ArithmeticException("BigInteger not invertible.");
// Get even part of modulus expressed as a power of 2
int powersOf2 = p.getLowestSetBit();
// Construct odd part of modulus
MutableBigInteger oddMod = new MutableBigInteger(p);
oddMod.rightShift(powersOf2);
if (oddMod.isOne())
return modInverseMP2(powersOf2);
// Calculate 1/a mod oddMod
MutableBigInteger oddPart = modInverse(oddMod);
// Calculate 1/a mod evenMod
MutableBigInteger evenPart = modInverseMP2(powersOf2);
// Combine the results using Chinese Remainder Theorem
MutableBigInteger y1 = modInverseBP2(oddMod, powersOf2);
MutableBigInteger y2 = oddMod.modInverseMP2(powersOf2);
MutableBigInteger temp1 = new MutableBigInteger();
MutableBigInteger temp2 = new MutableBigInteger();
MutableBigInteger result = new MutableBigInteger();
oddPart.leftShift(powersOf2);
oddPart.multiply(y1, result);
evenPart.multiply(oddMod, temp1);
temp1.multiply(y2, temp2);
result.add(temp2);
return result.divide(p, temp1);
} | java | MutableBigInteger mutableModInverse(MutableBigInteger p) {
// Modulus is odd, use Schroeppel's algorithm
if (p.isOdd())
return modInverse(p);
// Base and modulus are even, throw exception
if (isEven())
throw new ArithmeticException("BigInteger not invertible.");
// Get even part of modulus expressed as a power of 2
int powersOf2 = p.getLowestSetBit();
// Construct odd part of modulus
MutableBigInteger oddMod = new MutableBigInteger(p);
oddMod.rightShift(powersOf2);
if (oddMod.isOne())
return modInverseMP2(powersOf2);
// Calculate 1/a mod oddMod
MutableBigInteger oddPart = modInverse(oddMod);
// Calculate 1/a mod evenMod
MutableBigInteger evenPart = modInverseMP2(powersOf2);
// Combine the results using Chinese Remainder Theorem
MutableBigInteger y1 = modInverseBP2(oddMod, powersOf2);
MutableBigInteger y2 = oddMod.modInverseMP2(powersOf2);
MutableBigInteger temp1 = new MutableBigInteger();
MutableBigInteger temp2 = new MutableBigInteger();
MutableBigInteger result = new MutableBigInteger();
oddPart.leftShift(powersOf2);
oddPart.multiply(y1, result);
evenPart.multiply(oddMod, temp1);
temp1.multiply(y2, temp2);
result.add(temp2);
return result.divide(p, temp1);
} | [
"MutableBigInteger",
"mutableModInverse",
"(",
"MutableBigInteger",
"p",
")",
"{",
"// Modulus is odd, use Schroeppel's algorithm",
"if",
"(",
"p",
".",
"isOdd",
"(",
")",
")",
"return",
"modInverse",
"(",
"p",
")",
";",
"// Base and modulus are even, throw exception",
... | Returns the modInverse of this mod p. This and p are not affected by
the operation. | [
"Returns",
"the",
"modInverse",
"of",
"this",
"mod",
"p",
".",
"This",
"and",
"p",
"are",
"not",
"affected",
"by",
"the",
"operation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L1978-L2019 |
33,977 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.inverseMod32 | static int inverseMod32(int val) {
// Newton's iteration!
int t = val;
t *= 2 - val*t;
t *= 2 - val*t;
t *= 2 - val*t;
t *= 2 - val*t;
return t;
} | java | static int inverseMod32(int val) {
// Newton's iteration!
int t = val;
t *= 2 - val*t;
t *= 2 - val*t;
t *= 2 - val*t;
t *= 2 - val*t;
return t;
} | [
"static",
"int",
"inverseMod32",
"(",
"int",
"val",
")",
"{",
"// Newton's iteration!",
"int",
"t",
"=",
"val",
";",
"t",
"*=",
"2",
"-",
"val",
"*",
"t",
";",
"t",
"*=",
"2",
"-",
"val",
"*",
"t",
";",
"t",
"*=",
"2",
"-",
"val",
"*",
"t",
"... | Returns the multiplicative inverse of val mod 2^32. Assumes val is odd. | [
"Returns",
"the",
"multiplicative",
"inverse",
"of",
"val",
"mod",
"2^32",
".",
"Assumes",
"val",
"is",
"odd",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L2056-L2064 |
33,978 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.modInverseBP2 | static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
// Copy the mod to protect original
return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
} | java | static MutableBigInteger modInverseBP2(MutableBigInteger mod, int k) {
// Copy the mod to protect original
return fixup(new MutableBigInteger(1), new MutableBigInteger(mod), k);
} | [
"static",
"MutableBigInteger",
"modInverseBP2",
"(",
"MutableBigInteger",
"mod",
",",
"int",
"k",
")",
"{",
"// Copy the mod to protect original",
"return",
"fixup",
"(",
"new",
"MutableBigInteger",
"(",
"1",
")",
",",
"new",
"MutableBigInteger",
"(",
"mod",
")",
... | Calculate the multiplicative inverse of 2^k mod mod, where mod is odd. | [
"Calculate",
"the",
"multiplicative",
"inverse",
"of",
"2^k",
"mod",
"mod",
"where",
"mod",
"is",
"odd",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L2069-L2072 |
33,979 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.modInverse | private MutableBigInteger modInverse(MutableBigInteger mod) {
MutableBigInteger p = new MutableBigInteger(mod);
MutableBigInteger f = new MutableBigInteger(this);
MutableBigInteger g = new MutableBigInteger(p);
SignedMutableBigInteger c = new SignedMutableBigInteger(1);
SignedMutableBigInteger d = new SignedMutableBigInteger();
MutableBigInteger temp = null;
SignedMutableBigInteger sTemp = null;
int k = 0;
// Right shift f k times until odd, left shift d k times
if (f.isEven()) {
int trailingZeros = f.getLowestSetBit();
f.rightShift(trailingZeros);
d.leftShift(trailingZeros);
k = trailingZeros;
}
// The Almost Inverse Algorithm
while (!f.isOne()) {
// If gcd(f, g) != 1, number is not invertible modulo mod
if (f.isZero())
throw new ArithmeticException("BigInteger not invertible.");
// If f < g exchange f, g and c, d
if (f.compare(g) < 0) {
temp = f; f = g; g = temp;
sTemp = d; d = c; c = sTemp;
}
// If f == g (mod 4)
if (((f.value[f.offset + f.intLen - 1] ^
g.value[g.offset + g.intLen - 1]) & 3) == 0) {
f.subtract(g);
c.signedSubtract(d);
} else { // If f != g (mod 4)
f.add(g);
c.signedAdd(d);
}
// Right shift f k times until odd, left shift d k times
int trailingZeros = f.getLowestSetBit();
f.rightShift(trailingZeros);
d.leftShift(trailingZeros);
k += trailingZeros;
}
while (c.sign < 0)
c.signedAdd(p);
return fixup(c, p, k);
} | java | private MutableBigInteger modInverse(MutableBigInteger mod) {
MutableBigInteger p = new MutableBigInteger(mod);
MutableBigInteger f = new MutableBigInteger(this);
MutableBigInteger g = new MutableBigInteger(p);
SignedMutableBigInteger c = new SignedMutableBigInteger(1);
SignedMutableBigInteger d = new SignedMutableBigInteger();
MutableBigInteger temp = null;
SignedMutableBigInteger sTemp = null;
int k = 0;
// Right shift f k times until odd, left shift d k times
if (f.isEven()) {
int trailingZeros = f.getLowestSetBit();
f.rightShift(trailingZeros);
d.leftShift(trailingZeros);
k = trailingZeros;
}
// The Almost Inverse Algorithm
while (!f.isOne()) {
// If gcd(f, g) != 1, number is not invertible modulo mod
if (f.isZero())
throw new ArithmeticException("BigInteger not invertible.");
// If f < g exchange f, g and c, d
if (f.compare(g) < 0) {
temp = f; f = g; g = temp;
sTemp = d; d = c; c = sTemp;
}
// If f == g (mod 4)
if (((f.value[f.offset + f.intLen - 1] ^
g.value[g.offset + g.intLen - 1]) & 3) == 0) {
f.subtract(g);
c.signedSubtract(d);
} else { // If f != g (mod 4)
f.add(g);
c.signedAdd(d);
}
// Right shift f k times until odd, left shift d k times
int trailingZeros = f.getLowestSetBit();
f.rightShift(trailingZeros);
d.leftShift(trailingZeros);
k += trailingZeros;
}
while (c.sign < 0)
c.signedAdd(p);
return fixup(c, p, k);
} | [
"private",
"MutableBigInteger",
"modInverse",
"(",
"MutableBigInteger",
"mod",
")",
"{",
"MutableBigInteger",
"p",
"=",
"new",
"MutableBigInteger",
"(",
"mod",
")",
";",
"MutableBigInteger",
"f",
"=",
"new",
"MutableBigInteger",
"(",
"this",
")",
";",
"MutableBigI... | Calculate the multiplicative inverse of this mod mod, where mod is odd.
This and mod are not changed by the calculation.
This method implements an algorithm due to Richard Schroeppel, that uses
the same intermediate representation as Montgomery Reduction
("Montgomery Form"). The algorithm is described in an unpublished
manuscript entitled "Fast Modular Reciprocals." | [
"Calculate",
"the",
"multiplicative",
"inverse",
"of",
"this",
"mod",
"mod",
"where",
"mod",
"is",
"odd",
".",
"This",
"and",
"mod",
"are",
"not",
"changed",
"by",
"the",
"calculation",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L2083-L2134 |
33,980 | google/j2objc | jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java | MutableBigInteger.euclidModInverse | MutableBigInteger euclidModInverse(int k) {
MutableBigInteger b = new MutableBigInteger(1);
b.leftShift(k);
MutableBigInteger mod = new MutableBigInteger(b);
MutableBigInteger a = new MutableBigInteger(this);
MutableBigInteger q = new MutableBigInteger();
MutableBigInteger r = b.divide(a, q);
MutableBigInteger swapper = b;
// swap b & r
b = r;
r = swapper;
MutableBigInteger t1 = new MutableBigInteger(q);
MutableBigInteger t0 = new MutableBigInteger(1);
MutableBigInteger temp = new MutableBigInteger();
while (!b.isOne()) {
r = a.divide(b, q);
if (r.intLen == 0)
throw new ArithmeticException("BigInteger not invertible.");
swapper = r;
a = swapper;
if (q.intLen == 1)
t1.mul(q.value[q.offset], temp);
else
q.multiply(t1, temp);
swapper = q;
q = temp;
temp = swapper;
t0.add(q);
if (a.isOne())
return t0;
r = b.divide(a, q);
if (r.intLen == 0)
throw new ArithmeticException("BigInteger not invertible.");
swapper = b;
b = r;
if (q.intLen == 1)
t0.mul(q.value[q.offset], temp);
else
q.multiply(t0, temp);
swapper = q; q = temp; temp = swapper;
t1.add(q);
}
mod.subtract(t1);
return mod;
} | java | MutableBigInteger euclidModInverse(int k) {
MutableBigInteger b = new MutableBigInteger(1);
b.leftShift(k);
MutableBigInteger mod = new MutableBigInteger(b);
MutableBigInteger a = new MutableBigInteger(this);
MutableBigInteger q = new MutableBigInteger();
MutableBigInteger r = b.divide(a, q);
MutableBigInteger swapper = b;
// swap b & r
b = r;
r = swapper;
MutableBigInteger t1 = new MutableBigInteger(q);
MutableBigInteger t0 = new MutableBigInteger(1);
MutableBigInteger temp = new MutableBigInteger();
while (!b.isOne()) {
r = a.divide(b, q);
if (r.intLen == 0)
throw new ArithmeticException("BigInteger not invertible.");
swapper = r;
a = swapper;
if (q.intLen == 1)
t1.mul(q.value[q.offset], temp);
else
q.multiply(t1, temp);
swapper = q;
q = temp;
temp = swapper;
t0.add(q);
if (a.isOne())
return t0;
r = b.divide(a, q);
if (r.intLen == 0)
throw new ArithmeticException("BigInteger not invertible.");
swapper = b;
b = r;
if (q.intLen == 1)
t0.mul(q.value[q.offset], temp);
else
q.multiply(t0, temp);
swapper = q; q = temp; temp = swapper;
t1.add(q);
}
mod.subtract(t1);
return mod;
} | [
"MutableBigInteger",
"euclidModInverse",
"(",
"int",
"k",
")",
"{",
"MutableBigInteger",
"b",
"=",
"new",
"MutableBigInteger",
"(",
"1",
")",
";",
"b",
".",
"leftShift",
"(",
"k",
")",
";",
"MutableBigInteger",
"mod",
"=",
"new",
"MutableBigInteger",
"(",
"b... | Uses the extended Euclidean algorithm to compute the modInverse of base
mod a modulus that is a power of 2. The modulus is 2^k. | [
"Uses",
"the",
"extended",
"Euclidean",
"algorithm",
"to",
"compute",
"the",
"modInverse",
"of",
"base",
"mod",
"a",
"modulus",
"that",
"is",
"a",
"power",
"of",
"2",
".",
"The",
"modulus",
"is",
"2^k",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/openjdk/src/share/classes/java/math/MutableBigInteger.java#L2179-L2236 |
33,981 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimePrintContext.java | DateTimePrintContext.getValue | <R> R getValue(TemporalQuery<R> query) {
R result = temporal.query(query);
if (result == null && optional == 0) {
throw new DateTimeException("Unable to extract value: " + temporal.getClass());
}
return result;
} | java | <R> R getValue(TemporalQuery<R> query) {
R result = temporal.query(query);
if (result == null && optional == 0) {
throw new DateTimeException("Unable to extract value: " + temporal.getClass());
}
return result;
} | [
"<",
"R",
">",
"R",
"getValue",
"(",
"TemporalQuery",
"<",
"R",
">",
"query",
")",
"{",
"R",
"result",
"=",
"temporal",
".",
"query",
"(",
"query",
")",
";",
"if",
"(",
"result",
"==",
"null",
"&&",
"optional",
"==",
"0",
")",
"{",
"throw",
"new"... | Gets a value using a query.
@param query the query to use, not null
@return the result, null if not found and optional is true
@throws DateTimeException if the type is not available and the section is not optional | [
"Gets",
"a",
"value",
"using",
"a",
"query",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/format/DateTimePrintContext.java#L279-L285 |
33,982 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java | Date.compareTo | public int compareTo(Date anotherDate) {
long thisTime = getMillisOf(this);
long anotherTime = getMillisOf(anotherDate);
return (thisTime<anotherTime ? -1 : (thisTime==anotherTime ? 0 : 1));
} | java | public int compareTo(Date anotherDate) {
long thisTime = getMillisOf(this);
long anotherTime = getMillisOf(anotherDate);
return (thisTime<anotherTime ? -1 : (thisTime==anotherTime ? 0 : 1));
} | [
"public",
"int",
"compareTo",
"(",
"Date",
"anotherDate",
")",
"{",
"long",
"thisTime",
"=",
"getMillisOf",
"(",
"this",
")",
";",
"long",
"anotherTime",
"=",
"getMillisOf",
"(",
"anotherDate",
")",
";",
"return",
"(",
"thisTime",
"<",
"anotherTime",
"?",
... | Compares two Dates for ordering.
@param anotherDate the <code>Date</code> to be compared.
@return the value <code>0</code> if the argument Date is equal to
this Date; a value less than <code>0</code> if this Date
is before the Date argument; and a value greater than
<code>0</code> if this Date is after the Date argument.
@since 1.2
@exception NullPointerException if <code>anotherDate</code> is null. | [
"Compares",
"two",
"Dates",
"for",
"ordering",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java#L995-L999 |
33,983 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java | Date.normalize | private final BaseCalendar.Date normalize(BaseCalendar.Date date) {
int y = date.getNormalizedYear();
int m = date.getMonth();
int d = date.getDayOfMonth();
int hh = date.getHours();
int mm = date.getMinutes();
int ss = date.getSeconds();
int ms = date.getMillis();
TimeZone tz = date.getZone();
// If the specified year can't be handled using a long value
// in milliseconds, GregorianCalendar is used for full
// compatibility with underflow and overflow. This is required
// by some JCK tests. The limits are based max year values -
// years that can be represented by max values of d, hh, mm,
// ss and ms. Also, let GregorianCalendar handle the default
// cutover year so that we don't need to worry about the
// transition here.
if (y == 1582 || y > 280000000 || y < -280000000) {
if (tz == null) {
tz = TimeZone.getTimeZone("GMT");
}
GregorianCalendar gc = new GregorianCalendar(tz);
gc.clear();
gc.set(GregorianCalendar.MILLISECOND, ms);
gc.set(y, m-1, d, hh, mm, ss);
fastTime = gc.getTimeInMillis();
BaseCalendar cal = getCalendarSystem(fastTime);
date = (BaseCalendar.Date) cal.getCalendarDate(fastTime, tz);
return date;
}
BaseCalendar cal = getCalendarSystem(y);
if (cal != getCalendarSystem(date)) {
date = (BaseCalendar.Date) cal.newCalendarDate(tz);
date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
}
// Perform the GregorianCalendar-style normalization.
fastTime = cal.getTime(date);
// In case the normalized date requires the other calendar
// system, we need to recalculate it using the other one.
BaseCalendar ncal = getCalendarSystem(fastTime);
if (ncal != cal) {
date = (BaseCalendar.Date) ncal.newCalendarDate(tz);
date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
fastTime = ncal.getTime(date);
}
return date;
} | java | private final BaseCalendar.Date normalize(BaseCalendar.Date date) {
int y = date.getNormalizedYear();
int m = date.getMonth();
int d = date.getDayOfMonth();
int hh = date.getHours();
int mm = date.getMinutes();
int ss = date.getSeconds();
int ms = date.getMillis();
TimeZone tz = date.getZone();
// If the specified year can't be handled using a long value
// in milliseconds, GregorianCalendar is used for full
// compatibility with underflow and overflow. This is required
// by some JCK tests. The limits are based max year values -
// years that can be represented by max values of d, hh, mm,
// ss and ms. Also, let GregorianCalendar handle the default
// cutover year so that we don't need to worry about the
// transition here.
if (y == 1582 || y > 280000000 || y < -280000000) {
if (tz == null) {
tz = TimeZone.getTimeZone("GMT");
}
GregorianCalendar gc = new GregorianCalendar(tz);
gc.clear();
gc.set(GregorianCalendar.MILLISECOND, ms);
gc.set(y, m-1, d, hh, mm, ss);
fastTime = gc.getTimeInMillis();
BaseCalendar cal = getCalendarSystem(fastTime);
date = (BaseCalendar.Date) cal.getCalendarDate(fastTime, tz);
return date;
}
BaseCalendar cal = getCalendarSystem(y);
if (cal != getCalendarSystem(date)) {
date = (BaseCalendar.Date) cal.newCalendarDate(tz);
date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
}
// Perform the GregorianCalendar-style normalization.
fastTime = cal.getTime(date);
// In case the normalized date requires the other calendar
// system, we need to recalculate it using the other one.
BaseCalendar ncal = getCalendarSystem(fastTime);
if (ncal != cal) {
date = (BaseCalendar.Date) ncal.newCalendarDate(tz);
date.setNormalizedDate(y, m, d).setTimeOfDay(hh, mm, ss, ms);
fastTime = ncal.getTime(date);
}
return date;
} | [
"private",
"final",
"BaseCalendar",
".",
"Date",
"normalize",
"(",
"BaseCalendar",
".",
"Date",
"date",
")",
"{",
"int",
"y",
"=",
"date",
".",
"getNormalizedYear",
"(",
")",
";",
"int",
"m",
"=",
"date",
".",
"getMonth",
"(",
")",
";",
"int",
"d",
"... | fastTime and the returned data are in sync upon return. | [
"fastTime",
"and",
"the",
"returned",
"data",
"are",
"in",
"sync",
"upon",
"return",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Date.java#L1235-L1284 |
33,984 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java | ZoneRules.of | public static ZoneRules of(ZoneOffset baseStandardOffset,
ZoneOffset baseWallOffset,
List<ZoneOffsetTransition> standardOffsetTransitionList,
List<ZoneOffsetTransition> transitionList,
List<ZoneOffsetTransitionRule> lastRules) {
Objects.requireNonNull(baseStandardOffset, "baseStandardOffset");
Objects.requireNonNull(baseWallOffset, "baseWallOffset");
Objects.requireNonNull(standardOffsetTransitionList, "standardOffsetTransitionList");
Objects.requireNonNull(transitionList, "transitionList");
Objects.requireNonNull(lastRules, "lastRules");
return new ZoneRules(baseStandardOffset, baseWallOffset,
standardOffsetTransitionList, transitionList, lastRules);
} | java | public static ZoneRules of(ZoneOffset baseStandardOffset,
ZoneOffset baseWallOffset,
List<ZoneOffsetTransition> standardOffsetTransitionList,
List<ZoneOffsetTransition> transitionList,
List<ZoneOffsetTransitionRule> lastRules) {
Objects.requireNonNull(baseStandardOffset, "baseStandardOffset");
Objects.requireNonNull(baseWallOffset, "baseWallOffset");
Objects.requireNonNull(standardOffsetTransitionList, "standardOffsetTransitionList");
Objects.requireNonNull(transitionList, "transitionList");
Objects.requireNonNull(lastRules, "lastRules");
return new ZoneRules(baseStandardOffset, baseWallOffset,
standardOffsetTransitionList, transitionList, lastRules);
} | [
"public",
"static",
"ZoneRules",
"of",
"(",
"ZoneOffset",
"baseStandardOffset",
",",
"ZoneOffset",
"baseWallOffset",
",",
"List",
"<",
"ZoneOffsetTransition",
">",
"standardOffsetTransitionList",
",",
"List",
"<",
"ZoneOffsetTransition",
">",
"transitionList",
",",
"Lis... | Obtains an instance of a ZoneRules.
@param baseStandardOffset the standard offset to use before legal rules were set, not null
@param baseWallOffset the wall offset to use before legal rules were set, not null
@param standardOffsetTransitionList the list of changes to the standard offset, not null
@param transitionList the list of transitions, not null
@param lastRules the recurring last rules, size 16 or less, not null
@return the zone rules, not null | [
"Obtains",
"an",
"instance",
"of",
"a",
"ZoneRules",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L176-L188 |
33,985 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java | ZoneRules.findOffsetInfo | private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) {
LocalDateTime localTransition = trans.getDateTimeBefore();
if (trans.isGap()) {
if (dt.isBefore(localTransition)) {
return trans.getOffsetBefore();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans;
} else {
return trans.getOffsetAfter();
}
} else {
if (dt.isBefore(localTransition) == false) {
return trans.getOffsetAfter();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans.getOffsetBefore();
} else {
return trans;
}
}
} | java | private Object findOffsetInfo(LocalDateTime dt, ZoneOffsetTransition trans) {
LocalDateTime localTransition = trans.getDateTimeBefore();
if (trans.isGap()) {
if (dt.isBefore(localTransition)) {
return trans.getOffsetBefore();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans;
} else {
return trans.getOffsetAfter();
}
} else {
if (dt.isBefore(localTransition) == false) {
return trans.getOffsetAfter();
}
if (dt.isBefore(trans.getDateTimeAfter())) {
return trans.getOffsetBefore();
} else {
return trans;
}
}
} | [
"private",
"Object",
"findOffsetInfo",
"(",
"LocalDateTime",
"dt",
",",
"ZoneOffsetTransition",
"trans",
")",
"{",
"LocalDateTime",
"localTransition",
"=",
"trans",
".",
"getDateTimeBefore",
"(",
")",
";",
"if",
"(",
"trans",
".",
"isGap",
"(",
")",
")",
"{",
... | Finds the offset info for a local date-time and transition.
@param dt the date-time, not null
@param trans the transition, not null
@return the offset info, not null | [
"Finds",
"the",
"offset",
"info",
"for",
"a",
"local",
"date",
"-",
"time",
"and",
"transition",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L692-L713 |
33,986 | google/j2objc | jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java | ZoneRules.findTransitionArray | private ZoneOffsetTransition[] findTransitionArray(int year) {
Integer yearObj = year; // should use Year class, but this saves a class load
ZoneOffsetTransition[] transArray = lastRulesCache.get(yearObj);
if (transArray != null) {
return transArray;
}
ZoneOffsetTransitionRule[] ruleArray = lastRules;
transArray = new ZoneOffsetTransition[ruleArray.length];
for (int i = 0; i < ruleArray.length; i++) {
transArray[i] = ruleArray[i].createTransition(year);
}
if (year < LAST_CACHED_YEAR) {
lastRulesCache.putIfAbsent(yearObj, transArray);
}
return transArray;
} | java | private ZoneOffsetTransition[] findTransitionArray(int year) {
Integer yearObj = year; // should use Year class, but this saves a class load
ZoneOffsetTransition[] transArray = lastRulesCache.get(yearObj);
if (transArray != null) {
return transArray;
}
ZoneOffsetTransitionRule[] ruleArray = lastRules;
transArray = new ZoneOffsetTransition[ruleArray.length];
for (int i = 0; i < ruleArray.length; i++) {
transArray[i] = ruleArray[i].createTransition(year);
}
if (year < LAST_CACHED_YEAR) {
lastRulesCache.putIfAbsent(yearObj, transArray);
}
return transArray;
} | [
"private",
"ZoneOffsetTransition",
"[",
"]",
"findTransitionArray",
"(",
"int",
"year",
")",
"{",
"Integer",
"yearObj",
"=",
"year",
";",
"// should use Year class, but this saves a class load",
"ZoneOffsetTransition",
"[",
"]",
"transArray",
"=",
"lastRulesCache",
".",
... | Finds the appropriate transition array for the given year.
@param year the year, not null
@return the transition array, not null | [
"Finds",
"the",
"appropriate",
"transition",
"array",
"for",
"the",
"given",
"year",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/zone/ZoneRules.java#L721-L736 |
33,987 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getNode | public int getNode(Source source)
{
// if (source instanceof DOMSource)
// return ((DOMSource) source).getNode();
// TODO: Not sure if the BaseID is really the same thing as the ID.
String url = source.getSystemId();
if (null == url)
return DTM.NULL;
int n = m_sourceTree.size();
// System.out.println("getNode: "+n);
for (int i = 0; i < n; i++)
{
SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
// System.out.println("getNode - url: "+url);
// System.out.println("getNode - sTree.m_url: "+sTree.m_url);
if (url.equals(sTree.m_url))
return sTree.m_root;
}
// System.out.println("getNode - returning: "+node);
return DTM.NULL;
} | java | public int getNode(Source source)
{
// if (source instanceof DOMSource)
// return ((DOMSource) source).getNode();
// TODO: Not sure if the BaseID is really the same thing as the ID.
String url = source.getSystemId();
if (null == url)
return DTM.NULL;
int n = m_sourceTree.size();
// System.out.println("getNode: "+n);
for (int i = 0; i < n; i++)
{
SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
// System.out.println("getNode - url: "+url);
// System.out.println("getNode - sTree.m_url: "+sTree.m_url);
if (url.equals(sTree.m_url))
return sTree.m_root;
}
// System.out.println("getNode - returning: "+node);
return DTM.NULL;
} | [
"public",
"int",
"getNode",
"(",
"Source",
"source",
")",
"{",
"// if (source instanceof DOMSource)",
"// return ((DOMSource) source).getNode();",
"// TODO: Not sure if the BaseID is really the same thing as the ID.",
"String",
"url",
"=",
"source",
".",
"getSystemId",
"(",... | Given a Source object, find the node associated with it.
@param source The Source object to act as the key.
@return The node that is associated with the Source, or null if not found. | [
"Given",
"a",
"Source",
"object",
"find",
"the",
"node",
"associated",
"with",
"it",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L196-L223 |
33,988 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getSourceTree | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | java | public int getSourceTree(
String base, String urlString, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
// System.out.println("getSourceTree");
try
{
Source source = this.resolveURI(base, urlString, locator);
// System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
return getSourceTree(source, locator, xctxt);
}
catch (IOException ioe)
{
throw new TransformerException(ioe.getMessage(), locator, ioe);
}
/* catch (TransformerException te)
{
throw new TransformerException(te.getMessage(), locator, te);
}*/
} | [
"public",
"int",
"getSourceTree",
"(",
"String",
"base",
",",
"String",
"urlString",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"// System.out.println(\"getSourceTree\");",
"try",
"{",
"Source",
"source",
... | Get the source tree from the a base URL and a URL string.
@param base The base URI to use if the urlString is relative.
@param urlString An absolute or relative URL string.
@param locator The location of the caller, for diagnostic purposes.
@return should be a non-null reference to the node identified by the
base and urlString.
@throws TransformerException If the URL can not resolve to a node. | [
"Get",
"the",
"source",
"tree",
"from",
"the",
"a",
"base",
"URL",
"and",
"a",
"URL",
"string",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L237-L259 |
33,989 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.getSourceTree | public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
int n = getNode(source);
if (DTM.NULL != n)
return n;
n = parseToNode(source, locator, xctxt);
if (DTM.NULL != n)
putDocumentInCache(n, source);
return n;
} | java | public int getSourceTree(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
int n = getNode(source);
if (DTM.NULL != n)
return n;
n = parseToNode(source, locator, xctxt);
if (DTM.NULL != n)
putDocumentInCache(n, source);
return n;
} | [
"public",
"int",
"getSourceTree",
"(",
"Source",
"source",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"int",
"n",
"=",
"getNode",
"(",
"source",
")",
";",
"if",
"(",
"DTM",
".",
"NULL",
"!=",
... | Get the source tree from the input source.
@param source The Source object that should identify the desired node.
@param locator The location of the caller, for diagnostic purposes.
@return non-null reference to a node.
@throws TransformerException if the Source argument can't be resolved to
a node. | [
"Get",
"the",
"source",
"tree",
"from",
"the",
"input",
"source",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L272-L287 |
33,990 | google/j2objc | xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java | SourceTreeManager.parseToNode | public int parseToNode(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
try
{
Object xowner = xctxt.getOwnerObject();
DTM dtm;
if(null != xowner && xowner instanceof org.apache.xml.dtm.DTMWSFilter)
{
dtm = xctxt.getDTM(source, false,
(org.apache.xml.dtm.DTMWSFilter)xowner, false, true);
}
else
{
dtm = xctxt.getDTM(source, false, null, false, true);
}
return dtm.getDocument();
}
catch (Exception e)
{
//e.printStackTrace();
throw new TransformerException(e.getMessage(), locator, e);
}
} | java | public int parseToNode(Source source, SourceLocator locator, XPathContext xctxt)
throws TransformerException
{
try
{
Object xowner = xctxt.getOwnerObject();
DTM dtm;
if(null != xowner && xowner instanceof org.apache.xml.dtm.DTMWSFilter)
{
dtm = xctxt.getDTM(source, false,
(org.apache.xml.dtm.DTMWSFilter)xowner, false, true);
}
else
{
dtm = xctxt.getDTM(source, false, null, false, true);
}
return dtm.getDocument();
}
catch (Exception e)
{
//e.printStackTrace();
throw new TransformerException(e.getMessage(), locator, e);
}
} | [
"public",
"int",
"parseToNode",
"(",
"Source",
"source",
",",
"SourceLocator",
"locator",
",",
"XPathContext",
"xctxt",
")",
"throws",
"TransformerException",
"{",
"try",
"{",
"Object",
"xowner",
"=",
"xctxt",
".",
"getOwnerObject",
"(",
")",
";",
"DTM",
"dtm"... | Try to create a DOM source tree from the input source.
@param source The Source object that identifies the source node.
@param locator The location of the caller, for diagnostic purposes.
@return non-null reference to node identified by the source argument.
@throws TransformerException if the source argument can not be resolved
to a source node. | [
"Try",
"to",
"create",
"a",
"DOM",
"source",
"tree",
"from",
"the",
"input",
"source",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/SourceTreeManager.java#L300-L325 |
33,991 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java | UCaseProps.addCaseClosure | public final void addCaseClosure(int c, UnicodeSet set) {
/*
* Hardcode the case closure of i and its relatives and ignore the
* data file data for these characters.
* The Turkic dotless i and dotted I with their case mapping conditions
* and case folding option make the related characters behave specially.
* This code matches their closure behavior to their case folding behavior.
*/
switch(c) {
case 0x49:
/* regular i and I are in one equivalence class */
set.add(0x69);
return;
case 0x69:
set.add(0x49);
return;
case 0x130:
/* dotted I is in a class with <0069 0307> (for canonical equivalence with <0049 0307>) */
set.add(iDot);
return;
case 0x131:
/* dotless i is in a class by itself */
return;
default:
/* otherwise use the data file data */
break;
}
int props=trie.get(c);
if(!propsHasException(props)) {
if(getTypeFromProps(props)!=NONE) {
/* add the one simple case mapping, no matter what type it is */
int delta=getDelta(props);
if(delta!=0) {
set.add(c+delta);
}
}
} else {
/*
* c has exceptions, so there may be multiple simple and/or
* full case mappings. Add them all.
*/
int excOffset0, excOffset=getExceptionsOffset(props);
int closureOffset;
int excWord=exceptions.charAt(excOffset++);
int index, closureLength, fullLength, length;
excOffset0=excOffset;
/* add all simple case mappings */
for(index=EXC_LOWER; index<=EXC_TITLE; ++index) {
if(hasSlot(excWord, index)) {
excOffset=excOffset0;
c=getSlotValue(excWord, index, excOffset);
set.add(c);
}
}
/* get the closure string pointer & length */
if(hasSlot(excWord, EXC_CLOSURE)) {
excOffset=excOffset0;
long value=getSlotValueAndOffset(excWord, EXC_CLOSURE, excOffset);
closureLength=(int)value&CLOSURE_MAX_LENGTH; /* higher bits are reserved */
closureOffset=(int)(value>>32)+1; /* behind this slot, unless there are full case mappings */
} else {
closureLength=0;
closureOffset=0;
}
/* add the full case folding */
if(hasSlot(excWord, EXC_FULL_MAPPINGS)) {
excOffset=excOffset0;
long value=getSlotValueAndOffset(excWord, EXC_FULL_MAPPINGS, excOffset);
fullLength=(int)value;
/* start of full case mapping strings */
excOffset=(int)(value>>32)+1;
fullLength&=0xffff; /* bits 16 and higher are reserved */
/* skip the lowercase result string */
excOffset+=fullLength&FULL_LOWER;
fullLength>>=4;
/* add the full case folding string */
length=fullLength&0xf;
if(length!=0) {
set.add(exceptions.substring(excOffset, excOffset+length));
excOffset+=length;
}
/* skip the uppercase and titlecase strings */
fullLength>>=4;
excOffset+=fullLength&0xf;
fullLength>>=4;
excOffset+=fullLength;
closureOffset=excOffset; /* behind full case mappings */
}
/* add each code point in the closure string */
int limit=closureOffset+closureLength;
for(index=closureOffset; index<limit; index+=UTF16.getCharCount(c)) {
c=exceptions.codePointAt(index);
set.add(c);
}
}
} | java | public final void addCaseClosure(int c, UnicodeSet set) {
/*
* Hardcode the case closure of i and its relatives and ignore the
* data file data for these characters.
* The Turkic dotless i and dotted I with their case mapping conditions
* and case folding option make the related characters behave specially.
* This code matches their closure behavior to their case folding behavior.
*/
switch(c) {
case 0x49:
/* regular i and I are in one equivalence class */
set.add(0x69);
return;
case 0x69:
set.add(0x49);
return;
case 0x130:
/* dotted I is in a class with <0069 0307> (for canonical equivalence with <0049 0307>) */
set.add(iDot);
return;
case 0x131:
/* dotless i is in a class by itself */
return;
default:
/* otherwise use the data file data */
break;
}
int props=trie.get(c);
if(!propsHasException(props)) {
if(getTypeFromProps(props)!=NONE) {
/* add the one simple case mapping, no matter what type it is */
int delta=getDelta(props);
if(delta!=0) {
set.add(c+delta);
}
}
} else {
/*
* c has exceptions, so there may be multiple simple and/or
* full case mappings. Add them all.
*/
int excOffset0, excOffset=getExceptionsOffset(props);
int closureOffset;
int excWord=exceptions.charAt(excOffset++);
int index, closureLength, fullLength, length;
excOffset0=excOffset;
/* add all simple case mappings */
for(index=EXC_LOWER; index<=EXC_TITLE; ++index) {
if(hasSlot(excWord, index)) {
excOffset=excOffset0;
c=getSlotValue(excWord, index, excOffset);
set.add(c);
}
}
/* get the closure string pointer & length */
if(hasSlot(excWord, EXC_CLOSURE)) {
excOffset=excOffset0;
long value=getSlotValueAndOffset(excWord, EXC_CLOSURE, excOffset);
closureLength=(int)value&CLOSURE_MAX_LENGTH; /* higher bits are reserved */
closureOffset=(int)(value>>32)+1; /* behind this slot, unless there are full case mappings */
} else {
closureLength=0;
closureOffset=0;
}
/* add the full case folding */
if(hasSlot(excWord, EXC_FULL_MAPPINGS)) {
excOffset=excOffset0;
long value=getSlotValueAndOffset(excWord, EXC_FULL_MAPPINGS, excOffset);
fullLength=(int)value;
/* start of full case mapping strings */
excOffset=(int)(value>>32)+1;
fullLength&=0xffff; /* bits 16 and higher are reserved */
/* skip the lowercase result string */
excOffset+=fullLength&FULL_LOWER;
fullLength>>=4;
/* add the full case folding string */
length=fullLength&0xf;
if(length!=0) {
set.add(exceptions.substring(excOffset, excOffset+length));
excOffset+=length;
}
/* skip the uppercase and titlecase strings */
fullLength>>=4;
excOffset+=fullLength&0xf;
fullLength>>=4;
excOffset+=fullLength;
closureOffset=excOffset; /* behind full case mappings */
}
/* add each code point in the closure string */
int limit=closureOffset+closureLength;
for(index=closureOffset; index<limit; index+=UTF16.getCharCount(c)) {
c=exceptions.codePointAt(index);
set.add(c);
}
}
} | [
"public",
"final",
"void",
"addCaseClosure",
"(",
"int",
"c",
",",
"UnicodeSet",
"set",
")",
"{",
"/*\n * Hardcode the case closure of i and its relatives and ignore the\n * data file data for these characters.\n * The Turkic dotless i and dotted I with their case map... | Adds all simple case mappings and the full case folding for c to sa,
and also adds special case closure mappings.
c itself is not added.
For example, the mappings
- for s include long s
- for sharp s include ss
- for k include the Kelvin sign | [
"Adds",
"all",
"simple",
"case",
"mappings",
"and",
"the",
"full",
"case",
"folding",
"for",
"c",
"to",
"sa",
"and",
"also",
"adds",
"special",
"case",
"closure",
"mappings",
".",
"c",
"itself",
"is",
"not",
"added",
".",
"For",
"example",
"the",
"mappin... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java#L254-L362 |
33,992 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java | UCaseProps.addStringCaseClosure | public final boolean addStringCaseClosure(String s, UnicodeSet set) {
int i, length, start, limit, result, unfoldOffset, unfoldRows, unfoldRowWidth, unfoldStringWidth;
if(unfold==null || s==null) {
return false; /* no reverse case folding data, or no string */
}
length=s.length();
if(length<=1) {
/* the string is too short to find any match */
/*
* more precise would be:
* if(!u_strHasMoreChar32Than(s, length, 1))
* but this does not make much practical difference because
* a single supplementary code point would just not be found
*/
return false;
}
unfoldRows=unfold[UNFOLD_ROWS];
unfoldRowWidth=unfold[UNFOLD_ROW_WIDTH];
unfoldStringWidth=unfold[UNFOLD_STRING_WIDTH];
//unfoldCPWidth=unfoldRowWidth-unfoldStringWidth;
if(length>unfoldStringWidth) {
/* the string is too long to find any match */
return false;
}
/* do a binary search for the string */
start=0;
limit=unfoldRows;
while(start<limit) {
i=(start+limit)/2;
unfoldOffset=((i+1)*unfoldRowWidth); // +1 to skip the header values above
result=strcmpMax(s, unfoldOffset, unfoldStringWidth);
if(result==0) {
/* found the string: add each code point, and its case closure */
int c;
for(i=unfoldStringWidth; i<unfoldRowWidth && unfold[unfoldOffset+i]!=0; i+=UTF16.getCharCount(c)) {
c=UTF16.charAt(unfold, unfoldOffset, unfold.length, i);
set.add(c);
addCaseClosure(c, set);
}
return true;
} else if(result<0) {
limit=i;
} else /* result>0 */ {
start=i+1;
}
}
return false; /* string not found */
} | java | public final boolean addStringCaseClosure(String s, UnicodeSet set) {
int i, length, start, limit, result, unfoldOffset, unfoldRows, unfoldRowWidth, unfoldStringWidth;
if(unfold==null || s==null) {
return false; /* no reverse case folding data, or no string */
}
length=s.length();
if(length<=1) {
/* the string is too short to find any match */
/*
* more precise would be:
* if(!u_strHasMoreChar32Than(s, length, 1))
* but this does not make much practical difference because
* a single supplementary code point would just not be found
*/
return false;
}
unfoldRows=unfold[UNFOLD_ROWS];
unfoldRowWidth=unfold[UNFOLD_ROW_WIDTH];
unfoldStringWidth=unfold[UNFOLD_STRING_WIDTH];
//unfoldCPWidth=unfoldRowWidth-unfoldStringWidth;
if(length>unfoldStringWidth) {
/* the string is too long to find any match */
return false;
}
/* do a binary search for the string */
start=0;
limit=unfoldRows;
while(start<limit) {
i=(start+limit)/2;
unfoldOffset=((i+1)*unfoldRowWidth); // +1 to skip the header values above
result=strcmpMax(s, unfoldOffset, unfoldStringWidth);
if(result==0) {
/* found the string: add each code point, and its case closure */
int c;
for(i=unfoldStringWidth; i<unfoldRowWidth && unfold[unfoldOffset+i]!=0; i+=UTF16.getCharCount(c)) {
c=UTF16.charAt(unfold, unfoldOffset, unfold.length, i);
set.add(c);
addCaseClosure(c, set);
}
return true;
} else if(result<0) {
limit=i;
} else /* result>0 */ {
start=i+1;
}
}
return false; /* string not found */
} | [
"public",
"final",
"boolean",
"addStringCaseClosure",
"(",
"String",
"s",
",",
"UnicodeSet",
"set",
")",
"{",
"int",
"i",
",",
"length",
",",
"start",
",",
"limit",
",",
"result",
",",
"unfoldOffset",
",",
"unfoldRows",
",",
"unfoldRowWidth",
",",
"unfoldStr... | Maps the string to single code points and adds the associated case closure
mappings.
The string is mapped to code points if it is their full case folding string.
In other words, this performs a reverse full case folding and then
adds the case closure items of the resulting code points.
If the string is found and its closure applied, then
the string itself is added as well as part of its code points' closure.
@return true if the string was found | [
"Maps",
"the",
"string",
"to",
"single",
"code",
"points",
"and",
"adds",
"the",
"associated",
"case",
"closure",
"mappings",
".",
"The",
"string",
"is",
"mapped",
"to",
"code",
"points",
"if",
"it",
"is",
"their",
"full",
"case",
"folding",
"string",
".",... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java#L405-L459 |
33,993 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java | UCaseProps.getCaseLocale | private static final int getCaseLocale(String language) {
// Check the subtag length to reduce the number of comparisons
// for locales without special behavior.
// Fastpath for English "en" which is often used for default (=root locale) case mappings,
// and for Chinese "zh": Very common but no special case mapping behavior.
if(language.length()==2) {
if(language.equals("en") || language.charAt(0)>'t') {
return LOC_ROOT;
} else if(language.equals("tr") || language.equals("az")) {
return LOC_TURKISH;
} else if(language.equals("el")) {
return LOC_GREEK;
} else if(language.equals("lt")) {
return LOC_LITHUANIAN;
} else if(language.equals("nl")) {
return LOC_DUTCH;
}
} else if(language.length()==3) {
if(language.equals("tur") || language.equals("aze")) {
return LOC_TURKISH;
} else if(language.equals("ell")) {
return LOC_GREEK;
} else if(language.equals("lit")) {
return LOC_LITHUANIAN;
} else if(language.equals("nld")) {
return LOC_DUTCH;
}
}
return LOC_ROOT;
} | java | private static final int getCaseLocale(String language) {
// Check the subtag length to reduce the number of comparisons
// for locales without special behavior.
// Fastpath for English "en" which is often used for default (=root locale) case mappings,
// and for Chinese "zh": Very common but no special case mapping behavior.
if(language.length()==2) {
if(language.equals("en") || language.charAt(0)>'t') {
return LOC_ROOT;
} else if(language.equals("tr") || language.equals("az")) {
return LOC_TURKISH;
} else if(language.equals("el")) {
return LOC_GREEK;
} else if(language.equals("lt")) {
return LOC_LITHUANIAN;
} else if(language.equals("nl")) {
return LOC_DUTCH;
}
} else if(language.length()==3) {
if(language.equals("tur") || language.equals("aze")) {
return LOC_TURKISH;
} else if(language.equals("ell")) {
return LOC_GREEK;
} else if(language.equals("lit")) {
return LOC_LITHUANIAN;
} else if(language.equals("nld")) {
return LOC_DUTCH;
}
}
return LOC_ROOT;
} | [
"private",
"static",
"final",
"int",
"getCaseLocale",
"(",
"String",
"language",
")",
"{",
"// Check the subtag length to reduce the number of comparisons",
"// for locales without special behavior.",
"// Fastpath for English \"en\" which is often used for default (=root locale) case mapping... | Accepts both 2- and 3-letter language subtags. | [
"Accepts",
"both",
"2",
"-",
"and",
"3",
"-",
"letter",
"language",
"subtags",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java#L628-L657 |
33,994 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java | UCaseProps.toFullLower | public final int toFullLower(int c, ContextIterator iter, Appendable out, int caseLocale) {
int result, props;
result=c;
props=trie.get(c);
if(!propsHasException(props)) {
if(getTypeFromProps(props)>=UPPER) {
result=c+getDelta(props);
}
} else {
int excOffset=getExceptionsOffset(props), excOffset2;
int excWord=exceptions.charAt(excOffset++);
int full;
excOffset2=excOffset;
if((excWord&EXC_CONDITIONAL_SPECIAL)!=0) {
/* use hardcoded conditions and mappings */
/*
* Test for conditional mappings first
* (otherwise the unconditional default mappings are always taken),
* then test for characters that have unconditional mappings in SpecialCasing.txt,
* then get the UnicodeData.txt mappings.
*/
if( caseLocale==LOC_LITHUANIAN &&
/* base characters, find accents above */
(((c==0x49 || c==0x4a || c==0x12e) &&
isFollowedByMoreAbove(iter)) ||
/* precomposed with accent above, no need to find one */
(c==0xcc || c==0xcd || c==0x128))
) {
/*
# Lithuanian
# Lithuanian retains the dot in a lowercase i when followed by accents.
# Introduce an explicit dot above when lowercasing capital I's and J's
# whenever there are more accents above.
# (of the accents used in Lithuanian: grave, acute, tilde above, and ogonek)
0049; 0069 0307; 0049; 0049; lt More_Above; # LATIN CAPITAL LETTER I
004A; 006A 0307; 004A; 004A; lt More_Above; # LATIN CAPITAL LETTER J
012E; 012F 0307; 012E; 012E; lt More_Above; # LATIN CAPITAL LETTER I WITH OGONEK
00CC; 0069 0307 0300; 00CC; 00CC; lt; # LATIN CAPITAL LETTER I WITH GRAVE
00CD; 0069 0307 0301; 00CD; 00CD; lt; # LATIN CAPITAL LETTER I WITH ACUTE
0128; 0069 0307 0303; 0128; 0128; lt; # LATIN CAPITAL LETTER I WITH TILDE
*/
try {
switch(c) {
case 0x49: /* LATIN CAPITAL LETTER I */
out.append(iDot);
return 2;
case 0x4a: /* LATIN CAPITAL LETTER J */
out.append(jDot);
return 2;
case 0x12e: /* LATIN CAPITAL LETTER I WITH OGONEK */
out.append(iOgonekDot);
return 2;
case 0xcc: /* LATIN CAPITAL LETTER I WITH GRAVE */
out.append(iDotGrave);
return 3;
case 0xcd: /* LATIN CAPITAL LETTER I WITH ACUTE */
out.append(iDotAcute);
return 3;
case 0x128: /* LATIN CAPITAL LETTER I WITH TILDE */
out.append(iDotTilde);
return 3;
default:
return 0; /* will not occur */
}
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
/* # Turkish and Azeri */
} else if(caseLocale==LOC_TURKISH && c==0x130) {
/*
# I and i-dotless; I-dot and i are case pairs in Turkish and Azeri
# The following rules handle those cases.
0130; 0069; 0130; 0130; tr # LATIN CAPITAL LETTER I WITH DOT ABOVE
0130; 0069; 0130; 0130; az # LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
return 0x69;
} else if(caseLocale==LOC_TURKISH && c==0x307 && isPrecededBy_I(iter)) {
/*
# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i.
# This matches the behavior of the canonically equivalent I-dot_above
0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE
0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
*/
return 0; /* remove the dot (continue without output) */
} else if(caseLocale==LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter)) {
/*
# When lowercasing, unless an I is before a dot_above, it turns into a dotless i.
0049; 0131; 0049; 0049; tr Not_Before_Dot; # LATIN CAPITAL LETTER I
0049; 0131; 0049; 0049; az Not_Before_Dot; # LATIN CAPITAL LETTER I
*/
return 0x131;
} else if(c==0x130) {
/*
# Preserve canonical equivalence for I with dot. Turkic is handled below.
0130; 0069 0307; 0130; 0130; # LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
try {
out.append(iDot);
return 2;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
} else if( c==0x3a3 &&
!isFollowedByCasedLetter(iter, 1) &&
isFollowedByCasedLetter(iter, -1) /* -1=preceded */
) {
/* greek capital sigma maps depending on surrounding cased letters (see SpecialCasing.txt) */
/*
# Special case for final form of sigma
03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
*/
return 0x3c2; /* greek small final sigma */
} else {
/* no known conditional special case mapping, use a normal mapping */
}
} else if(hasSlot(excWord, EXC_FULL_MAPPINGS)) {
long value=getSlotValueAndOffset(excWord, EXC_FULL_MAPPINGS, excOffset);
full=(int)value&FULL_LOWER;
if(full!=0) {
/* start of full case mapping strings */
excOffset=(int)(value>>32)+1;
try {
// append the lowercase mapping
out.append(exceptions, excOffset, excOffset+full);
/* return the string length */
return full;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
}
if(hasSlot(excWord, EXC_LOWER)) {
result=getSlotValue(excWord, EXC_LOWER, excOffset2);
}
}
return (result==c) ? ~result : result;
} | java | public final int toFullLower(int c, ContextIterator iter, Appendable out, int caseLocale) {
int result, props;
result=c;
props=trie.get(c);
if(!propsHasException(props)) {
if(getTypeFromProps(props)>=UPPER) {
result=c+getDelta(props);
}
} else {
int excOffset=getExceptionsOffset(props), excOffset2;
int excWord=exceptions.charAt(excOffset++);
int full;
excOffset2=excOffset;
if((excWord&EXC_CONDITIONAL_SPECIAL)!=0) {
/* use hardcoded conditions and mappings */
/*
* Test for conditional mappings first
* (otherwise the unconditional default mappings are always taken),
* then test for characters that have unconditional mappings in SpecialCasing.txt,
* then get the UnicodeData.txt mappings.
*/
if( caseLocale==LOC_LITHUANIAN &&
/* base characters, find accents above */
(((c==0x49 || c==0x4a || c==0x12e) &&
isFollowedByMoreAbove(iter)) ||
/* precomposed with accent above, no need to find one */
(c==0xcc || c==0xcd || c==0x128))
) {
/*
# Lithuanian
# Lithuanian retains the dot in a lowercase i when followed by accents.
# Introduce an explicit dot above when lowercasing capital I's and J's
# whenever there are more accents above.
# (of the accents used in Lithuanian: grave, acute, tilde above, and ogonek)
0049; 0069 0307; 0049; 0049; lt More_Above; # LATIN CAPITAL LETTER I
004A; 006A 0307; 004A; 004A; lt More_Above; # LATIN CAPITAL LETTER J
012E; 012F 0307; 012E; 012E; lt More_Above; # LATIN CAPITAL LETTER I WITH OGONEK
00CC; 0069 0307 0300; 00CC; 00CC; lt; # LATIN CAPITAL LETTER I WITH GRAVE
00CD; 0069 0307 0301; 00CD; 00CD; lt; # LATIN CAPITAL LETTER I WITH ACUTE
0128; 0069 0307 0303; 0128; 0128; lt; # LATIN CAPITAL LETTER I WITH TILDE
*/
try {
switch(c) {
case 0x49: /* LATIN CAPITAL LETTER I */
out.append(iDot);
return 2;
case 0x4a: /* LATIN CAPITAL LETTER J */
out.append(jDot);
return 2;
case 0x12e: /* LATIN CAPITAL LETTER I WITH OGONEK */
out.append(iOgonekDot);
return 2;
case 0xcc: /* LATIN CAPITAL LETTER I WITH GRAVE */
out.append(iDotGrave);
return 3;
case 0xcd: /* LATIN CAPITAL LETTER I WITH ACUTE */
out.append(iDotAcute);
return 3;
case 0x128: /* LATIN CAPITAL LETTER I WITH TILDE */
out.append(iDotTilde);
return 3;
default:
return 0; /* will not occur */
}
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
/* # Turkish and Azeri */
} else if(caseLocale==LOC_TURKISH && c==0x130) {
/*
# I and i-dotless; I-dot and i are case pairs in Turkish and Azeri
# The following rules handle those cases.
0130; 0069; 0130; 0130; tr # LATIN CAPITAL LETTER I WITH DOT ABOVE
0130; 0069; 0130; 0130; az # LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
return 0x69;
} else if(caseLocale==LOC_TURKISH && c==0x307 && isPrecededBy_I(iter)) {
/*
# When lowercasing, remove dot_above in the sequence I + dot_above, which will turn into i.
# This matches the behavior of the canonically equivalent I-dot_above
0307; ; 0307; 0307; tr After_I; # COMBINING DOT ABOVE
0307; ; 0307; 0307; az After_I; # COMBINING DOT ABOVE
*/
return 0; /* remove the dot (continue without output) */
} else if(caseLocale==LOC_TURKISH && c==0x49 && !isFollowedByDotAbove(iter)) {
/*
# When lowercasing, unless an I is before a dot_above, it turns into a dotless i.
0049; 0131; 0049; 0049; tr Not_Before_Dot; # LATIN CAPITAL LETTER I
0049; 0131; 0049; 0049; az Not_Before_Dot; # LATIN CAPITAL LETTER I
*/
return 0x131;
} else if(c==0x130) {
/*
# Preserve canonical equivalence for I with dot. Turkic is handled below.
0130; 0069 0307; 0130; 0130; # LATIN CAPITAL LETTER I WITH DOT ABOVE
*/
try {
out.append(iDot);
return 2;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
} else if( c==0x3a3 &&
!isFollowedByCasedLetter(iter, 1) &&
isFollowedByCasedLetter(iter, -1) /* -1=preceded */
) {
/* greek capital sigma maps depending on surrounding cased letters (see SpecialCasing.txt) */
/*
# Special case for final form of sigma
03A3; 03C2; 03A3; 03A3; Final_Sigma; # GREEK CAPITAL LETTER SIGMA
*/
return 0x3c2; /* greek small final sigma */
} else {
/* no known conditional special case mapping, use a normal mapping */
}
} else if(hasSlot(excWord, EXC_FULL_MAPPINGS)) {
long value=getSlotValueAndOffset(excWord, EXC_FULL_MAPPINGS, excOffset);
full=(int)value&FULL_LOWER;
if(full!=0) {
/* start of full case mapping strings */
excOffset=(int)(value>>32)+1;
try {
// append the lowercase mapping
out.append(exceptions, excOffset, excOffset+full);
/* return the string length */
return full;
} catch (IOException e) {
throw new ICUUncheckedIOException(e);
}
}
}
if(hasSlot(excWord, EXC_LOWER)) {
result=getSlotValue(excWord, EXC_LOWER, excOffset2);
}
}
return (result==c) ? ~result : result;
} | [
"public",
"final",
"int",
"toFullLower",
"(",
"int",
"c",
",",
"ContextIterator",
"iter",
",",
"Appendable",
"out",
",",
"int",
"caseLocale",
")",
"{",
"int",
"result",
",",
"props",
";",
"result",
"=",
"c",
";",
"props",
"=",
"trie",
".",
"get",
"(",
... | Get the full lowercase mapping for c.
@param c Character to be mapped.
@param iter Character iterator, used for context-sensitive mappings.
See ContextIterator for details.
If iter==null then a context-independent result is returned.
@param out If the mapping result is a string, then it is appended to out.
@param caseLocale Case locale value from ucase_getCaseLocale().
@return Output code point or string length, see MAX_STRING_LENGTH.
@see ContextIterator
@see #MAX_STRING_LENGTH
@hide draft / provisional / internal are hidden on Android | [
"Get",
"the",
"full",
"lowercase",
"mapping",
"for",
"c",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCaseProps.java#L824-L975 |
33,995 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java | TransliteratorRegistry.put | public void put(String ID,
Class<? extends Transliterator> transliteratorSubclass,
boolean visible) {
registerEntry(ID, transliteratorSubclass, visible);
} | java | public void put(String ID,
Class<? extends Transliterator> transliteratorSubclass,
boolean visible) {
registerEntry(ID, transliteratorSubclass, visible);
} | [
"public",
"void",
"put",
"(",
"String",
"ID",
",",
"Class",
"<",
"?",
"extends",
"Transliterator",
">",
"transliteratorSubclass",
",",
"boolean",
"visible",
")",
"{",
"registerEntry",
"(",
"ID",
",",
"transliteratorSubclass",
",",
"visible",
")",
";",
"}"
] | Register a class. This adds an entry to the
dynamic store, or replaces an existing entry. Any entry in the
underlying static locale resource store is masked. | [
"Register",
"a",
"class",
".",
"This",
"adds",
"an",
"entry",
"to",
"the",
"dynamic",
"store",
"or",
"replaces",
"an",
"existing",
"entry",
".",
"Any",
"entry",
"in",
"the",
"underlying",
"static",
"locale",
"resource",
"store",
"is",
"masked",
"."
] | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L322-L326 |
33,996 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java | TransliteratorRegistry.put | public void put(String ID,
Transliterator.Factory factory,
boolean visible) {
registerEntry(ID, factory, visible);
} | java | public void put(String ID,
Transliterator.Factory factory,
boolean visible) {
registerEntry(ID, factory, visible);
} | [
"public",
"void",
"put",
"(",
"String",
"ID",
",",
"Transliterator",
".",
"Factory",
"factory",
",",
"boolean",
"visible",
")",
"{",
"registerEntry",
"(",
"ID",
",",
"factory",
",",
"visible",
")",
";",
"}"
] | Register an ID and a factory function pointer. This adds an
entry to the dynamic store, or replaces an existing entry. Any
entry in the underlying static locale resource store is masked. | [
"Register",
"an",
"ID",
"and",
"a",
"factory",
"function",
"pointer",
".",
"This",
"adds",
"an",
"entry",
"to",
"the",
"dynamic",
"store",
"or",
"replaces",
"an",
"existing",
"entry",
".",
"Any",
"entry",
"in",
"the",
"underlying",
"static",
"locale",
"res... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L333-L337 |
33,997 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java | TransliteratorRegistry.put | public void put(String ID,
String resourceName,
int dir,
boolean visible) {
registerEntry(ID, new ResourceEntry(resourceName, dir), visible);
} | java | public void put(String ID,
String resourceName,
int dir,
boolean visible) {
registerEntry(ID, new ResourceEntry(resourceName, dir), visible);
} | [
"public",
"void",
"put",
"(",
"String",
"ID",
",",
"String",
"resourceName",
",",
"int",
"dir",
",",
"boolean",
"visible",
")",
"{",
"registerEntry",
"(",
"ID",
",",
"new",
"ResourceEntry",
"(",
"resourceName",
",",
"dir",
")",
",",
"visible",
")",
";",
... | Register an ID and a resource name. This adds an entry to the
dynamic store, or replaces an existing entry. Any entry in the
underlying static locale resource store is masked. | [
"Register",
"an",
"ID",
"and",
"a",
"resource",
"name",
".",
"This",
"adds",
"an",
"entry",
"to",
"the",
"dynamic",
"store",
"or",
"replaces",
"an",
"existing",
"entry",
".",
"Any",
"entry",
"in",
"the",
"underlying",
"static",
"locale",
"resource",
"store... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L344-L349 |
33,998 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java | TransliteratorRegistry.put | public void put(String ID,
String alias,
boolean visible) {
registerEntry(ID, new AliasEntry(alias), visible);
} | java | public void put(String ID,
String alias,
boolean visible) {
registerEntry(ID, new AliasEntry(alias), visible);
} | [
"public",
"void",
"put",
"(",
"String",
"ID",
",",
"String",
"alias",
",",
"boolean",
"visible",
")",
"{",
"registerEntry",
"(",
"ID",
",",
"new",
"AliasEntry",
"(",
"alias",
")",
",",
"visible",
")",
";",
"}"
] | Register an ID and an alias ID. This adds an entry to the
dynamic store, or replaces an existing entry. Any entry in the
underlying static locale resource store is masked. | [
"Register",
"an",
"ID",
"and",
"an",
"alias",
"ID",
".",
"This",
"adds",
"an",
"entry",
"to",
"the",
"dynamic",
"store",
"or",
"replaces",
"an",
"existing",
"entry",
".",
"Any",
"entry",
"in",
"the",
"underlying",
"static",
"locale",
"resource",
"store",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L356-L360 |
33,999 | google/j2objc | jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java | TransliteratorRegistry.put | public void put(String ID,
Transliterator trans,
boolean visible) {
registerEntry(ID, trans, visible);
} | java | public void put(String ID,
Transliterator trans,
boolean visible) {
registerEntry(ID, trans, visible);
} | [
"public",
"void",
"put",
"(",
"String",
"ID",
",",
"Transliterator",
"trans",
",",
"boolean",
"visible",
")",
"{",
"registerEntry",
"(",
"ID",
",",
"trans",
",",
"visible",
")",
";",
"}"
] | Register an ID and a Transliterator object. This adds an entry
to the dynamic store, or replaces an existing entry. Any entry
in the underlying static locale resource store is masked. | [
"Register",
"an",
"ID",
"and",
"a",
"Transliterator",
"object",
".",
"This",
"adds",
"an",
"entry",
"to",
"the",
"dynamic",
"store",
"or",
"replaces",
"an",
"existing",
"entry",
".",
"Any",
"entry",
"in",
"the",
"underlying",
"static",
"locale",
"resource",
... | 471504a735b48d5d4ace51afa1542cc4790a921a | https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/TransliteratorRegistry.java#L367-L371 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.