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,500
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneAdapter.java
TimeZoneAdapter.wrap
public static java.util.TimeZone wrap(android.icu.util.TimeZone tz) { return new TimeZoneAdapter(tz); }
java
public static java.util.TimeZone wrap(android.icu.util.TimeZone tz) { return new TimeZoneAdapter(tz); }
[ "public", "static", "java", ".", "util", ".", "TimeZone", "wrap", "(", "android", ".", "icu", ".", "util", ".", "TimeZone", "tz", ")", "{", "return", "new", "TimeZoneAdapter", "(", "tz", ")", ";", "}" ]
Given a java.util.TimeZone, wrap it in the appropriate adapter subclass of android.icu.util.TimeZone and return the adapter.
[ "Given", "a", "java", ".", "util", ".", "TimeZone", "wrap", "it", "in", "the", "appropriate", "adapter", "subclass", "of", "android", ".", "icu", ".", "util", ".", "TimeZone", "and", "return", "the", "adapter", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/TimeZoneAdapter.java#L48-L50
33,501
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java
DTMDefaultBaseTraversers.getAxisTraverser
public DTMAxisTraverser getAxisTraverser(final int axis) { DTMAxisTraverser traverser; if (null == m_traversers) // Cache of stateless traversers for this DTM { m_traversers = new DTMAxisTraverser[Axis.getNamesLength()]; traverser = null; } else { traverser = m_traversers[axis]; // Share/reuse existing traverser if (traverser != null) return traverser; } switch (axis) // Generate new traverser { case Axis.ANCESTOR : traverser = new AncestorTraverser(); break; case Axis.ANCESTORORSELF : traverser = new AncestorOrSelfTraverser(); break; case Axis.ATTRIBUTE : traverser = new AttributeTraverser(); break; case Axis.CHILD : traverser = new ChildTraverser(); break; case Axis.DESCENDANT : traverser = new DescendantTraverser(); break; case Axis.DESCENDANTORSELF : traverser = new DescendantOrSelfTraverser(); break; case Axis.FOLLOWING : traverser = new FollowingTraverser(); break; case Axis.FOLLOWINGSIBLING : traverser = new FollowingSiblingTraverser(); break; case Axis.NAMESPACE : traverser = new NamespaceTraverser(); break; case Axis.NAMESPACEDECLS : traverser = new NamespaceDeclsTraverser(); break; case Axis.PARENT : traverser = new ParentTraverser(); break; case Axis.PRECEDING : traverser = new PrecedingTraverser(); break; case Axis.PRECEDINGSIBLING : traverser = new PrecedingSiblingTraverser(); break; case Axis.SELF : traverser = new SelfTraverser(); break; case Axis.ALL : traverser = new AllFromRootTraverser(); break; case Axis.ALLFROMNODE : traverser = new AllFromNodeTraverser(); break; case Axis.PRECEDINGANDANCESTOR : traverser = new PrecedingAndAncestorTraverser(); break; case Axis.DESCENDANTSFROMROOT : traverser = new DescendantFromRootTraverser(); break; case Axis.DESCENDANTSORSELFFROMROOT : traverser = new DescendantOrSelfFromRootTraverser(); break; case Axis.ROOT : traverser = new RootTraverser(); break; case Axis.FILTEREDLIST : return null; // Don't want to throw an exception for this one. default : throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_UNKNOWN_AXIS_TYPE, new Object[]{Integer.toString(axis)})); //"Unknown axis traversal type: "+axis); } if (null == traverser) throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_AXIS_TRAVERSER_NOT_SUPPORTED, new Object[]{Axis.getNames(axis)})); // "Axis traverser not supported: " // + Axis.names[axis]); m_traversers[axis] = traverser; return traverser; }
java
public DTMAxisTraverser getAxisTraverser(final int axis) { DTMAxisTraverser traverser; if (null == m_traversers) // Cache of stateless traversers for this DTM { m_traversers = new DTMAxisTraverser[Axis.getNamesLength()]; traverser = null; } else { traverser = m_traversers[axis]; // Share/reuse existing traverser if (traverser != null) return traverser; } switch (axis) // Generate new traverser { case Axis.ANCESTOR : traverser = new AncestorTraverser(); break; case Axis.ANCESTORORSELF : traverser = new AncestorOrSelfTraverser(); break; case Axis.ATTRIBUTE : traverser = new AttributeTraverser(); break; case Axis.CHILD : traverser = new ChildTraverser(); break; case Axis.DESCENDANT : traverser = new DescendantTraverser(); break; case Axis.DESCENDANTORSELF : traverser = new DescendantOrSelfTraverser(); break; case Axis.FOLLOWING : traverser = new FollowingTraverser(); break; case Axis.FOLLOWINGSIBLING : traverser = new FollowingSiblingTraverser(); break; case Axis.NAMESPACE : traverser = new NamespaceTraverser(); break; case Axis.NAMESPACEDECLS : traverser = new NamespaceDeclsTraverser(); break; case Axis.PARENT : traverser = new ParentTraverser(); break; case Axis.PRECEDING : traverser = new PrecedingTraverser(); break; case Axis.PRECEDINGSIBLING : traverser = new PrecedingSiblingTraverser(); break; case Axis.SELF : traverser = new SelfTraverser(); break; case Axis.ALL : traverser = new AllFromRootTraverser(); break; case Axis.ALLFROMNODE : traverser = new AllFromNodeTraverser(); break; case Axis.PRECEDINGANDANCESTOR : traverser = new PrecedingAndAncestorTraverser(); break; case Axis.DESCENDANTSFROMROOT : traverser = new DescendantFromRootTraverser(); break; case Axis.DESCENDANTSORSELFFROMROOT : traverser = new DescendantOrSelfFromRootTraverser(); break; case Axis.ROOT : traverser = new RootTraverser(); break; case Axis.FILTEREDLIST : return null; // Don't want to throw an exception for this one. default : throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_UNKNOWN_AXIS_TYPE, new Object[]{Integer.toString(axis)})); //"Unknown axis traversal type: "+axis); } if (null == traverser) throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_AXIS_TRAVERSER_NOT_SUPPORTED, new Object[]{Axis.getNames(axis)})); // "Axis traverser not supported: " // + Axis.names[axis]); m_traversers[axis] = traverser; return traverser; }
[ "public", "DTMAxisTraverser", "getAxisTraverser", "(", "final", "int", "axis", ")", "{", "DTMAxisTraverser", "traverser", ";", "if", "(", "null", "==", "m_traversers", ")", "// Cache of stateless traversers for this DTM", "{", "m_traversers", "=", "new", "DTMAxisTravers...
This returns a stateless "traverser", that can navigate over an XPath axis, though perhaps not in document order. @param axis One of Axes.ANCESTORORSELF, etc. @return A DTMAxisTraverser, or null if the given axis isn't supported.
[ "This", "returns", "a", "stateless", "traverser", "that", "can", "navigate", "over", "an", "XPath", "axis", "though", "perhaps", "not", "in", "document", "order", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMDefaultBaseTraversers.java#L101-L195
33,502
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java
SocketChannelImpl.translateReadyOps
public boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl sk) { int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes int oldOps = sk.nioReadyOps(); int newOps = initialOps; if ((ops & PollArrayWrapper.POLLNVAL) != 0) { // This should only happen if this channel is pre-closed while a // selection operation is in progress // ## Throw an error if this channel has not been pre-closed return false; } if ((ops & (PollArrayWrapper.POLLERR | PollArrayWrapper.POLLHUP)) != 0) { newOps = intOps; sk.nioReadyOps(newOps); // No need to poll again in checkConnect, // the error will be detected there readyToConnect = true; return (newOps & ~oldOps) != 0; } if (((ops & PollArrayWrapper.POLLIN) != 0) && ((intOps & SelectionKey.OP_READ) != 0) && (state == ST_CONNECTED)) newOps |= SelectionKey.OP_READ; if (((ops & PollArrayWrapper.POLLCONN) != 0) && ((intOps & SelectionKey.OP_CONNECT) != 0) && ((state == ST_UNCONNECTED) || (state == ST_PENDING))) { newOps |= SelectionKey.OP_CONNECT; readyToConnect = true; } if (((ops & PollArrayWrapper.POLLOUT) != 0) && ((intOps & SelectionKey.OP_WRITE) != 0) && (state == ST_CONNECTED)) newOps |= SelectionKey.OP_WRITE; sk.nioReadyOps(newOps); return (newOps & ~oldOps) != 0; }
java
public boolean translateReadyOps(int ops, int initialOps, SelectionKeyImpl sk) { int intOps = sk.nioInterestOps(); // Do this just once, it synchronizes int oldOps = sk.nioReadyOps(); int newOps = initialOps; if ((ops & PollArrayWrapper.POLLNVAL) != 0) { // This should only happen if this channel is pre-closed while a // selection operation is in progress // ## Throw an error if this channel has not been pre-closed return false; } if ((ops & (PollArrayWrapper.POLLERR | PollArrayWrapper.POLLHUP)) != 0) { newOps = intOps; sk.nioReadyOps(newOps); // No need to poll again in checkConnect, // the error will be detected there readyToConnect = true; return (newOps & ~oldOps) != 0; } if (((ops & PollArrayWrapper.POLLIN) != 0) && ((intOps & SelectionKey.OP_READ) != 0) && (state == ST_CONNECTED)) newOps |= SelectionKey.OP_READ; if (((ops & PollArrayWrapper.POLLCONN) != 0) && ((intOps & SelectionKey.OP_CONNECT) != 0) && ((state == ST_UNCONNECTED) || (state == ST_PENDING))) { newOps |= SelectionKey.OP_CONNECT; readyToConnect = true; } if (((ops & PollArrayWrapper.POLLOUT) != 0) && ((intOps & SelectionKey.OP_WRITE) != 0) && (state == ST_CONNECTED)) newOps |= SelectionKey.OP_WRITE; sk.nioReadyOps(newOps); return (newOps & ~oldOps) != 0; }
[ "public", "boolean", "translateReadyOps", "(", "int", "ops", ",", "int", "initialOps", ",", "SelectionKeyImpl", "sk", ")", "{", "int", "intOps", "=", "sk", ".", "nioInterestOps", "(", ")", ";", "// Do this just once, it synchronizes", "int", "oldOps", "=", "sk",...
Translates native poll revent ops into a ready operation ops
[ "Translates", "native", "poll", "revent", "ops", "into", "a", "ready", "operation", "ops" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/nio/ch/SocketChannelImpl.java#L917-L959
33,503
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java
ToTextStream.comment
public void comment(String data) throws org.xml.sax.SAXException { final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } data.getChars(0, length, m_charsBuff, 0); comment(m_charsBuff, 0, length); }
java
public void comment(String data) throws org.xml.sax.SAXException { final int length = data.length(); if (length > m_charsBuff.length) { m_charsBuff = new char[length*2 + 1]; } data.getChars(0, length, m_charsBuff, 0); comment(m_charsBuff, 0, length); }
[ "public", "void", "comment", "(", "String", "data", ")", "throws", "org", ".", "xml", ".", "sax", ".", "SAXException", "{", "final", "int", "length", "=", "data", ".", "length", "(", ")", ";", "if", "(", "length", ">", "m_charsBuff", ".", "length", "...
Called when a Comment is to be constructed. Note that Xalan will normally invoke the other version of this method. %REVIEW% In fact, is this one ever needed, or was it a mistake? @param data The comment data. @throws org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
[ "Called", "when", "a", "Comment", "is", "to", "be", "constructed", ".", "Note", "that", "Xalan", "will", "normally", "invoke", "the", "other", "version", "of", "this", "method", ".", "%REVIEW%", "In", "fact", "is", "this", "one", "ever", "needed", "or", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/ToTextStream.java#L470-L479
33,504
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java
FileHandler.openFiles
private void openFiles() throws IOException { LogManager manager = LogManager.getLogManager(); manager.checkPermission(); if (count < 1) { throw new IllegalArgumentException("file count = " + count); } if (limit < 0) { limit = 0; } // We register our own ErrorManager during initialization // so we can record exceptions. InitializationErrorManager em = new InitializationErrorManager(); setErrorManager(em); // Create a lock file. This grants us exclusive access // to our set of output files, as long as we are alive. int unique = -1; for (;;) { unique++; if (unique > MAX_LOCKS) { throw new IOException("Couldn't get lock for " + pattern); } // Generate a lock file name from the "unique" int. lockFileName = generate(pattern, 0, unique).toString() + ".lck"; // Now try to lock that filename. // Because some systems (e.g., Solaris) can only do file locks // between processes (and not within a process), we first check // if we ourself already have the file locked. synchronized(locks) { if (locks.get(lockFileName) != null) { // We already own this lock, for a different FileHandler // object. Try again. continue; } FileChannel fc; try { lockStream = new FileOutputStream(lockFileName); fc = lockStream.getChannel(); } catch (IOException ix) { // We got an IOException while trying to open the file. // Try the next file. continue; } boolean available; try { available = fc.tryLock() != null; // We got the lock OK. } catch (IOException ix) { // We got an IOException while trying to get the lock. // This normally indicates that locking is not supported // on the target directory. We have to proceed without // getting a lock. Drop through. available = true; } if (available) { // We got the lock. Remember it. locks.put(lockFileName, lockFileName); break; } // We failed to get the lock. Try next file. fc.close(); } } files = new File[count]; for (int i = 0; i < count; i++) { files[i] = generate(pattern, i, unique); } // Create the initial log file. if (append) { open(files[0], true); } else { rotate(); } // Did we detect any exceptions during initialization? Exception ex = em.lastException; if (ex != null) { if (ex instanceof IOException) { throw (IOException) ex; } else if (ex instanceof SecurityException) { throw (SecurityException) ex; } else { throw new IOException("Exception: " + ex); } } // Install the normal default ErrorManager. setErrorManager(new ErrorManager()); }
java
private void openFiles() throws IOException { LogManager manager = LogManager.getLogManager(); manager.checkPermission(); if (count < 1) { throw new IllegalArgumentException("file count = " + count); } if (limit < 0) { limit = 0; } // We register our own ErrorManager during initialization // so we can record exceptions. InitializationErrorManager em = new InitializationErrorManager(); setErrorManager(em); // Create a lock file. This grants us exclusive access // to our set of output files, as long as we are alive. int unique = -1; for (;;) { unique++; if (unique > MAX_LOCKS) { throw new IOException("Couldn't get lock for " + pattern); } // Generate a lock file name from the "unique" int. lockFileName = generate(pattern, 0, unique).toString() + ".lck"; // Now try to lock that filename. // Because some systems (e.g., Solaris) can only do file locks // between processes (and not within a process), we first check // if we ourself already have the file locked. synchronized(locks) { if (locks.get(lockFileName) != null) { // We already own this lock, for a different FileHandler // object. Try again. continue; } FileChannel fc; try { lockStream = new FileOutputStream(lockFileName); fc = lockStream.getChannel(); } catch (IOException ix) { // We got an IOException while trying to open the file. // Try the next file. continue; } boolean available; try { available = fc.tryLock() != null; // We got the lock OK. } catch (IOException ix) { // We got an IOException while trying to get the lock. // This normally indicates that locking is not supported // on the target directory. We have to proceed without // getting a lock. Drop through. available = true; } if (available) { // We got the lock. Remember it. locks.put(lockFileName, lockFileName); break; } // We failed to get the lock. Try next file. fc.close(); } } files = new File[count]; for (int i = 0; i < count; i++) { files[i] = generate(pattern, i, unique); } // Create the initial log file. if (append) { open(files[0], true); } else { rotate(); } // Did we detect any exceptions during initialization? Exception ex = em.lastException; if (ex != null) { if (ex instanceof IOException) { throw (IOException) ex; } else if (ex instanceof SecurityException) { throw (SecurityException) ex; } else { throw new IOException("Exception: " + ex); } } // Install the normal default ErrorManager. setErrorManager(new ErrorManager()); }
[ "private", "void", "openFiles", "(", ")", "throws", "IOException", "{", "LogManager", "manager", "=", "LogManager", ".", "getLogManager", "(", ")", ";", "manager", ".", "checkPermission", "(", ")", ";", "if", "(", "count", "<", "1", ")", "{", "throw", "n...
configured instance variables.
[ "configured", "instance", "variables", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java#L369-L461
33,505
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java
FileHandler.generate
private File generate(String pattern, int generation, int unique) throws IOException { File file = null; String word = ""; int ix = 0; boolean sawg = false; boolean sawu = false; while (ix < pattern.length()) { char ch = pattern.charAt(ix); ix++; char ch2 = 0; if (ix < pattern.length()) { ch2 = Character.toLowerCase(pattern.charAt(ix)); } if (ch == '/') { if (file == null) { file = new File(word); } else { file = new File(file, word); } word = ""; continue; } else if (ch == '%') { if (ch2 == 't') { String tmpDir = System.getProperty("java.io.tmpdir"); if (tmpDir == null) { tmpDir = System.getProperty("user.home"); } file = new File(tmpDir); ix++; word = ""; continue; } else if (ch2 == 'h') { file = new File(System.getProperty("user.home")); // Android-changed: Don't make a special exemption for setuid programs. // // if (isSetUID()) { // // Ok, we are in a set UID program. For safety's sake // // we disallow attempts to open files relative to %h. // throw new IOException("can't use %h in set UID program"); // } ix++; word = ""; continue; } else if (ch2 == 'g') { word = word + generation; sawg = true; ix++; continue; } else if (ch2 == 'u') { word = word + unique; sawu = true; ix++; continue; } else if (ch2 == '%') { word = word + "%"; ix++; continue; } } word = word + ch; } if (count > 1 && !sawg) { word = word + "." + generation; } if (unique > 0 && !sawu) { word = word + "." + unique; } if (word.length() > 0) { if (file == null) { file = new File(word); } else { file = new File(file, word); } } return file; }
java
private File generate(String pattern, int generation, int unique) throws IOException { File file = null; String word = ""; int ix = 0; boolean sawg = false; boolean sawu = false; while (ix < pattern.length()) { char ch = pattern.charAt(ix); ix++; char ch2 = 0; if (ix < pattern.length()) { ch2 = Character.toLowerCase(pattern.charAt(ix)); } if (ch == '/') { if (file == null) { file = new File(word); } else { file = new File(file, word); } word = ""; continue; } else if (ch == '%') { if (ch2 == 't') { String tmpDir = System.getProperty("java.io.tmpdir"); if (tmpDir == null) { tmpDir = System.getProperty("user.home"); } file = new File(tmpDir); ix++; word = ""; continue; } else if (ch2 == 'h') { file = new File(System.getProperty("user.home")); // Android-changed: Don't make a special exemption for setuid programs. // // if (isSetUID()) { // // Ok, we are in a set UID program. For safety's sake // // we disallow attempts to open files relative to %h. // throw new IOException("can't use %h in set UID program"); // } ix++; word = ""; continue; } else if (ch2 == 'g') { word = word + generation; sawg = true; ix++; continue; } else if (ch2 == 'u') { word = word + unique; sawu = true; ix++; continue; } else if (ch2 == '%') { word = word + "%"; ix++; continue; } } word = word + ch; } if (count > 1 && !sawg) { word = word + "." + generation; } if (unique > 0 && !sawu) { word = word + "." + unique; } if (word.length() > 0) { if (file == null) { file = new File(word); } else { file = new File(file, word); } } return file; }
[ "private", "File", "generate", "(", "String", "pattern", ",", "int", "generation", ",", "int", "unique", ")", "throws", "IOException", "{", "File", "file", "=", "null", ";", "String", "word", "=", "\"\"", ";", "int", "ix", "=", "0", ";", "boolean", "sa...
Generate a filename from a pattern.
[ "Generate", "a", "filename", "from", "a", "pattern", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java#L464-L539
33,506
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java
FileHandler.rotate
private synchronized void rotate() { Level oldLevel = getLevel(); setLevel(Level.OFF); super.close(); for (int i = count-2; i >= 0; i--) { File f1 = files[i]; File f2 = files[i+1]; if (f1.exists()) { if (f2.exists()) { f2.delete(); } f1.renameTo(f2); } } try { open(files[0], false); } catch (IOException ix) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError(null, ix, ErrorManager.OPEN_FAILURE); } setLevel(oldLevel); }
java
private synchronized void rotate() { Level oldLevel = getLevel(); setLevel(Level.OFF); super.close(); for (int i = count-2; i >= 0; i--) { File f1 = files[i]; File f2 = files[i+1]; if (f1.exists()) { if (f2.exists()) { f2.delete(); } f1.renameTo(f2); } } try { open(files[0], false); } catch (IOException ix) { // We don't want to throw an exception here, but we // report the exception to any registered ErrorManager. reportError(null, ix, ErrorManager.OPEN_FAILURE); } setLevel(oldLevel); }
[ "private", "synchronized", "void", "rotate", "(", ")", "{", "Level", "oldLevel", "=", "getLevel", "(", ")", ";", "setLevel", "(", "Level", ".", "OFF", ")", ";", "super", ".", "close", "(", ")", ";", "for", "(", "int", "i", "=", "count", "-", "2", ...
Rotate the set of output files
[ "Rotate", "the", "set", "of", "output", "files" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java#L542-L566
33,507
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java
FileHandler.close
public synchronized void close() throws SecurityException { super.close(); // Unlock any lock file. if (lockFileName == null) { return; } try { // Closing the lock file's FileOutputStream will close // the underlying channel and free any locks. lockStream.close(); } catch (Exception ex) { // Problems closing the stream. Punt. } synchronized(locks) { locks.remove(lockFileName); } new File(lockFileName).delete(); lockFileName = null; lockStream = null; }
java
public synchronized void close() throws SecurityException { super.close(); // Unlock any lock file. if (lockFileName == null) { return; } try { // Closing the lock file's FileOutputStream will close // the underlying channel and free any locks. lockStream.close(); } catch (Exception ex) { // Problems closing the stream. Punt. } synchronized(locks) { locks.remove(lockFileName); } new File(lockFileName).delete(); lockFileName = null; lockStream = null; }
[ "public", "synchronized", "void", "close", "(", ")", "throws", "SecurityException", "{", "super", ".", "close", "(", ")", ";", "// Unlock any lock file.", "if", "(", "lockFileName", "==", "null", ")", "{", "return", ";", "}", "try", "{", "// Closing the lock f...
Close all the files. @exception SecurityException if a security manager exists and if the caller does not have <tt>LoggingPermission("control")</tt>.
[ "Close", "all", "the", "files", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/logging/FileHandler.java#L604-L623
33,508
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/BASE64Decoder.java
BASE64Decoder.decodeAtom
protected void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem) throws java.io.IOException { int i; byte a = -1, b = -1, c = -1, d = -1; if (rem < 2) { throw new CEFormatException("BASE64Decoder: Not enough bytes for an atom."); } do { i = inStream.read(); if (i == -1) { throw new CEStreamExhausted(); } } while (i == '\n' || i == '\r'); decode_buffer[0] = (byte) i; i = readFully(inStream, decode_buffer, 1, rem-1); if (i == -1) { throw new CEStreamExhausted(); } if (rem > 3 && decode_buffer[3] == '=') { rem = 3; } if (rem > 2 && decode_buffer[2] == '=') { rem = 2; } switch (rem) { case 4: d = pem_convert_array[decode_buffer[3] & 0xff]; // NOBREAK case 3: c = pem_convert_array[decode_buffer[2] & 0xff]; // NOBREAK case 2: b = pem_convert_array[decode_buffer[1] & 0xff]; a = pem_convert_array[decode_buffer[0] & 0xff]; break; } switch (rem) { case 2: outStream.write( (byte)(((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); break; case 3: outStream.write( (byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); outStream.write( (byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf)) ); break; case 4: outStream.write( (byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); outStream.write( (byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf)) ); outStream.write( (byte) (((c << 6) & 0xc0) | (d & 0x3f)) ); break; } return; }
java
protected void decodeAtom(PushbackInputStream inStream, OutputStream outStream, int rem) throws java.io.IOException { int i; byte a = -1, b = -1, c = -1, d = -1; if (rem < 2) { throw new CEFormatException("BASE64Decoder: Not enough bytes for an atom."); } do { i = inStream.read(); if (i == -1) { throw new CEStreamExhausted(); } } while (i == '\n' || i == '\r'); decode_buffer[0] = (byte) i; i = readFully(inStream, decode_buffer, 1, rem-1); if (i == -1) { throw new CEStreamExhausted(); } if (rem > 3 && decode_buffer[3] == '=') { rem = 3; } if (rem > 2 && decode_buffer[2] == '=') { rem = 2; } switch (rem) { case 4: d = pem_convert_array[decode_buffer[3] & 0xff]; // NOBREAK case 3: c = pem_convert_array[decode_buffer[2] & 0xff]; // NOBREAK case 2: b = pem_convert_array[decode_buffer[1] & 0xff]; a = pem_convert_array[decode_buffer[0] & 0xff]; break; } switch (rem) { case 2: outStream.write( (byte)(((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); break; case 3: outStream.write( (byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); outStream.write( (byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf)) ); break; case 4: outStream.write( (byte) (((a << 2) & 0xfc) | ((b >>> 4) & 3)) ); outStream.write( (byte) (((b << 4) & 0xf0) | ((c >>> 2) & 0xf)) ); outStream.write( (byte) (((c << 6) & 0xc0) | (d & 0x3f)) ); break; } return; }
[ "protected", "void", "decodeAtom", "(", "PushbackInputStream", "inStream", ",", "OutputStream", "outStream", ",", "int", "rem", ")", "throws", "java", ".", "io", ".", "IOException", "{", "int", "i", ";", "byte", "a", "=", "-", "1", ",", "b", "=", "-", ...
Decode one BASE64 atom into 1, 2, or 3 bytes of data.
[ "Decode", "one", "BASE64", "atom", "into", "1", "2", "or", "3", "bytes", "of", "data", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/BASE64Decoder.java#L105-L161
33,509
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedReader.java
PipedReader.receive
synchronized void receive(int c) throws IOException { if (!connected) { throw new IOException("Pipe not connected"); } else if (closedByWriter || closedByReader) { throw new IOException("Pipe closed"); } else if (readSide != null && !readSide.isAlive()) { throw new IOException("Read end dead"); } writeSide = Thread.currentThread(); while (in == out) { if ((readSide != null) && !readSide.isAlive()) { throw new IOException("Pipe broken"); } /* full: kick any waiting readers */ notifyAll(); try { wait(1000); } catch (InterruptedException ex) { throw new java.io.InterruptedIOException(); } } if (in < 0) { in = 0; out = 0; } buffer[in++] = (char) c; if (in >= buffer.length) { in = 0; } }
java
synchronized void receive(int c) throws IOException { if (!connected) { throw new IOException("Pipe not connected"); } else if (closedByWriter || closedByReader) { throw new IOException("Pipe closed"); } else if (readSide != null && !readSide.isAlive()) { throw new IOException("Read end dead"); } writeSide = Thread.currentThread(); while (in == out) { if ((readSide != null) && !readSide.isAlive()) { throw new IOException("Pipe broken"); } /* full: kick any waiting readers */ notifyAll(); try { wait(1000); } catch (InterruptedException ex) { throw new java.io.InterruptedIOException(); } } if (in < 0) { in = 0; out = 0; } buffer[in++] = (char) c; if (in >= buffer.length) { in = 0; } }
[ "synchronized", "void", "receive", "(", "int", "c", ")", "throws", "IOException", "{", "if", "(", "!", "connected", ")", "{", "throw", "new", "IOException", "(", "\"Pipe not connected\"", ")", ";", "}", "else", "if", "(", "closedByWriter", "||", "closedByRea...
Receives a char of data. This method will block if no input is available.
[ "Receives", "a", "char", "of", "data", ".", "This", "method", "will", "block", "if", "no", "input", "is", "available", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedReader.java#L168-L198
33,510
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedReader.java
PipedReader.ready
public synchronized boolean ready() throws IOException { if (!connected) { throw new IOException("Pipe not connected"); } else if (closedByReader) { throw new IOException("Pipe closed"); } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) { throw new IOException("Write end dead"); } if (in < 0) { return false; } else { return true; } }
java
public synchronized boolean ready() throws IOException { if (!connected) { throw new IOException("Pipe not connected"); } else if (closedByReader) { throw new IOException("Pipe closed"); } else if (writeSide != null && !writeSide.isAlive() && !closedByWriter && (in < 0)) { throw new IOException("Write end dead"); } if (in < 0) { return false; } else { return true; } }
[ "public", "synchronized", "boolean", "ready", "(", ")", "throws", "IOException", "{", "if", "(", "!", "connected", ")", "{", "throw", "new", "IOException", "(", "\"Pipe not connected\"", ")", ";", "}", "else", "if", "(", "closedByReader", ")", "{", "throw", ...
Tell whether this stream is ready to be read. A piped character stream is ready if the circular buffer is not empty. @exception IOException if the pipe is <a href=PipedInputStream.html#BROKEN> <code>broken</code></a>, {@link #connect(java.io.PipedWriter) unconnected}, or closed.
[ "Tell", "whether", "this", "stream", "is", "ready", "to", "be", "read", ".", "A", "piped", "character", "stream", "is", "ready", "if", "the", "circular", "buffer", "is", "not", "empty", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/io/PipedReader.java#L336-L350
33,511
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java
DTMManagerDefault.addDTM
synchronized public void addDTM(DTM dtm, int id, int offset) { if(id>=IDENT_MAX_DTMS) { // TODO: %REVIEW% Not really the right error message. throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!"); } // We used to just allocate the array size to IDENT_MAX_DTMS. // But we expect to increase that to 16 bits, and I'm not willing // to allocate that much space unless needed. We could use one of our // handy-dandy Fast*Vectors, but this will do for now. // %REVIEW% int oldlen=m_dtms.length; if(oldlen<=id) { // Various growth strategies are possible. I think we don't want // to over-allocate excessively, and I'm willing to reallocate // more often to get that. See also Fast*Vector classes. // // %REVIEW% Should throw a more diagnostic error if we go over the max... int newlen=Math.min((id+256),IDENT_MAX_DTMS); DTM new_m_dtms[] = new DTM[newlen]; System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen); m_dtms=new_m_dtms; int new_m_dtm_offsets[] = new int[newlen]; System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen); m_dtm_offsets=new_m_dtm_offsets; } m_dtms[id] = dtm; m_dtm_offsets[id]=offset; dtm.documentRegistration(); // The DTM should have been told who its manager was when we created it. // Do we need to allow for adopting DTMs _not_ created by this manager? }
java
synchronized public void addDTM(DTM dtm, int id, int offset) { if(id>=IDENT_MAX_DTMS) { // TODO: %REVIEW% Not really the right error message. throw new DTMException(XMLMessages.createXMLMessage(XMLErrorResources.ER_NO_DTMIDS_AVAIL, null)); //"No more DTM IDs are available!"); } // We used to just allocate the array size to IDENT_MAX_DTMS. // But we expect to increase that to 16 bits, and I'm not willing // to allocate that much space unless needed. We could use one of our // handy-dandy Fast*Vectors, but this will do for now. // %REVIEW% int oldlen=m_dtms.length; if(oldlen<=id) { // Various growth strategies are possible. I think we don't want // to over-allocate excessively, and I'm willing to reallocate // more often to get that. See also Fast*Vector classes. // // %REVIEW% Should throw a more diagnostic error if we go over the max... int newlen=Math.min((id+256),IDENT_MAX_DTMS); DTM new_m_dtms[] = new DTM[newlen]; System.arraycopy(m_dtms,0,new_m_dtms,0,oldlen); m_dtms=new_m_dtms; int new_m_dtm_offsets[] = new int[newlen]; System.arraycopy(m_dtm_offsets,0,new_m_dtm_offsets,0,oldlen); m_dtm_offsets=new_m_dtm_offsets; } m_dtms[id] = dtm; m_dtm_offsets[id]=offset; dtm.documentRegistration(); // The DTM should have been told who its manager was when we created it. // Do we need to allow for adopting DTMs _not_ created by this manager? }
[ "synchronized", "public", "void", "addDTM", "(", "DTM", "dtm", ",", "int", "id", ",", "int", "offset", ")", "{", "if", "(", "id", ">=", "IDENT_MAX_DTMS", ")", "{", "// TODO: %REVIEW% Not really the right error message.", "throw", "new", "DTMException", "(", "XML...
Add a DTM to the DTM table. @param dtm Should be a valid reference to a DTM. @param id Integer DTM ID to be bound to this DTM. @param offset Integer addressing offset. The internal DTM Node ID is obtained by adding this offset to the node-number field of the public DTM Handle. For the first DTM ID accessing each DTM, this is 0; for overflow addressing it will be a multiple of 1<<IDENT_DTM_NODE_BITS.
[ "Add", "a", "DTM", "to", "the", "DTM", "table", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java#L143-L179
33,512
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java
DTMManagerDefault.getFirstFreeDTMID
synchronized public int getFirstFreeDTMID() { int n = m_dtms.length; for (int i = 1; i < n; i++) { if(null == m_dtms[i]) { return i; } } return n; // count on addDTM() to throw exception if out of range }
java
synchronized public int getFirstFreeDTMID() { int n = m_dtms.length; for (int i = 1; i < n; i++) { if(null == m_dtms[i]) { return i; } } return n; // count on addDTM() to throw exception if out of range }
[ "synchronized", "public", "int", "getFirstFreeDTMID", "(", ")", "{", "int", "n", "=", "m_dtms", ".", "length", ";", "for", "(", "int", "i", "=", "1", ";", "i", "<", "n", ";", "i", "++", ")", "{", "if", "(", "null", "==", "m_dtms", "[", "i", "]"...
Get the first free DTM ID available. %OPT% Linear search is inefficient!
[ "Get", "the", "first", "free", "DTM", "ID", "available", ".", "%OPT%", "Linear", "search", "is", "inefficient!" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java#L184-L195
33,513
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java
DTMManagerDefault.getDTM
synchronized public DTM getDTM(int nodeHandle) { try { // Performance critical function. return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS]; } catch(java.lang.ArrayIndexOutOfBoundsException e) { if(nodeHandle==DTM.NULL) return null; // Accept as a special case. else throw e; // Programming error; want to know about it. } }
java
synchronized public DTM getDTM(int nodeHandle) { try { // Performance critical function. return m_dtms[nodeHandle >>> IDENT_DTM_NODE_BITS]; } catch(java.lang.ArrayIndexOutOfBoundsException e) { if(nodeHandle==DTM.NULL) return null; // Accept as a special case. else throw e; // Programming error; want to know about it. } }
[ "synchronized", "public", "DTM", "getDTM", "(", "int", "nodeHandle", ")", "{", "try", "{", "// Performance critical function.", "return", "m_dtms", "[", "nodeHandle", ">>>", "IDENT_DTM_NODE_BITS", "]", ";", "}", "catch", "(", "java", ".", "lang", ".", "ArrayInde...
Return the DTM object containing a representation of this node. @param nodeHandle DTM Handle indicating which node to retrieve @return a reference to the DTM object containing this node.
[ "Return", "the", "DTM", "object", "containing", "a", "representation", "of", "this", "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/DTMManagerDefault.java#L643-L657
33,514
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java
DTMManagerDefault.getDTMIdentity
synchronized public int getDTMIdentity(DTM dtm) { // Shortcut using DTMDefaultBase's extension hooks // %REVIEW% Should the lookup be part of the basic DTM API? if(dtm instanceof DTMDefaultBase) { DTMDefaultBase dtmdb=(DTMDefaultBase)dtm; if(dtmdb.getManager()==this) return dtmdb.getDTMIDs().elementAt(0); else return -1; } int n = m_dtms.length; for (int i = 0; i < n; i++) { DTM tdtm = m_dtms[i]; if (tdtm == dtm && m_dtm_offsets[i]==0) return i << IDENT_DTM_NODE_BITS; } return -1; }
java
synchronized public int getDTMIdentity(DTM dtm) { // Shortcut using DTMDefaultBase's extension hooks // %REVIEW% Should the lookup be part of the basic DTM API? if(dtm instanceof DTMDefaultBase) { DTMDefaultBase dtmdb=(DTMDefaultBase)dtm; if(dtmdb.getManager()==this) return dtmdb.getDTMIDs().elementAt(0); else return -1; } int n = m_dtms.length; for (int i = 0; i < n; i++) { DTM tdtm = m_dtms[i]; if (tdtm == dtm && m_dtm_offsets[i]==0) return i << IDENT_DTM_NODE_BITS; } return -1; }
[ "synchronized", "public", "int", "getDTMIdentity", "(", "DTM", "dtm", ")", "{", "// Shortcut using DTMDefaultBase's extension hooks", "// %REVIEW% Should the lookup be part of the basic DTM API?", "if", "(", "dtm", "instanceof", "DTMDefaultBase", ")", "{", "DTMDefaultBase", "dt...
Given a DTM, find the ID number in the DTM tables which addresses the start of the document. If overflow addressing is in use, other DTM IDs may also be assigned to this DTM. @param dtm The DTM which (hopefully) contains this node. @return The DTM ID (as the high bits of a NodeHandle, not as our internal index), or -1 if the DTM doesn't belong to this manager.
[ "Given", "a", "DTM", "find", "the", "ID", "number", "in", "the", "DTM", "tables", "which", "addresses", "the", "start", "of", "the", "document", ".", "If", "overflow", "addressing", "is", "in", "use", "other", "DTM", "IDs", "may", "also", "be", "assigned...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/dtm/ref/DTMManagerDefault.java#L669-L693
33,515
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExtensionHandler.java
ExtensionHandler.getClassForName
static Class getClassForName(String className) throws ClassNotFoundException { // Hack for backwards compatibility with XalanJ1 stylesheets if(className.equals("org.apache.xalan.xslt.extensions.Redirect")) { className = "org.apache.xalan.lib.Redirect"; } return ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); }
java
static Class getClassForName(String className) throws ClassNotFoundException { // Hack for backwards compatibility with XalanJ1 stylesheets if(className.equals("org.apache.xalan.xslt.extensions.Redirect")) { className = "org.apache.xalan.lib.Redirect"; } return ObjectFactory.findProviderClass( className, ObjectFactory.findClassLoader(), true); }
[ "static", "Class", "getClassForName", "(", "String", "className", ")", "throws", "ClassNotFoundException", "{", "// Hack for backwards compatibility with XalanJ1 stylesheets", "if", "(", "className", ".", "equals", "(", "\"org.apache.xalan.xslt.extensions.Redirect\"", ")", ")",...
This method loads a class using the context class loader if we're running under Java2 or higher. @param className Name of the class to load
[ "This", "method", "loads", "a", "class", "using", "the", "context", "class", "loader", "if", "we", "re", "running", "under", "Java2", "or", "higher", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/extensions/ExtensionHandler.java#L57-L67
33,516
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/BMPSet.java
BMPSet.set32x64Bits
private static void set32x64Bits(int[] table, int start, int limit) { assert (64 == table.length); int lead = start >> 6; // Named for UTF-8 2-byte lead byte with upper 5 bits. int trail = start & 0x3f; // Named for UTF-8 2-byte trail byte with lower 6 bits. // Set one bit indicating an all-one block. int bits = 1 << lead; if ((start + 1) == limit) { // Single-character shortcut. table[trail] |= bits; return; } int limitLead = limit >> 6; int limitTrail = limit & 0x3f; if (lead == limitLead) { // Partial vertical bit column. while (trail < limitTrail) { table[trail++] |= bits; } } else { // Partial vertical bit column, // followed by a bit rectangle, // followed by another partial vertical bit column. if (trail > 0) { do { table[trail++] |= bits; } while (trail < 64); ++lead; } if (lead < limitLead) { bits = ~((1 << lead) - 1); if (limitLead < 0x20) { bits &= (1 << limitLead) - 1; } for (trail = 0; trail < 64; ++trail) { table[trail] |= bits; } } // limit<=0x800. If limit==0x800 then limitLead=32 and limitTrail=0. // In that case, bits=1<<limitLead == 1<<0 == 1 // (because Java << uses only the lower 5 bits of the shift operand) // but the bits value is not used because trail<limitTrail is already false. bits = 1 << limitLead; for (trail = 0; trail < limitTrail; ++trail) { table[trail] |= bits; } } }
java
private static void set32x64Bits(int[] table, int start, int limit) { assert (64 == table.length); int lead = start >> 6; // Named for UTF-8 2-byte lead byte with upper 5 bits. int trail = start & 0x3f; // Named for UTF-8 2-byte trail byte with lower 6 bits. // Set one bit indicating an all-one block. int bits = 1 << lead; if ((start + 1) == limit) { // Single-character shortcut. table[trail] |= bits; return; } int limitLead = limit >> 6; int limitTrail = limit & 0x3f; if (lead == limitLead) { // Partial vertical bit column. while (trail < limitTrail) { table[trail++] |= bits; } } else { // Partial vertical bit column, // followed by a bit rectangle, // followed by another partial vertical bit column. if (trail > 0) { do { table[trail++] |= bits; } while (trail < 64); ++lead; } if (lead < limitLead) { bits = ~((1 << lead) - 1); if (limitLead < 0x20) { bits &= (1 << limitLead) - 1; } for (trail = 0; trail < 64; ++trail) { table[trail] |= bits; } } // limit<=0x800. If limit==0x800 then limitLead=32 and limitTrail=0. // In that case, bits=1<<limitLead == 1<<0 == 1 // (because Java << uses only the lower 5 bits of the shift operand) // but the bits value is not used because trail<limitTrail is already false. bits = 1 << limitLead; for (trail = 0; trail < limitTrail; ++trail) { table[trail] |= bits; } } }
[ "private", "static", "void", "set32x64Bits", "(", "int", "[", "]", "table", ",", "int", "start", ",", "int", "limit", ")", "{", "assert", "(", "64", "==", "table", ".", "length", ")", ";", "int", "lead", "=", "start", ">>", "6", ";", "// Named for UT...
Set bits in a bit rectangle in "vertical" bit organization. start<limit<=0x800
[ "Set", "bits", "in", "a", "bit", "rectangle", "in", "vertical", "bit", "organization", ".", "start<limit<", "=", "0x800" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/BMPSet.java#L330-L378
33,517
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/Certificate.java
Certificate.writeReplace
protected Object writeReplace() throws java.io.ObjectStreamException { try { return new CertificateRep(type, getEncoded()); } catch (CertificateException e) { throw new java.io.NotSerializableException ("java.security.cert.Certificate: " + type + ": " + e.getMessage()); } }
java
protected Object writeReplace() throws java.io.ObjectStreamException { try { return new CertificateRep(type, getEncoded()); } catch (CertificateException e) { throw new java.io.NotSerializableException ("java.security.cert.Certificate: " + type + ": " + e.getMessage()); } }
[ "protected", "Object", "writeReplace", "(", ")", "throws", "java", ".", "io", ".", "ObjectStreamException", "{", "try", "{", "return", "new", "CertificateRep", "(", "type", ",", "getEncoded", "(", ")", ")", ";", "}", "catch", "(", "CertificateException", "e"...
Replace the Certificate to be serialized. @return the alternate Certificate object to be serialized @throws java.io.ObjectStreamException if a new object representing this Certificate could not be created @since 1.3
[ "Replace", "the", "Certificate", "to", "be", "serialized", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/Certificate.java#L296-L306
33,518
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java
JarURLConnectionImpl.getInputStream
@Override public InputStream getInputStream() throws IOException { if (closed) { throw new IllegalStateException("JarURLConnection InputStream has been closed"); } connect(); if (jarInput != null) { return jarInput; } if (jarEntry == null) { throw new IOException("Jar entry not specified"); } return jarInput = new JarURLConnectionInputStream(jarFile .getInputStream(jarEntry), jarFile); }
java
@Override public InputStream getInputStream() throws IOException { if (closed) { throw new IllegalStateException("JarURLConnection InputStream has been closed"); } connect(); if (jarInput != null) { return jarInput; } if (jarEntry == null) { throw new IOException("Jar entry not specified"); } return jarInput = new JarURLConnectionInputStream(jarFile .getInputStream(jarEntry), jarFile); }
[ "@", "Override", "public", "InputStream", "getInputStream", "(", ")", "throws", "IOException", "{", "if", "(", "closed", ")", "{", "throw", "new", "IllegalStateException", "(", "\"JarURLConnection InputStream has been closed\"", ")", ";", "}", "connect", "(", ")", ...
Creates an input stream for reading from this URL Connection. @return the input stream @throws IOException if an IO error occurs while connecting to the resource.
[ "Creates", "an", "input", "stream", "for", "reading", "from", "this", "URL", "Connection", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/net/url/JarURLConnectionImpl.java#L210-L224
33,519
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RFC822Name.java
RFC822Name.subtreeDepth
public int subtreeDepth() throws UnsupportedOperationException { String subtree=name; int i=1; /* strip off name@ portion */ int atNdx = subtree.lastIndexOf('@'); if (atNdx >= 0) { i++; subtree=subtree.substring(atNdx+1); } /* count dots in dnsname, adding one if dnsname preceded by @ */ for (; subtree.lastIndexOf('.') >= 0; i++) { subtree=subtree.substring(0,subtree.lastIndexOf('.')); } return i; }
java
public int subtreeDepth() throws UnsupportedOperationException { String subtree=name; int i=1; /* strip off name@ portion */ int atNdx = subtree.lastIndexOf('@'); if (atNdx >= 0) { i++; subtree=subtree.substring(atNdx+1); } /* count dots in dnsname, adding one if dnsname preceded by @ */ for (; subtree.lastIndexOf('.') >= 0; i++) { subtree=subtree.substring(0,subtree.lastIndexOf('.')); } return i; }
[ "public", "int", "subtreeDepth", "(", ")", "throws", "UnsupportedOperationException", "{", "String", "subtree", "=", "name", ";", "int", "i", "=", "1", ";", "/* strip off name@ portion */", "int", "atNdx", "=", "subtree", ".", "lastIndexOf", "(", "'", "'", ")"...
Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds. @returns distance of name from root @throws UnsupportedOperationException if not supported for this name type
[ "Return", "subtree", "depth", "of", "this", "name", "for", "purposes", "of", "determining", "NameConstraints", "minimum", "and", "maximum", "bounds", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/RFC822Name.java#L238-L255
33,520
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java
Locale.getISO3Country
public String getISO3Country() throws MissingResourceException { // Android changed: Use.getIso3Country. Also return "" for missing regions. final String region = baseLocale.getRegion(); // Note that this will return an UN.M49 region code if (region.length() == 3) { return baseLocale.getRegion(); } else if (region.isEmpty()) { return ""; } // Prefix "en-" because ICU doesn't really care about what the language is. String country3 = ICU.getISO3Country("en-" + region); if (!region.isEmpty() && country3.isEmpty()) { throw new MissingResourceException("Couldn't find 3-letter country code for " + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry"); } return country3; }
java
public String getISO3Country() throws MissingResourceException { // Android changed: Use.getIso3Country. Also return "" for missing regions. final String region = baseLocale.getRegion(); // Note that this will return an UN.M49 region code if (region.length() == 3) { return baseLocale.getRegion(); } else if (region.isEmpty()) { return ""; } // Prefix "en-" because ICU doesn't really care about what the language is. String country3 = ICU.getISO3Country("en-" + region); if (!region.isEmpty() && country3.isEmpty()) { throw new MissingResourceException("Couldn't find 3-letter country code for " + baseLocale.getRegion(), "FormatData_" + toString(), "ShortCountry"); } return country3; }
[ "public", "String", "getISO3Country", "(", ")", "throws", "MissingResourceException", "{", "// Android changed: Use.getIso3Country. Also return \"\" for missing regions.", "final", "String", "region", "=", "baseLocale", ".", "getRegion", "(", ")", ";", "// Note that this will r...
Returns a three-letter abbreviation for this locale's country. If the country matches an ISO 3166-1 alpha-2 code, the corresponding ISO 3166-1 alpha-3 uppercase code is returned. If the locale doesn't specify a country, this will be the empty string. <p>The ISO 3166-1 codes can be found on-line. @return A three-letter abbreviation of this locale's country. @exception MissingResourceException Throws MissingResourceException if the three-letter country abbreviation is not available for this locale.
[ "Returns", "a", "three", "-", "letter", "abbreviation", "for", "this", "locale", "s", "country", ".", "If", "the", "country", "matches", "an", "ISO", "3166", "-", "1", "alpha", "-", "2", "code", "the", "corresponding", "ISO", "3166", "-", "1", "alpha", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L1575-L1592
33,521
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java
Locale.isUnM49AreaCode
private static boolean isUnM49AreaCode(String code) { if (code.length() != 3) { return false; } for (int i = 0; i < 3; ++i) { final char character = code.charAt(i); if (!(character >= '0' && character <= '9')) { return false; } } return true; }
java
private static boolean isUnM49AreaCode(String code) { if (code.length() != 3) { return false; } for (int i = 0; i < 3; ++i) { final char character = code.charAt(i); if (!(character >= '0' && character <= '9')) { return false; } } return true; }
[ "private", "static", "boolean", "isUnM49AreaCode", "(", "String", "code", ")", "{", "if", "(", "code", ".", "length", "(", ")", "!=", "3", ")", "{", "return", "false", ";", "}", "for", "(", "int", "i", "=", "0", ";", "i", "<", "3", ";", "++", "...
A UN M.49 is a 3 digit numeric code.
[ "A", "UN", "M", ".", "49", "is", "a", "3", "digit", "numeric", "code", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L1786-L1799
33,522
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java
Locale.formatList
private static String formatList(String[] stringList, String listPattern, String listCompositionPattern) { // If we have no list patterns, compose the list in a simple, // non-localized way. if (listPattern == null || listCompositionPattern == null) { StringBuffer result = new StringBuffer(); for (int i=0; i<stringList.length; ++i) { if (i>0) result.append(','); result.append(stringList[i]); } return result.toString(); } // Compose the list down to three elements if necessary if (stringList.length > 3) { MessageFormat format = new MessageFormat(listCompositionPattern); stringList = composeList(format, stringList); } // Rebuild the argument list with the list length as the first element Object[] args = new Object[stringList.length + 1]; System.arraycopy(stringList, 0, args, 1, stringList.length); args[0] = new Integer(stringList.length); // Format it using the pattern in the resource MessageFormat format = new MessageFormat(listPattern); return format.format(args); }
java
private static String formatList(String[] stringList, String listPattern, String listCompositionPattern) { // If we have no list patterns, compose the list in a simple, // non-localized way. if (listPattern == null || listCompositionPattern == null) { StringBuffer result = new StringBuffer(); for (int i=0; i<stringList.length; ++i) { if (i>0) result.append(','); result.append(stringList[i]); } return result.toString(); } // Compose the list down to three elements if necessary if (stringList.length > 3) { MessageFormat format = new MessageFormat(listCompositionPattern); stringList = composeList(format, stringList); } // Rebuild the argument list with the list length as the first element Object[] args = new Object[stringList.length + 1]; System.arraycopy(stringList, 0, args, 1, stringList.length); args[0] = new Integer(stringList.length); // Format it using the pattern in the resource MessageFormat format = new MessageFormat(listPattern); return format.format(args); }
[ "private", "static", "String", "formatList", "(", "String", "[", "]", "stringList", ",", "String", "listPattern", ",", "String", "listCompositionPattern", ")", "{", "// If we have no list patterns, compose the list in a simple,", "// non-localized way.", "if", "(", "listPat...
Format a list using given pattern strings. If either of the patterns is null, then a the list is formatted by concatenation with the delimiter ','. @param stringList the list of strings to be formatted. @param listPattern should create a MessageFormat taking 0-3 arguments and formatting them into a list. @param listCompositionPattern should take 2 arguments and is used by composeList. @return a string representing the list.
[ "Format", "a", "list", "using", "given", "pattern", "strings", ".", "If", "either", "of", "the", "patterns", "is", "null", "then", "a", "the", "list", "is", "formatted", "by", "concatenation", "with", "the", "delimiter", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L2045-L2071
33,523
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java
Locale.composeList
private static String[] composeList(MessageFormat format, String[] list) { if (list.length <= 3) return list; // Use the given format to compose the first two elements into one String[] listItems = { list[0], list[1] }; String newItem = format.format(listItems); // Form a new list one element shorter String[] newList = new String[list.length-1]; System.arraycopy(list, 2, newList, 1, newList.length-1); newList[0] = newItem; // Recurse return composeList(format, newList); }
java
private static String[] composeList(MessageFormat format, String[] list) { if (list.length <= 3) return list; // Use the given format to compose the first two elements into one String[] listItems = { list[0], list[1] }; String newItem = format.format(listItems); // Form a new list one element shorter String[] newList = new String[list.length-1]; System.arraycopy(list, 2, newList, 1, newList.length-1); newList[0] = newItem; // Recurse return composeList(format, newList); }
[ "private", "static", "String", "[", "]", "composeList", "(", "MessageFormat", "format", ",", "String", "[", "]", "list", ")", "{", "if", "(", "list", ".", "length", "<=", "3", ")", "return", "list", ";", "// Use the given format to compose the first two elements...
Given a list of strings, return a list shortened to three elements. Shorten it by applying the given format to the first two elements recursively. @param format a format which takes two arguments @param list a list of strings @return if the list is three elements or shorter, the same list; otherwise, a new list of three elements.
[ "Given", "a", "list", "of", "strings", "return", "a", "list", "shortened", "to", "three", "elements", ".", "Shorten", "it", "by", "applying", "the", "given", "format", "to", "the", "first", "two", "elements", "recursively", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Locale.java#L2082-L2096
33,524
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java
HttpCookie.hasExpired
public boolean hasExpired() { if (maxAge == 0) return true; // if not specify max-age, this cookie should be // discarded when user agent is to be closed, but // it is not expired. if (maxAge == MAX_AGE_UNSPECIFIED) return false; long deltaSecond = (System.currentTimeMillis() - whenCreated) / 1000; if (deltaSecond > maxAge) return true; else return false; }
java
public boolean hasExpired() { if (maxAge == 0) return true; // if not specify max-age, this cookie should be // discarded when user agent is to be closed, but // it is not expired. if (maxAge == MAX_AGE_UNSPECIFIED) return false; long deltaSecond = (System.currentTimeMillis() - whenCreated) / 1000; if (deltaSecond > maxAge) return true; else return false; }
[ "public", "boolean", "hasExpired", "(", ")", "{", "if", "(", "maxAge", "==", "0", ")", "return", "true", ";", "// if not specify max-age, this cookie should be", "// discarded when user agent is to be closed, but", "// it is not expired.", "if", "(", "maxAge", "==", "MAX_...
Reports whether this http cookie has expired or not. @return <tt>true</tt> to indicate this http cookie has expired; otherwise, <tt>false</tt>
[ "Reports", "whether", "this", "http", "cookie", "has", "expired", "or", "not", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/HttpCookie.java#L280-L293
33,525
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java
StringToIntTable.put
public final void put(String key, int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; }
java
public final void put(String key, int value) { if ((m_firstFree + 1) >= m_mapSize) { m_mapSize += m_blocksize; String newMap[] = new String[m_mapSize]; System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1); m_map = newMap; int newValues[] = new int[m_mapSize]; System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1); m_values = newValues; } m_map[m_firstFree] = key; m_values[m_firstFree] = value; m_firstFree++; }
[ "public", "final", "void", "put", "(", "String", "key", ",", "int", "value", ")", "{", "if", "(", "(", "m_firstFree", "+", "1", ")", ">=", "m_mapSize", ")", "{", "m_mapSize", "+=", "m_blocksize", ";", "String", "newMap", "[", "]", "=", "new", "String...
Append a string onto the vector. @param key String to append @param value The int value of the string
[ "Append", "a", "string", "onto", "the", "vector", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java#L100-L124
33,526
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java
StringToIntTable.keys
public final String[] keys() { String [] keysArr = new String[m_firstFree]; for (int i = 0; i < m_firstFree; i++) { keysArr[i] = m_map[i]; } return keysArr; }
java
public final String[] keys() { String [] keysArr = new String[m_firstFree]; for (int i = 0; i < m_firstFree; i++) { keysArr[i] = m_map[i]; } return keysArr; }
[ "public", "final", "String", "[", "]", "keys", "(", ")", "{", "String", "[", "]", "keysArr", "=", "new", "String", "[", "m_firstFree", "]", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_firstFree", ";", "i", "++", ")", "{", "keysArr", ...
Return array of keys in the table. @return Array of strings
[ "Return", "array", "of", "keys", "in", "the", "table", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/utils/StringToIntTable.java#L192-L202
33,527
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.init
@Override public void init(boolean forward) throws CertPathValidatorException { if (forward) { throw new CertPathValidatorException ("forward checking not supported"); } certIndex = 1; explicitPolicy = (expPolicyRequired ? 0 : certPathLen + 1); policyMapping = (polMappingInhibited ? 0 : certPathLen + 1); inhibitAnyPolicy = (anyPolicyInhibited ? 0 : certPathLen + 1); }
java
@Override public void init(boolean forward) throws CertPathValidatorException { if (forward) { throw new CertPathValidatorException ("forward checking not supported"); } certIndex = 1; explicitPolicy = (expPolicyRequired ? 0 : certPathLen + 1); policyMapping = (polMappingInhibited ? 0 : certPathLen + 1); inhibitAnyPolicy = (anyPolicyInhibited ? 0 : certPathLen + 1); }
[ "@", "Override", "public", "void", "init", "(", "boolean", "forward", ")", "throws", "CertPathValidatorException", "{", "if", "(", "forward", ")", "{", "throw", "new", "CertPathValidatorException", "(", "\"forward checking not supported\"", ")", ";", "}", "certIndex...
Initializes the internal state of the checker from parameters specified in the constructor @param forward a boolean indicating whether this checker should be initialized capable of building in the forward direction @throws CertPathValidatorException if user wants to enable forward checking and forward checking is not supported.
[ "Initializes", "the", "internal", "state", "of", "the", "checker", "from", "parameters", "specified", "in", "the", "constructor" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L118-L129
33,528
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.check
@Override public void check(Certificate cert, Collection<String> unresCritExts) throws CertPathValidatorException { // now do the policy checks checkPolicy((X509Certificate) cert); if (unresCritExts != null && !unresCritExts.isEmpty()) { unresCritExts.remove(CertificatePolicies_Id.toString()); unresCritExts.remove(PolicyMappings_Id.toString()); unresCritExts.remove(PolicyConstraints_Id.toString()); unresCritExts.remove(InhibitAnyPolicy_Id.toString()); } }
java
@Override public void check(Certificate cert, Collection<String> unresCritExts) throws CertPathValidatorException { // now do the policy checks checkPolicy((X509Certificate) cert); if (unresCritExts != null && !unresCritExts.isEmpty()) { unresCritExts.remove(CertificatePolicies_Id.toString()); unresCritExts.remove(PolicyMappings_Id.toString()); unresCritExts.remove(PolicyConstraints_Id.toString()); unresCritExts.remove(InhibitAnyPolicy_Id.toString()); } }
[ "@", "Override", "public", "void", "check", "(", "Certificate", "cert", ",", "Collection", "<", "String", ">", "unresCritExts", ")", "throws", "CertPathValidatorException", "{", "// now do the policy checks", "checkPolicy", "(", "(", "X509Certificate", ")", "cert", ...
Performs the policy processing checks on the certificate using its internal state. @param cert the Certificate to be processed @param unresCritExts the unresolved critical extensions @throws CertPathValidatorException if the certificate does not verify
[ "Performs", "the", "policy", "processing", "checks", "on", "the", "certificate", "using", "its", "internal", "state", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L175-L188
33,529
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.checkPolicy
private void checkPolicy(X509Certificate currCert) throws CertPathValidatorException { String msg = "certificate policies"; if (debug != null) { debug.println("PolicyChecker.checkPolicy() ---checking " + msg + "..."); debug.println("PolicyChecker.checkPolicy() certIndex = " + certIndex); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "explicitPolicy = " + explicitPolicy); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyMapping = " + policyMapping); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyTree = " + rootNode); } X509CertImpl currCertImpl = null; try { currCertImpl = X509CertImpl.toImpl(currCert); } catch (CertificateException ce) { throw new CertPathValidatorException(ce); } boolean finalCert = (certIndex == certPathLen); rootNode = processPolicies(certIndex, initPolicies, explicitPolicy, policyMapping, inhibitAnyPolicy, rejectPolicyQualifiers, rootNode, currCertImpl, finalCert); if (!finalCert) { explicitPolicy = mergeExplicitPolicy(explicitPolicy, currCertImpl, finalCert); policyMapping = mergePolicyMapping(policyMapping, currCertImpl); inhibitAnyPolicy = mergeInhibitAnyPolicy(inhibitAnyPolicy, currCertImpl); } certIndex++; if (debug != null) { debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "explicitPolicy = " + explicitPolicy); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyMapping = " + policyMapping); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyTree = " + rootNode); debug.println("PolicyChecker.checkPolicy() " + msg + " verified"); } }
java
private void checkPolicy(X509Certificate currCert) throws CertPathValidatorException { String msg = "certificate policies"; if (debug != null) { debug.println("PolicyChecker.checkPolicy() ---checking " + msg + "..."); debug.println("PolicyChecker.checkPolicy() certIndex = " + certIndex); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "explicitPolicy = " + explicitPolicy); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyMapping = " + policyMapping); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy); debug.println("PolicyChecker.checkPolicy() BEFORE PROCESSING: " + "policyTree = " + rootNode); } X509CertImpl currCertImpl = null; try { currCertImpl = X509CertImpl.toImpl(currCert); } catch (CertificateException ce) { throw new CertPathValidatorException(ce); } boolean finalCert = (certIndex == certPathLen); rootNode = processPolicies(certIndex, initPolicies, explicitPolicy, policyMapping, inhibitAnyPolicy, rejectPolicyQualifiers, rootNode, currCertImpl, finalCert); if (!finalCert) { explicitPolicy = mergeExplicitPolicy(explicitPolicy, currCertImpl, finalCert); policyMapping = mergePolicyMapping(policyMapping, currCertImpl); inhibitAnyPolicy = mergeInhibitAnyPolicy(inhibitAnyPolicy, currCertImpl); } certIndex++; if (debug != null) { debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "explicitPolicy = " + explicitPolicy); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyMapping = " + policyMapping); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "inhibitAnyPolicy = " + inhibitAnyPolicy); debug.println("PolicyChecker.checkPolicy() AFTER PROCESSING: " + "policyTree = " + rootNode); debug.println("PolicyChecker.checkPolicy() " + msg + " verified"); } }
[ "private", "void", "checkPolicy", "(", "X509Certificate", "currCert", ")", "throws", "CertPathValidatorException", "{", "String", "msg", "=", "\"certificate policies\"", ";", "if", "(", "debug", "!=", "null", ")", "{", "debug", ".", "println", "(", "\"PolicyChecke...
Internal method to run through all the checks. @param currCert the certificate to be processed @exception CertPathValidatorException Exception thrown if the certificate does not verify
[ "Internal", "method", "to", "run", "through", "all", "the", "checks", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L197-L250
33,530
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.mergeInhibitAnyPolicy
static int mergeInhibitAnyPolicy(int inhibitAnyPolicy, X509CertImpl currCert) throws CertPathValidatorException { if ((inhibitAnyPolicy > 0) && !X509CertImpl.isSelfIssued(currCert)) { inhibitAnyPolicy--; } try { InhibitAnyPolicyExtension inhAnyPolExt = (InhibitAnyPolicyExtension) currCert.getExtension(InhibitAnyPolicy_Id); if (inhAnyPolExt == null) return inhibitAnyPolicy; int skipCerts = inhAnyPolExt.get(InhibitAnyPolicyExtension.SKIP_CERTS).intValue(); if (debug != null) debug.println("PolicyChecker.mergeInhibitAnyPolicy() " + "skipCerts Index from cert = " + skipCerts); if (skipCerts != -1) { if (skipCerts < inhibitAnyPolicy) { inhibitAnyPolicy = skipCerts; } } } catch (IOException e) { if (debug != null) { debug.println("PolicyChecker.mergeInhibitAnyPolicy " + "unexpected exception"); e.printStackTrace(); } throw new CertPathValidatorException(e); } return inhibitAnyPolicy; }
java
static int mergeInhibitAnyPolicy(int inhibitAnyPolicy, X509CertImpl currCert) throws CertPathValidatorException { if ((inhibitAnyPolicy > 0) && !X509CertImpl.isSelfIssued(currCert)) { inhibitAnyPolicy--; } try { InhibitAnyPolicyExtension inhAnyPolExt = (InhibitAnyPolicyExtension) currCert.getExtension(InhibitAnyPolicy_Id); if (inhAnyPolExt == null) return inhibitAnyPolicy; int skipCerts = inhAnyPolExt.get(InhibitAnyPolicyExtension.SKIP_CERTS).intValue(); if (debug != null) debug.println("PolicyChecker.mergeInhibitAnyPolicy() " + "skipCerts Index from cert = " + skipCerts); if (skipCerts != -1) { if (skipCerts < inhibitAnyPolicy) { inhibitAnyPolicy = skipCerts; } } } catch (IOException e) { if (debug != null) { debug.println("PolicyChecker.mergeInhibitAnyPolicy " + "unexpected exception"); e.printStackTrace(); } throw new CertPathValidatorException(e); } return inhibitAnyPolicy; }
[ "static", "int", "mergeInhibitAnyPolicy", "(", "int", "inhibitAnyPolicy", ",", "X509CertImpl", "currCert", ")", "throws", "CertPathValidatorException", "{", "if", "(", "(", "inhibitAnyPolicy", ">", "0", ")", "&&", "!", "X509CertImpl", ".", "isSelfIssued", "(", "cu...
Merges the specified inhibitAnyPolicy value with the SkipCerts value of the InhibitAnyPolicy extension obtained from the certificate. @param inhibitAnyPolicy an integer which indicates whether "any-policy" is considered a match @param currCert the Certificate to be processed @return returns the new inhibitAnyPolicy value @exception CertPathValidatorException Exception thrown if an error occurs
[ "Merges", "the", "specified", "inhibitAnyPolicy", "value", "with", "the", "SkipCerts", "value", "of", "the", "InhibitAnyPolicy", "extension", "obtained", "from", "the", "certificate", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L368-L402
33,531
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.removeInvalidNodes
private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
java
private static PolicyNodeImpl removeInvalidNodes(PolicyNodeImpl rootNode, int certIndex, Set<String> initPolicies, CertificatePoliciesExtension currCertPolicies) throws CertPathValidatorException { List<PolicyInformation> policyInfo = null; try { policyInfo = currCertPolicies.get(CertificatePoliciesExtension.POLICIES); } catch (IOException ioe) { throw new CertPathValidatorException("Exception while " + "retrieving policyOIDs", ioe); } boolean childDeleted = false; for (PolicyInformation curPolInfo : policyInfo) { String curPolicy = curPolInfo.getPolicyIdentifier().getIdentifier().toString(); if (debug != null) debug.println("PolicyChecker.processPolicies() " + "processing policy second time: " + curPolicy); Set<PolicyNodeImpl> validNodes = rootNode.getPolicyNodesValid(certIndex, curPolicy); for (PolicyNodeImpl curNode : validNodes) { PolicyNodeImpl parentNode = (PolicyNodeImpl)curNode.getParent(); if (parentNode.getValidPolicy().equals(ANY_POLICY)) { if ((!initPolicies.contains(curPolicy)) && (!curPolicy.equals(ANY_POLICY))) { if (debug != null) debug.println("PolicyChecker.processPolicies() " + "before deleting: policy tree = " + rootNode); parentNode.deleteChild(curNode); childDeleted = true; if (debug != null) debug.println("PolicyChecker.processPolicies() " + "after deleting: policy tree = " + rootNode); } } } } if (childDeleted) { rootNode.prune(certIndex); if (!rootNode.getChildren().hasNext()) { rootNode = null; } } return rootNode; }
[ "private", "static", "PolicyNodeImpl", "removeInvalidNodes", "(", "PolicyNodeImpl", "rootNode", ",", "int", "certIndex", ",", "Set", "<", "String", ">", "initPolicies", ",", "CertificatePoliciesExtension", "currCertPolicies", ")", "throws", "CertPathValidatorException", "...
Removes those nodes which do not intersect with the initial policies specified by the user. @param rootNode the root node of the valid policy tree @param certIndex the index of the certificate being processed @param initPolicies the Set of policies required by the user @param currCertPolicies the CertificatePoliciesExtension of the certificate being processed @returns the root node of the valid policy tree after modification @exception CertPathValidatorException Exception thrown if error occurs.
[ "Removes", "those", "nodes", "which", "do", "not", "intersect", "with", "the", "initial", "policies", "specified", "by", "the", "user", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L855-L905
33,532
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java
PolicyChecker.getPolicyTree
PolicyNode getPolicyTree() { if (rootNode == null) return null; else { PolicyNodeImpl policyTree = rootNode.copyTree(); policyTree.setImmutable(); return policyTree; } }
java
PolicyNode getPolicyTree() { if (rootNode == null) return null; else { PolicyNodeImpl policyTree = rootNode.copyTree(); policyTree.setImmutable(); return policyTree; } }
[ "PolicyNode", "getPolicyTree", "(", ")", "{", "if", "(", "rootNode", "==", "null", ")", "return", "null", ";", "else", "{", "PolicyNodeImpl", "policyTree", "=", "rootNode", ".", "copyTree", "(", ")", ";", "policyTree", ".", "setImmutable", "(", ")", ";", ...
Gets the root node of the valid policy tree, or null if the valid policy tree is null. Marks each node of the returned tree immutable and thread-safe. @returns the root node of the valid policy tree, or null if the valid policy tree is null
[ "Gets", "the", "root", "node", "of", "the", "valid", "policy", "tree", "or", "null", "if", "the", "valid", "policy", "tree", "is", "null", ".", "Marks", "each", "node", "of", "the", "returned", "tree", "immutable", "and", "thread", "-", "safe", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/PolicyChecker.java#L915-L923
33,533
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Spliterators.java
Spliterators.checkFromToBounds
private static void checkFromToBounds(int arrayLength, int origin, int fence) { if (origin > fence) { throw new ArrayIndexOutOfBoundsException( "origin(" + origin + ") > fence(" + fence + ")"); } if (origin < 0) { throw new ArrayIndexOutOfBoundsException(origin); } if (fence > arrayLength) { throw new ArrayIndexOutOfBoundsException(fence); } }
java
private static void checkFromToBounds(int arrayLength, int origin, int fence) { if (origin > fence) { throw new ArrayIndexOutOfBoundsException( "origin(" + origin + ") > fence(" + fence + ")"); } if (origin < 0) { throw new ArrayIndexOutOfBoundsException(origin); } if (fence > arrayLength) { throw new ArrayIndexOutOfBoundsException(fence); } }
[ "private", "static", "void", "checkFromToBounds", "(", "int", "arrayLength", ",", "int", "origin", ",", "int", "fence", ")", "{", "if", "(", "origin", ">", "fence", ")", "{", "throw", "new", "ArrayIndexOutOfBoundsException", "(", "\"origin(\"", "+", "origin", ...
Validate inclusive start index and exclusive end index against the length of an array. @param arrayLength The length of the array @param origin The inclusive start index @param fence The exclusive end index @throws ArrayIndexOutOfBoundsException if the start index is greater than the end index, if the start index is negative, or the end index is greater than the array length
[ "Validate", "inclusive", "start", "index", "and", "exclusive", "end", "index", "against", "the", "length", "of", "an", "array", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/Spliterators.java#L385-L396
33,534
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java
NativeIDN.toASCII
public static String toASCII(String s, int flags) { String[] parts = SEPARATORS_REGEX.split(s); for (int i = 0; i < parts.length; i++) { if (nonASCII(parts[i])) { parts[i] = PUNYCODE_PREFIX + encode(parts[i]); } } return String.join(".", parts); }
java
public static String toASCII(String s, int flags) { String[] parts = SEPARATORS_REGEX.split(s); for (int i = 0; i < parts.length; i++) { if (nonASCII(parts[i])) { parts[i] = PUNYCODE_PREFIX + encode(parts[i]); } } return String.join(".", parts); }
[ "public", "static", "String", "toASCII", "(", "String", "s", ",", "int", "flags", ")", "{", "String", "[", "]", "parts", "=", "SEPARATORS_REGEX", ".", "split", "(", "s", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parts", ".", "le...
Convert a Unicode string to IDN.
[ "Convert", "a", "Unicode", "string", "to", "IDN", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java#L49-L57
33,535
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java
NativeIDN.nonASCII
private static boolean nonASCII(String s) { for (int i = 0; i < s.length(); i++) { if (s.charAt(i) > 0x7F) { return true; } } return false; }
java
private static boolean nonASCII(String s) { for (int i = 0; i < s.length(); i++) { if (s.charAt(i) > 0x7F) { return true; } } return false; }
[ "private", "static", "boolean", "nonASCII", "(", "String", "s", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "s", ".", "length", "(", ")", ";", "i", "++", ")", "{", "if", "(", "s", ".", "charAt", "(", "i", ")", ">", "0x7F", ")...
Returns true if a string contains any non-ASCII characters.
[ "Returns", "true", "if", "a", "string", "contains", "any", "non", "-", "ASCII", "characters", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java#L62-L69
33,536
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java
NativeIDN.encode
private static String encode(String s) { int n = INITIAL_N; int delta = 0; int bias = INITIAL_BIAS; StringBuffer output = new StringBuffer(); // Copy all basic code points to the output. int b = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (basicCodePoint(c)) { output.append(c); b++; } } if (b > 0) { output.append(DELIMITER); } int h = b; while (h < s.length()) { int m = Integer.MAX_VALUE; for (int i = 0; i < s.length(); i++) { int c = s.charAt(i); if (c >= n && c < m) { m = c; } } if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) { // This should probably be a java.text.ParseException, but // IllegalArgumentException is what Android's IDN expects. throw new IllegalArgumentException("encoding overflow"); } delta = delta + (m - n) * (h + 1); n = m; for (int j = 0; j < s.length(); j++) { int c = s.charAt(j); if (c < n) { delta++; if (0 == delta) { throw new IllegalArgumentException("encoding overflow"); } } if (c == n) { int q = delta; for (int k = BASE;; k += BASE) { int t; if (k <= bias) { t = TMIN; } else if (k >= bias + TMAX) { t = TMAX; } else { t = k - bias; } if (q < t) { break; } output.append((char) encodeDigit(t + (q - t) % (BASE - t))); q = (q - t) / (BASE - t); } output.append((char) encodeDigit(q)); bias = adapt(delta, h + 1, h == b); delta = 0; h++; } } delta++; n++; } return output.toString(); }
java
private static String encode(String s) { int n = INITIAL_N; int delta = 0; int bias = INITIAL_BIAS; StringBuffer output = new StringBuffer(); // Copy all basic code points to the output. int b = 0; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); if (basicCodePoint(c)) { output.append(c); b++; } } if (b > 0) { output.append(DELIMITER); } int h = b; while (h < s.length()) { int m = Integer.MAX_VALUE; for (int i = 0; i < s.length(); i++) { int c = s.charAt(i); if (c >= n && c < m) { m = c; } } if (m - n > (Integer.MAX_VALUE - delta) / (h + 1)) { // This should probably be a java.text.ParseException, but // IllegalArgumentException is what Android's IDN expects. throw new IllegalArgumentException("encoding overflow"); } delta = delta + (m - n) * (h + 1); n = m; for (int j = 0; j < s.length(); j++) { int c = s.charAt(j); if (c < n) { delta++; if (0 == delta) { throw new IllegalArgumentException("encoding overflow"); } } if (c == n) { int q = delta; for (int k = BASE;; k += BASE) { int t; if (k <= bias) { t = TMIN; } else if (k >= bias + TMAX) { t = TMAX; } else { t = k - bias; } if (q < t) { break; } output.append((char) encodeDigit(t + (q - t) % (BASE - t))); q = (q - t) / (BASE - t); } output.append((char) encodeDigit(q)); bias = adapt(delta, h + 1, h == b); delta = 0; h++; } } delta++; n++; } return output.toString(); }
[ "private", "static", "String", "encode", "(", "String", "s", ")", "{", "int", "n", "=", "INITIAL_N", ";", "int", "delta", "=", "0", ";", "int", "bias", "=", "INITIAL_BIAS", ";", "StringBuffer", "output", "=", "new", "StringBuffer", "(", ")", ";", "// C...
Encodes a Unicode string to Punycode ASCII.
[ "Encodes", "a", "Unicode", "string", "to", "Punycode", "ASCII", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java#L74-L144
33,537
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java
NativeIDN.toUnicode
public static String toUnicode(String s, int flags) { String[] parts = SEPARATORS_REGEX.split(s); for (int i = 0; i < parts.length; i++) { if (parts[i].startsWith(PUNYCODE_PREFIX)) { parts[i] = decode(parts[i].substring(PUNYCODE_PREFIX.length())); } } return String.join(".", parts); }
java
public static String toUnicode(String s, int flags) { String[] parts = SEPARATORS_REGEX.split(s); for (int i = 0; i < parts.length; i++) { if (parts[i].startsWith(PUNYCODE_PREFIX)) { parts[i] = decode(parts[i].substring(PUNYCODE_PREFIX.length())); } } return String.join(".", parts); }
[ "public", "static", "String", "toUnicode", "(", "String", "s", ",", "int", "flags", ")", "{", "String", "[", "]", "parts", "=", "SEPARATORS_REGEX", ".", "split", "(", "s", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "parts", ".", "...
Convert an IDN-formatted ASCII string to Unicode.
[ "Convert", "an", "IDN", "-", "formatted", "ASCII", "string", "to", "Unicode", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/libcore/icu/NativeIDN.java#L149-L158
33,538
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.next
public int next() { if (dir_ > 1) { // Continue forward iteration. Test this first. if (otherHalf_ != 0) { int oh = otherHalf_; otherHalf_ = 0; return oh; } } else if (dir_ == 1) { // next() after setOffset() dir_ = 2; } else if (dir_ == 0) { // The iter_ is already reset to the start of the text. dir_ = 2; } else /* dir_ < 0 */{ // illegal change of direction throw new IllegalStateException("Illegal change of direction"); // Java porting note: ICU4C sets U_INVALID_STATE_ERROR to the return status. } // No need to keep all CEs in the buffer when we iterate. iter_.clearCEsIfNoneRemaining(); long ce = iter_.nextCE(); if (ce == Collation.NO_CE) { return NULLORDER; } // Turn the 64-bit CE into two old-style 32-bit CEs, without quaternary bits. long p = ce >>> 32; int lower32 = (int) ce; int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { otherHalf_ = secondHalf | 0xc0; // continuation CE } return firstHalf; }
java
public int next() { if (dir_ > 1) { // Continue forward iteration. Test this first. if (otherHalf_ != 0) { int oh = otherHalf_; otherHalf_ = 0; return oh; } } else if (dir_ == 1) { // next() after setOffset() dir_ = 2; } else if (dir_ == 0) { // The iter_ is already reset to the start of the text. dir_ = 2; } else /* dir_ < 0 */{ // illegal change of direction throw new IllegalStateException("Illegal change of direction"); // Java porting note: ICU4C sets U_INVALID_STATE_ERROR to the return status. } // No need to keep all CEs in the buffer when we iterate. iter_.clearCEsIfNoneRemaining(); long ce = iter_.nextCE(); if (ce == Collation.NO_CE) { return NULLORDER; } // Turn the 64-bit CE into two old-style 32-bit CEs, without quaternary bits. long p = ce >>> 32; int lower32 = (int) ce; int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { otherHalf_ = secondHalf | 0xc0; // continuation CE } return firstHalf; }
[ "public", "int", "next", "(", ")", "{", "if", "(", "dir_", ">", "1", ")", "{", "// Continue forward iteration. Test this first.", "if", "(", "otherHalf_", "!=", "0", ")", "{", "int", "oh", "=", "otherHalf_", ";", "otherHalf_", "=", "0", ";", "return", "o...
Get the next collation element in the source string. <p>This iterator iterates over a sequence of collation elements that were built from the string. Because there isn't necessarily a one-to-one mapping from characters to collation elements, this doesn't mean the same thing as "return the collation element [or ordering priority] of the next character in the string". <p>This function returns the collation element that the iterator is currently pointing to, and then updates the internal pointer to point to the next element. @return the next collation element or NULLORDER if the end of the iteration has been reached.
[ "Get", "the", "next", "collation", "element", "in", "the", "source", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L311-L345
33,539
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.previous
public int previous() { if (dir_ < 0) { // Continue backwards iteration. Test this first. if (otherHalf_ != 0) { int oh = otherHalf_; otherHalf_ = 0; return oh; } } else if (dir_ == 0) { iter_.resetToOffset(string_.length()); dir_ = -1; } else if (dir_ == 1) { // previous() after setOffset() dir_ = -1; } else /* dir_ > 1 */{ // illegal change of direction throw new IllegalStateException("Illegal change of direction"); // Java porting note: ICU4C sets U_INVALID_STATE_ERROR to the return status. } if (offsets_ == null) { offsets_ = new UVector32(); } // If we already have expansion CEs, then we also have offsets. // Otherwise remember the trailing offset in case we need to // write offsets for an artificial expansion. int limitOffset = iter_.getCEsLength() == 0 ? iter_.getOffset() : 0; long ce = iter_.previousCE(offsets_); if (ce == Collation.NO_CE) { return NULLORDER; } // Turn the 64-bit CE into two old-style 32-bit CEs, without quaternary bits. long p = ce >>> 32; int lower32 = (int) ce; int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { if (offsets_.isEmpty()) { // When we convert a single 64-bit CE into two 32-bit CEs, // we need to make this artificial expansion behave like a normal expansion. // See CollationIterator.previousCE(). offsets_.addElement(iter_.getOffset()); offsets_.addElement(limitOffset); } otherHalf_ = firstHalf; return secondHalf | 0xc0; // continuation CE } return firstHalf; }
java
public int previous() { if (dir_ < 0) { // Continue backwards iteration. Test this first. if (otherHalf_ != 0) { int oh = otherHalf_; otherHalf_ = 0; return oh; } } else if (dir_ == 0) { iter_.resetToOffset(string_.length()); dir_ = -1; } else if (dir_ == 1) { // previous() after setOffset() dir_ = -1; } else /* dir_ > 1 */{ // illegal change of direction throw new IllegalStateException("Illegal change of direction"); // Java porting note: ICU4C sets U_INVALID_STATE_ERROR to the return status. } if (offsets_ == null) { offsets_ = new UVector32(); } // If we already have expansion CEs, then we also have offsets. // Otherwise remember the trailing offset in case we need to // write offsets for an artificial expansion. int limitOffset = iter_.getCEsLength() == 0 ? iter_.getOffset() : 0; long ce = iter_.previousCE(offsets_); if (ce == Collation.NO_CE) { return NULLORDER; } // Turn the 64-bit CE into two old-style 32-bit CEs, without quaternary bits. long p = ce >>> 32; int lower32 = (int) ce; int firstHalf = getFirstHalf(p, lower32); int secondHalf = getSecondHalf(p, lower32); if (secondHalf != 0) { if (offsets_.isEmpty()) { // When we convert a single 64-bit CE into two 32-bit CEs, // we need to make this artificial expansion behave like a normal expansion. // See CollationIterator.previousCE(). offsets_.addElement(iter_.getOffset()); offsets_.addElement(limitOffset); } otherHalf_ = firstHalf; return secondHalf | 0xc0; // continuation CE } return firstHalf; }
[ "public", "int", "previous", "(", ")", "{", "if", "(", "dir_", "<", "0", ")", "{", "// Continue backwards iteration. Test this first.", "if", "(", "otherHalf_", "!=", "0", ")", "{", "int", "oh", "=", "otherHalf_", ";", "otherHalf_", "=", "0", ";", "return"...
Get the previous collation element in the source string. <p>This iterator iterates over a sequence of collation elements that were built from the string. Because there isn't necessarily a one-to-one mapping from characters to collation elements, this doesn't mean the same thing as "return the collation element [or ordering priority] of the previous character in the string". <p>This function updates the iterator's internal pointer to point to the collation element preceding the one it's currently pointing to and then returns that element, while next() returns the current element and then updates the pointer. @return the previous collation element, or NULLORDER when the start of the iteration has been reached.
[ "Get", "the", "previous", "collation", "element", "in", "the", "source", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L365-L412
33,540
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.setText
public void setText(String source) { string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
java
public void setText(String source) { string_ = source; // TODO: do we need to remember the source string in a field? CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new UTF16CollationIterator(rbc_.data, numeric, string_, 0); } else { newIter = new FCDUTF16CollationIterator(rbc_.data, numeric, string_, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
[ "public", "void", "setText", "(", "String", "source", ")", "{", "string_", "=", "source", ";", "// TODO: do we need to remember the source string in a field?", "CollationIterator", "newIter", ";", "boolean", "numeric", "=", "rbc_", ".", "settings", ".", "readOnly", "(...
Set a new source string for iteration, and reset the offset to the beginning of the text. @param source the new source string for iteration.
[ "Set", "a", "new", "source", "string", "for", "iteration", "and", "reset", "the", "offset", "to", "the", "beginning", "of", "the", "text", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L492-L504
33,541
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java
CollationElementIterator.setText
public void setText(UCharacterIterator source) { string_ = source.getText(); // TODO: do we need to remember the source string in a field? // Note: In C++, we just setText(source.getText()). // In Java, we actually operate on a character iterator. // (The old code apparently did so only for a CharacterIterator; // for a UCharacterIterator it also just used source.getText()). // TODO: do we need to remember the cloned iterator in a field? UCharacterIterator src; try { src = (UCharacterIterator) source.clone(); } catch (CloneNotSupportedException e) { // Fall back to ICU 52 behavior of iterating over the text contents // of the UCharacterIterator. setText(source.getText()); return; } src.setToStart(); CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new IterCollationIterator(rbc_.data, numeric, src); } else { newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
java
public void setText(UCharacterIterator source) { string_ = source.getText(); // TODO: do we need to remember the source string in a field? // Note: In C++, we just setText(source.getText()). // In Java, we actually operate on a character iterator. // (The old code apparently did so only for a CharacterIterator; // for a UCharacterIterator it also just used source.getText()). // TODO: do we need to remember the cloned iterator in a field? UCharacterIterator src; try { src = (UCharacterIterator) source.clone(); } catch (CloneNotSupportedException e) { // Fall back to ICU 52 behavior of iterating over the text contents // of the UCharacterIterator. setText(source.getText()); return; } src.setToStart(); CollationIterator newIter; boolean numeric = rbc_.settings.readOnly().isNumeric(); if (rbc_.settings.readOnly().dontCheckFCD()) { newIter = new IterCollationIterator(rbc_.data, numeric, src); } else { newIter = new FCDIterCollationIterator(rbc_.data, numeric, src, 0); } iter_ = newIter; otherHalf_ = 0; dir_ = 0; }
[ "public", "void", "setText", "(", "UCharacterIterator", "source", ")", "{", "string_", "=", "source", ".", "getText", "(", ")", ";", "// TODO: do we need to remember the source string in a field?", "// Note: In C++, we just setText(source.getText()).", "// In Java, we actually op...
Set a new source string iterator for iteration, and reset the offset to the beginning of the text. <p>The source iterator's integrity will be preserved since a new copy will be created for use. @param source the new source string iterator for iteration.
[ "Set", "a", "new", "source", "string", "iterator", "for", "iteration", "and", "reset", "the", "offset", "to", "the", "beginning", "of", "the", "text", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CollationElementIterator.java#L514-L541
33,542
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/MsgMgr.java
MsgMgr.message
public void message(SourceLocator srcLctr, String msg, boolean terminate) throws TransformerException { ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) { errHandler.warning(new TransformerException(msg, srcLctr)); } else { if (terminate) throw new TransformerException(msg, srcLctr); else System.out.println(msg); } }
java
public void message(SourceLocator srcLctr, String msg, boolean terminate) throws TransformerException { ErrorListener errHandler = m_transformer.getErrorListener(); if (null != errHandler) { errHandler.warning(new TransformerException(msg, srcLctr)); } else { if (terminate) throw new TransformerException(msg, srcLctr); else System.out.println(msg); } }
[ "public", "void", "message", "(", "SourceLocator", "srcLctr", ",", "String", "msg", ",", "boolean", "terminate", ")", "throws", "TransformerException", "{", "ErrorListener", "errHandler", "=", "m_transformer", ".", "getErrorListener", "(", ")", ";", "if", "(", "...
Warn the user of a problem. This is public for access by extensions. @param msg The message text to issue @param terminate Flag indicating whether to terminate this process @throws XSLProcessorException thrown if the active ProblemListener and XPathContext decide the error condition is severe enough to halt processing. @throws TransformerException
[ "Warn", "the", "user", "of", "a", "problem", ".", "This", "is", "public", "for", "access", "by", "extensions", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/MsgMgr.java#L62-L78
33,543
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ReverseState.java
ReverseState.updateState
public void updateState(TrustAnchor anchor, BuilderParams buildParams) throws CertificateException, IOException, CertPathValidatorException { trustAnchor = anchor; X509Certificate trustedCert = anchor.getTrustedCert(); if (trustedCert != null) { updateState(trustedCert); } else { X500Principal caName = anchor.getCA(); updateState(anchor.getCAPublicKey(), caName); } // The user specified AlgorithmChecker and RevocationChecker may not be // able to set the trust anchor until now. boolean revCheckerAdded = false; for (PKIXCertPathChecker checker : userCheckers) { if (checker instanceof AlgorithmChecker) { ((AlgorithmChecker)checker).trySetTrustAnchor(anchor); } else if (checker instanceof PKIXRevocationChecker) { if (revCheckerAdded) { throw new CertPathValidatorException( "Only one PKIXRevocationChecker can be specified"); } // if it's our own, initialize it if (checker instanceof RevocationChecker) { ((RevocationChecker)checker).init(anchor, buildParams); } ((PKIXRevocationChecker)checker).init(false); revCheckerAdded = true; } } // only create a RevocationChecker if revocation is enabled and // a PKIXRevocationChecker has not already been added if (buildParams.revocationEnabled() && !revCheckerAdded) { revChecker = new RevocationChecker(anchor, buildParams); revChecker.init(false); } init = false; }
java
public void updateState(TrustAnchor anchor, BuilderParams buildParams) throws CertificateException, IOException, CertPathValidatorException { trustAnchor = anchor; X509Certificate trustedCert = anchor.getTrustedCert(); if (trustedCert != null) { updateState(trustedCert); } else { X500Principal caName = anchor.getCA(); updateState(anchor.getCAPublicKey(), caName); } // The user specified AlgorithmChecker and RevocationChecker may not be // able to set the trust anchor until now. boolean revCheckerAdded = false; for (PKIXCertPathChecker checker : userCheckers) { if (checker instanceof AlgorithmChecker) { ((AlgorithmChecker)checker).trySetTrustAnchor(anchor); } else if (checker instanceof PKIXRevocationChecker) { if (revCheckerAdded) { throw new CertPathValidatorException( "Only one PKIXRevocationChecker can be specified"); } // if it's our own, initialize it if (checker instanceof RevocationChecker) { ((RevocationChecker)checker).init(anchor, buildParams); } ((PKIXRevocationChecker)checker).init(false); revCheckerAdded = true; } } // only create a RevocationChecker if revocation is enabled and // a PKIXRevocationChecker has not already been added if (buildParams.revocationEnabled() && !revCheckerAdded) { revChecker = new RevocationChecker(anchor, buildParams); revChecker.init(false); } init = false; }
[ "public", "void", "updateState", "(", "TrustAnchor", "anchor", ",", "BuilderParams", "buildParams", ")", "throws", "CertificateException", ",", "IOException", ",", "CertPathValidatorException", "{", "trustAnchor", "=", "anchor", ";", "X509Certificate", "trustedCert", "=...
Update the state with the specified trust anchor. @param anchor the most-trusted CA @param buildParams builder parameters
[ "Update", "the", "state", "with", "the", "specified", "trust", "anchor", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/provider/certpath/ReverseState.java#L221-L261
33,544
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.addNode
public void addNode(int n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); this.addElement(n); }
java
public void addNode(int n) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); this.addElement(n); }
[ "public", "void", "addNode", "(", "int", "n", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ",", "null", ")", ")", ";...
Add a node to the NodeSetDTM. Not all types of NodeSetDTMs support this operation @param n Node to be added @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Add", "a", "node", "to", "the", "NodeSetDTM", ".", "Not", "all", "types", "of", "NodeSetDTMs", "support", "this", "operation" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L535-L542
33,545
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java
NodeSetDTM.setItem
public void setItem(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); }
java
public void setItem(int node, int index) { if (!m_mutable) throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_NODESETDTM_NOT_MUTABLE, null)); //"This NodeSetDTM is not mutable!"); super.setElementAt(node, index); }
[ "public", "void", "setItem", "(", "int", "node", ",", "int", "index", ")", "{", "if", "(", "!", "m_mutable", ")", "throw", "new", "RuntimeException", "(", "XSLMessages", ".", "createXPATHMessage", "(", "XPATHErrorResources", ".", "ER_NODESETDTM_NOT_MUTABLE", ","...
Same as setElementAt. @param node The node to be set. @param index The index of the node to be replaced. @throws RuntimeException thrown if this NodeSetDTM is not of a mutable type.
[ "Same", "as", "setElementAt", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/NodeSetDTM.java#L1025-L1032
33,546
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterProperty.java
UCharacterProperty.getEuropeanDigit
public static int getEuropeanDigit(int ch) { if ((ch > 0x7a && ch < 0xff21) || ch < 0x41 || (ch > 0x5a && ch < 0x61) || ch > 0xff5a || (ch > 0xff3a && ch < 0xff41)) { return -1; } if (ch <= 0x7a) { // ch >= 0x41 or ch < 0x61 return ch + 10 - ((ch <= 0x5a) ? 0x41 : 0x61); } // ch >= 0xff21 if (ch <= 0xff3a) { return ch + 10 - 0xff21; } // ch >= 0xff41 && ch <= 0xff5a return ch + 10 - 0xff41; }
java
public static int getEuropeanDigit(int ch) { if ((ch > 0x7a && ch < 0xff21) || ch < 0x41 || (ch > 0x5a && ch < 0x61) || ch > 0xff5a || (ch > 0xff3a && ch < 0xff41)) { return -1; } if (ch <= 0x7a) { // ch >= 0x41 or ch < 0x61 return ch + 10 - ((ch <= 0x5a) ? 0x41 : 0x61); } // ch >= 0xff21 if (ch <= 0xff3a) { return ch + 10 - 0xff21; } // ch >= 0xff41 && ch <= 0xff5a return ch + 10 - 0xff41; }
[ "public", "static", "int", "getEuropeanDigit", "(", "int", "ch", ")", "{", "if", "(", "(", "ch", ">", "0x7a", "&&", "ch", "<", "0xff21", ")", "||", "ch", "<", "0x41", "||", "(", "ch", ">", "0x5a", "&&", "ch", "<", "0x61", ")", "||", "ch", ">", ...
Returns the digit values of characters like 'A' - 'Z', normal, half-width and full-width. This method assumes that the other digit characters are checked by the calling method. @param ch character to test @return -1 if ch is not a character of the form 'A' - 'Z', otherwise its corresponding digit will be returned.
[ "Returns", "the", "digit", "values", "of", "characters", "like", "A", "-", "Z", "normal", "half", "-", "width", "and", "full", "-", "width", ".", "This", "method", "assumes", "that", "the", "other", "digit", "characters", "are", "checked", "by", "the", "...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/UCharacterProperty.java#L822-L838
33,547
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.encode
public void encode(DerOutputStream outStrm) throws CRLException { try { if (revokedCert == null) { DerOutputStream tmp = new DerOutputStream(); // sequence { serialNumber, revocationDate, extensions } serialNumber.encode(tmp); if (revocationDate.getTime() < YR_2050) { tmp.putUTCTime(revocationDate); } else { tmp.putGeneralizedTime(revocationDate); } if (extensions != null) extensions.encode(tmp, isExplicit); DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, tmp); revokedCert = seq.toByteArray(); } outStrm.write(revokedCert); } catch (IOException e) { throw new CRLException("Encoding error: " + e.toString()); } }
java
public void encode(DerOutputStream outStrm) throws CRLException { try { if (revokedCert == null) { DerOutputStream tmp = new DerOutputStream(); // sequence { serialNumber, revocationDate, extensions } serialNumber.encode(tmp); if (revocationDate.getTime() < YR_2050) { tmp.putUTCTime(revocationDate); } else { tmp.putGeneralizedTime(revocationDate); } if (extensions != null) extensions.encode(tmp, isExplicit); DerOutputStream seq = new DerOutputStream(); seq.write(DerValue.tag_Sequence, tmp); revokedCert = seq.toByteArray(); } outStrm.write(revokedCert); } catch (IOException e) { throw new CRLException("Encoding error: " + e.toString()); } }
[ "public", "void", "encode", "(", "DerOutputStream", "outStrm", ")", "throws", "CRLException", "{", "try", "{", "if", "(", "revokedCert", "==", "null", ")", "{", "DerOutputStream", "tmp", "=", "new", "DerOutputStream", "(", ")", ";", "// sequence { serialNumber, ...
Encodes the revoked certificate to an output stream. @param outStrm an output stream to which the encoded revoked certificate is written. @exception CRLException on encoding errors.
[ "Encodes", "the", "revoked", "certificate", "to", "an", "output", "stream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L158-L183
33,548
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.getRevocationReason
@Override public CRLReason getRevocationReason() { Extension ext = getExtension(PKIXExtensions.ReasonCode_Id); if (ext == null) { return null; } CRLReasonCodeExtension rcExt = (CRLReasonCodeExtension) ext; return rcExt.getReasonCode(); }
java
@Override public CRLReason getRevocationReason() { Extension ext = getExtension(PKIXExtensions.ReasonCode_Id); if (ext == null) { return null; } CRLReasonCodeExtension rcExt = (CRLReasonCodeExtension) ext; return rcExt.getReasonCode(); }
[ "@", "Override", "public", "CRLReason", "getRevocationReason", "(", ")", "{", "Extension", "ext", "=", "getExtension", "(", "PKIXExtensions", ".", "ReasonCode_Id", ")", ";", "if", "(", "ext", "==", "null", ")", "{", "return", "null", ";", "}", "CRLReasonCode...
This method is the overridden implementation of the getRevocationReason method in X509CRLEntry. It is better performance-wise since it returns cached values.
[ "This", "method", "is", "the", "overridden", "implementation", "of", "the", "getRevocationReason", "method", "in", "X509CRLEntry", ".", "It", "is", "better", "performance", "-", "wise", "since", "it", "returns", "cached", "values", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L240-L248
33,549
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.getRevocationReason
public static CRLReason getRevocationReason(X509CRLEntry crlEntry) { try { byte[] ext = crlEntry.getExtensionValue("2.5.29.21"); if (ext == null) { return null; } DerValue val = new DerValue(ext); byte[] data = val.getOctetString(); CRLReasonCodeExtension rcExt = new CRLReasonCodeExtension(Boolean.FALSE, data); return rcExt.getReasonCode(); } catch (IOException ioe) { return null; } }
java
public static CRLReason getRevocationReason(X509CRLEntry crlEntry) { try { byte[] ext = crlEntry.getExtensionValue("2.5.29.21"); if (ext == null) { return null; } DerValue val = new DerValue(ext); byte[] data = val.getOctetString(); CRLReasonCodeExtension rcExt = new CRLReasonCodeExtension(Boolean.FALSE, data); return rcExt.getReasonCode(); } catch (IOException ioe) { return null; } }
[ "public", "static", "CRLReason", "getRevocationReason", "(", "X509CRLEntry", "crlEntry", ")", "{", "try", "{", "byte", "[", "]", "ext", "=", "crlEntry", ".", "getExtensionValue", "(", "\"2.5.29.21\"", ")", ";", "if", "(", "ext", "==", "null", ")", "{", "re...
This static method is the default implementation of the getRevocationReason method in X509CRLEntry.
[ "This", "static", "method", "is", "the", "default", "implementation", "of", "the", "getRevocationReason", "method", "in", "X509CRLEntry", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L254-L269
33,550
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.getReasonCode
public Integer getReasonCode() throws IOException { Object obj = getExtension(PKIXExtensions.ReasonCode_Id); if (obj == null) return null; CRLReasonCodeExtension reasonCode = (CRLReasonCodeExtension)obj; return reasonCode.get(CRLReasonCodeExtension.REASON); }
java
public Integer getReasonCode() throws IOException { Object obj = getExtension(PKIXExtensions.ReasonCode_Id); if (obj == null) return null; CRLReasonCodeExtension reasonCode = (CRLReasonCodeExtension)obj; return reasonCode.get(CRLReasonCodeExtension.REASON); }
[ "public", "Integer", "getReasonCode", "(", ")", "throws", "IOException", "{", "Object", "obj", "=", "getExtension", "(", "PKIXExtensions", ".", "ReasonCode_Id", ")", ";", "if", "(", "obj", "==", "null", ")", "return", "null", ";", "CRLReasonCodeExtension", "re...
get Reason Code from CRL entry. @returns Integer or null, if no such extension @throws IOException on error
[ "get", "Reason", "Code", "from", "CRL", "entry", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L277-L283
33,551
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.getExtension
public Extension getExtension(ObjectIdentifier oid) { if (extensions == null) return null; // following returns null if no such OID in map //XXX consider cloning this return extensions.get(OIDMap.getName(oid)); }
java
public Extension getExtension(ObjectIdentifier oid) { if (extensions == null) return null; // following returns null if no such OID in map //XXX consider cloning this return extensions.get(OIDMap.getName(oid)); }
[ "public", "Extension", "getExtension", "(", "ObjectIdentifier", "oid", ")", "{", "if", "(", "extensions", "==", "null", ")", "return", "null", ";", "// following returns null if no such OID in map", "//XXX consider cloning this", "return", "extensions", ".", "get", "(",...
get an extension @param oid ObjectIdentifier of extension desired @returns Extension of type <extension> or null, if not found
[ "get", "an", "extension" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L437-L444
33,552
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.toImpl
public static X509CRLEntryImpl toImpl(X509CRLEntry entry) throws CRLException { if (entry instanceof X509CRLEntryImpl) { return (X509CRLEntryImpl)entry; } else { return new X509CRLEntryImpl(entry.getEncoded()); } }
java
public static X509CRLEntryImpl toImpl(X509CRLEntry entry) throws CRLException { if (entry instanceof X509CRLEntryImpl) { return (X509CRLEntryImpl)entry; } else { return new X509CRLEntryImpl(entry.getEncoded()); } }
[ "public", "static", "X509CRLEntryImpl", "toImpl", "(", "X509CRLEntry", "entry", ")", "throws", "CRLException", "{", "if", "(", "entry", "instanceof", "X509CRLEntryImpl", ")", "{", "return", "(", "X509CRLEntryImpl", ")", "entry", ";", "}", "else", "{", "return", ...
Utility method to convert an arbitrary instance of X509CRLEntry to a X509CRLEntryImpl. Does a cast if possible, otherwise reparses the encoding.
[ "Utility", "method", "to", "convert", "an", "arbitrary", "instance", "of", "X509CRLEntry", "to", "a", "X509CRLEntryImpl", ".", "Does", "a", "cast", "if", "possible", "otherwise", "reparses", "the", "encoding", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L483-L490
33,553
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java
X509CRLEntryImpl.getExtensions
public Map<String, java.security.cert.Extension> getExtensions() { if (extensions == null) { return Collections.emptyMap(); } Collection<Extension> exts = extensions.getAllExtensions(); Map<String, java.security.cert.Extension> map = new TreeMap<>(); for (Extension ext : exts) { map.put(ext.getId(), ext); } return map; }
java
public Map<String, java.security.cert.Extension> getExtensions() { if (extensions == null) { return Collections.emptyMap(); } Collection<Extension> exts = extensions.getAllExtensions(); Map<String, java.security.cert.Extension> map = new TreeMap<>(); for (Extension ext : exts) { map.put(ext.getId(), ext); } return map; }
[ "public", "Map", "<", "String", ",", "java", ".", "security", ".", "cert", ".", "Extension", ">", "getExtensions", "(", ")", "{", "if", "(", "extensions", "==", "null", ")", "{", "return", "Collections", ".", "emptyMap", "(", ")", ";", "}", "Collection...
Returns all extensions for this entry in a map @return the extension map, can be empty, but not null
[ "Returns", "all", "extensions", "for", "this", "entry", "in", "a", "map" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/X509CRLEntryImpl.java#L506-L516
33,554
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java
ExemptionMechanism.isCryptoAllowed
public final boolean isCryptoAllowed(Key key) throws ExemptionMechanismException { boolean ret = false; if (done && (key != null)) { // Check if the key passed in is the same as the one // this exemption mechanism used. ret = keyStored.equals(key); } return ret; }
java
public final boolean isCryptoAllowed(Key key) throws ExemptionMechanismException { boolean ret = false; if (done && (key != null)) { // Check if the key passed in is the same as the one // this exemption mechanism used. ret = keyStored.equals(key); } return ret; }
[ "public", "final", "boolean", "isCryptoAllowed", "(", "Key", "key", ")", "throws", "ExemptionMechanismException", "{", "boolean", "ret", "=", "false", ";", "if", "(", "done", "&&", "(", "key", "!=", "null", ")", ")", "{", "// Check if the key passed in is the sa...
Returns whether the result blob has been generated successfully by this exemption mechanism. <p>The method also makes sure that the key passed in is the same as the one this exemption mechanism used in initializing and generating phases. @param key the key the crypto is going to use. @return whether the result blob of the same key has been generated successfully by this exemption mechanism; false if <code>key</code> is null. @exception ExemptionMechanismException if problem(s) encountered while determining whether the result blob has been generated successfully by this exemption mechanism object.
[ "Returns", "whether", "the", "result", "blob", "has", "been", "generated", "successfully", "by", "this", "exemption", "mechanism", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java#L257-L266
33,555
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java
ExemptionMechanism.init
public final void init(Key key) throws InvalidKeyException, ExemptionMechanismException { done = false; initialized = false; keyStored = key; exmechSpi.engineInit(key); initialized = true; }
java
public final void init(Key key) throws InvalidKeyException, ExemptionMechanismException { done = false; initialized = false; keyStored = key; exmechSpi.engineInit(key); initialized = true; }
[ "public", "final", "void", "init", "(", "Key", "key", ")", "throws", "InvalidKeyException", ",", "ExemptionMechanismException", "{", "done", "=", "false", ";", "initialized", "=", "false", ";", "keyStored", "=", "key", ";", "exmechSpi", ".", "engineInit", "(",...
Initializes this exemption mechanism with a key. <p>If this exemption mechanism requires any algorithm parameters that cannot be derived from the given <code>key</code>, the underlying exemption mechanism implementation is supposed to generate the required parameters itself (using provider-specific default values); in the case that algorithm parameters must be specified by the caller, an <code>InvalidKeyException</code> is raised. @param key the key for this exemption mechanism @exception InvalidKeyException if the given key is inappropriate for this exemption mechanism. @exception ExemptionMechanismException if problem(s) encountered in the process of initializing.
[ "Initializes", "this", "exemption", "mechanism", "with", "a", "key", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java#L314-L322
33,556
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java
ExemptionMechanism.genExemptionBlob
public final byte[] genExemptionBlob() throws IllegalStateException, ExemptionMechanismException { if (!initialized) { throw new IllegalStateException( "ExemptionMechanism not initialized"); } byte[] blob = exmechSpi.engineGenExemptionBlob(); done = true; return blob; }
java
public final byte[] genExemptionBlob() throws IllegalStateException, ExemptionMechanismException { if (!initialized) { throw new IllegalStateException( "ExemptionMechanism not initialized"); } byte[] blob = exmechSpi.engineGenExemptionBlob(); done = true; return blob; }
[ "public", "final", "byte", "[", "]", "genExemptionBlob", "(", ")", "throws", "IllegalStateException", ",", "ExemptionMechanismException", "{", "if", "(", "!", "initialized", ")", "{", "throw", "new", "IllegalStateException", "(", "\"ExemptionMechanism not initialized\""...
Generates the exemption mechanism key blob. @return the new buffer with the result key blob. @exception IllegalStateException if this exemption mechanism is in a wrong state (e.g., has not been initialized). @exception ExemptionMechanismException if problem(s) encountered in the process of generating.
[ "Generates", "the", "exemption", "mechanism", "key", "blob", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/crypto/ExemptionMechanism.java#L398-L407
33,557
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/DoubleSummaryStatistics.java
DoubleSummaryStatistics.accept
@Override public void accept(double value) { ++count; simpleSum += value; sumWithCompensation(value); min = Math.min(min, value); max = Math.max(max, value); }
java
@Override public void accept(double value) { ++count; simpleSum += value; sumWithCompensation(value); min = Math.min(min, value); max = Math.max(max, value); }
[ "@", "Override", "public", "void", "accept", "(", "double", "value", ")", "{", "++", "count", ";", "simpleSum", "+=", "value", ";", "sumWithCompensation", "(", "value", ")", ";", "min", "=", "Math", ".", "min", "(", "min", ",", "value", ")", ";", "ma...
Records another value into the summary information. @param value the input value
[ "Records", "another", "value", "into", "the", "summary", "information", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/DoubleSummaryStatistics.java#L82-L89
33,558
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java
ServerSocket.createImpl
void createImpl() throws SocketException { if (impl == null) setImpl(); try { impl.create(true); created = true; } catch (IOException e) { throw new SocketException(e.getMessage()); } }
java
void createImpl() throws SocketException { if (impl == null) setImpl(); try { impl.create(true); created = true; } catch (IOException e) { throw new SocketException(e.getMessage()); } }
[ "void", "createImpl", "(", ")", "throws", "SocketException", "{", "if", "(", "impl", "==", "null", ")", "setImpl", "(", ")", ";", "try", "{", "impl", ".", "create", "(", "true", ")", ";", "created", "=", "true", ";", "}", "catch", "(", "IOException",...
Creates the socket implementation. @throws IOException if creation fails @since 1.4
[ "Creates", "the", "socket", "implementation", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java#L304-L313
33,559
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java
ServerSocket.accept
public Socket accept() throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); if (!isBound()) throw new SocketException("Socket is not bound yet"); Socket s = new Socket((SocketImpl) null); implAccept(s); return s; }
java
public Socket accept() throws IOException { if (isClosed()) throw new SocketException("Socket is closed"); if (!isBound()) throw new SocketException("Socket is not bound yet"); Socket s = new Socket((SocketImpl) null); implAccept(s); return s; }
[ "public", "Socket", "accept", "(", ")", "throws", "IOException", "{", "if", "(", "isClosed", "(", ")", ")", "throw", "new", "SocketException", "(", "\"Socket is closed\"", ")", ";", "if", "(", "!", "isBound", "(", ")", ")", "throw", "new", "SocketException...
Listens for a connection to be made to this socket and accepts it. The method blocks until a connection is made. <p>A new Socket <code>s</code> is created and, if there is a security manager, the security manager's <code>checkAccept</code> method is called with <code>s.getInetAddress().getHostAddress()</code> and <code>s.getPort()</code> as its arguments to ensure the operation is allowed. This could result in a SecurityException. @exception IOException if an I/O error occurs when waiting for a connection. @exception SecurityException if a security manager exists and its <code>checkAccept</code> method doesn't allow the operation. @exception SocketTimeoutException if a timeout was previously set with setSoTimeout and the timeout has been reached. @exception java.nio.channels.IllegalBlockingModeException if this socket has an associated channel, the channel is in non-blocking mode, and there is no connection ready to be accepted @return the new Socket @see SecurityManager#checkAccept @revised 1.4 @spec JSR-51
[ "Listens", "for", "a", "connection", "to", "be", "made", "to", "this", "socket", "and", "accepts", "it", ".", "The", "method", "blocks", "until", "a", "connection", "is", "made", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java#L495-L503
33,560
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java
ServerSocket.getReuseAddress
public boolean getReuseAddress() throws SocketException { if (isClosed()) throw new SocketException("Socket is closed"); return ((Boolean) (getImpl().getOption(SocketOptions.SO_REUSEADDR))).booleanValue(); }
java
public boolean getReuseAddress() throws SocketException { if (isClosed()) throw new SocketException("Socket is closed"); return ((Boolean) (getImpl().getOption(SocketOptions.SO_REUSEADDR))).booleanValue(); }
[ "public", "boolean", "getReuseAddress", "(", ")", "throws", "SocketException", "{", "if", "(", "isClosed", "(", ")", ")", "throw", "new", "SocketException", "(", "\"Socket is closed\"", ")", ";", "return", "(", "(", "Boolean", ")", "(", "getImpl", "(", ")", ...
Tests if SO_REUSEADDR is enabled. @return a <code>boolean</code> indicating whether or not SO_REUSEADDR is enabled. @exception SocketException if there is an error in the underlying protocol, such as a TCP error. @since 1.4 @see #setReuseAddress(boolean)
[ "Tests", "if", "SO_REUSEADDR", "is", "enabled", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/net/ServerSocket.java#L714-L718
33,561
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.tableSizeFor
static final int tableSizeFor(int cap) { int n = cap - 1; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1; }
java
static final int tableSizeFor(int cap) { int n = cap - 1; n |= n >>> 1; n |= n >>> 2; n |= n >>> 4; n |= n >>> 8; n |= n >>> 16; return (n < 0) ? 1 : (n >= MAXIMUM_CAPACITY) ? MAXIMUM_CAPACITY : n + 1; }
[ "static", "final", "int", "tableSizeFor", "(", "int", "cap", ")", "{", "int", "n", "=", "cap", "-", "1", ";", "n", "|=", "n", ">>>", "1", ";", "n", "|=", "n", ">>>", "2", ";", "n", "|=", "n", ">>>", "4", ";", "n", "|=", "n", ">>>", "8", "...
Returns a power of two size for the given target capacity.
[ "Returns", "a", "power", "of", "two", "size", "for", "the", "given", "target", "capacity", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L383-L391
33,562
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.putMapEntries
final void putMapEntries(Map<? extends K, ? extends V> m, boolean evict) { int s = m.size(); if (s > 0) { if (table == null) { // pre-size float ft = ((float)s / loadFactor) + 1.0F; int t = ((ft < (float)MAXIMUM_CAPACITY) ? (int)ft : MAXIMUM_CAPACITY); if (t > threshold) threshold = tableSizeFor(t); } else if (s > threshold) resize(); for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) { K key = e.getKey(); V value = e.getValue(); putVal(hash(key), key, value, false, evict); } } }
java
final void putMapEntries(Map<? extends K, ? extends V> m, boolean evict) { int s = m.size(); if (s > 0) { if (table == null) { // pre-size float ft = ((float)s / loadFactor) + 1.0F; int t = ((ft < (float)MAXIMUM_CAPACITY) ? (int)ft : MAXIMUM_CAPACITY); if (t > threshold) threshold = tableSizeFor(t); } else if (s > threshold) resize(); for (Map.Entry<? extends K, ? extends V> e : m.entrySet()) { K key = e.getKey(); V value = e.getValue(); putVal(hash(key), key, value, false, evict); } } }
[ "final", "void", "putMapEntries", "(", "Map", "<", "?", "extends", "K", ",", "?", "extends", "V", ">", "m", ",", "boolean", "evict", ")", "{", "int", "s", "=", "m", ".", "size", "(", ")", ";", "if", "(", "s", ">", "0", ")", "{", "if", "(", ...
Implements Map.putAll and Map constructor @param m the map @param evict false when initially constructing this map, else true (relayed to method afterNodeInsertion).
[ "Implements", "Map", ".", "putAll", "and", "Map", "constructor" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L505-L523
33,563
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.getNode
final Node<K,V> getNode(int hash, Object key) { Node<K,V>[] tab; Node<K,V> first, e; int n; K k; if ((tab = table) != null && (n = tab.length) > 0 && (first = tab[(n - 1) & hash]) != null) { if (first.hash == hash && // always check first node ((k = first.key) == key || (key != null && key.equals(k)))) return first; if ((e = first.next) != null) { if (first instanceof TreeNode) return ((TreeNode<K,V>)first).getTreeNode(hash, key); do { if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) return e; } while ((e = e.next) != null); } } return null; }
java
final Node<K,V> getNode(int hash, Object key) { Node<K,V>[] tab; Node<K,V> first, e; int n; K k; if ((tab = table) != null && (n = tab.length) > 0 && (first = tab[(n - 1) & hash]) != null) { if (first.hash == hash && // always check first node ((k = first.key) == key || (key != null && key.equals(k)))) return first; if ((e = first.next) != null) { if (first instanceof TreeNode) return ((TreeNode<K,V>)first).getTreeNode(hash, key); do { if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) return e; } while ((e = e.next) != null); } } return null; }
[ "final", "Node", "<", "K", ",", "V", ">", "getNode", "(", "int", "hash", ",", "Object", "key", ")", "{", "Node", "<", "K", ",", "V", ">", "[", "]", "tab", ";", "Node", "<", "K", ",", "V", ">", "first", ",", "e", ";", "int", "n", ";", "K",...
Implements Map.get and related methods @param hash hash for key @param key the key @return the node, or null if none
[ "Implements", "Map", ".", "get", "and", "related", "methods" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L572-L590
33,564
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.putVal
final V putVal(int hash, K key, V value, boolean onlyIfAbsent, boolean evict) { Node<K,V>[] tab; Node<K,V> p; int n, i; if ((tab = table) == null || (n = tab.length) == 0) n = (tab = resize()).length; if ((p = tab[i = (n - 1) & hash]) == null) tab[i] = newNode(hash, key, value, null); else { Node<K,V> e; K k; if (p.hash == hash && ((k = p.key) == key || (key != null && key.equals(k)))) e = p; else if (p instanceof TreeNode) e = ((TreeNode<K,V>)p).putTreeVal(this, tab, hash, key, value); else { for (int binCount = 0; ; ++binCount) { if ((e = p.next) == null) { p.next = newNode(hash, key, value, null); if (binCount >= TREEIFY_THRESHOLD - 1) // -1 for 1st treeifyBin(tab, hash); break; } if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) break; p = e; } } if (e != null) { // existing mapping for key V oldValue = e.value; if (!onlyIfAbsent || oldValue == null) e.value = value; afterNodeAccess(e); return oldValue; } } ++modCount; if (++size > threshold) resize(); afterNodeInsertion(evict); return null; }
java
final V putVal(int hash, K key, V value, boolean onlyIfAbsent, boolean evict) { Node<K,V>[] tab; Node<K,V> p; int n, i; if ((tab = table) == null || (n = tab.length) == 0) n = (tab = resize()).length; if ((p = tab[i = (n - 1) & hash]) == null) tab[i] = newNode(hash, key, value, null); else { Node<K,V> e; K k; if (p.hash == hash && ((k = p.key) == key || (key != null && key.equals(k)))) e = p; else if (p instanceof TreeNode) e = ((TreeNode<K,V>)p).putTreeVal(this, tab, hash, key, value); else { for (int binCount = 0; ; ++binCount) { if ((e = p.next) == null) { p.next = newNode(hash, key, value, null); if (binCount >= TREEIFY_THRESHOLD - 1) // -1 for 1st treeifyBin(tab, hash); break; } if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) break; p = e; } } if (e != null) { // existing mapping for key V oldValue = e.value; if (!onlyIfAbsent || oldValue == null) e.value = value; afterNodeAccess(e); return oldValue; } } ++modCount; if (++size > threshold) resize(); afterNodeInsertion(evict); return null; }
[ "final", "V", "putVal", "(", "int", "hash", ",", "K", "key", ",", "V", "value", ",", "boolean", "onlyIfAbsent", ",", "boolean", "evict", ")", "{", "Node", "<", "K", ",", "V", ">", "[", "]", "tab", ";", "Node", "<", "K", ",", "V", ">", "p", ";...
Implements Map.put and related methods @param hash hash for key @param key the key @param value the value to put @param onlyIfAbsent if true, don't change existing value @param evict if false, the table is in creation mode. @return previous value, or null if none
[ "Implements", "Map", ".", "put", "and", "related", "methods" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L630-L671
33,565
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.resize
final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; int oldCap = (oldTab == null) ? 0 : oldTab.length; int oldThr = threshold; int newCap, newThr = 0; if (oldCap > 0) { if (oldCap >= MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return oldTab; } else if ((newCap = oldCap << 1) < MAXIMUM_CAPACITY && oldCap >= DEFAULT_INITIAL_CAPACITY) newThr = oldThr << 1; // double threshold } else if (oldThr > 0) // initial capacity was placed in threshold newCap = oldThr; else { // zero initial threshold signifies using defaults newCap = DEFAULT_INITIAL_CAPACITY; newThr = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY); } if (newThr == 0) { float ft = (float)newCap * loadFactor; newThr = (newCap < MAXIMUM_CAPACITY && ft < (float)MAXIMUM_CAPACITY ? (int)ft : Integer.MAX_VALUE); } threshold = newThr; @SuppressWarnings({"rawtypes","unchecked"}) Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap]; table = newTab; if (oldTab != null) { for (int j = 0; j < oldCap; ++j) { Node<K,V> e; if ((e = oldTab[j]) != null) { oldTab[j] = null; if (e.next == null) newTab[e.hash & (newCap - 1)] = e; else if (e instanceof TreeNode) ((TreeNode<K,V>)e).split(this, newTab, j, oldCap); else { // preserve order Node<K,V> loHead = null, loTail = null; Node<K,V> hiHead = null, hiTail = null; Node<K,V> next; do { next = e.next; if ((e.hash & oldCap) == 0) { if (loTail == null) loHead = e; else loTail.next = e; loTail = e; } else { if (hiTail == null) hiHead = e; else hiTail.next = e; hiTail = e; } } while ((e = next) != null); if (loTail != null) { loTail.next = null; newTab[j] = loHead; } if (hiTail != null) { hiTail.next = null; newTab[j + oldCap] = hiHead; } } } } } return newTab; }
java
final Node<K,V>[] resize() { Node<K,V>[] oldTab = table; int oldCap = (oldTab == null) ? 0 : oldTab.length; int oldThr = threshold; int newCap, newThr = 0; if (oldCap > 0) { if (oldCap >= MAXIMUM_CAPACITY) { threshold = Integer.MAX_VALUE; return oldTab; } else if ((newCap = oldCap << 1) < MAXIMUM_CAPACITY && oldCap >= DEFAULT_INITIAL_CAPACITY) newThr = oldThr << 1; // double threshold } else if (oldThr > 0) // initial capacity was placed in threshold newCap = oldThr; else { // zero initial threshold signifies using defaults newCap = DEFAULT_INITIAL_CAPACITY; newThr = (int)(DEFAULT_LOAD_FACTOR * DEFAULT_INITIAL_CAPACITY); } if (newThr == 0) { float ft = (float)newCap * loadFactor; newThr = (newCap < MAXIMUM_CAPACITY && ft < (float)MAXIMUM_CAPACITY ? (int)ft : Integer.MAX_VALUE); } threshold = newThr; @SuppressWarnings({"rawtypes","unchecked"}) Node<K,V>[] newTab = (Node<K,V>[])new Node[newCap]; table = newTab; if (oldTab != null) { for (int j = 0; j < oldCap; ++j) { Node<K,V> e; if ((e = oldTab[j]) != null) { oldTab[j] = null; if (e.next == null) newTab[e.hash & (newCap - 1)] = e; else if (e instanceof TreeNode) ((TreeNode<K,V>)e).split(this, newTab, j, oldCap); else { // preserve order Node<K,V> loHead = null, loTail = null; Node<K,V> hiHead = null, hiTail = null; Node<K,V> next; do { next = e.next; if ((e.hash & oldCap) == 0) { if (loTail == null) loHead = e; else loTail.next = e; loTail = e; } else { if (hiTail == null) hiHead = e; else hiTail.next = e; hiTail = e; } } while ((e = next) != null); if (loTail != null) { loTail.next = null; newTab[j] = loHead; } if (hiTail != null) { hiTail.next = null; newTab[j + oldCap] = hiHead; } } } } } return newTab; }
[ "final", "Node", "<", "K", ",", "V", ">", "[", "]", "resize", "(", ")", "{", "Node", "<", "K", ",", "V", ">", "[", "]", "oldTab", "=", "table", ";", "int", "oldCap", "=", "(", "oldTab", "==", "null", ")", "?", "0", ":", "oldTab", ".", "leng...
Initializes or doubles table size. If null, allocates in accord with initial capacity target held in field threshold. Otherwise, because we are using power-of-two expansion, the elements from each bin must either stay at same index, or move with a power of two offset in the new table. @return the table
[ "Initializes", "or", "doubles", "table", "size", ".", "If", "null", "allocates", "in", "accord", "with", "initial", "capacity", "target", "held", "in", "field", "threshold", ".", "Otherwise", "because", "we", "are", "using", "power", "-", "of", "-", "two", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L682-L754
33,566
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.treeifyBin
final void treeifyBin(Node<K,V>[] tab, int hash) { int n, index; Node<K,V> e; if (tab == null || (n = tab.length) < MIN_TREEIFY_CAPACITY) resize(); else if ((e = tab[index = (n - 1) & hash]) != null) { TreeNode<K,V> hd = null, tl = null; do { TreeNode<K,V> p = replacementTreeNode(e, null); if (tl == null) hd = p; else { p.prev = tl; tl.next = p; } tl = p; } while ((e = e.next) != null); if ((tab[index] = hd) != null) hd.treeify(tab); } }
java
final void treeifyBin(Node<K,V>[] tab, int hash) { int n, index; Node<K,V> e; if (tab == null || (n = tab.length) < MIN_TREEIFY_CAPACITY) resize(); else if ((e = tab[index = (n - 1) & hash]) != null) { TreeNode<K,V> hd = null, tl = null; do { TreeNode<K,V> p = replacementTreeNode(e, null); if (tl == null) hd = p; else { p.prev = tl; tl.next = p; } tl = p; } while ((e = e.next) != null); if ((tab[index] = hd) != null) hd.treeify(tab); } }
[ "final", "void", "treeifyBin", "(", "Node", "<", "K", ",", "V", ">", "[", "]", "tab", ",", "int", "hash", ")", "{", "int", "n", ",", "index", ";", "Node", "<", "K", ",", "V", ">", "e", ";", "if", "(", "tab", "==", "null", "||", "(", "n", ...
Replaces all linked nodes in bin at index for given hash unless table is too small, in which case resizes instead.
[ "Replaces", "all", "linked", "nodes", "in", "bin", "at", "index", "for", "given", "hash", "unless", "table", "is", "too", "small", "in", "which", "case", "resizes", "instead", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L760-L779
33,567
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java
HashMap.removeNode
final Node<K,V> removeNode(int hash, Object key, Object value, boolean matchValue, boolean movable) { Node<K,V>[] tab; Node<K,V> p; int n, index; if ((tab = table) != null && (n = tab.length) > 0 && (p = tab[index = (n - 1) & hash]) != null) { Node<K,V> node = null, e; K k; V v; if (p.hash == hash && ((k = p.key) == key || (key != null && key.equals(k)))) node = p; else if ((e = p.next) != null) { if (p instanceof TreeNode) node = ((TreeNode<K,V>)p).getTreeNode(hash, key); else { do { if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) { node = e; break; } p = e; } while ((e = e.next) != null); } } if (node != null && (!matchValue || (v = node.value) == value || (value != null && value.equals(v)))) { if (node instanceof TreeNode) ((TreeNode<K,V>)node).removeTreeNode(this, tab, movable); else if (node == p) tab[index] = node.next; else p.next = node.next; ++modCount; --size; afterNodeRemoval(node); return node; } } return null; }
java
final Node<K,V> removeNode(int hash, Object key, Object value, boolean matchValue, boolean movable) { Node<K,V>[] tab; Node<K,V> p; int n, index; if ((tab = table) != null && (n = tab.length) > 0 && (p = tab[index = (n - 1) & hash]) != null) { Node<K,V> node = null, e; K k; V v; if (p.hash == hash && ((k = p.key) == key || (key != null && key.equals(k)))) node = p; else if ((e = p.next) != null) { if (p instanceof TreeNode) node = ((TreeNode<K,V>)p).getTreeNode(hash, key); else { do { if (e.hash == hash && ((k = e.key) == key || (key != null && key.equals(k)))) { node = e; break; } p = e; } while ((e = e.next) != null); } } if (node != null && (!matchValue || (v = node.value) == value || (value != null && value.equals(v)))) { if (node instanceof TreeNode) ((TreeNode<K,V>)node).removeTreeNode(this, tab, movable); else if (node == p) tab[index] = node.next; else p.next = node.next; ++modCount; --size; afterNodeRemoval(node); return node; } } return null; }
[ "final", "Node", "<", "K", ",", "V", ">", "removeNode", "(", "int", "hash", ",", "Object", "key", ",", "Object", "value", ",", "boolean", "matchValue", ",", "boolean", "movable", ")", "{", "Node", "<", "K", ",", "V", ">", "[", "]", "tab", ";", "N...
Implements Map.remove and related methods @param hash hash for key @param key the key @param value the value to match if matchValue, else ignored @param matchValue if true only remove if value is equal @param movable if false do not move other nodes while removing @return the node, or null if none
[ "Implements", "Map", ".", "remove", "and", "related", "methods" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/HashMap.java#L818-L857
33,568
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.addInternal
private static void addInternal(String name, ObjectIdentifier oid, Class clazz) { OIDInfo info = new OIDInfo(name, oid, clazz); oidMap.put(oid, info); nameMap.put(name, info); }
java
private static void addInternal(String name, ObjectIdentifier oid, Class clazz) { OIDInfo info = new OIDInfo(name, oid, clazz); oidMap.put(oid, info); nameMap.put(name, info); }
[ "private", "static", "void", "addInternal", "(", "String", "name", ",", "ObjectIdentifier", "oid", ",", "Class", "clazz", ")", "{", "OIDInfo", "info", "=", "new", "OIDInfo", "(", "name", ",", "oid", ",", "clazz", ")", ";", "oidMap", ".", "put", "(", "o...
Add attributes to the table. For internal use in the static initializer.
[ "Add", "attributes", "to", "the", "table", ".", "For", "internal", "use", "in", "the", "static", "initializer", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L174-L179
33,569
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.addAttribute
public static void addAttribute(String name, String oid, Class<?> clazz) throws CertificateException { ObjectIdentifier objId; try { objId = new ObjectIdentifier(oid); } catch (IOException ioe) { throw new CertificateException ("Invalid Object identifier: " + oid); } OIDInfo info = new OIDInfo(name, objId, clazz); if (oidMap.put(objId, info) != null) { throw new CertificateException ("Object identifier already exists: " + oid); } if (nameMap.put(name, info) != null) { throw new CertificateException("Name already exists: " + name); } }
java
public static void addAttribute(String name, String oid, Class<?> clazz) throws CertificateException { ObjectIdentifier objId; try { objId = new ObjectIdentifier(oid); } catch (IOException ioe) { throw new CertificateException ("Invalid Object identifier: " + oid); } OIDInfo info = new OIDInfo(name, objId, clazz); if (oidMap.put(objId, info) != null) { throw new CertificateException ("Object identifier already exists: " + oid); } if (nameMap.put(name, info) != null) { throw new CertificateException("Name already exists: " + name); } }
[ "public", "static", "void", "addAttribute", "(", "String", "name", ",", "String", "oid", ",", "Class", "<", "?", ">", "clazz", ")", "throws", "CertificateException", "{", "ObjectIdentifier", "objId", ";", "try", "{", "objId", "=", "new", "ObjectIdentifier", ...
Add a name to lookup table. @param name the name of the attr @param oid the string representation of the object identifier for the class. @param clazz the Class object associated with this attribute @exception CertificateException on errors.
[ "Add", "a", "name", "to", "lookup", "table", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L213-L230
33,570
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.getName
public static String getName(ObjectIdentifier oid) { OIDInfo info = oidMap.get(oid); return (info == null) ? null : info.name; }
java
public static String getName(ObjectIdentifier oid) { OIDInfo info = oidMap.get(oid); return (info == null) ? null : info.name; }
[ "public", "static", "String", "getName", "(", "ObjectIdentifier", "oid", ")", "{", "OIDInfo", "info", "=", "oidMap", ".", "get", "(", "oid", ")", ";", "return", "(", "info", "==", "null", ")", "?", "null", ":", "info", ".", "name", ";", "}" ]
Return user friendly name associated with the OID. @param oid the name of the object identifier to be returned. @return the user friendly name or null if no name is registered for this oid.
[ "Return", "user", "friendly", "name", "associated", "with", "the", "OID", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L239-L242
33,571
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.getOID
public static ObjectIdentifier getOID(String name) { OIDInfo info = nameMap.get(name); return (info == null) ? null : info.oid; }
java
public static ObjectIdentifier getOID(String name) { OIDInfo info = nameMap.get(name); return (info == null) ? null : info.oid; }
[ "public", "static", "ObjectIdentifier", "getOID", "(", "String", "name", ")", "{", "OIDInfo", "info", "=", "nameMap", ".", "get", "(", "name", ")", ";", "return", "(", "info", "==", "null", ")", "?", "null", ":", "info", ".", "oid", ";", "}" ]
Return Object identifier for user friendly name. @param name the user friendly name. @return the Object Identifier or null if no oid is registered for this name.
[ "Return", "Object", "identifier", "for", "user", "friendly", "name", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L251-L254
33,572
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.getClass
public static Class<?> getClass(String name) throws CertificateException { OIDInfo info = nameMap.get(name); return (info == null) ? null : info.getClazz(); }
java
public static Class<?> getClass(String name) throws CertificateException { OIDInfo info = nameMap.get(name); return (info == null) ? null : info.getClazz(); }
[ "public", "static", "Class", "<", "?", ">", "getClass", "(", "String", "name", ")", "throws", "CertificateException", "{", "OIDInfo", "info", "=", "nameMap", ".", "get", "(", "name", ")", ";", "return", "(", "info", "==", "null", ")", "?", "null", ":",...
Return the java class object associated with the user friendly name. @param name the user friendly name. @exception CertificateException if class cannot be instantiated.
[ "Return", "the", "java", "class", "object", "associated", "with", "the", "user", "friendly", "name", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L262-L265
33,573
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java
OIDMap.getClass
public static Class<?> getClass(ObjectIdentifier oid) throws CertificateException { OIDInfo info = oidMap.get(oid); return (info == null) ? null : info.getClazz(); }
java
public static Class<?> getClass(ObjectIdentifier oid) throws CertificateException { OIDInfo info = oidMap.get(oid); return (info == null) ? null : info.getClazz(); }
[ "public", "static", "Class", "<", "?", ">", "getClass", "(", "ObjectIdentifier", "oid", ")", "throws", "CertificateException", "{", "OIDInfo", "info", "=", "oidMap", ".", "get", "(", "oid", ")", ";", "return", "(", "info", "==", "null", ")", "?", "null",...
Return the java class object associated with the object identifier. @param oid the name of the object identifier to be returned. @exception CertificateException if class cannot be instatiated.
[ "Return", "the", "java", "class", "object", "associated", "with", "the", "object", "identifier", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/OIDMap.java#L273-L277
33,574
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java
OffsetTime.toEpochNano
private long toEpochNano() { long nod = time.toNanoOfDay(); long offsetNanos = offset.getTotalSeconds() * NANOS_PER_SECOND; return nod - offsetNanos; }
java
private long toEpochNano() { long nod = time.toNanoOfDay(); long offsetNanos = offset.getTotalSeconds() * NANOS_PER_SECOND; return nod - offsetNanos; }
[ "private", "long", "toEpochNano", "(", ")", "{", "long", "nod", "=", "time", ".", "toNanoOfDay", "(", ")", ";", "long", "offsetNanos", "=", "offset", ".", "getTotalSeconds", "(", ")", "*", "NANOS_PER_SECOND", ";", "return", "nod", "-", "offsetNanos", ";", ...
Converts this time to epoch nanos based on 1970-01-01Z. @return the epoch nanos value
[ "Converts", "this", "time", "to", "epoch", "nanos", "based", "on", "1970", "-", "01", "-", "01Z", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java#L1223-L1227
33,575
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/ArrayRewriter.java
ArrayRewriter.visit
@Override public boolean visit(Assignment node) { Expression lhs = node.getLeftHandSide(); TypeMirror lhsType = lhs.getTypeMirror(); if (lhs instanceof ArrayAccess && !lhsType.getKind().isPrimitive()) { FunctionInvocation newAssignment = newArrayAssignment(node, (ArrayAccess) lhs, lhsType); node.replaceWith(newAssignment); newAssignment.accept(this); return false; } return true; }
java
@Override public boolean visit(Assignment node) { Expression lhs = node.getLeftHandSide(); TypeMirror lhsType = lhs.getTypeMirror(); if (lhs instanceof ArrayAccess && !lhsType.getKind().isPrimitive()) { FunctionInvocation newAssignment = newArrayAssignment(node, (ArrayAccess) lhs, lhsType); node.replaceWith(newAssignment); newAssignment.accept(this); return false; } return true; }
[ "@", "Override", "public", "boolean", "visit", "(", "Assignment", "node", ")", "{", "Expression", "lhs", "=", "node", ".", "getLeftHandSide", "(", ")", ";", "TypeMirror", "lhsType", "=", "lhs", ".", "getTypeMirror", "(", ")", ";", "if", "(", "lhs", "inst...
rhs is an array creation, we can optimize with "SetAndConsume".
[ "rhs", "is", "an", "array", "creation", "we", "can", "optimize", "with", "SetAndConsume", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/ArrayRewriter.java#L235-L246
33,576
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.findCodeFromLocale
private static int[] findCodeFromLocale(ULocale locale) { int[] result = getCodesFromLocale(locale); if(result != null) { return result; } ULocale likely = ULocale.addLikelySubtags(locale); return getCodesFromLocale(likely); }
java
private static int[] findCodeFromLocale(ULocale locale) { int[] result = getCodesFromLocale(locale); if(result != null) { return result; } ULocale likely = ULocale.addLikelySubtags(locale); return getCodesFromLocale(likely); }
[ "private", "static", "int", "[", "]", "findCodeFromLocale", "(", "ULocale", "locale", ")", "{", "int", "[", "]", "result", "=", "getCodesFromLocale", "(", "locale", ")", ";", "if", "(", "result", "!=", "null", ")", "{", "return", "result", ";", "}", "U...
Helper function to find the code from locale. @param locale The locale.
[ "Helper", "function", "to", "find", "the", "code", "from", "locale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L860-L867
33,577
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getCode
public static final int[] getCode(String nameOrAbbrOrLocale) { boolean triedCode = false; if (nameOrAbbrOrLocale.indexOf('_') < 0 && nameOrAbbrOrLocale.indexOf('-') < 0) { int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale); if (propNum != UProperty.UNDEFINED) { return new int[] {propNum}; } triedCode = true; } int[] scripts = findCodeFromLocale(new ULocale(nameOrAbbrOrLocale)); if (scripts != null) { return scripts; } if (!triedCode) { int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale); if (propNum != UProperty.UNDEFINED) { return new int[] {propNum}; } } return null; }
java
public static final int[] getCode(String nameOrAbbrOrLocale) { boolean triedCode = false; if (nameOrAbbrOrLocale.indexOf('_') < 0 && nameOrAbbrOrLocale.indexOf('-') < 0) { int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale); if (propNum != UProperty.UNDEFINED) { return new int[] {propNum}; } triedCode = true; } int[] scripts = findCodeFromLocale(new ULocale(nameOrAbbrOrLocale)); if (scripts != null) { return scripts; } if (!triedCode) { int propNum = UCharacter.getPropertyValueEnumNoThrow(UProperty.SCRIPT, nameOrAbbrOrLocale); if (propNum != UProperty.UNDEFINED) { return new int[] {propNum}; } } return null; }
[ "public", "static", "final", "int", "[", "]", "getCode", "(", "String", "nameOrAbbrOrLocale", ")", "{", "boolean", "triedCode", "=", "false", ";", "if", "(", "nameOrAbbrOrLocale", ".", "indexOf", "(", "'", "'", ")", "<", "0", "&&", "nameOrAbbrOrLocale", "....
Gets the script codes associated with the given locale or ISO 15924 abbreviation or name. Returns MALAYAM given "Malayam" OR "Mlym". Returns LATIN given "en" OR "en_US" <p>Note: To search by short or long script alias only, use {@link #getCodeFromName(String)} instead. That does a fast lookup with no access of the locale data. @param nameOrAbbrOrLocale name of the script or ISO 15924 code or locale @return The script codes array. null if the the code cannot be found.
[ "Gets", "the", "script", "codes", "associated", "with", "the", "given", "locale", "or", "ISO", "15924", "abbreviation", "or", "name", ".", "Returns", "MALAYAM", "given", "Malayam", "OR", "Mlym", ".", "Returns", "LATIN", "given", "en", "OR", "en_US" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L901-L921
33,578
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getScript
public static final int getScript(int codepoint){ if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(codepoint, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return scriptX; } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_INHERITED) { return UScript.COMMON; } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_OTHER) { return UScript.INHERITED; } else { return UCharacterProperty.INSTANCE.m_scriptExtensions_[scriptX&UCharacterProperty.SCRIPT_MASK_]; } }else{ throw new IllegalArgumentException(Integer.toString(codepoint)); } }
java
public static final int getScript(int codepoint){ if (codepoint >= UCharacter.MIN_VALUE & codepoint <= UCharacter.MAX_VALUE) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(codepoint, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return scriptX; } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_INHERITED) { return UScript.COMMON; } else if(scriptX<UCharacterProperty.SCRIPT_X_WITH_OTHER) { return UScript.INHERITED; } else { return UCharacterProperty.INSTANCE.m_scriptExtensions_[scriptX&UCharacterProperty.SCRIPT_MASK_]; } }else{ throw new IllegalArgumentException(Integer.toString(codepoint)); } }
[ "public", "static", "final", "int", "getScript", "(", "int", "codepoint", ")", "{", "if", "(", "codepoint", ">=", "UCharacter", ".", "MIN_VALUE", "&", "codepoint", "<=", "UCharacter", ".", "MAX_VALUE", ")", "{", "int", "scriptX", "=", "UCharacterProperty", "...
Gets the script code associated with the given codepoint. Returns UScript.MALAYAM given 0x0D02 @param codepoint UChar32 codepoint @return The script code
[ "Gets", "the", "script", "code", "associated", "with", "the", "given", "codepoint", ".", "Returns", "UScript", ".", "MALAYAM", "given", "0x0D02" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L943-L958
33,579
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.hasScript
public static final boolean hasScript(int c, int sc) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return sc==scriptX; } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; } if(sc>0x7fff) { // Guard against bogus input that would // make us go past the Script_Extensions terminator. return false; } while(sc>scriptExtensions[scx]) { ++scx; } return sc==(scriptExtensions[scx]&0x7fff); }
java
public static final boolean hasScript(int c, int sc) { int scriptX=UCharacterProperty.INSTANCE.getAdditional(c, 0)&UCharacterProperty.SCRIPT_X_MASK; if(scriptX<UCharacterProperty.SCRIPT_X_WITH_COMMON) { return sc==scriptX; } char[] scriptExtensions=UCharacterProperty.INSTANCE.m_scriptExtensions_; int scx=scriptX&UCharacterProperty.SCRIPT_MASK_; // index into scriptExtensions if(scriptX>=UCharacterProperty.SCRIPT_X_WITH_OTHER) { scx=scriptExtensions[scx+1]; } if(sc>0x7fff) { // Guard against bogus input that would // make us go past the Script_Extensions terminator. return false; } while(sc>scriptExtensions[scx]) { ++scx; } return sc==(scriptExtensions[scx]&0x7fff); }
[ "public", "static", "final", "boolean", "hasScript", "(", "int", "c", ",", "int", "sc", ")", "{", "int", "scriptX", "=", "UCharacterProperty", ".", "INSTANCE", ".", "getAdditional", "(", "c", ",", "0", ")", "&", "UCharacterProperty", ".", "SCRIPT_X_MASK", ...
Do the Script_Extensions of code point c contain script sc? If c does not have explicit Script_Extensions, then this tests whether c has the Script property value sc. <p>Some characters are commonly used in multiple scripts. For more information, see UAX #24: http://www.unicode.org/reports/tr24/. @param c code point @param sc script code @return true if sc is in Script_Extensions(c)
[ "Do", "the", "Script_Extensions", "of", "code", "point", "c", "contain", "script", "sc?", "If", "c", "does", "not", "have", "explicit", "Script_Extensions", "then", "this", "tests", "whether", "c", "has", "the", "Script", "property", "value", "sc", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L972-L992
33,580
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getName
public static final String getName(int scriptCode){ return UCharacter.getPropertyValueName(UProperty.SCRIPT, scriptCode, UProperty.NameChoice.LONG); }
java
public static final String getName(int scriptCode){ return UCharacter.getPropertyValueName(UProperty.SCRIPT, scriptCode, UProperty.NameChoice.LONG); }
[ "public", "static", "final", "String", "getName", "(", "int", "scriptCode", ")", "{", "return", "UCharacter", ".", "getPropertyValueName", "(", "UProperty", ".", "SCRIPT", ",", "scriptCode", ",", "UProperty", ".", "NameChoice", ".", "LONG", ")", ";", "}" ]
Returns the long Unicode script name, if there is one. Otherwise returns the 4-letter ISO 15924 script code. Returns "Malayam" given MALAYALAM. @param scriptCode int script code @return long script name as given in PropertyValueAliases.txt, or the 4-letter code @throws IllegalArgumentException if the script code is not valid
[ "Returns", "the", "long", "Unicode", "script", "name", "if", "there", "is", "one", ".", "Otherwise", "returns", "the", "4", "-", "letter", "ISO", "15924", "script", "code", ".", "Returns", "Malayam", "given", "MALAYALAM", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L1052-L1056
33,581
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getShortName
public static final String getShortName(int scriptCode){ return UCharacter.getPropertyValueName(UProperty.SCRIPT, scriptCode, UProperty.NameChoice.SHORT); }
java
public static final String getShortName(int scriptCode){ return UCharacter.getPropertyValueName(UProperty.SCRIPT, scriptCode, UProperty.NameChoice.SHORT); }
[ "public", "static", "final", "String", "getShortName", "(", "int", "scriptCode", ")", "{", "return", "UCharacter", ".", "getPropertyValueName", "(", "UProperty", ".", "SCRIPT", ",", "scriptCode", ",", "UProperty", ".", "NameChoice", ".", "SHORT", ")", ";", "}"...
Returns the 4-letter ISO 15924 script code, which is the same as the short Unicode script name if Unicode has names for the script. Returns "Mlym" given MALAYALAM. @param scriptCode int script code @return short script name (4-letter code) @throws IllegalArgumentException if the script code is not valid
[ "Returns", "the", "4", "-", "letter", "ISO", "15924", "script", "code", "which", "is", "the", "same", "as", "the", "short", "Unicode", "script", "name", "if", "Unicode", "has", "names", "for", "the", "script", ".", "Returns", "Mlym", "given", "MALAYALAM", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L1067-L1071
33,582
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java
UScript.getSampleString
public static final String getSampleString(int script) { int sampleChar = ScriptMetadata.getScriptProps(script) & 0x1fffff; if(sampleChar != 0) { return new StringBuilder().appendCodePoint(sampleChar).toString(); } return ""; }
java
public static final String getSampleString(int script) { int sampleChar = ScriptMetadata.getScriptProps(script) & 0x1fffff; if(sampleChar != 0) { return new StringBuilder().appendCodePoint(sampleChar).toString(); } return ""; }
[ "public", "static", "final", "String", "getSampleString", "(", "int", "script", ")", "{", "int", "sampleChar", "=", "ScriptMetadata", ".", "getScriptProps", "(", "script", ")", "&", "0x1fffff", ";", "if", "(", "sampleChar", "!=", "0", ")", "{", "return", "...
Returns the script sample character string. This string normally consists of one code point but might be longer. The string is empty if the script is not encoded. @param script script code @return the sample character string
[ "Returns", "the", "script", "sample", "character", "string", ".", "This", "string", "normally", "consists", "of", "one", "code", "point", "but", "might", "be", "longer", ".", "The", "string", "is", "empty", "if", "the", "script", "is", "not", "encoded", "....
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/lang/UScript.java#L1325-L1331
33,583
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/TextAttribute.java
TextAttribute.readResolve
protected Object readResolve() throws InvalidObjectException { if (this.getClass() != TextAttribute.class) { throw new InvalidObjectException( "subclass didn't correctly implement readResolve"); } TextAttribute instance = (TextAttribute) instanceMap.get(getName()); if (instance != null) { return instance; } else { throw new InvalidObjectException("unknown attribute name"); } }
java
protected Object readResolve() throws InvalidObjectException { if (this.getClass() != TextAttribute.class) { throw new InvalidObjectException( "subclass didn't correctly implement readResolve"); } TextAttribute instance = (TextAttribute) instanceMap.get(getName()); if (instance != null) { return instance; } else { throw new InvalidObjectException("unknown attribute name"); } }
[ "protected", "Object", "readResolve", "(", ")", "throws", "InvalidObjectException", "{", "if", "(", "this", ".", "getClass", "(", ")", "!=", "TextAttribute", ".", "class", ")", "{", "throw", "new", "InvalidObjectException", "(", "\"subclass didn't correctly implemen...
Resolves instances being deserialized to the predefined constants.
[ "Resolves", "instances", "being", "deserialized", "to", "the", "predefined", "constants", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/awt/font/TextAttribute.java#L281-L293
33,584
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.beginEntry
public void beginEntry(JarEntry je, ManifestEntryVerifier mev) throws IOException { if (je == null) return; if (debug != null) { debug.println("beginEntry "+je.getName()); } String name = je.getName(); /* * Assumptions: * 1. The manifest should be the first entry in the META-INF directory. * 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries * 3. Any of the following will throw a SecurityException: * a. digest mismatch between a manifest section and * the SF section. * b. digest mismatch between the actual jar entry and the manifest */ if (parsingMeta) { String uname = name.toUpperCase(Locale.ENGLISH); if ((uname.startsWith("META-INF/") || uname.startsWith("/META-INF/"))) { if (je.isDirectory()) { mev.setEntry(null, je); return; } if (SignatureFileVerifier.isBlockOrSF(uname)) { /* We parse only DSA, RSA or EC PKCS7 blocks. */ parsingBlockOrSF = true; baos.reset(); mev.setEntry(null, je); } return; } } if (parsingMeta) { doneWithMeta(); } if (je.isDirectory()) { mev.setEntry(null, je); return; } // be liberal in what you accept. If the name starts with ./, remove // it as we internally canonicalize it with out the ./. if (name.startsWith("./")) name = name.substring(2); // be liberal in what you accept. If the name starts with /, remove // it as we internally canonicalize it with out the /. if (name.startsWith("/")) name = name.substring(1); // only set the jev object for entries that have a signature if (sigFileSigners.get(name) != null) { mev.setEntry(name, je); return; } // don't compute the digest for this entry mev.setEntry(null, je); return; }
java
public void beginEntry(JarEntry je, ManifestEntryVerifier mev) throws IOException { if (je == null) return; if (debug != null) { debug.println("beginEntry "+je.getName()); } String name = je.getName(); /* * Assumptions: * 1. The manifest should be the first entry in the META-INF directory. * 2. The .SF/.DSA/.EC files follow the manifest, before any normal entries * 3. Any of the following will throw a SecurityException: * a. digest mismatch between a manifest section and * the SF section. * b. digest mismatch between the actual jar entry and the manifest */ if (parsingMeta) { String uname = name.toUpperCase(Locale.ENGLISH); if ((uname.startsWith("META-INF/") || uname.startsWith("/META-INF/"))) { if (je.isDirectory()) { mev.setEntry(null, je); return; } if (SignatureFileVerifier.isBlockOrSF(uname)) { /* We parse only DSA, RSA or EC PKCS7 blocks. */ parsingBlockOrSF = true; baos.reset(); mev.setEntry(null, je); } return; } } if (parsingMeta) { doneWithMeta(); } if (je.isDirectory()) { mev.setEntry(null, je); return; } // be liberal in what you accept. If the name starts with ./, remove // it as we internally canonicalize it with out the ./. if (name.startsWith("./")) name = name.substring(2); // be liberal in what you accept. If the name starts with /, remove // it as we internally canonicalize it with out the /. if (name.startsWith("/")) name = name.substring(1); // only set the jev object for entries that have a signature if (sigFileSigners.get(name) != null) { mev.setEntry(name, je); return; } // don't compute the digest for this entry mev.setEntry(null, je); return; }
[ "public", "void", "beginEntry", "(", "JarEntry", "je", ",", "ManifestEntryVerifier", "mev", ")", "throws", "IOException", "{", "if", "(", "je", "==", "null", ")", "return", ";", "if", "(", "debug", "!=", "null", ")", "{", "debug", ".", "println", "(", ...
This method scans to see which entry we're parsing and keeps various state information depending on what type of file is being parsed.
[ "This", "method", "scans", "to", "see", "which", "entry", "we", "re", "parsing", "and", "keeps", "various", "state", "information", "depending", "on", "what", "type", "of", "file", "is", "being", "parsed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L111-L182
33,585
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.update
public void update(int b, ManifestEntryVerifier mev) throws IOException { if (b != -1) { if (parsingBlockOrSF) { baos.write(b); } else { mev.update((byte)b); } } else { processEntry(mev); } }
java
public void update(int b, ManifestEntryVerifier mev) throws IOException { if (b != -1) { if (parsingBlockOrSF) { baos.write(b); } else { mev.update((byte)b); } } else { processEntry(mev); } }
[ "public", "void", "update", "(", "int", "b", ",", "ManifestEntryVerifier", "mev", ")", "throws", "IOException", "{", "if", "(", "b", "!=", "-", "1", ")", "{", "if", "(", "parsingBlockOrSF", ")", "{", "baos", ".", "write", "(", "b", ")", ";", "}", "...
update a single byte.
[ "update", "a", "single", "byte", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L188-L200
33,586
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.update
public void update(int n, byte[] b, int off, int len, ManifestEntryVerifier mev) throws IOException { if (n != -1) { if (parsingBlockOrSF) { baos.write(b, off, n); } else { mev.update(b, off, n); } } else { processEntry(mev); } }
java
public void update(int n, byte[] b, int off, int len, ManifestEntryVerifier mev) throws IOException { if (n != -1) { if (parsingBlockOrSF) { baos.write(b, off, n); } else { mev.update(b, off, n); } } else { processEntry(mev); } }
[ "public", "void", "update", "(", "int", "n", ",", "byte", "[", "]", "b", ",", "int", "off", ",", "int", "len", ",", "ManifestEntryVerifier", "mev", ")", "throws", "IOException", "{", "if", "(", "n", "!=", "-", "1", ")", "{", "if", "(", "parsingBloc...
update an array of bytes.
[ "update", "an", "array", "of", "bytes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L206-L219
33,587
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.getCerts
@Deprecated // Android-changed added "Deprecated." public java.security.cert.Certificate[] getCerts(String name) { return mapSignersToCertArray(getCodeSigners(name)); }
java
@Deprecated // Android-changed added "Deprecated." public java.security.cert.Certificate[] getCerts(String name) { return mapSignersToCertArray(getCodeSigners(name)); }
[ "@", "Deprecated", "// Android-changed added \"Deprecated.\"", "public", "java", ".", "security", ".", "cert", ".", "Certificate", "[", "]", "getCerts", "(", "String", "name", ")", "{", "return", "mapSignersToCertArray", "(", "getCodeSigners", "(", "name", ")", ")...
Return an array of java.security.cert.Certificate objects for the given file in the jar. @deprecated Deprecated.
[ "Return", "an", "array", "of", "java", ".", "security", ".", "cert", ".", "Certificate", "objects", "for", "the", "given", "file", "in", "the", "jar", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L330-L334
33,588
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.doneWithMeta
void doneWithMeta() { parsingMeta = false; anyToVerify = !sigFileSigners.isEmpty(); baos = null; sigFileData = null; pendingBlocks = null; signerCache = null; manDig = null; // MANIFEST.MF is always treated as signed and verified, // move its signers from sigFileSigners to verifiedSigners. if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) { verifiedSigners.put(JarFile.MANIFEST_NAME, sigFileSigners.remove(JarFile.MANIFEST_NAME)); } }
java
void doneWithMeta() { parsingMeta = false; anyToVerify = !sigFileSigners.isEmpty(); baos = null; sigFileData = null; pendingBlocks = null; signerCache = null; manDig = null; // MANIFEST.MF is always treated as signed and verified, // move its signers from sigFileSigners to verifiedSigners. if (sigFileSigners.containsKey(JarFile.MANIFEST_NAME)) { verifiedSigners.put(JarFile.MANIFEST_NAME, sigFileSigners.remove(JarFile.MANIFEST_NAME)); } }
[ "void", "doneWithMeta", "(", ")", "{", "parsingMeta", "=", "false", ";", "anyToVerify", "=", "!", "sigFileSigners", ".", "isEmpty", "(", ")", ";", "baos", "=", "null", ";", "sigFileData", "=", "null", ";", "pendingBlocks", "=", "null", ";", "signerCache", ...
called to let us know we have processed all the META-INF entries, and if we re-read one of them, don't re-process it. Also gets rid of any data structures we needed when parsing META-INF entries.
[ "called", "to", "let", "us", "know", "we", "have", "processed", "all", "the", "META", "-", "INF", "entries", "and", "if", "we", "re", "-", "read", "one", "of", "them", "don", "t", "re", "-", "process", "it", ".", "Also", "gets", "rid", "of", "any",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L411-L426
33,589
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java
JarVerifier.isSigningRelated
static boolean isSigningRelated(String name) { name = name.toUpperCase(Locale.ENGLISH); if (!name.startsWith("META-INF/")) { return false; } name = name.substring(9); if (name.indexOf('/') != -1) { return false; } if (name.endsWith(".DSA") || name.endsWith(".RSA") || name.endsWith(".SF") || name.endsWith(".EC") || name.startsWith("SIG-") || name.equals("MANIFEST.MF")) { return true; } return false; }
java
static boolean isSigningRelated(String name) { name = name.toUpperCase(Locale.ENGLISH); if (!name.startsWith("META-INF/")) { return false; } name = name.substring(9); if (name.indexOf('/') != -1) { return false; } if (name.endsWith(".DSA") || name.endsWith(".RSA") || name.endsWith(".SF") || name.endsWith(".EC") || name.startsWith("SIG-") || name.equals("MANIFEST.MF")) { return true; } return false; }
[ "static", "boolean", "isSigningRelated", "(", "String", "name", ")", "{", "name", "=", "name", ".", "toUpperCase", "(", "Locale", ".", "ENGLISH", ")", ";", "if", "(", "!", "name", ".", "startsWith", "(", "\"META-INF/\"", ")", ")", "{", "return", "false",...
true if file is part of the signature mechanism itself
[ "true", "if", "file", "is", "part", "of", "the", "signature", "mechanism", "itself" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/jar/JarVerifier.java#L801-L819
33,590
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java
FastStringBuffer.charAt
public char charAt(int pos) { int startChunk = pos >>> m_chunkBits; if (startChunk == 0 && m_innerFSB != null) return m_innerFSB.charAt(pos & m_chunkMask); else return m_array[startChunk][pos & m_chunkMask]; }
java
public char charAt(int pos) { int startChunk = pos >>> m_chunkBits; if (startChunk == 0 && m_innerFSB != null) return m_innerFSB.charAt(pos & m_chunkMask); else return m_array[startChunk][pos & m_chunkMask]; }
[ "public", "char", "charAt", "(", "int", "pos", ")", "{", "int", "startChunk", "=", "pos", ">>>", "m_chunkBits", ";", "if", "(", "startChunk", "==", "0", "&&", "m_innerFSB", "!=", "null", ")", "return", "m_innerFSB", ".", "charAt", "(", "pos", "&", "m_c...
Get a single character from the string buffer. @param pos character position requested. @return A character from the requested position.
[ "Get", "a", "single", "character", "from", "the", "string", "buffer", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java#L948-L956
33,591
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java
FastStringBuffer.sendNormalizedSAXcharacters
static int sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler, int edgeTreatmentFlags) throws org.xml.sax.SAXException { boolean processingLeadingWhitespace = ((edgeTreatmentFlags & SUPPRESS_LEADING_WS) != 0); boolean seenWhitespace = ((edgeTreatmentFlags & CARRY_WS) != 0); int currPos = start; int limit = start+length; // Strip any leading spaces first, if required if (processingLeadingWhitespace) { for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // If we've only encountered leading spaces, the // current state remains unchanged if (currPos == limit) { return edgeTreatmentFlags; } } // If we get here, there are no more leading spaces to strip while (currPos < limit) { int startNonWhitespace = currPos; // Grab a chunk of non-whitespace characters for (; currPos < limit && !XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // Non-whitespace seen - emit them, along with a single // space for any preceding whitespace characters if (startNonWhitespace != currPos) { if (seenWhitespace) { handler.characters(SINGLE_SPACE, 0, 1); seenWhitespace = false; } handler.characters(ch, startNonWhitespace, currPos - startNonWhitespace); } int startWhitespace = currPos; // Consume any whitespace characters for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } if (startWhitespace != currPos) { seenWhitespace = true; } } return (seenWhitespace ? CARRY_WS : 0) | (edgeTreatmentFlags & SUPPRESS_TRAILING_WS); }
java
static int sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler, int edgeTreatmentFlags) throws org.xml.sax.SAXException { boolean processingLeadingWhitespace = ((edgeTreatmentFlags & SUPPRESS_LEADING_WS) != 0); boolean seenWhitespace = ((edgeTreatmentFlags & CARRY_WS) != 0); int currPos = start; int limit = start+length; // Strip any leading spaces first, if required if (processingLeadingWhitespace) { for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // If we've only encountered leading spaces, the // current state remains unchanged if (currPos == limit) { return edgeTreatmentFlags; } } // If we get here, there are no more leading spaces to strip while (currPos < limit) { int startNonWhitespace = currPos; // Grab a chunk of non-whitespace characters for (; currPos < limit && !XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } // Non-whitespace seen - emit them, along with a single // space for any preceding whitespace characters if (startNonWhitespace != currPos) { if (seenWhitespace) { handler.characters(SINGLE_SPACE, 0, 1); seenWhitespace = false; } handler.characters(ch, startNonWhitespace, currPos - startNonWhitespace); } int startWhitespace = currPos; // Consume any whitespace characters for (; currPos < limit && XMLCharacterRecognizer.isWhiteSpace(ch[currPos]); currPos++) { } if (startWhitespace != currPos) { seenWhitespace = true; } } return (seenWhitespace ? CARRY_WS : 0) | (edgeTreatmentFlags & SUPPRESS_TRAILING_WS); }
[ "static", "int", "sendNormalizedSAXcharacters", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ",", "org", ".", "xml", ".", "sax", ".", "ContentHandler", "handler", ",", "int", "edgeTreatmentFlags", ")", "throws", "org", ".", "xml"...
Internal method to directly normalize and dispatch the character array. This version is aware of the fact that it may be called several times in succession if the data is made up of multiple "chunks", and thus must actively manage the handling of leading and trailing whitespace. Note: The recursion is due to the possible recursion of inner FSBs. @param ch The characters from the XML document. @param start The start position in the array. @param length The number of characters to read from the array. @param handler SAX ContentHandler object to receive the event. @param edgeTreatmentFlags How leading/trailing spaces should be handled. This is a bitfield contining two flags, bitwise-ORed together: <dl> <dt>SUPPRESS_LEADING_WS</dt> <dd>When false, causes leading whitespace to be converted to a single space; when true, causes it to be discarded entirely. Should be set TRUE for the first chunk, and (in multi-chunk output) whenever the previous chunk ended in retained whitespace.</dd> <dt>SUPPRESS_TRAILING_WS</dt> <dd>When false, causes trailing whitespace to be converted to a single space; when true, causes it to be discarded entirely. Should be set TRUE for the last or only chunk. </dd> </dl> @return normalization status, as in the edgeTreatmentFlags parameter: <dl> <dt>0</dt> <dd>if this output did not end in retained whitespace, and thus whitespace at the start of the following chunk (if any) should be converted to a single space. <dt>SUPPRESS_LEADING_WS</dt> <dd>if this output ended in retained whitespace, and thus whitespace at the start of the following chunk (if any) should be completely suppressed.</dd> </dd> </dl> @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
[ "Internal", "method", "to", "directly", "normalize", "and", "dispatch", "the", "character", "array", ".", "This", "version", "is", "aware", "of", "the", "fact", "that", "it", "may", "be", "called", "several", "times", "in", "succession", "if", "the", "data",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java#L1127-L1186
33,592
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java
FastStringBuffer.sendNormalizedSAXcharacters
public static void sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException { sendNormalizedSAXcharacters(ch, start, length, handler, SUPPRESS_BOTH); }
java
public static void sendNormalizedSAXcharacters(char ch[], int start, int length, org.xml.sax.ContentHandler handler) throws org.xml.sax.SAXException { sendNormalizedSAXcharacters(ch, start, length, handler, SUPPRESS_BOTH); }
[ "public", "static", "void", "sendNormalizedSAXcharacters", "(", "char", "ch", "[", "]", ",", "int", "start", ",", "int", "length", ",", "org", ".", "xml", ".", "sax", ".", "ContentHandler", "handler", ")", "throws", "org", ".", "xml", ".", "sax", ".", ...
Directly normalize and dispatch the character array. @param ch The characters from the XML document. @param start The start position in the array. @param length The number of characters to read from the array. @param handler SAX ContentHandler object to receive the event. @exception org.xml.sax.SAXException Any SAX exception, possibly wrapping another exception.
[ "Directly", "normalize", "and", "dispatch", "the", "character", "array", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/utils/FastStringBuffer.java#L1198-L1205
33,593
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.evaluate
final <R> R evaluate(TerminalOp<E_OUT, R> terminalOp) { assert getOutputShape() == terminalOp.inputShape(); if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; return isParallel() ? terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags())) : terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags())); }
java
final <R> R evaluate(TerminalOp<E_OUT, R> terminalOp) { assert getOutputShape() == terminalOp.inputShape(); if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; return isParallel() ? terminalOp.evaluateParallel(this, sourceSpliterator(terminalOp.getOpFlags())) : terminalOp.evaluateSequential(this, sourceSpliterator(terminalOp.getOpFlags())); }
[ "final", "<", "R", ">", "R", "evaluate", "(", "TerminalOp", "<", "E_OUT", ",", "R", ">", "terminalOp", ")", "{", "assert", "getOutputShape", "(", ")", "==", "terminalOp", ".", "inputShape", "(", ")", ";", "if", "(", "linkedOrConsumed", ")", "throw", "n...
Evaluate the pipeline with a terminal operation to produce a result. @param <R> the type of result @param terminalOp the terminal operation to be applied to the pipeline. @return the result
[ "Evaluate", "the", "pipeline", "with", "a", "terminal", "operation", "to", "produce", "a", "result", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L230-L239
33,594
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.evaluateToArrayNode
@SuppressWarnings("unchecked") public final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; // If the last intermediate operation is stateful then // evaluate directly to avoid an extra collection step if (isParallel() && previousStage != null && opIsStateful()) { // Set the depth of this, last, pipeline stage to zero to slice the // pipeline such that this operation will not be included in the // upstream slice and upstream operations will not be included // in this slice depth = 0; return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator); } else { return evaluate(sourceSpliterator(0), true, generator); } }
java
@SuppressWarnings("unchecked") public final Node<E_OUT> evaluateToArrayNode(IntFunction<E_OUT[]> generator) { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; // If the last intermediate operation is stateful then // evaluate directly to avoid an extra collection step if (isParallel() && previousStage != null && opIsStateful()) { // Set the depth of this, last, pipeline stage to zero to slice the // pipeline such that this operation will not be included in the // upstream slice and upstream operations will not be included // in this slice depth = 0; return opEvaluateParallel(previousStage, previousStage.sourceSpliterator(0), generator); } else { return evaluate(sourceSpliterator(0), true, generator); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "final", "Node", "<", "E_OUT", ">", "evaluateToArrayNode", "(", "IntFunction", "<", "E_OUT", "[", "]", ">", "generator", ")", "{", "if", "(", "linkedOrConsumed", ")", "throw", "new", "IllegalStateEx...
Collect the elements output from the pipeline stage. @param generator the array generator to be used to create array instances @return a flat array-backed Node that holds the collected output elements
[ "Collect", "the", "elements", "output", "from", "the", "pipeline", "stage", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L247-L266
33,595
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.sourceStageSpliterator
@SuppressWarnings("unchecked") final Spliterator<E_OUT> sourceStageSpliterator() { if (this != sourceStage) throw new IllegalStateException(); if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSupplier.get(); sourceStage.sourceSupplier = null; return s; } else { throw new IllegalStateException(MSG_CONSUMED); } }
java
@SuppressWarnings("unchecked") final Spliterator<E_OUT> sourceStageSpliterator() { if (this != sourceStage) throw new IllegalStateException(); if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSupplier.get(); sourceStage.sourceSupplier = null; return s; } else { throw new IllegalStateException(MSG_CONSUMED); } }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "final", "Spliterator", "<", "E_OUT", ">", "sourceStageSpliterator", "(", ")", "{", "if", "(", "this", "!=", "sourceStage", ")", "throw", "new", "IllegalStateException", "(", ")", ";", "if", "(", "linkedOrCon...
Gets the source stage spliterator if this pipeline stage is the source stage. The pipeline is consumed after this method is called and returns successfully. @return the source stage spliterator @throws IllegalStateException if this pipeline stage is not the source stage.
[ "Gets", "the", "source", "stage", "spliterator", "if", "this", "pipeline", "stage", "is", "the", "source", "stage", ".", "The", "pipeline", "is", "consumed", "after", "this", "method", "is", "called", "and", "returns", "successfully", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L277-L301
33,596
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.spliterator
@Override @SuppressWarnings("unchecked") public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (this == sourceStage) { if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Supplier<Spliterator<E_OUT>> s = (Supplier<Spliterator<E_OUT>>) sourceStage.sourceSupplier; sourceStage.sourceSupplier = null; return lazySpliterator(s); } else { throw new IllegalStateException(MSG_CONSUMED); } } else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } }
java
@Override @SuppressWarnings("unchecked") public Spliterator<E_OUT> spliterator() { if (linkedOrConsumed) throw new IllegalStateException(MSG_STREAM_LINKED); linkedOrConsumed = true; if (this == sourceStage) { if (sourceStage.sourceSpliterator != null) { @SuppressWarnings("unchecked") Spliterator<E_OUT> s = (Spliterator<E_OUT>) sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; return s; } else if (sourceStage.sourceSupplier != null) { @SuppressWarnings("unchecked") Supplier<Spliterator<E_OUT>> s = (Supplier<Spliterator<E_OUT>>) sourceStage.sourceSupplier; sourceStage.sourceSupplier = null; return lazySpliterator(s); } else { throw new IllegalStateException(MSG_CONSUMED); } } else { return wrap(this, () -> sourceSpliterator(0), isParallel()); } }
[ "@", "Override", "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "public", "Spliterator", "<", "E_OUT", ">", "spliterator", "(", ")", "{", "if", "(", "linkedOrConsumed", ")", "throw", "new", "IllegalStateException", "(", "MSG_STREAM_LINKED", ")", ";", "linke...
Primitive specialization use co-variant overrides, hence is not final
[ "Primitive", "specialization", "use", "co", "-", "variant", "overrides", "hence", "is", "not", "final" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L343-L370
33,597
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java
AbstractPipeline.sourceSpliterator
@SuppressWarnings("unchecked") private Spliterator<?> sourceSpliterator(int terminalFlags) { // Get the source spliterator of the pipeline Spliterator<?> spliterator = null; if (sourceStage.sourceSpliterator != null) { spliterator = sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; } else if (sourceStage.sourceSupplier != null) { spliterator = (Spliterator<?>) sourceStage.sourceSupplier.get(); sourceStage.sourceSupplier = null; } else { throw new IllegalStateException(MSG_CONSUMED); } if (isParallel() && sourceStage.sourceAnyStateful) { // Adapt the source spliterator, evaluating each stateful op // in the pipeline up to and including this pipeline stage. // The depth and flags of each pipeline stage are adjusted accordingly. int depth = 1; for (@SuppressWarnings("rawtypes") AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this; u != e; u = p, p = p.nextStage) { int thisOpFlags = p.sourceOrOpFlags; if (p.opIsStateful()) { depth = 0; if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) { // Clear the short circuit flag for next pipeline stage // This stage encapsulates short-circuiting, the next // stage may not have any short-circuit operations, and // if so spliterator.forEachRemaining should be used // for traversal thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT; } spliterator = p.opEvaluateParallelLazy(u, spliterator); // Inject or clear SIZED on the source pipeline stage // based on the stage's spliterator thisOpFlags = spliterator.hasCharacteristics(Spliterator.SIZED) ? (thisOpFlags & ~StreamOpFlag.NOT_SIZED) | StreamOpFlag.IS_SIZED : (thisOpFlags & ~StreamOpFlag.IS_SIZED) | StreamOpFlag.NOT_SIZED; } p.depth = depth++; p.combinedFlags = StreamOpFlag.combineOpFlags(thisOpFlags, u.combinedFlags); } } if (terminalFlags != 0) { // Apply flags from the terminal operation to last pipeline stage combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags); } return spliterator; }
java
@SuppressWarnings("unchecked") private Spliterator<?> sourceSpliterator(int terminalFlags) { // Get the source spliterator of the pipeline Spliterator<?> spliterator = null; if (sourceStage.sourceSpliterator != null) { spliterator = sourceStage.sourceSpliterator; sourceStage.sourceSpliterator = null; } else if (sourceStage.sourceSupplier != null) { spliterator = (Spliterator<?>) sourceStage.sourceSupplier.get(); sourceStage.sourceSupplier = null; } else { throw new IllegalStateException(MSG_CONSUMED); } if (isParallel() && sourceStage.sourceAnyStateful) { // Adapt the source spliterator, evaluating each stateful op // in the pipeline up to and including this pipeline stage. // The depth and flags of each pipeline stage are adjusted accordingly. int depth = 1; for (@SuppressWarnings("rawtypes") AbstractPipeline u = sourceStage, p = sourceStage.nextStage, e = this; u != e; u = p, p = p.nextStage) { int thisOpFlags = p.sourceOrOpFlags; if (p.opIsStateful()) { depth = 0; if (StreamOpFlag.SHORT_CIRCUIT.isKnown(thisOpFlags)) { // Clear the short circuit flag for next pipeline stage // This stage encapsulates short-circuiting, the next // stage may not have any short-circuit operations, and // if so spliterator.forEachRemaining should be used // for traversal thisOpFlags = thisOpFlags & ~StreamOpFlag.IS_SHORT_CIRCUIT; } spliterator = p.opEvaluateParallelLazy(u, spliterator); // Inject or clear SIZED on the source pipeline stage // based on the stage's spliterator thisOpFlags = spliterator.hasCharacteristics(Spliterator.SIZED) ? (thisOpFlags & ~StreamOpFlag.NOT_SIZED) | StreamOpFlag.IS_SIZED : (thisOpFlags & ~StreamOpFlag.IS_SIZED) | StreamOpFlag.NOT_SIZED; } p.depth = depth++; p.combinedFlags = StreamOpFlag.combineOpFlags(thisOpFlags, u.combinedFlags); } } if (terminalFlags != 0) { // Apply flags from the terminal operation to last pipeline stage combinedFlags = StreamOpFlag.combineOpFlags(terminalFlags, combinedFlags); } return spliterator; }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "private", "Spliterator", "<", "?", ">", "sourceSpliterator", "(", "int", "terminalFlags", ")", "{", "// Get the source spliterator of the pipeline", "Spliterator", "<", "?", ">", "spliterator", "=", "null", ";", "...
Get the source spliterator for this pipeline stage. For a sequential or stateless parallel pipeline, this is the source spliterator. For a stateful parallel pipeline, this is a spliterator describing the results of all computations up to and including the most recent stateful operation.
[ "Get", "the", "source", "spliterator", "for", "this", "pipeline", "stage", ".", "For", "a", "sequential", "or", "stateless", "parallel", "pipeline", "this", "is", "the", "source", "spliterator", ".", "For", "a", "stateful", "parallel", "pipeline", "this", "is"...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/stream/AbstractPipeline.java#L397-L454
33,598
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java
Variable.isPsuedoVarRef
public boolean isPsuedoVarRef() { java.lang.String ns = m_qname.getNamespaceURI(); if((null != ns) && ns.equals(PSUEDOVARNAMESPACE)) { if(m_qname.getLocalName().startsWith("#")) return true; } return false; }
java
public boolean isPsuedoVarRef() { java.lang.String ns = m_qname.getNamespaceURI(); if((null != ns) && ns.equals(PSUEDOVARNAMESPACE)) { if(m_qname.getLocalName().startsWith("#")) return true; } return false; }
[ "public", "boolean", "isPsuedoVarRef", "(", ")", "{", "java", ".", "lang", ".", "String", "ns", "=", "m_qname", ".", "getNamespaceURI", "(", ")", ";", "if", "(", "(", "null", "!=", "ns", ")", "&&", "ns", ".", "equals", "(", "PSUEDOVARNAMESPACE", ")", ...
Tell if this is a psuedo variable reference, declared by Xalan instead of by the user.
[ "Tell", "if", "this", "is", "a", "psuedo", "variable", "reference", "declared", "by", "Xalan", "instead", "of", "by", "the", "user", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/operations/Variable.java#L375-L384
33,599
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FormattedFloatingDecimal.java
FormattedFloatingDecimal.checkExponent
private int checkExponent(int length) { if (length >= nDigits || length < 0) return decExponent; for (int i = 0; i < length; i++) if (digits[i] != '9') // a '9' anywhere in digits will absorb the round return decExponent; return decExponent + (digits[length] >= '5' ? 1 : 0); }
java
private int checkExponent(int length) { if (length >= nDigits || length < 0) return decExponent; for (int i = 0; i < length; i++) if (digits[i] != '9') // a '9' anywhere in digits will absorb the round return decExponent; return decExponent + (digits[length] >= '5' ? 1 : 0); }
[ "private", "int", "checkExponent", "(", "int", "length", ")", "{", "if", "(", "length", ">=", "nDigits", "||", "length", "<", "0", ")", "return", "decExponent", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "length", ";", "i", "++", ")", ...
Given the desired number of digits predict the result's exponent.
[ "Given", "the", "desired", "number", "of", "digits", "predict", "the", "result", "s", "exponent", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/misc/FormattedFloatingDecimal.java#L411-L420