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
35,100
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java
CountersTable.putElemNumber
Vector putElemNumber(ElemNumber numberElem) { Vector counters = new Vector(); this.put(numberElem, counters); return counters; }
java
Vector putElemNumber(ElemNumber numberElem) { Vector counters = new Vector(); this.put(numberElem, counters); return counters; }
[ "Vector", "putElemNumber", "(", "ElemNumber", "numberElem", ")", "{", "Vector", "counters", "=", "new", "Vector", "(", ")", ";", "this", ".", "put", "(", "numberElem", ",", "counters", ")", ";", "return", "counters", ";", "}" ]
Put a counter into the table and create an empty vector as it's value. @param numberElem the given xsl:number element. @return an empty vector to be used to store counts for this number element.
[ "Put", "a", "counter", "into", "the", "table", "and", "create", "an", "empty", "vector", "as", "it", "s", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java#L75-L83
35,101
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java
CountersTable.appendBtoFList
void appendBtoFList(NodeSetDTM flist, NodeSetDTM blist) { int n = blist.size(); for (int i = (n - 1); i >= 0; i--) { flist.addElement(blist.item(i)); } }
java
void appendBtoFList(NodeSetDTM flist, NodeSetDTM blist) { int n = blist.size(); for (int i = (n - 1); i >= 0; i--) { flist.addElement(blist.item(i)); } }
[ "void", "appendBtoFList", "(", "NodeSetDTM", "flist", ",", "NodeSetDTM", "blist", ")", "{", "int", "n", "=", "blist", ".", "size", "(", ")", ";", "for", "(", "int", "i", "=", "(", "n", "-", "1", ")", ";", "i", ">=", "0", ";", "i", "--", ")", ...
Add a list of counted nodes that were built in backwards document order, or a list of counted nodes that are in forwards document order. @param flist Vector of nodes built in forwards document order @param blist Vector of nodes built in backwards document order
[ "Add", "a", "list", "of", "counted", "nodes", "that", "were", "built", "in", "backwards", "document", "order", "or", "a", "list", "of", "counted", "nodes", "that", "are", "in", "forwards", "document", "order", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java#L98-L107
35,102
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java
CountersTable.countNode
public int countNode(XPathContext support, ElemNumber numberElem, int node) throws TransformerException { int count = 0; Vector counters = getCounters(numberElem); int nCounters = counters.size(); // XPath countMatchPattern = numberElem.getCountMatchPattern(support, node); // XPath fromMatchPattern = numberElem.m_fromMatchPattern; int target = numberElem.getTargetNode(support, node); if (DTM.NULL != target) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); count = counter.getPreviouslyCounted(support, target); if (count > 0) return count; } // In the loop below, we collect the nodes in backwards doc order, so // we don't have to do inserts, but then we store the nodes in forwards // document order, so we don't have to insert nodes into that list, // so that's what the appendBtoFList stuff is all about. In cases // of forward counting by one, this will mean a single node copy from // the backwards list (m_newFound) to the forwards list (counter.m_countNodes). count = 0; if (m_newFound == null) m_newFound = new NodeSetDTM(support.getDTMManager()); for (; DTM.NULL != target; target = numberElem.getPreviousNode(support, target)) { // First time in, we should not have to check for previous counts, // since the original target node was already checked in the // block above. if (0 != count) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); int cacheLen = counter.m_countNodes.size(); if ((cacheLen > 0) && (counter.m_countNodes.elementAt(cacheLen - 1) == target)) { count += (cacheLen + counter.m_countNodesStartCount); if (cacheLen > 0) appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); return count; } } } m_newFound.addElement(target); count++; } // If we got to this point, then we didn't find a counter, so make // one and add it to the list. Counter counter = new Counter(numberElem, new NodeSetDTM(support.getDTMManager())); m_countersMade++; // for diagnostics appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); counters.addElement(counter); } return count; }
java
public int countNode(XPathContext support, ElemNumber numberElem, int node) throws TransformerException { int count = 0; Vector counters = getCounters(numberElem); int nCounters = counters.size(); // XPath countMatchPattern = numberElem.getCountMatchPattern(support, node); // XPath fromMatchPattern = numberElem.m_fromMatchPattern; int target = numberElem.getTargetNode(support, node); if (DTM.NULL != target) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); count = counter.getPreviouslyCounted(support, target); if (count > 0) return count; } // In the loop below, we collect the nodes in backwards doc order, so // we don't have to do inserts, but then we store the nodes in forwards // document order, so we don't have to insert nodes into that list, // so that's what the appendBtoFList stuff is all about. In cases // of forward counting by one, this will mean a single node copy from // the backwards list (m_newFound) to the forwards list (counter.m_countNodes). count = 0; if (m_newFound == null) m_newFound = new NodeSetDTM(support.getDTMManager()); for (; DTM.NULL != target; target = numberElem.getPreviousNode(support, target)) { // First time in, we should not have to check for previous counts, // since the original target node was already checked in the // block above. if (0 != count) { for (int i = 0; i < nCounters; i++) { Counter counter = (Counter) counters.elementAt(i); int cacheLen = counter.m_countNodes.size(); if ((cacheLen > 0) && (counter.m_countNodes.elementAt(cacheLen - 1) == target)) { count += (cacheLen + counter.m_countNodesStartCount); if (cacheLen > 0) appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); return count; } } } m_newFound.addElement(target); count++; } // If we got to this point, then we didn't find a counter, so make // one and add it to the list. Counter counter = new Counter(numberElem, new NodeSetDTM(support.getDTMManager())); m_countersMade++; // for diagnostics appendBtoFList(counter.m_countNodes, m_newFound); m_newFound.removeAllElements(); counters.addElement(counter); } return count; }
[ "public", "int", "countNode", "(", "XPathContext", "support", ",", "ElemNumber", "numberElem", ",", "int", "node", ")", "throws", "TransformerException", "{", "int", "count", "=", "0", ";", "Vector", "counters", "=", "getCounters", "(", "numberElem", ")", ";",...
Count forward until the given node is found, or until we have looked to the given amount. @param support The XPath context to use @param numberElem The given xsl:number element. @param node The node to count. @return The node count, or 0 if not found. @throws TransformerException
[ "Count", "forward", "until", "the", "given", "node", "is", "found", "or", "until", "we", "have", "looked", "to", "the", "given", "amount", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/transformer/CountersTable.java#L126-L207
35,103
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_2022.java
CharsetRecog_2022.match
int match(byte [] text, int textLen, byte [][] escapeSequences) { int i, j; int escN; int hits = 0; int misses = 0; int shifts = 0; int quality; scanInput: for (i=0; i<textLen; i++) { if (text[i] == 0x1b) { checkEscapes: for (escN=0; escN<escapeSequences.length; escN++) { byte [] seq = escapeSequences[escN]; if ((textLen - i) < seq.length) { continue checkEscapes; } for (j=1; j<seq.length; j++) { if (seq[j] != text[i+j]) { continue checkEscapes; } } hits++; i += seq.length-1; continue scanInput; } misses++; } if (text[i] == 0x0e || text[i] == 0x0f) { // Shift in/out shifts++; } } if (hits == 0) { return 0; } // // Initial quality is based on relative proportion of recongized vs. // unrecognized escape sequences. // All good: quality = 100; // half or less good: quality = 0; // linear inbetween. quality = (100*hits - 100*misses) / (hits + misses); // Back off quality if there were too few escape sequences seen. // Include shifts in this computation, so that KR does not get penalized // for having only a single Escape sequence, but many shifts. if (hits+shifts < 5) { quality -= (5-(hits+shifts))*10; } if (quality < 0) { quality = 0; } return quality; }
java
int match(byte [] text, int textLen, byte [][] escapeSequences) { int i, j; int escN; int hits = 0; int misses = 0; int shifts = 0; int quality; scanInput: for (i=0; i<textLen; i++) { if (text[i] == 0x1b) { checkEscapes: for (escN=0; escN<escapeSequences.length; escN++) { byte [] seq = escapeSequences[escN]; if ((textLen - i) < seq.length) { continue checkEscapes; } for (j=1; j<seq.length; j++) { if (seq[j] != text[i+j]) { continue checkEscapes; } } hits++; i += seq.length-1; continue scanInput; } misses++; } if (text[i] == 0x0e || text[i] == 0x0f) { // Shift in/out shifts++; } } if (hits == 0) { return 0; } // // Initial quality is based on relative proportion of recongized vs. // unrecognized escape sequences. // All good: quality = 100; // half or less good: quality = 0; // linear inbetween. quality = (100*hits - 100*misses) / (hits + misses); // Back off quality if there were too few escape sequences seen. // Include shifts in this computation, so that KR does not get penalized // for having only a single Escape sequence, but many shifts. if (hits+shifts < 5) { quality -= (5-(hits+shifts))*10; } if (quality < 0) { quality = 0; } return quality; }
[ "int", "match", "(", "byte", "[", "]", "text", ",", "int", "textLen", ",", "byte", "[", "]", "[", "]", "escapeSequences", ")", "{", "int", "i", ",", "j", ";", "int", "escN", ";", "int", "hits", "=", "0", ";", "int", "misses", "=", "0", ";", "...
Matching function shared among the 2022 detectors JP, CN and KR Counts up the number of legal an unrecognized escape sequences in the sample of text, and computes a score based on the total number & the proportion that fit the encoding. @param text the byte buffer containing text to analyse @param textLen the size of the text in the byte. @param escapeSequences the byte escape sequences to test for. @return match quality, in the range of 0-100.
[ "Matching", "function", "shared", "among", "the", "2022", "detectors", "JP", "CN", "and", "KR", "Counts", "up", "the", "number", "of", "legal", "an", "unrecognized", "escape", "sequences", "in", "the", "sample", "of", "text", "and", "computes", "a", "score",...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/CharsetRecog_2022.java#L35-L96
35,104
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java
DateFormatSymbols.getCachedInstance
private static DateFormatSymbols getCachedInstance(Locale locale) { SoftReference<DateFormatSymbols> ref = cachedInstances.get(locale); DateFormatSymbols dfs = null; if (ref == null || (dfs = ref.get()) == null) { dfs = new DateFormatSymbols(locale); ref = new SoftReference<DateFormatSymbols>(dfs); SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref); if (x != null) { DateFormatSymbols y = x.get(); if (y != null) { dfs = y; } else { // Replace the empty SoftReference with ref. cachedInstances.put(locale, ref); } } } return dfs; }
java
private static DateFormatSymbols getCachedInstance(Locale locale) { SoftReference<DateFormatSymbols> ref = cachedInstances.get(locale); DateFormatSymbols dfs = null; if (ref == null || (dfs = ref.get()) == null) { dfs = new DateFormatSymbols(locale); ref = new SoftReference<DateFormatSymbols>(dfs); SoftReference<DateFormatSymbols> x = cachedInstances.putIfAbsent(locale, ref); if (x != null) { DateFormatSymbols y = x.get(); if (y != null) { dfs = y; } else { // Replace the empty SoftReference with ref. cachedInstances.put(locale, ref); } } } return dfs; }
[ "private", "static", "DateFormatSymbols", "getCachedInstance", "(", "Locale", "locale", ")", "{", "SoftReference", "<", "DateFormatSymbols", ">", "ref", "=", "cachedInstances", ".", "get", "(", "locale", ")", ";", "DateFormatSymbols", "dfs", "=", "null", ";", "i...
Returns a cached DateFormatSymbols if it's found in the cache. Otherwise, this method returns a newly cached instance for the given locale.
[ "Returns", "a", "cached", "DateFormatSymbols", "if", "it", "s", "found", "in", "the", "cache", ".", "Otherwise", "this", "method", "returns", "a", "newly", "cached", "instance", "for", "the", "given", "locale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java#L456-L474
35,105
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java
DateFormatSymbols.copyMembers
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst) { dst.eras = Arrays.copyOf(src.eras, src.eras.length); dst.months = Arrays.copyOf(src.months, src.months.length); dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length); dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length); dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length); dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length); if (src.zoneStrings != null) { dst.zoneStrings = src.getZoneStringsImpl(true); } else { dst.zoneStrings = null; } dst.localPatternChars = src.localPatternChars; dst.tinyMonths = src.tinyMonths; dst.tinyWeekdays = src.tinyWeekdays; dst.standAloneMonths = src.standAloneMonths; dst.shortStandAloneMonths = src.shortStandAloneMonths; dst.tinyStandAloneMonths = src.tinyStandAloneMonths; dst.standAloneWeekdays = src.standAloneWeekdays; dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays; dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays; }
java
private final void copyMembers(DateFormatSymbols src, DateFormatSymbols dst) { dst.eras = Arrays.copyOf(src.eras, src.eras.length); dst.months = Arrays.copyOf(src.months, src.months.length); dst.shortMonths = Arrays.copyOf(src.shortMonths, src.shortMonths.length); dst.weekdays = Arrays.copyOf(src.weekdays, src.weekdays.length); dst.shortWeekdays = Arrays.copyOf(src.shortWeekdays, src.shortWeekdays.length); dst.ampms = Arrays.copyOf(src.ampms, src.ampms.length); if (src.zoneStrings != null) { dst.zoneStrings = src.getZoneStringsImpl(true); } else { dst.zoneStrings = null; } dst.localPatternChars = src.localPatternChars; dst.tinyMonths = src.tinyMonths; dst.tinyWeekdays = src.tinyWeekdays; dst.standAloneMonths = src.standAloneMonths; dst.shortStandAloneMonths = src.shortStandAloneMonths; dst.tinyStandAloneMonths = src.tinyStandAloneMonths; dst.standAloneWeekdays = src.standAloneWeekdays; dst.shortStandAloneWeekdays = src.shortStandAloneWeekdays; dst.tinyStandAloneWeekdays = src.tinyStandAloneWeekdays; }
[ "private", "final", "void", "copyMembers", "(", "DateFormatSymbols", "src", ",", "DateFormatSymbols", "dst", ")", "{", "dst", ".", "eras", "=", "Arrays", ".", "copyOf", "(", "src", ".", "eras", ",", "src", ".", "eras", ".", "length", ")", ";", "dst", "...
Clones all the data members from the source DateFormatSymbols to the target DateFormatSymbols. This is only for subclasses. @param src the source DateFormatSymbols. @param dst the target DateFormatSymbols.
[ "Clones", "all", "the", "data", "members", "from", "the", "source", "DateFormatSymbols", "to", "the", "target", "DateFormatSymbols", ".", "This", "is", "only", "for", "subclasses", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/DateFormatSymbols.java#L926-L951
35,106
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/TrustAnchor.java
TrustAnchor.setNameConstraints
private void setNameConstraints(byte[] bytes) { if (bytes == null) { ncBytes = null; nc = null; } else { ncBytes = bytes.clone(); // validate DER encoding try { nc = new NameConstraintsExtension(Boolean.FALSE, bytes); } catch (IOException ioe) { IllegalArgumentException iae = new IllegalArgumentException(ioe.getMessage()); iae.initCause(ioe); throw iae; } } }
java
private void setNameConstraints(byte[] bytes) { if (bytes == null) { ncBytes = null; nc = null; } else { ncBytes = bytes.clone(); // validate DER encoding try { nc = new NameConstraintsExtension(Boolean.FALSE, bytes); } catch (IOException ioe) { IllegalArgumentException iae = new IllegalArgumentException(ioe.getMessage()); iae.initCause(ioe); throw iae; } } }
[ "private", "void", "setNameConstraints", "(", "byte", "[", "]", "bytes", ")", "{", "if", "(", "bytes", "==", "null", ")", "{", "ncBytes", "=", "null", ";", "nc", "=", "null", ";", "}", "else", "{", "ncBytes", "=", "bytes", ".", "clone", "(", ")", ...
Decode the name constraints and clone them if not null.
[ "Decode", "the", "name", "constraints", "and", "clone", "them", "if", "not", "null", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/cert/TrustAnchor.java#L272-L288
35,107
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.put
public void put(E e) throws InterruptedException { if (e == null) throw new NullPointerException(); if (transferer.transfer(e, false, 0) == null) { Thread.interrupted(); throw new InterruptedException(); } }
java
public void put(E e) throws InterruptedException { if (e == null) throw new NullPointerException(); if (transferer.transfer(e, false, 0) == null) { Thread.interrupted(); throw new InterruptedException(); } }
[ "public", "void", "put", "(", "E", "e", ")", "throws", "InterruptedException", "{", "if", "(", "e", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "transferer", ".", "transfer", "(", "e", ",", "false", ",", "0", ...
Adds the specified element to this queue, waiting if necessary for another thread to receive it. @throws InterruptedException {@inheritDoc} @throws NullPointerException {@inheritDoc}
[ "Adds", "the", "specified", "element", "to", "this", "queue", "waiting", "if", "necessary", "for", "another", "thread", "to", "receive", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L878-L884
35,108
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.offer
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) throw new NullPointerException(); if (transferer.transfer(e, true, unit.toNanos(timeout)) != null) return true; if (!Thread.interrupted()) return false; throw new InterruptedException(); }
java
public boolean offer(E e, long timeout, TimeUnit unit) throws InterruptedException { if (e == null) throw new NullPointerException(); if (transferer.transfer(e, true, unit.toNanos(timeout)) != null) return true; if (!Thread.interrupted()) return false; throw new InterruptedException(); }
[ "public", "boolean", "offer", "(", "E", "e", ",", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "if", "(", "e", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "if", "(", "transferer", "...
Inserts the specified element into this queue, waiting if necessary up to the specified wait time for another thread to receive it. @return {@code true} if successful, or {@code false} if the specified waiting time elapses before a consumer appears @throws InterruptedException {@inheritDoc} @throws NullPointerException {@inheritDoc}
[ "Inserts", "the", "specified", "element", "into", "this", "queue", "waiting", "if", "necessary", "up", "to", "the", "specified", "wait", "time", "for", "another", "thread", "to", "receive", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L895-L903
35,109
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.offer
public boolean offer(E e) { if (e == null) throw new NullPointerException(); return transferer.transfer(e, true, 0) != null; }
java
public boolean offer(E e) { if (e == null) throw new NullPointerException(); return transferer.transfer(e, true, 0) != null; }
[ "public", "boolean", "offer", "(", "E", "e", ")", "{", "if", "(", "e", "==", "null", ")", "throw", "new", "NullPointerException", "(", ")", ";", "return", "transferer", ".", "transfer", "(", "e", ",", "true", ",", "0", ")", "!=", "null", ";", "}" ]
Inserts the specified element into this queue, if another thread is waiting to receive it. @param e the element to add @return {@code true} if the element was added to this queue, else {@code false} @throws NullPointerException if the specified element is null
[ "Inserts", "the", "specified", "element", "into", "this", "queue", "if", "another", "thread", "is", "waiting", "to", "receive", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L914-L917
35,110
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.take
public E take() throws InterruptedException { E e = transferer.transfer(null, false, 0); if (e != null) return e; Thread.interrupted(); throw new InterruptedException(); }
java
public E take() throws InterruptedException { E e = transferer.transfer(null, false, 0); if (e != null) return e; Thread.interrupted(); throw new InterruptedException(); }
[ "public", "E", "take", "(", ")", "throws", "InterruptedException", "{", "E", "e", "=", "transferer", ".", "transfer", "(", "null", ",", "false", ",", "0", ")", ";", "if", "(", "e", "!=", "null", ")", "return", "e", ";", "Thread", ".", "interrupted", ...
Retrieves and removes the head of this queue, waiting if necessary for another thread to insert it. @return the head of this queue @throws InterruptedException {@inheritDoc}
[ "Retrieves", "and", "removes", "the", "head", "of", "this", "queue", "waiting", "if", "necessary", "for", "another", "thread", "to", "insert", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L926-L932
35,111
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java
SynchronousQueue.poll
public E poll(long timeout, TimeUnit unit) throws InterruptedException { E e = transferer.transfer(null, true, unit.toNanos(timeout)); if (e != null || !Thread.interrupted()) return e; throw new InterruptedException(); }
java
public E poll(long timeout, TimeUnit unit) throws InterruptedException { E e = transferer.transfer(null, true, unit.toNanos(timeout)); if (e != null || !Thread.interrupted()) return e; throw new InterruptedException(); }
[ "public", "E", "poll", "(", "long", "timeout", ",", "TimeUnit", "unit", ")", "throws", "InterruptedException", "{", "E", "e", "=", "transferer", ".", "transfer", "(", "null", ",", "true", ",", "unit", ".", "toNanos", "(", "timeout", ")", ")", ";", "if"...
Retrieves and removes the head of this queue, waiting if necessary up to the specified wait time, for another thread to insert it. @return the head of this queue, or {@code null} if the specified waiting time elapses before an element is present @throws InterruptedException {@inheritDoc}
[ "Retrieves", "and", "removes", "the", "head", "of", "this", "queue", "waiting", "if", "necessary", "up", "to", "the", "specified", "wait", "time", "for", "another", "thread", "to", "insert", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/SynchronousQueue.java#L943-L948
35,112
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java
Security.insertProviderAt
public static synchronized int insertProviderAt(Provider provider, int position) { String providerName = provider.getName(); check("insertProvider." + providerName); ProviderList list = Providers.getFullProviderList(); ProviderList newList = ProviderList.insertAt(list, provider, position - 1); if (list == newList) { return -1; } increaseVersion(); Providers.setProviderList(newList); return newList.getIndex(providerName) + 1; }
java
public static synchronized int insertProviderAt(Provider provider, int position) { String providerName = provider.getName(); check("insertProvider." + providerName); ProviderList list = Providers.getFullProviderList(); ProviderList newList = ProviderList.insertAt(list, provider, position - 1); if (list == newList) { return -1; } increaseVersion(); Providers.setProviderList(newList); return newList.getIndex(providerName) + 1; }
[ "public", "static", "synchronized", "int", "insertProviderAt", "(", "Provider", "provider", ",", "int", "position", ")", "{", "String", "providerName", "=", "provider", ".", "getName", "(", ")", ";", "check", "(", "\"insertProvider.\"", "+", "providerName", ")",...
Adds a new provider, at a specified position. The position is the preference order in which providers are searched for requested algorithms. The position is 1-based, that is, 1 is most preferred, followed by 2, and so on. <p>If the given provider is installed at the requested position, the provider that used to be at that position, and all providers with a position greater than <code>position</code>, are shifted up one position (towards the end of the list of installed providers). <p>A provider cannot be added if it is already installed. <p>First, if there is a security manager, its <code>checkSecurityAccess</code> method is called with the string <code>"insertProvider."+provider.getName()</code> to see if it's ok to add a new provider. If the default implementation of <code>checkSecurityAccess</code> is used (i.e., that method is not overriden), then this will result in a call to the security manager's <code>checkPermission</code> method with a <code>SecurityPermission("insertProvider."+provider.getName())</code> permission. @param provider the provider to be added. @param position the preference position that the caller would like for this provider. @return the actual preference position in which the provider was added, or -1 if the provider was not added because it is already installed. @throws NullPointerException if provider is null @throws SecurityException if a security manager exists and its <code>{@link java.lang.SecurityManager#checkSecurityAccess}</code> method denies access to add a new provider @see #getProvider @see #removeProvider @see java.security.SecurityPermission
[ "Adds", "a", "new", "provider", "at", "a", "specified", "position", ".", "The", "position", "is", "the", "preference", "order", "in", "which", "providers", "are", "searched", "for", "requested", "algorithms", ".", "The", "position", "is", "1", "-", "based", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java#L234-L246
35,113
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java
Security.removeProvider
public static synchronized void removeProvider(String name) { check("removeProvider." + name); ProviderList list = Providers.getFullProviderList(); ProviderList newList = ProviderList.remove(list, name); Providers.setProviderList(newList); increaseVersion(); }
java
public static synchronized void removeProvider(String name) { check("removeProvider." + name); ProviderList list = Providers.getFullProviderList(); ProviderList newList = ProviderList.remove(list, name); Providers.setProviderList(newList); increaseVersion(); }
[ "public", "static", "synchronized", "void", "removeProvider", "(", "String", "name", ")", "{", "check", "(", "\"removeProvider.\"", "+", "name", ")", ";", "ProviderList", "list", "=", "Providers", ".", "getFullProviderList", "(", ")", ";", "ProviderList", "newLi...
Removes the provider with the specified name. <p>When the specified provider is removed, all providers located at a position greater than where the specified provider was are shifted down one position (towards the head of the list of installed providers). <p>This method returns silently if the provider is not installed or if name is null. <p>First, if there is a security manager, its <code>checkSecurityAccess</code> method is called with the string <code>"removeProvider."+name</code> to see if it's ok to remove the provider. If the default implementation of <code>checkSecurityAccess</code> is used (i.e., that method is not overriden), then this will result in a call to the security manager's <code>checkPermission</code> method with a <code>SecurityPermission("removeProvider."+name)</code> permission. @param name the name of the provider to remove. @throws SecurityException if a security manager exists and its <code>{@link java.lang.SecurityManager#checkSecurityAccess}</code> method denies access to remove the provider @see #getProvider @see #addProvider
[ "Removes", "the", "provider", "with", "the", "specified", "name", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java#L321-L327
35,114
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java
Security.getProperty
public static String getProperty(String key) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SecurityPermission("getProperty."+ key)); } String name = props.getProperty(key); if (name != null) name = name.trim(); // could be a class name with trailing ws return name; }
java
public static String getProperty(String key) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(new SecurityPermission("getProperty."+ key)); } String name = props.getProperty(key); if (name != null) name = name.trim(); // could be a class name with trailing ws return name; }
[ "public", "static", "String", "getProperty", "(", "String", "key", ")", "{", "SecurityManager", "sm", "=", "System", ".", "getSecurityManager", "(", ")", ";", "if", "(", "sm", "!=", "null", ")", "{", "sm", ".", "checkPermission", "(", "new", "SecurityPermi...
Gets a security property value. <p>First, if there is a security manager, its <code>checkPermission</code> method is called with a <code>java.security.SecurityPermission("getProperty."+key)</code> permission to see if it's ok to retrieve the specified security property value.. @param key the key of the property being retrieved. @return the value of the security property corresponding to key. @throws SecurityException if a security manager exists and its <code>{@link java.lang.SecurityManager#checkPermission}</code> method denies access to retrieve the specified security property value @throws NullPointerException is key is null @see #setProperty @see java.security.SecurityPermission
[ "Gets", "a", "security", "property", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java#L636-L646
35,115
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java
Security.setProperty
public static void setProperty(String key, String datum) { check("setProperty."+key); props.put(key, datum); increaseVersion(); invalidateSMCache(key); /* See below. */ }
java
public static void setProperty(String key, String datum) { check("setProperty."+key); props.put(key, datum); increaseVersion(); invalidateSMCache(key); /* See below. */ }
[ "public", "static", "void", "setProperty", "(", "String", "key", ",", "String", "datum", ")", "{", "check", "(", "\"setProperty.\"", "+", "key", ")", ";", "props", ".", "put", "(", "key", ",", "datum", ")", ";", "increaseVersion", "(", ")", ";", "inval...
Sets a security property value. <p>First, if there is a security manager, its <code>checkPermission</code> method is called with a <code>java.security.SecurityPermission("setProperty."+key)</code> permission to see if it's ok to set the specified security property value. @param key the name of the property to be set. @param datum the value of the property to be set. @throws SecurityException if a security manager exists and its <code>{@link java.lang.SecurityManager#checkPermission}</code> method denies access to set the specified security property value @throws NullPointerException if key or datum is null @see #getProperty @see java.security.SecurityPermission
[ "Sets", "a", "security", "property", "value", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/security/Security.java#L670-L675
35,116
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipCoder.java
ZipCoder.getBytesUTF8
byte[] getBytesUTF8(String s) { if (isUTF8) return getBytes(s); if (utf8 == null) utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.getBytes(s); }
java
byte[] getBytesUTF8(String s) { if (isUTF8) return getBytes(s); if (utf8 == null) utf8 = new ZipCoder(StandardCharsets.UTF_8); return utf8.getBytes(s); }
[ "byte", "[", "]", "getBytesUTF8", "(", "String", "s", ")", "{", "if", "(", "isUTF8", ")", "return", "getBytes", "(", "s", ")", ";", "if", "(", "utf8", "==", "null", ")", "utf8", "=", "new", "ZipCoder", "(", "StandardCharsets", ".", "UTF_8", ")", ";...
assume invoked only if "this" is not utf8
[ "assume", "invoked", "only", "if", "this", "is", "not", "utf8" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipCoder.java#L109-L115
35,117
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java
Period.validateChrono
private void validateChrono(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); Chronology temporalChrono = temporal.query(TemporalQueries.chronology()); if (temporalChrono != null && IsoChronology.INSTANCE.equals(temporalChrono) == false) { throw new DateTimeException("Chronology mismatch, expected: ISO, actual: " + temporalChrono.getId()); } }
java
private void validateChrono(TemporalAccessor temporal) { Objects.requireNonNull(temporal, "temporal"); Chronology temporalChrono = temporal.query(TemporalQueries.chronology()); if (temporalChrono != null && IsoChronology.INSTANCE.equals(temporalChrono) == false) { throw new DateTimeException("Chronology mismatch, expected: ISO, actual: " + temporalChrono.getId()); } }
[ "private", "void", "validateChrono", "(", "TemporalAccessor", "temporal", ")", "{", "Objects", ".", "requireNonNull", "(", "temporal", ",", "\"temporal\"", ")", ";", "Chronology", "temporalChrono", "=", "temporal", ".", "query", "(", "TemporalQueries", ".", "chron...
Validates that the temporal has the correct chronology.
[ "Validates", "that", "the", "temporal", "has", "the", "correct", "chronology", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/Period.java#L961-L967
35,118
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java
SimpleDateFormat.format
private StringBuffer format(Date date, StringBuffer toAppendTo, FieldDelegate delegate) { // Convert input date to time field list calendar.setTime(date); boolean useDateFormatSymbols = useDateFormatSymbols(); for (int i = 0; i < compiledPattern.length; ) { int tag = compiledPattern[i] >>> 8; int count = compiledPattern[i++] & 0xff; if (count == 255) { count = compiledPattern[i++] << 16; count |= compiledPattern[i++]; } switch (tag) { case TAG_QUOTE_ASCII_CHAR: toAppendTo.append((char)count); break; case TAG_QUOTE_CHARS: toAppendTo.append(compiledPattern, i, count); i += count; break; default: subFormat(tag, count, delegate, toAppendTo, useDateFormatSymbols); break; } } return toAppendTo; }
java
private StringBuffer format(Date date, StringBuffer toAppendTo, FieldDelegate delegate) { // Convert input date to time field list calendar.setTime(date); boolean useDateFormatSymbols = useDateFormatSymbols(); for (int i = 0; i < compiledPattern.length; ) { int tag = compiledPattern[i] >>> 8; int count = compiledPattern[i++] & 0xff; if (count == 255) { count = compiledPattern[i++] << 16; count |= compiledPattern[i++]; } switch (tag) { case TAG_QUOTE_ASCII_CHAR: toAppendTo.append((char)count); break; case TAG_QUOTE_CHARS: toAppendTo.append(compiledPattern, i, count); i += count; break; default: subFormat(tag, count, delegate, toAppendTo, useDateFormatSymbols); break; } } return toAppendTo; }
[ "private", "StringBuffer", "format", "(", "Date", "date", ",", "StringBuffer", "toAppendTo", ",", "FieldDelegate", "delegate", ")", "{", "// Convert input date to time field list", "calendar", ".", "setTime", "(", "date", ")", ";", "boolean", "useDateFormatSymbols", "...
Called from Format after creating a FieldDelegate
[ "Called", "from", "Format", "after", "creating", "a", "FieldDelegate" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java#L951-L982
35,119
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java
SimpleDateFormat.matchString
private int matchString(String text, int start, int field, String[] data, CalendarBuilder calb) { int i = 0; int count = data.length; if (field == Calendar.DAY_OF_WEEK) i = 1; // There may be multiple strings in the data[] array which begin with // the same prefix (e.g., Cerven and Cervenec (June and July) in Czech). // We keep track of the longest match, and return that. Note that this // unfortunately requires us to test all array elements. int bestMatchLength = 0, bestMatch = -1; for (; i<count; ++i) { int length = data[i].length(); // Always compare if we have no match yet; otherwise only compare // against potentially better matches (longer strings). if (length > bestMatchLength && text.regionMatches(true, start, data[i], 0, length)) { bestMatch = i; bestMatchLength = length; } // When the input option ends with a period (usually an abbreviated form), attempt // to match all chars up to that period. if ((data[i].charAt(length - 1) == '.') && ((length - 1) > bestMatchLength) && text.regionMatches(true, start, data[i], 0, length - 1)) { bestMatch = i; bestMatchLength = (length - 1); } } if (bestMatch >= 0) { calb.set(field, bestMatch); return start + bestMatchLength; } return -start; }
java
private int matchString(String text, int start, int field, String[] data, CalendarBuilder calb) { int i = 0; int count = data.length; if (field == Calendar.DAY_OF_WEEK) i = 1; // There may be multiple strings in the data[] array which begin with // the same prefix (e.g., Cerven and Cervenec (June and July) in Czech). // We keep track of the longest match, and return that. Note that this // unfortunately requires us to test all array elements. int bestMatchLength = 0, bestMatch = -1; for (; i<count; ++i) { int length = data[i].length(); // Always compare if we have no match yet; otherwise only compare // against potentially better matches (longer strings). if (length > bestMatchLength && text.regionMatches(true, start, data[i], 0, length)) { bestMatch = i; bestMatchLength = length; } // When the input option ends with a period (usually an abbreviated form), attempt // to match all chars up to that period. if ((data[i].charAt(length - 1) == '.') && ((length - 1) > bestMatchLength) && text.regionMatches(true, start, data[i], 0, length - 1)) { bestMatch = i; bestMatchLength = (length - 1); } } if (bestMatch >= 0) { calb.set(field, bestMatch); return start + bestMatchLength; } return -start; }
[ "private", "int", "matchString", "(", "String", "text", ",", "int", "start", ",", "int", "field", ",", "String", "[", "]", "data", ",", "CalendarBuilder", "calb", ")", "{", "int", "i", "=", "0", ";", "int", "count", "=", "data", ".", "length", ";", ...
Private code-size reduction function used by subParse. @param text the time text being parsed. @param start where to start parsing. @param field the date field being parsed. @param data the string array to parsed. @return the new start position if matching succeeded; a negative number indicating matching failure, otherwise.
[ "Private", "code", "-", "size", "reduction", "function", "used", "by", "subParse", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java#L1581-L1620
35,120
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java
SimpleDateFormat.subParseZoneString
private int subParseZoneString(String text, int start, CalendarBuilder calb) { boolean useSameName = false; // true if standard and daylight time use the same abbreviation. TimeZone currentTimeZone = getTimeZone(); // At this point, check for named time zones by looking through // the locale data from the TimeZoneNames strings. // Want to be able to parse both short and long forms. int zoneIndex = formatData.getZoneIndex(currentTimeZone.getID()); TimeZone tz = null; String[][] zoneStrings = formatData.getZoneStringsWrapper(); String[] zoneNames = null; int nameIndex = 0; if (zoneIndex != -1) { zoneNames = zoneStrings[zoneIndex]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { // Check if the standard name (abbr) and the daylight name are the same. useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); } } if (tz == null) { zoneIndex = formatData.getZoneIndex(TimeZone.getDefault().getID()); if (zoneIndex != -1) { zoneNames = zoneStrings[zoneIndex]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); } } } if (tz == null) { int len = zoneStrings.length; for (int i = 0; i < len; i++) { zoneNames = zoneStrings[i]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); break; } } } if (tz != null) { // Matched any ? if (!tz.equals(currentTimeZone)) { setTimeZone(tz); } // If the time zone matched uses the same name // (abbreviation) for both standard and daylight time, // let the time zone in the Calendar decide which one. // // Also if tz.getDSTSaving() returns 0 for DST, use tz to // determine the local time. (6645292) int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0; if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) { calb.clear(Calendar.ZONE_OFFSET).set(Calendar.DST_OFFSET, dstAmount); } return (start + zoneNames[nameIndex].length()); } return 0; }
java
private int subParseZoneString(String text, int start, CalendarBuilder calb) { boolean useSameName = false; // true if standard and daylight time use the same abbreviation. TimeZone currentTimeZone = getTimeZone(); // At this point, check for named time zones by looking through // the locale data from the TimeZoneNames strings. // Want to be able to parse both short and long forms. int zoneIndex = formatData.getZoneIndex(currentTimeZone.getID()); TimeZone tz = null; String[][] zoneStrings = formatData.getZoneStringsWrapper(); String[] zoneNames = null; int nameIndex = 0; if (zoneIndex != -1) { zoneNames = zoneStrings[zoneIndex]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { // Check if the standard name (abbr) and the daylight name are the same. useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); } } if (tz == null) { zoneIndex = formatData.getZoneIndex(TimeZone.getDefault().getID()); if (zoneIndex != -1) { zoneNames = zoneStrings[zoneIndex]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); } } } if (tz == null) { int len = zoneStrings.length; for (int i = 0; i < len; i++) { zoneNames = zoneStrings[i]; if ((nameIndex = matchZoneString(text, start, zoneNames)) > 0) { if (nameIndex <= 2) { useSameName = zoneNames[nameIndex].equalsIgnoreCase(zoneNames[nameIndex + 2]); } tz = TimeZone.getTimeZone(zoneNames[0]); break; } } } if (tz != null) { // Matched any ? if (!tz.equals(currentTimeZone)) { setTimeZone(tz); } // If the time zone matched uses the same name // (abbreviation) for both standard and daylight time, // let the time zone in the Calendar decide which one. // // Also if tz.getDSTSaving() returns 0 for DST, use tz to // determine the local time. (6645292) int dstAmount = (nameIndex >= 3) ? tz.getDSTSavings() : 0; if (!(useSameName || (nameIndex >= 3 && dstAmount == 0))) { calb.clear(Calendar.ZONE_OFFSET).set(Calendar.DST_OFFSET, dstAmount); } return (start + zoneNames[nameIndex].length()); } return 0; }
[ "private", "int", "subParseZoneString", "(", "String", "text", ",", "int", "start", ",", "CalendarBuilder", "calb", ")", "{", "boolean", "useSameName", "=", "false", ";", "// true if standard and daylight time use the same abbreviation.", "TimeZone", "currentTimeZone", "=...
find time zone 'text' matched zoneStrings and set to internal calendar.
[ "find", "time", "zone", "text", "matched", "zoneStrings", "and", "set", "to", "internal", "calendar", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java#L1677-L1742
35,121
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java
SimpleDateFormat.applyLocalizedPattern
public void applyLocalizedPattern(String pattern) { String p = translatePattern(pattern, formatData.getLocalPatternChars(), DateFormatSymbols.patternChars); compiledPattern = compile(p); this.pattern = p; }
java
public void applyLocalizedPattern(String pattern) { String p = translatePattern(pattern, formatData.getLocalPatternChars(), DateFormatSymbols.patternChars); compiledPattern = compile(p); this.pattern = p; }
[ "public", "void", "applyLocalizedPattern", "(", "String", "pattern", ")", "{", "String", "p", "=", "translatePattern", "(", "pattern", ",", "formatData", ".", "getLocalPatternChars", "(", ")", ",", "DateFormatSymbols", ".", "patternChars", ")", ";", "compiledPatte...
Applies the given localized pattern string to this date format. @param pattern a String to be mapped to the new date and time format pattern for this format @exception NullPointerException if the given pattern is null @exception IllegalArgumentException if the given pattern is invalid
[ "Applies", "the", "given", "localized", "pattern", "string", "to", "this", "date", "format", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/text/SimpleDateFormat.java#L2363-L2369
35,122
google/j2objc
jre_emul/Classes/com/google/j2objc/net/DataEnqueuedOutputStream.java
DataEnqueuedOutputStream.offerData
@Override public void offerData(OutputStream stream) { byte[] next = null; try { next = queue.poll(timeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { // If this ever times out (unlikely given our assumption), next stays null. } try { // Only if next is not null nor CLOSED do we write the chunk. if (next != null && next != CLOSED) { stream.write(next); return; } } catch (IOException ignored) { // Any errors in the piped (NS)OutputStream (unlikely) fall through to the next section. } // Close the piped (NS)OutputStream and ignore any errors. try { stream.close(); } catch (IOException ignored) { // Ignored. } }
java
@Override public void offerData(OutputStream stream) { byte[] next = null; try { next = queue.poll(timeoutMillis, TimeUnit.MILLISECONDS); } catch (InterruptedException ignored) { // If this ever times out (unlikely given our assumption), next stays null. } try { // Only if next is not null nor CLOSED do we write the chunk. if (next != null && next != CLOSED) { stream.write(next); return; } } catch (IOException ignored) { // Any errors in the piped (NS)OutputStream (unlikely) fall through to the next section. } // Close the piped (NS)OutputStream and ignore any errors. try { stream.close(); } catch (IOException ignored) { // Ignored. } }
[ "@", "Override", "public", "void", "offerData", "(", "OutputStream", "stream", ")", "{", "byte", "[", "]", "next", "=", "null", ";", "try", "{", "next", "=", "queue", ".", "poll", "(", "timeoutMillis", ",", "TimeUnit", ".", "MILLISECONDS", ")", ";", "}...
Offers data from the queue to the OutputStream piped to the adapted NSInputStream.
[ "Offers", "data", "from", "the", "queue", "to", "the", "OutputStream", "piped", "to", "the", "adapted", "NSInputStream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/DataEnqueuedOutputStream.java#L128-L153
35,123
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java
DeadCodeEliminator.eliminateDeadCode
private void eliminateDeadCode(TypeElement type, AbstractTypeDeclaration node) { List<BodyDeclaration> decls = node.getBodyDeclarations(); String clazz = elementUtil.getBinaryName(type); if (deadCodeMap.containsClass(clazz)) { stripClass(node); } else { removeDeadMethods(clazz, decls); removeDeadFields(clazz, decls); } }
java
private void eliminateDeadCode(TypeElement type, AbstractTypeDeclaration node) { List<BodyDeclaration> decls = node.getBodyDeclarations(); String clazz = elementUtil.getBinaryName(type); if (deadCodeMap.containsClass(clazz)) { stripClass(node); } else { removeDeadMethods(clazz, decls); removeDeadFields(clazz, decls); } }
[ "private", "void", "eliminateDeadCode", "(", "TypeElement", "type", ",", "AbstractTypeDeclaration", "node", ")", "{", "List", "<", "BodyDeclaration", ">", "decls", "=", "node", ".", "getBodyDeclarations", "(", ")", ";", "String", "clazz", "=", "elementUtil", "."...
Remove dead members from a type.
[ "Remove", "dead", "members", "from", "a", "type", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L86-L95
35,124
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java
DeadCodeEliminator.removeDeadMethods
private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) declaration; ExecutableElement elem = method.getExecutableElement(); String name = typeUtil.getReferenceName(elem); String signature = typeUtil.getReferenceSignature(elem); if (deadCodeMap.containsMethod(clazz, name, signature)) { if (method.isConstructor()) { deadCodeMap.addConstructorRemovedClass(clazz); } if (Modifier.isNative(method.getModifiers())) { removeMethodOCNI(method); } declarationsIter.remove(); } } } }
java
private void removeDeadMethods(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof MethodDeclaration) { MethodDeclaration method = (MethodDeclaration) declaration; ExecutableElement elem = method.getExecutableElement(); String name = typeUtil.getReferenceName(elem); String signature = typeUtil.getReferenceSignature(elem); if (deadCodeMap.containsMethod(clazz, name, signature)) { if (method.isConstructor()) { deadCodeMap.addConstructorRemovedClass(clazz); } if (Modifier.isNative(method.getModifiers())) { removeMethodOCNI(method); } declarationsIter.remove(); } } } }
[ "private", "void", "removeDeadMethods", "(", "String", "clazz", ",", "List", "<", "BodyDeclaration", ">", "declarations", ")", "{", "Iterator", "<", "BodyDeclaration", ">", "declarationsIter", "=", "declarations", ".", "iterator", "(", ")", ";", "while", "(", ...
Remove dead methods from a type's body declarations.
[ "Remove", "dead", "methods", "from", "a", "type", "s", "body", "declarations", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L160-L180
35,125
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java
DeadCodeEliminator.removeMethodOCNI
private void removeMethodOCNI(MethodDeclaration method) { int methodStart = method.getStartPosition(); String src = unit.getSource().substring(methodStart, methodStart + method.getLength()); if (src.contains("/*-[")) { int ocniStart = methodStart + src.indexOf("/*-["); Iterator<Comment> commentsIter = unit.getCommentList().iterator(); while (commentsIter.hasNext()) { Comment comment = commentsIter.next(); if (comment.isBlockComment() && comment.getStartPosition() == ocniStart) { commentsIter.remove(); break; } } } }
java
private void removeMethodOCNI(MethodDeclaration method) { int methodStart = method.getStartPosition(); String src = unit.getSource().substring(methodStart, methodStart + method.getLength()); if (src.contains("/*-[")) { int ocniStart = methodStart + src.indexOf("/*-["); Iterator<Comment> commentsIter = unit.getCommentList().iterator(); while (commentsIter.hasNext()) { Comment comment = commentsIter.next(); if (comment.isBlockComment() && comment.getStartPosition() == ocniStart) { commentsIter.remove(); break; } } } }
[ "private", "void", "removeMethodOCNI", "(", "MethodDeclaration", "method", ")", "{", "int", "methodStart", "=", "method", ".", "getStartPosition", "(", ")", ";", "String", "src", "=", "unit", ".", "getSource", "(", ")", ".", "substring", "(", "methodStart", ...
Remove the OCNI comment associated with a native method, if it exists.
[ "Remove", "the", "OCNI", "comment", "associated", "with", "a", "native", "method", "if", "it", "exists", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L185-L199
35,126
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java
DeadCodeEliminator.removeDeadFields
private void removeDeadFields(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof FieldDeclaration) { FieldDeclaration field = (FieldDeclaration) declaration; Iterator<VariableDeclarationFragment> fragmentsIter = field.getFragments().iterator(); while (fragmentsIter.hasNext()) { VariableDeclarationFragment fragment = fragmentsIter.next(); // Don't delete any constants because we can't detect their use. Instead, // these are translated by the TypeDeclarationGenerator as #define directives, // so the enclosing type can still be deleted if otherwise empty. VariableElement var = fragment.getVariableElement(); if (var.getConstantValue() == null && deadCodeMap.containsField(clazz, ElementUtil.getName(var))) { fragmentsIter.remove(); } } if (field.getFragments().isEmpty()) { declarationsIter.remove(); } } } }
java
private void removeDeadFields(String clazz, List<BodyDeclaration> declarations) { Iterator<BodyDeclaration> declarationsIter = declarations.iterator(); while (declarationsIter.hasNext()) { BodyDeclaration declaration = declarationsIter.next(); if (declaration instanceof FieldDeclaration) { FieldDeclaration field = (FieldDeclaration) declaration; Iterator<VariableDeclarationFragment> fragmentsIter = field.getFragments().iterator(); while (fragmentsIter.hasNext()) { VariableDeclarationFragment fragment = fragmentsIter.next(); // Don't delete any constants because we can't detect their use. Instead, // these are translated by the TypeDeclarationGenerator as #define directives, // so the enclosing type can still be deleted if otherwise empty. VariableElement var = fragment.getVariableElement(); if (var.getConstantValue() == null && deadCodeMap.containsField(clazz, ElementUtil.getName(var))) { fragmentsIter.remove(); } } if (field.getFragments().isEmpty()) { declarationsIter.remove(); } } } }
[ "private", "void", "removeDeadFields", "(", "String", "clazz", ",", "List", "<", "BodyDeclaration", ">", "declarations", ")", "{", "Iterator", "<", "BodyDeclaration", ">", "declarationsIter", "=", "declarations", ".", "iterator", "(", ")", ";", "while", "(", "...
Deletes non-constant dead fields from a type's body declarations list.
[ "Deletes", "non", "-", "constant", "dead", "fields", "from", "a", "type", "s", "body", "declarations", "list", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L204-L227
35,127
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java
DeadCodeEliminator.removeDeadClasses
public static void removeDeadClasses(CompilationUnit unit, CodeReferenceMap deadCodeMap) { ElementUtil elementUtil = unit.getEnv().elementUtil(); Iterator<AbstractTypeDeclaration> iter = unit.getTypes().iterator(); while (iter.hasNext()) { AbstractTypeDeclaration type = iter.next(); TypeElement typeElement = type.getTypeElement(); if (!ElementUtil.isGeneratedAnnotation(typeElement)) { if (deadCodeMap.containsClass(typeElement, elementUtil)) { type.setDeadClass(true); } else { // Keep class, remove dead interfaces. if (typeElement.getInterfaces().size() > 0) { GeneratedTypeElement replacement = GeneratedTypeElement.mutableCopy(typeElement); for (TypeElement intrface : ElementUtil.getInterfaces(typeElement)) { if (!deadCodeMap.containsClass(intrface, elementUtil)) { replacement.addInterface(intrface.asType()); } } if (typeElement.getInterfaces().size() > replacement.getInterfaces().size()) { type.setTypeElement(replacement); } } } } } }
java
public static void removeDeadClasses(CompilationUnit unit, CodeReferenceMap deadCodeMap) { ElementUtil elementUtil = unit.getEnv().elementUtil(); Iterator<AbstractTypeDeclaration> iter = unit.getTypes().iterator(); while (iter.hasNext()) { AbstractTypeDeclaration type = iter.next(); TypeElement typeElement = type.getTypeElement(); if (!ElementUtil.isGeneratedAnnotation(typeElement)) { if (deadCodeMap.containsClass(typeElement, elementUtil)) { type.setDeadClass(true); } else { // Keep class, remove dead interfaces. if (typeElement.getInterfaces().size() > 0) { GeneratedTypeElement replacement = GeneratedTypeElement.mutableCopy(typeElement); for (TypeElement intrface : ElementUtil.getInterfaces(typeElement)) { if (!deadCodeMap.containsClass(intrface, elementUtil)) { replacement.addInterface(intrface.asType()); } } if (typeElement.getInterfaces().size() > replacement.getInterfaces().size()) { type.setTypeElement(replacement); } } } } } }
[ "public", "static", "void", "removeDeadClasses", "(", "CompilationUnit", "unit", ",", "CodeReferenceMap", "deadCodeMap", ")", "{", "ElementUtil", "elementUtil", "=", "unit", ".", "getEnv", "(", ")", ".", "elementUtil", "(", ")", ";", "Iterator", "<", "AbstractTy...
Remove empty classes marked as dead. This needs to be done after translation to avoid inner class references in the AST returned by DeadCodeEliminator.
[ "Remove", "empty", "classes", "marked", "as", "dead", ".", "This", "needs", "to", "be", "done", "after", "translation", "to", "avoid", "inner", "class", "references", "in", "the", "AST", "returned", "by", "DeadCodeEliminator", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/translate/DeadCodeEliminator.java#L233-L258
35,128
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.moveList
public static <T> void moveList(List<T> fromList, List<T> toList) { for (Iterator<T> iter = fromList.iterator(); iter.hasNext(); ) { T elem = iter.next(); iter.remove(); toList.add(elem); } }
java
public static <T> void moveList(List<T> fromList, List<T> toList) { for (Iterator<T> iter = fromList.iterator(); iter.hasNext(); ) { T elem = iter.next(); iter.remove(); toList.add(elem); } }
[ "public", "static", "<", "T", ">", "void", "moveList", "(", "List", "<", "T", ">", "fromList", ",", "List", "<", "T", ">", "toList", ")", "{", "for", "(", "Iterator", "<", "T", ">", "iter", "=", "fromList", ".", "iterator", "(", ")", ";", "iter",...
Moves nodes from one list to another, ensuring that they are not double-parented in the process.
[ "Moves", "nodes", "from", "one", "list", "to", "another", "ensuring", "that", "they", "are", "not", "double", "-", "parented", "in", "the", "process", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L64-L70
35,129
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.trimParentheses
public static Expression trimParentheses(Expression node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression) node).getExpression(); } return node; }
java
public static Expression trimParentheses(Expression node) { while (node instanceof ParenthesizedExpression) { node = ((ParenthesizedExpression) node).getExpression(); } return node; }
[ "public", "static", "Expression", "trimParentheses", "(", "Expression", "node", ")", "{", "while", "(", "node", "instanceof", "ParenthesizedExpression", ")", "{", "node", "=", "(", "(", "ParenthesizedExpression", ")", "node", ")", ".", "getExpression", "(", ")",...
Returns the first descendant of the given node that is not a ParenthesizedExpression.
[ "Returns", "the", "first", "descendant", "of", "the", "given", "node", "that", "is", "not", "a", "ParenthesizedExpression", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L126-L131
35,130
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.getDeclaredElement
public static Element getDeclaredElement(TreeNode node) { if (node instanceof AbstractTypeDeclaration) { return ((AbstractTypeDeclaration) node).getTypeElement(); } else if (node instanceof MethodDeclaration) { return ((MethodDeclaration) node).getExecutableElement(); } else if (node instanceof VariableDeclaration) { return ((VariableDeclaration) node).getVariableElement(); } return null; }
java
public static Element getDeclaredElement(TreeNode node) { if (node instanceof AbstractTypeDeclaration) { return ((AbstractTypeDeclaration) node).getTypeElement(); } else if (node instanceof MethodDeclaration) { return ((MethodDeclaration) node).getExecutableElement(); } else if (node instanceof VariableDeclaration) { return ((VariableDeclaration) node).getVariableElement(); } return null; }
[ "public", "static", "Element", "getDeclaredElement", "(", "TreeNode", "node", ")", "{", "if", "(", "node", "instanceof", "AbstractTypeDeclaration", ")", "{", "return", "(", "(", "AbstractTypeDeclaration", ")", "node", ")", ".", "getTypeElement", "(", ")", ";", ...
Gets the element that is declared by this node.
[ "Gets", "the", "element", "that", "is", "declared", "by", "this", "node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L228-L237
35,131
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.getVariableElement
public static VariableElement getVariableElement(Expression node) { node = trimParentheses(node); switch (node.getKind()) { case FIELD_ACCESS: return ((FieldAccess) node).getVariableElement(); case SUPER_FIELD_ACCESS: return ((SuperFieldAccess) node).getVariableElement(); case QUALIFIED_NAME: case SIMPLE_NAME: return getVariableElement((Name) node); default: return null; } }
java
public static VariableElement getVariableElement(Expression node) { node = trimParentheses(node); switch (node.getKind()) { case FIELD_ACCESS: return ((FieldAccess) node).getVariableElement(); case SUPER_FIELD_ACCESS: return ((SuperFieldAccess) node).getVariableElement(); case QUALIFIED_NAME: case SIMPLE_NAME: return getVariableElement((Name) node); default: return null; } }
[ "public", "static", "VariableElement", "getVariableElement", "(", "Expression", "node", ")", "{", "node", "=", "trimParentheses", "(", "node", ")", ";", "switch", "(", "node", ".", "getKind", "(", ")", ")", "{", "case", "FIELD_ACCESS", ":", "return", "(", ...
Gets a variable element for the given expression if the expression represents a variable. Returns null otherwise.
[ "Gets", "a", "variable", "element", "for", "the", "given", "expression", "if", "the", "expression", "represents", "a", "variable", ".", "Returns", "null", "otherwise", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L243-L256
35,132
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.getQualifiedMainTypeName
public static String getQualifiedMainTypeName(CompilationUnit unit) { PackageDeclaration pkg = unit.getPackage(); if (pkg.isDefaultPackage()) { return unit.getMainTypeName(); } else { return pkg.getName().getFullyQualifiedName() + '.' + unit.getMainTypeName(); } }
java
public static String getQualifiedMainTypeName(CompilationUnit unit) { PackageDeclaration pkg = unit.getPackage(); if (pkg.isDefaultPackage()) { return unit.getMainTypeName(); } else { return pkg.getName().getFullyQualifiedName() + '.' + unit.getMainTypeName(); } }
[ "public", "static", "String", "getQualifiedMainTypeName", "(", "CompilationUnit", "unit", ")", "{", "PackageDeclaration", "pkg", "=", "unit", ".", "getPackage", "(", ")", ";", "if", "(", "pkg", ".", "isDefaultPackage", "(", ")", ")", "{", "return", "unit", "...
Gets the fully qualified name of the main type in this compilation unit.
[ "Gets", "the", "fully", "qualified", "name", "of", "the", "main", "type", "in", "this", "compilation", "unit", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L299-L306
35,133
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java
TreeUtil.asStatementList
public static List<Statement> asStatementList(Statement node) { if (node instanceof Block) { return ((Block) node).getStatements(); } TreeNode parent = node.getParent(); if (parent instanceof Block) { List<Statement> stmts = ((Block) parent).getStatements(); for (int i = 0; i < stmts.size(); i++) { if (stmts.get(i) == node) { return stmts.subList(i, i + 1); } } } return new LonelyStatementList(node); }
java
public static List<Statement> asStatementList(Statement node) { if (node instanceof Block) { return ((Block) node).getStatements(); } TreeNode parent = node.getParent(); if (parent instanceof Block) { List<Statement> stmts = ((Block) parent).getStatements(); for (int i = 0; i < stmts.size(); i++) { if (stmts.get(i) == node) { return stmts.subList(i, i + 1); } } } return new LonelyStatementList(node); }
[ "public", "static", "List", "<", "Statement", ">", "asStatementList", "(", "Statement", "node", ")", "{", "if", "(", "node", "instanceof", "Block", ")", "{", "return", "(", "(", "Block", ")", "node", ")", ".", "getStatements", "(", ")", ";", "}", "Tree...
Returns the given statement as a list of statements that can be added to. If node is a Block, then returns it's statement list. If node is the direct child of a Block, returns the sublist containing node as the only element. Otherwise, creates a new Block node in the place of node and returns its list of statements.
[ "Returns", "the", "given", "statement", "as", "a", "list", "of", "statements", "that", "can", "be", "added", "to", ".", "If", "node", "is", "a", "Block", "then", "returns", "it", "s", "statement", "list", ".", "If", "node", "is", "the", "direct", "chil...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/ast/TreeUtil.java#L323-L337
35,134
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOMErrorHandlerImpl.java
DOMErrorHandlerImpl.handleError
public boolean handleError(DOMError error) { boolean fail = true; String severity = null; if (error.getSeverity() == DOMError.SEVERITY_WARNING) { fail = false; severity = "[Warning]"; } else if (error.getSeverity() == DOMError.SEVERITY_ERROR) { severity = "[Error]"; } else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) { severity = "[Fatal Error]"; } System.err.println(severity + ": " + error.getMessage() + "\t"); System.err.println("Type : " + error.getType() + "\t" + "Related Data: " + error.getRelatedData() + "\t" + "Related Exception: " + error.getRelatedException() ); return fail; }
java
public boolean handleError(DOMError error) { boolean fail = true; String severity = null; if (error.getSeverity() == DOMError.SEVERITY_WARNING) { fail = false; severity = "[Warning]"; } else if (error.getSeverity() == DOMError.SEVERITY_ERROR) { severity = "[Error]"; } else if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) { severity = "[Fatal Error]"; } System.err.println(severity + ": " + error.getMessage() + "\t"); System.err.println("Type : " + error.getType() + "\t" + "Related Data: " + error.getRelatedData() + "\t" + "Related Exception: " + error.getRelatedException() ); return fail; }
[ "public", "boolean", "handleError", "(", "DOMError", "error", ")", "{", "boolean", "fail", "=", "true", ";", "String", "severity", "=", "null", ";", "if", "(", "error", ".", "getSeverity", "(", ")", "==", "DOMError", ".", "SEVERITY_WARNING", ")", "{", "f...
Implementation of DOMErrorHandler.handleError that adds copy of error to list for later retrieval.
[ "Implementation", "of", "DOMErrorHandler", ".", "handleError", "that", "adds", "copy", "of", "error", "to", "list", "for", "later", "retrieval", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xml/serializer/dom3/DOMErrorHandlerImpl.java#L47-L65
35,135
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VersionInfo.java
VersionInfo.main
public static void main(String[] args) { String icuApiVer; if (ICU_VERSION.getMajor() <= 4) { if (ICU_VERSION.getMinor() % 2 != 0) { // Development mile stone int major = ICU_VERSION.getMajor(); int minor = ICU_VERSION.getMinor() + 1; if (minor >= 10) { minor -= 10; major++; } icuApiVer = "" + major + "." + minor + "M" + ICU_VERSION.getMilli(); } else { icuApiVer = ICU_VERSION.getVersionString(2, 2); } } else { if (ICU_VERSION.getMinor() == 0) { // Development mile stone icuApiVer = "" + ICU_VERSION.getMajor() + "M" + ICU_VERSION.getMilli(); } else { icuApiVer = ICU_VERSION.getVersionString(2, 2); } } System.out.println("International Components for Unicode for Java " + icuApiVer); System.out.println(""); System.out.println("Implementation Version: " + ICU_VERSION.getVersionString(2, 4)); System.out.println("Unicode Data Version: " + UNICODE_VERSION.getVersionString(2, 4)); System.out.println("CLDR Data Version: " + LocaleData.getCLDRVersion().getVersionString(2, 4)); System.out.println("Time Zone Data Version: " + getTZDataVersion()); }
java
public static void main(String[] args) { String icuApiVer; if (ICU_VERSION.getMajor() <= 4) { if (ICU_VERSION.getMinor() % 2 != 0) { // Development mile stone int major = ICU_VERSION.getMajor(); int minor = ICU_VERSION.getMinor() + 1; if (minor >= 10) { minor -= 10; major++; } icuApiVer = "" + major + "." + minor + "M" + ICU_VERSION.getMilli(); } else { icuApiVer = ICU_VERSION.getVersionString(2, 2); } } else { if (ICU_VERSION.getMinor() == 0) { // Development mile stone icuApiVer = "" + ICU_VERSION.getMajor() + "M" + ICU_VERSION.getMilli(); } else { icuApiVer = ICU_VERSION.getVersionString(2, 2); } } System.out.println("International Components for Unicode for Java " + icuApiVer); System.out.println(""); System.out.println("Implementation Version: " + ICU_VERSION.getVersionString(2, 4)); System.out.println("Unicode Data Version: " + UNICODE_VERSION.getVersionString(2, 4)); System.out.println("CLDR Data Version: " + LocaleData.getCLDRVersion().getVersionString(2, 4)); System.out.println("Time Zone Data Version: " + getTZDataVersion()); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "{", "String", "icuApiVer", ";", "if", "(", "ICU_VERSION", ".", "getMajor", "(", ")", "<=", "4", ")", "{", "if", "(", "ICU_VERSION", ".", "getMinor", "(", ")", "%", "2", "!="...
Main method prints out ICU version information @param args arguments (currently not used) @hide unsupported on Android
[ "Main", "method", "prints", "out", "ICU", "version", "information" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/util/VersionInfo.java#L562-L595
35,136
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java
NumberingSystem.getInstance
public static NumberingSystem getInstance(ULocale locale) { // Check for @numbers boolean nsResolved = true; String numbersKeyword = locale.getKeywordValue("numbers"); if (numbersKeyword != null ) { for ( String keyword : OTHER_NS_KEYWORDS ) { if ( numbersKeyword.equals(keyword)) { nsResolved = false; break; } } } else { numbersKeyword = "default"; nsResolved = false; } if (nsResolved) { NumberingSystem ns = getInstanceByName(numbersKeyword); if (ns != null) { return ns; } // If the @numbers keyword points to a bogus numbering system name, // we return the default for the locale. numbersKeyword = "default"; } // Attempt to get the numbering system from the cache String baseName = locale.getBaseName(); // TODO: Caching by locale+numbersKeyword could yield a large cache. // Try to load for each locale the mappings from OTHER_NS_KEYWORDS and default // to real numbering system names; can we get those from supplemental data? // Then look up those mappings for the locale and resolve the keyword. String key = baseName+"@numbers="+numbersKeyword; LocaleLookupData localeLookupData = new LocaleLookupData(locale, numbersKeyword); return cachedLocaleData.getInstance(key, localeLookupData); }
java
public static NumberingSystem getInstance(ULocale locale) { // Check for @numbers boolean nsResolved = true; String numbersKeyword = locale.getKeywordValue("numbers"); if (numbersKeyword != null ) { for ( String keyword : OTHER_NS_KEYWORDS ) { if ( numbersKeyword.equals(keyword)) { nsResolved = false; break; } } } else { numbersKeyword = "default"; nsResolved = false; } if (nsResolved) { NumberingSystem ns = getInstanceByName(numbersKeyword); if (ns != null) { return ns; } // If the @numbers keyword points to a bogus numbering system name, // we return the default for the locale. numbersKeyword = "default"; } // Attempt to get the numbering system from the cache String baseName = locale.getBaseName(); // TODO: Caching by locale+numbersKeyword could yield a large cache. // Try to load for each locale the mappings from OTHER_NS_KEYWORDS and default // to real numbering system names; can we get those from supplemental data? // Then look up those mappings for the locale and resolve the keyword. String key = baseName+"@numbers="+numbersKeyword; LocaleLookupData localeLookupData = new LocaleLookupData(locale, numbersKeyword); return cachedLocaleData.getInstance(key, localeLookupData); }
[ "public", "static", "NumberingSystem", "getInstance", "(", "ULocale", "locale", ")", "{", "// Check for @numbers", "boolean", "nsResolved", "=", "true", ";", "String", "numbersKeyword", "=", "locale", ".", "getKeywordValue", "(", "\"numbers\"", ")", ";", "if", "("...
Returns the default numbering system for the specified ULocale.
[ "Returns", "the", "default", "numbering", "system", "for", "the", "specified", "ULocale", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java#L110-L145
35,137
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java
NumberingSystem.getAvailableNames
public static String [] getAvailableNames() { UResourceBundle numberingSystemsInfo = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "numberingSystems"); UResourceBundle nsCurrent = numberingSystemsInfo.get("numberingSystems"); UResourceBundle temp; String nsName; ArrayList<String> output = new ArrayList<String>(); UResourceBundleIterator it = nsCurrent.getIterator(); while (it.hasNext()) { temp = it.next(); nsName = temp.getKey(); output.add(nsName); } return output.toArray(new String[output.size()]); }
java
public static String [] getAvailableNames() { UResourceBundle numberingSystemsInfo = UResourceBundle.getBundleInstance(ICUData.ICU_BASE_NAME, "numberingSystems"); UResourceBundle nsCurrent = numberingSystemsInfo.get("numberingSystems"); UResourceBundle temp; String nsName; ArrayList<String> output = new ArrayList<String>(); UResourceBundleIterator it = nsCurrent.getIterator(); while (it.hasNext()) { temp = it.next(); nsName = temp.getKey(); output.add(nsName); } return output.toArray(new String[output.size()]); }
[ "public", "static", "String", "[", "]", "getAvailableNames", "(", ")", "{", "UResourceBundle", "numberingSystemsInfo", "=", "UResourceBundle", ".", "getBundleInstance", "(", "ICUData", ".", "ICU_BASE_NAME", ",", "\"numberingSystems\"", ")", ";", "UResourceBundle", "ns...
Returns a string array containing a list of the names of numbering systems currently known to ICU.
[ "Returns", "a", "string", "array", "containing", "a", "list", "of", "the", "names", "of", "numbering", "systems", "currently", "known", "to", "ICU", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/NumberingSystem.java#L245-L260
35,138
google/j2objc
jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONTokener.java
JSONTokener.readLiteral
private Object readLiteral() throws JSONException { String literal = nextToInternal("{}[]/\\:,=;# \t\f"); if (literal.length() == 0) { throw syntaxError("Expected literal value"); } else if ("null".equalsIgnoreCase(literal)) { return JSONObject.NULL; } else if ("true".equalsIgnoreCase(literal)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(literal)) { return Boolean.FALSE; } /* try to parse as an integral type... */ if (literal.indexOf('.') == -1) { int base = 10; String number = literal; if (number.startsWith("0x") || number.startsWith("0X")) { number = number.substring(2); base = 16; } else if (number.startsWith("0") && number.length() > 1) { number = number.substring(1); base = 8; } try { long longValue = Long.parseLong(number, base); if (longValue <= Integer.MAX_VALUE && longValue >= Integer.MIN_VALUE) { return (int) longValue; } else { return longValue; } } catch (NumberFormatException e) { /* * This only happens for integral numbers greater than * Long.MAX_VALUE, numbers in exponential form (5e-10) and * unquoted strings. Fall through to try floating point. */ } } /* ...next try to parse as a floating point... */ try { return Double.valueOf(literal); } catch (NumberFormatException ignored) { } /* ... finally give up. We have an unquoted string */ return new String(literal); // a new string avoids leaking memory }
java
private Object readLiteral() throws JSONException { String literal = nextToInternal("{}[]/\\:,=;# \t\f"); if (literal.length() == 0) { throw syntaxError("Expected literal value"); } else if ("null".equalsIgnoreCase(literal)) { return JSONObject.NULL; } else if ("true".equalsIgnoreCase(literal)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(literal)) { return Boolean.FALSE; } /* try to parse as an integral type... */ if (literal.indexOf('.') == -1) { int base = 10; String number = literal; if (number.startsWith("0x") || number.startsWith("0X")) { number = number.substring(2); base = 16; } else if (number.startsWith("0") && number.length() > 1) { number = number.substring(1); base = 8; } try { long longValue = Long.parseLong(number, base); if (longValue <= Integer.MAX_VALUE && longValue >= Integer.MIN_VALUE) { return (int) longValue; } else { return longValue; } } catch (NumberFormatException e) { /* * This only happens for integral numbers greater than * Long.MAX_VALUE, numbers in exponential form (5e-10) and * unquoted strings. Fall through to try floating point. */ } } /* ...next try to parse as a floating point... */ try { return Double.valueOf(literal); } catch (NumberFormatException ignored) { } /* ... finally give up. We have an unquoted string */ return new String(literal); // a new string avoids leaking memory }
[ "private", "Object", "readLiteral", "(", ")", "throws", "JSONException", "{", "String", "literal", "=", "nextToInternal", "(", "\"{}[]/\\\\:,=;# \\t\\f\"", ")", ";", "if", "(", "literal", ".", "length", "(", ")", "==", "0", ")", "{", "throw", "syntaxError", ...
Reads a null, boolean, numeric or unquoted string literal value. Numeric values will be returned as an Integer, Long, or Double, in that order of preference.
[ "Reads", "a", "null", "boolean", "numeric", "or", "unquoted", "string", "literal", "value", ".", "Numeric", "values", "will", "be", "returned", "as", "an", "Integer", "Long", "or", "Double", "in", "that", "order", "of", "preference", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONTokener.java#L281-L329
35,139
google/j2objc
jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONTokener.java
JSONTokener.nextToInternal
private String nextToInternal(String excluded) { int start = pos; for (; pos < in.length(); pos++) { char c = in.charAt(pos); if (c == '\r' || c == '\n' || excluded.indexOf(c) != -1) { return in.substring(start, pos); } } return in.substring(start); }
java
private String nextToInternal(String excluded) { int start = pos; for (; pos < in.length(); pos++) { char c = in.charAt(pos); if (c == '\r' || c == '\n' || excluded.indexOf(c) != -1) { return in.substring(start, pos); } } return in.substring(start); }
[ "private", "String", "nextToInternal", "(", "String", "excluded", ")", "{", "int", "start", "=", "pos", ";", "for", "(", ";", "pos", "<", "in", ".", "length", "(", ")", ";", "pos", "++", ")", "{", "char", "c", "=", "in", ".", "charAt", "(", "pos"...
Returns the string up to but not including any of the given characters or a newline character. This does not consume the excluded character.
[ "Returns", "the", "string", "up", "to", "but", "not", "including", "any", "of", "the", "given", "characters", "or", "a", "newline", "character", ".", "This", "does", "not", "consume", "the", "excluded", "character", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/json/src/main/java/org/json/JSONTokener.java#L335-L344
35,140
google/j2objc
jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/AsyncTimeout.java
AsyncTimeout.cancelScheduledTimeout
private static synchronized boolean cancelScheduledTimeout(AsyncTimeout node) { // Remove the node from the linked list. for (AsyncTimeout prev = head; prev != null; prev = prev.next) { if (prev.next == node) { prev.next = node.next; node.next = null; return false; } } // The node wasn't found in the linked list: it must have timed out! return true; }
java
private static synchronized boolean cancelScheduledTimeout(AsyncTimeout node) { // Remove the node from the linked list. for (AsyncTimeout prev = head; prev != null; prev = prev.next) { if (prev.next == node) { prev.next = node.next; node.next = null; return false; } } // The node wasn't found in the linked list: it must have timed out! return true; }
[ "private", "static", "synchronized", "boolean", "cancelScheduledTimeout", "(", "AsyncTimeout", "node", ")", "{", "// Remove the node from the linked list.", "for", "(", "AsyncTimeout", "prev", "=", "head", ";", "prev", "!=", "null", ";", "prev", "=", "prev", ".", ...
Returns true if the timeout occurred.
[ "Returns", "true", "if", "the", "timeout", "occurred", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/okhttp/okio/okio/src/main/java/okio/AsyncTimeout.java#L115-L127
35,141
google/j2objc
jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java
DataEnqueuedInputStream.offerData
void offerData(byte[] chunk) { if (chunk == null || chunk.length == 0) { throw new IllegalArgumentException("chunk must have at least one byte of data"); } if (closed) { return; } // Since this is an unbounded queue, offer() always succeeds. In addition, we don't make a copy // of the chunk, as the data source (NSURLSessionDataTask) does not reuse the underlying byte // array of a chunk when the chunk is alive. queue.offer(chunk); }
java
void offerData(byte[] chunk) { if (chunk == null || chunk.length == 0) { throw new IllegalArgumentException("chunk must have at least one byte of data"); } if (closed) { return; } // Since this is an unbounded queue, offer() always succeeds. In addition, we don't make a copy // of the chunk, as the data source (NSURLSessionDataTask) does not reuse the underlying byte // array of a chunk when the chunk is alive. queue.offer(chunk); }
[ "void", "offerData", "(", "byte", "[", "]", "chunk", ")", "{", "if", "(", "chunk", "==", "null", "||", "chunk", ".", "length", "==", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"chunk must have at least one byte of data\"", ")", ";", "}...
Offers a chunk of data to the queue.
[ "Offers", "a", "chunk", "of", "data", "to", "the", "queue", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java#L69-L82
35,142
google/j2objc
jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java
DataEnqueuedInputStream.endOffering
void endOffering(IOException exception) { if (closed) { return; } // closed should never be set by this method--only the polling side should do it, as it means // that the CLOSED marker has been encountered. if (this.exception == null) { this.exception = exception; } // Since this is an unbounded queue, offer() always succeeds. queue.offer(CLOSED); }
java
void endOffering(IOException exception) { if (closed) { return; } // closed should never be set by this method--only the polling side should do it, as it means // that the CLOSED marker has been encountered. if (this.exception == null) { this.exception = exception; } // Since this is an unbounded queue, offer() always succeeds. queue.offer(CLOSED); }
[ "void", "endOffering", "(", "IOException", "exception", ")", "{", "if", "(", "closed", ")", "{", "return", ";", "}", "// closed should never be set by this method--only the polling side should do it, as it means", "// that the CLOSED marker has been encountered.", "if", "(", "t...
Signals that no more data is available and an exception should be thrown.
[ "Signals", "that", "no", "more", "data", "is", "available", "and", "an", "exception", "should", "be", "thrown", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java#L92-L106
35,143
google/j2objc
jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java
DataEnqueuedInputStream.read
@Override public synchronized int read(byte[] buf, int offset, int length) throws IOException { if (buf == null) { throw new IllegalArgumentException("buf must not be null"); } if (!(offset >= 0 && length > 0 && offset < buf.length && length <= (buf.length - offset))) { throw new IllegalArgumentException("invalid offset and lengeth"); } // Return early if closed is true; throw the saved exception if needed. if (closed) { if (exception != null) { throw exception; } return -1; } // Check if there is already a chunk that hasn't been exhausted; call take() if not. if (currentChunk == null) { if (currentChunkReadPos != -1) { throw new IllegalStateException("currentChunk is null but currentChunkReadPos is not -1"); } byte[] next = null; try { if (timeoutMillis >= 0) { next = queue.poll(timeoutMillis, TimeUnit.MILLISECONDS); } else { next = queue.take(); } } catch (InterruptedException e) { // Unlikely to happen. throw new AssertionError(e); } if (next == null) { closed = true; SocketTimeoutException timeoutException = new SocketTimeoutException(); if (exception == null) { exception = timeoutException; // It is still possible that an endOffer(Exception) races and set exception at this point, // but timeoutException is still being thrown, and it's ok for subsequent reads to // throw the exception set by endOffer(Exception). } throw timeoutException; } // If it's the end marker, acknowledge that so that the buffer will mark itself as closed // for reading. if (next == CLOSED) { closed = true; if (exception != null) { throw exception; } return -1; } currentChunk = next; currentChunkReadPos = 0; } int available = currentChunk.length - currentChunkReadPos; if (length < available) { // Copy from the currentChunk. System.arraycopy(currentChunk, currentChunkReadPos, buf, offset, length); currentChunkReadPos += length; return length; } else { // Copy the entire currentChunk. System.arraycopy(currentChunk, currentChunkReadPos, buf, offset, available); currentChunk = null; currentChunkReadPos = -1; return available; } }
java
@Override public synchronized int read(byte[] buf, int offset, int length) throws IOException { if (buf == null) { throw new IllegalArgumentException("buf must not be null"); } if (!(offset >= 0 && length > 0 && offset < buf.length && length <= (buf.length - offset))) { throw new IllegalArgumentException("invalid offset and lengeth"); } // Return early if closed is true; throw the saved exception if needed. if (closed) { if (exception != null) { throw exception; } return -1; } // Check if there is already a chunk that hasn't been exhausted; call take() if not. if (currentChunk == null) { if (currentChunkReadPos != -1) { throw new IllegalStateException("currentChunk is null but currentChunkReadPos is not -1"); } byte[] next = null; try { if (timeoutMillis >= 0) { next = queue.poll(timeoutMillis, TimeUnit.MILLISECONDS); } else { next = queue.take(); } } catch (InterruptedException e) { // Unlikely to happen. throw new AssertionError(e); } if (next == null) { closed = true; SocketTimeoutException timeoutException = new SocketTimeoutException(); if (exception == null) { exception = timeoutException; // It is still possible that an endOffer(Exception) races and set exception at this point, // but timeoutException is still being thrown, and it's ok for subsequent reads to // throw the exception set by endOffer(Exception). } throw timeoutException; } // If it's the end marker, acknowledge that so that the buffer will mark itself as closed // for reading. if (next == CLOSED) { closed = true; if (exception != null) { throw exception; } return -1; } currentChunk = next; currentChunkReadPos = 0; } int available = currentChunk.length - currentChunkReadPos; if (length < available) { // Copy from the currentChunk. System.arraycopy(currentChunk, currentChunkReadPos, buf, offset, length); currentChunkReadPos += length; return length; } else { // Copy the entire currentChunk. System.arraycopy(currentChunk, currentChunkReadPos, buf, offset, available); currentChunk = null; currentChunkReadPos = -1; return available; } }
[ "@", "Override", "public", "synchronized", "int", "read", "(", "byte", "[", "]", "buf", ",", "int", "offset", ",", "int", "length", ")", "throws", "IOException", "{", "if", "(", "buf", "==", "null", ")", "{", "throw", "new", "IllegalArgumentException", "...
Reads from the current chunk or polls a next chunk from the queue. This is synchronized to allow reads to be used on different thread while still guaranteeing their sequentiality.
[ "Reads", "from", "the", "current", "chunk", "or", "polls", "a", "next", "chunk", "from", "the", "queue", ".", "This", "is", "synchronized", "to", "allow", "reads", "to", "be", "used", "on", "different", "thread", "while", "still", "guaranteeing", "their", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/Classes/com/google/j2objc/net/DataEnqueuedInputStream.java#L137-L212
35,144
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/YearMonth.java
YearMonth.with
private YearMonth with(int newYear, int newMonth) { if (year == newYear && month == newMonth) { return this; } return new YearMonth(newYear, newMonth); }
java
private YearMonth with(int newYear, int newMonth) { if (year == newYear && month == newMonth) { return this; } return new YearMonth(newYear, newMonth); }
[ "private", "YearMonth", "with", "(", "int", "newYear", ",", "int", "newMonth", ")", "{", "if", "(", "year", "==", "newYear", "&&", "month", "==", "newMonth", ")", "{", "return", "this", ";", "}", "return", "new", "YearMonth", "(", "newYear", ",", "newM...
Returns a copy of this year-month with the new year and month, checking to see if a new object is in fact required. @param newYear the year to represent, validated from MIN_YEAR to MAX_YEAR @param newMonth the month-of-year to represent, validated not null @return the year-month, not null
[ "Returns", "a", "copy", "of", "this", "year", "-", "month", "with", "the", "new", "year", "and", "month", "checking", "to", "see", "if", "a", "new", "object", "is", "in", "fact", "required", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/YearMonth.java#L312-L317
35,145
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Quantifier.java
Quantifier.matches
public int matches(Replaceable text, int[] offset, int limit, boolean incremental) { int start = offset[0]; int count = 0; while (count < maxCount) { int pos = offset[0]; int m = matcher.matches(text, offset, limit, incremental); if (m == U_MATCH) { ++count; if (pos == offset[0]) { // If offset has not moved we have a zero-width match. // Don't keep matching it infinitely. break; } } else if (incremental && m == U_PARTIAL_MATCH) { return U_PARTIAL_MATCH; } else { break; } } if (incremental && offset[0] == limit) { return U_PARTIAL_MATCH; } if (count >= minCount) { return U_MATCH; } offset[0] = start; return U_MISMATCH; }
java
public int matches(Replaceable text, int[] offset, int limit, boolean incremental) { int start = offset[0]; int count = 0; while (count < maxCount) { int pos = offset[0]; int m = matcher.matches(text, offset, limit, incremental); if (m == U_MATCH) { ++count; if (pos == offset[0]) { // If offset has not moved we have a zero-width match. // Don't keep matching it infinitely. break; } } else if (incremental && m == U_PARTIAL_MATCH) { return U_PARTIAL_MATCH; } else { break; } } if (incremental && offset[0] == limit) { return U_PARTIAL_MATCH; } if (count >= minCount) { return U_MATCH; } offset[0] = start; return U_MISMATCH; }
[ "public", "int", "matches", "(", "Replaceable", "text", ",", "int", "[", "]", "offset", ",", "int", "limit", ",", "boolean", "incremental", ")", "{", "int", "start", "=", "offset", "[", "0", "]", ";", "int", "count", "=", "0", ";", "while", "(", "c...
Implement UnicodeMatcher API.
[ "Implement", "UnicodeMatcher", "API", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Quantifier.java#L39-L69
35,146
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Quantifier.java
Quantifier.toPattern
public String toPattern(boolean escapeUnprintable) { StringBuilder result = new StringBuilder(); result.append(matcher.toPattern(escapeUnprintable)); if (minCount == 0) { if (maxCount == 1) { return result.append('?').toString(); } else if (maxCount == MAX) { return result.append('*').toString(); } // else fall through } else if (minCount == 1 && maxCount == MAX) { return result.append('+').toString(); } result.append('{'); result.append(Utility.hex(minCount,1)); result.append(','); if (maxCount != MAX) { result.append(Utility.hex(maxCount,1)); } result.append('}'); return result.toString(); }
java
public String toPattern(boolean escapeUnprintable) { StringBuilder result = new StringBuilder(); result.append(matcher.toPattern(escapeUnprintable)); if (minCount == 0) { if (maxCount == 1) { return result.append('?').toString(); } else if (maxCount == MAX) { return result.append('*').toString(); } // else fall through } else if (minCount == 1 && maxCount == MAX) { return result.append('+').toString(); } result.append('{'); result.append(Utility.hex(minCount,1)); result.append(','); if (maxCount != MAX) { result.append(Utility.hex(maxCount,1)); } result.append('}'); return result.toString(); }
[ "public", "String", "toPattern", "(", "boolean", "escapeUnprintable", ")", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "result", ".", "append", "(", "matcher", ".", "toPattern", "(", "escapeUnprintable", ")", ")", ";", "if", "...
Implement UnicodeMatcher API
[ "Implement", "UnicodeMatcher", "API" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/Quantifier.java#L74-L95
35,147
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPointName.java
DistributionPointName.encode
public void encode(DerOutputStream out) throws IOException { DerOutputStream theChoice = new DerOutputStream(); if (fullName != null) { fullName.encode(theChoice); out.writeImplicit( DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), theChoice); } else { relativeName.encode(theChoice); out.writeImplicit( DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_RELATIVE_NAME), theChoice); } }
java
public void encode(DerOutputStream out) throws IOException { DerOutputStream theChoice = new DerOutputStream(); if (fullName != null) { fullName.encode(theChoice); out.writeImplicit( DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_FULL_NAME), theChoice); } else { relativeName.encode(theChoice); out.writeImplicit( DerValue.createTag(DerValue.TAG_CONTEXT, true, TAG_RELATIVE_NAME), theChoice); } }
[ "public", "void", "encode", "(", "DerOutputStream", "out", ")", "throws", "IOException", "{", "DerOutputStream", "theChoice", "=", "new", "DerOutputStream", "(", ")", ";", "if", "(", "fullName", "!=", "null", ")", "{", "fullName", ".", "encode", "(", "theCho...
Encodes the distribution point name and writes it to the DerOutputStream. @param out the output stream. @exception IOException on encoding error.
[ "Encodes", "the", "distribution", "point", "name", "and", "writes", "it", "to", "the", "DerOutputStream", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/sun/security/x509/DistributionPointName.java#L170-L187
35,148
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java
CDATASectionImpl.split
public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
java
public void split() { if (!needsSplitting()) { return; } Node parent = getParentNode(); String[] parts = getData().split("\\]\\]>"); parent.insertBefore(new CDATASectionImpl(document, parts[0] + "]]"), this); for (int p = 1; p < parts.length - 1; p++) { parent.insertBefore(new CDATASectionImpl(document, ">" + parts[p] + "]]"), this); } setData(">" + parts[parts.length - 1]); }
[ "public", "void", "split", "(", ")", "{", "if", "(", "!", "needsSplitting", "(", ")", ")", "{", "return", ";", "}", "Node", "parent", "=", "getParentNode", "(", ")", ";", "String", "[", "]", "parts", "=", "getData", "(", ")", ".", "split", "(", "...
Splits this CDATA node into parts that do not contain a "]]>" sequence. Any newly created nodes will be inserted before this node.
[ "Splits", "this", "CDATA", "node", "into", "parts", "that", "do", "not", "contain", "a", "]]", ">", "sequence", ".", "Any", "newly", "created", "nodes", "will", "be", "inserted", "before", "this", "node", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java#L52-L64
35,149
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java
CDATASectionImpl.replaceWithText
public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; }
java
public TextImpl replaceWithText() { TextImpl replacement = new TextImpl(document, getData()); parent.insertBefore(replacement, this); parent.removeChild(this); return replacement; }
[ "public", "TextImpl", "replaceWithText", "(", ")", "{", "TextImpl", "replacement", "=", "new", "TextImpl", "(", "document", ",", "getData", "(", ")", ")", ";", "parent", ".", "insertBefore", "(", "replacement", ",", "this", ")", ";", "parent", ".", "remove...
Replaces this node with a semantically equivalent text node. This node will be removed from the DOM tree and the new node inserted in its place. @return the replacement node.
[ "Replaces", "this", "node", "with", "a", "semantically", "equivalent", "text", "node", ".", "This", "node", "will", "be", "removed", "from", "the", "DOM", "tree", "and", "the", "new", "node", "inserted", "in", "its", "place", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/org/apache/harmony/xml/dom/CDATASectionImpl.java#L81-L86
35,150
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java
UnionPattern.fixupVariables
public void fixupVariables(java.util.Vector vars, int globalsSize) { for (int i = 0; i < m_patterns.length; i++) { m_patterns[i].fixupVariables(vars, globalsSize); } }
java
public void fixupVariables(java.util.Vector vars, int globalsSize) { for (int i = 0; i < m_patterns.length; i++) { m_patterns[i].fixupVariables(vars, globalsSize); } }
[ "public", "void", "fixupVariables", "(", "java", ".", "util", ".", "Vector", "vars", ",", "int", "globalsSize", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "m_patterns", ".", "length", ";", "i", "++", ")", "{", "m_patterns", "[", "i"...
No arguments to process, so this does nothing.
[ "No", "arguments", "to", "process", "so", "this", "does", "nothing", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java#L45-L51
35,151
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java
UnionPattern.setPatterns
public void setPatterns(StepPattern[] patterns) { m_patterns = patterns; if(null != patterns) { for(int i = 0; i < patterns.length; i++) { patterns[i].exprSetParent(this); } } }
java
public void setPatterns(StepPattern[] patterns) { m_patterns = patterns; if(null != patterns) { for(int i = 0; i < patterns.length; i++) { patterns[i].exprSetParent(this); } } }
[ "public", "void", "setPatterns", "(", "StepPattern", "[", "]", "patterns", ")", "{", "m_patterns", "=", "patterns", ";", "if", "(", "null", "!=", "patterns", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "patterns", ".", "length", ";", ...
Set the contained step patterns to be tested. @param patterns the contained step patterns to be tested.
[ "Set", "the", "contained", "step", "patterns", "to", "be", "tested", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java#L80-L91
35,152
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java
UnionPattern.execute
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject bestScore = null; int n = m_patterns.length; for (int i = 0; i < n; i++) { XObject score = m_patterns[i].execute(xctxt); if (score != NodeTest.SCORE_NONE) { if (null == bestScore) bestScore = score; else if (score.num() > bestScore.num()) bestScore = score; } } if (null == bestScore) { bestScore = NodeTest.SCORE_NONE; } return bestScore; }
java
public XObject execute(XPathContext xctxt) throws javax.xml.transform.TransformerException { XObject bestScore = null; int n = m_patterns.length; for (int i = 0; i < n; i++) { XObject score = m_patterns[i].execute(xctxt); if (score != NodeTest.SCORE_NONE) { if (null == bestScore) bestScore = score; else if (score.num() > bestScore.num()) bestScore = score; } } if (null == bestScore) { bestScore = NodeTest.SCORE_NONE; } return bestScore; }
[ "public", "XObject", "execute", "(", "XPathContext", "xctxt", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "XObject", "bestScore", "=", "null", ";", "int", "n", "=", "m_patterns", ".", "length", ";", "for", "(", "...
Test a node to see if it matches any of the patterns in the union. @param xctxt XPath runtime context. @return {@link org.apache.xpath.patterns.NodeTest#SCORE_NODETEST}, {@link org.apache.xpath.patterns.NodeTest#SCORE_NONE}, {@link org.apache.xpath.patterns.NodeTest#SCORE_NSWILD}, {@link org.apache.xpath.patterns.NodeTest#SCORE_QNAME}, or {@link org.apache.xpath.patterns.NodeTest#SCORE_OTHER}. @throws javax.xml.transform.TransformerException
[ "Test", "a", "node", "to", "see", "if", "it", "matches", "any", "of", "the", "patterns", "in", "the", "union", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/UnionPattern.java#L117-L142
35,153
google/j2objc
translator/src/main/java/com/google/devtools/j2objc/gen/GenerationUnit.java
GenerationUnit.addPackageJavadoc
private void addPackageJavadoc(CompilationUnit unit, String qualifiedMainType) { Javadoc javadoc = unit.getPackage().getJavadoc(); if (javadoc == null) { return; } SourceBuilder builder = new SourceBuilder(false); JavadocGenerator.printDocComment(builder, javadoc); javadocBlocks.put(qualifiedMainType, builder.toString()); }
java
private void addPackageJavadoc(CompilationUnit unit, String qualifiedMainType) { Javadoc javadoc = unit.getPackage().getJavadoc(); if (javadoc == null) { return; } SourceBuilder builder = new SourceBuilder(false); JavadocGenerator.printDocComment(builder, javadoc); javadocBlocks.put(qualifiedMainType, builder.toString()); }
[ "private", "void", "addPackageJavadoc", "(", "CompilationUnit", "unit", ",", "String", "qualifiedMainType", ")", "{", "Javadoc", "javadoc", "=", "unit", ".", "getPackage", "(", ")", ".", "getJavadoc", "(", ")", ";", "if", "(", "javadoc", "==", "null", ")", ...
Collect javadoc from the package declarations to display in the header.
[ "Collect", "javadoc", "from", "the", "package", "declarations", "to", "display", "in", "the", "header", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/translator/src/main/java/com/google/devtools/j2objc/gen/GenerationUnit.java#L186-L194
35,154
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java
AtomicReferenceFieldUpdater.newUpdater
@CallerSensitive public static <U,W> AtomicReferenceFieldUpdater<U,W> newUpdater(Class<U> tclass, Class<W> vclass, String fieldName) { return new AtomicReferenceFieldUpdaterImpl<U,W>(tclass, vclass, fieldName, null); /* J2ObjC: Call stack not available. return new AtomicReferenceFieldUpdaterImpl<U,W> (tclass, vclass, fieldName, VMStack.getStackClass1()); // android-changed */ }
java
@CallerSensitive public static <U,W> AtomicReferenceFieldUpdater<U,W> newUpdater(Class<U> tclass, Class<W> vclass, String fieldName) { return new AtomicReferenceFieldUpdaterImpl<U,W>(tclass, vclass, fieldName, null); /* J2ObjC: Call stack not available. return new AtomicReferenceFieldUpdaterImpl<U,W> (tclass, vclass, fieldName, VMStack.getStackClass1()); // android-changed */ }
[ "@", "CallerSensitive", "public", "static", "<", "U", ",", "W", ">", "AtomicReferenceFieldUpdater", "<", "U", ",", "W", ">", "newUpdater", "(", "Class", "<", "U", ">", "tclass", ",", "Class", "<", "W", ">", "vclass", ",", "String", "fieldName", ")", "{...
Creates and returns an updater for objects with the given field. The Class arguments are needed to check that reflective types and generic types match. @param tclass the class of the objects holding the field @param vclass the class of the field @param fieldName the name of the field to be updated @param <U> the type of instances of tclass @param <W> the type of instances of vclass @return the updater @throws ClassCastException if the field is of the wrong type @throws IllegalArgumentException if the field is not volatile @throws RuntimeException with a nested reflection-based exception if the class does not hold field or is the wrong type, or the field is inaccessible to the caller according to Java language access control
[ "Creates", "and", "returns", "an", "updater", "for", "objects", "with", "the", "given", "field", ".", "The", "Class", "arguments", "are", "needed", "to", "check", "that", "reflective", "types", "and", "generic", "types", "match", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/concurrent/atomic/AtomicReferenceFieldUpdater.java#L100-L109
35,155
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java
ReplaceableContextIterator.setText
public void setText(Replaceable rep) { this.rep=rep; limit=contextLimit=rep.length(); cpStart=cpLimit=index=contextStart=0; dir=0; reachedLimit=false; }
java
public void setText(Replaceable rep) { this.rep=rep; limit=contextLimit=rep.length(); cpStart=cpLimit=index=contextStart=0; dir=0; reachedLimit=false; }
[ "public", "void", "setText", "(", "Replaceable", "rep", ")", "{", "this", ".", "rep", "=", "rep", ";", "limit", "=", "contextLimit", "=", "rep", ".", "length", "(", ")", ";", "cpStart", "=", "cpLimit", "=", "index", "=", "contextStart", "=", "0", ";"...
Set the text for iteration. @param rep Iteration text.
[ "Set", "the", "text", "for", "iteration", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java#L48-L54
35,156
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java
ReplaceableContextIterator.nextCaseMapCP
public int nextCaseMapCP() { int c; if(cpLimit<limit) { cpStart=cpLimit; c=rep.char32At(cpLimit); cpLimit+=UTF16.getCharCount(c); return c; } else { return -1; } }
java
public int nextCaseMapCP() { int c; if(cpLimit<limit) { cpStart=cpLimit; c=rep.char32At(cpLimit); cpLimit+=UTF16.getCharCount(c); return c; } else { return -1; } }
[ "public", "int", "nextCaseMapCP", "(", ")", "{", "int", "c", ";", "if", "(", "cpLimit", "<", "limit", ")", "{", "cpStart", "=", "cpLimit", ";", "c", "=", "rep", ".", "char32At", "(", "cpLimit", ")", ";", "cpLimit", "+=", "UTF16", ".", "getCharCount",...
Iterate forward through the string to fetch the next code point to be case-mapped, and set the context indexes for it. @return The next code point to be case-mapped, or <0 when the iteration is done.
[ "Iterate", "forward", "through", "the", "string", "to", "fetch", "the", "next", "code", "point", "to", "be", "case", "-", "mapped", "and", "set", "the", "context", "indexes", "for", "it", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java#L120-L130
35,157
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java
ReplaceableContextIterator.replace
public int replace(String text) { int delta=text.length()-(cpLimit-cpStart); rep.replace(cpStart, cpLimit, text); cpLimit+=delta; limit+=delta; contextLimit+=delta; return delta; }
java
public int replace(String text) { int delta=text.length()-(cpLimit-cpStart); rep.replace(cpStart, cpLimit, text); cpLimit+=delta; limit+=delta; contextLimit+=delta; return delta; }
[ "public", "int", "replace", "(", "String", "text", ")", "{", "int", "delta", "=", "text", ".", "length", "(", ")", "-", "(", "cpLimit", "-", "cpStart", ")", ";", "rep", ".", "replace", "(", "cpStart", ",", "cpLimit", ",", "text", ")", ";", "cpLimit...
Replace the current code point by its case mapping, and update the indexes. @param text Replacement text. @return The delta for the change of the text length.
[ "Replace", "the", "current", "code", "point", "by", "its", "case", "mapping", "and", "update", "the", "indexes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java#L139-L146
35,158
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java
ReplaceableContextIterator.reset
public void reset(int direction) { if(direction>0) { /* reset for forward iteration */ this.dir=1; index=cpLimit; } else if(direction<0) { /* reset for backward iteration */ this.dir=-1; index=cpStart; } else { // not a valid direction this.dir=0; index=0; } reachedLimit=false; }
java
public void reset(int direction) { if(direction>0) { /* reset for forward iteration */ this.dir=1; index=cpLimit; } else if(direction<0) { /* reset for backward iteration */ this.dir=-1; index=cpStart; } else { // not a valid direction this.dir=0; index=0; } reachedLimit=false; }
[ "public", "void", "reset", "(", "int", "direction", ")", "{", "if", "(", "direction", ">", "0", ")", "{", "/* reset for forward iteration */", "this", ".", "dir", "=", "1", ";", "index", "=", "cpLimit", ";", "}", "else", "if", "(", "direction", "<", "0...
implement UCaseProps.ContextIterator
[ "implement", "UCaseProps", ".", "ContextIterator" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/ReplaceableContextIterator.java#L157-L172
35,159
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.codePointAtImpl
static int codePointAtImpl(char[] a, int index, int limit) { char c1 = a[index]; if (isHighSurrogate(c1) && ++index < limit) { char c2 = a[index]; if (isLowSurrogate(c2)) { return toCodePoint(c1, c2); } } return c1; }
java
static int codePointAtImpl(char[] a, int index, int limit) { char c1 = a[index]; if (isHighSurrogate(c1) && ++index < limit) { char c2 = a[index]; if (isLowSurrogate(c2)) { return toCodePoint(c1, c2); } } return c1; }
[ "static", "int", "codePointAtImpl", "(", "char", "[", "]", "a", ",", "int", "index", ",", "int", "limit", ")", "{", "char", "c1", "=", "a", "[", "index", "]", ";", "if", "(", "isHighSurrogate", "(", "c1", ")", "&&", "++", "index", "<", "limit", "...
throws ArrayIndexOutOfBoundsException if index out of bounds
[ "throws", "ArrayIndexOutOfBoundsException", "if", "index", "out", "of", "bounds" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L4995-L5004
35,160
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.codePointBeforeImpl
static int codePointBeforeImpl(char[] a, int index, int start) { char c2 = a[--index]; if (isLowSurrogate(c2) && index > start) { char c1 = a[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } return c2; }
java
static int codePointBeforeImpl(char[] a, int index, int start) { char c2 = a[--index]; if (isLowSurrogate(c2) && index > start) { char c1 = a[--index]; if (isHighSurrogate(c1)) { return toCodePoint(c1, c2); } } return c2; }
[ "static", "int", "codePointBeforeImpl", "(", "char", "[", "]", "a", ",", "int", "index", ",", "int", "start", ")", "{", "char", "c2", "=", "a", "[", "--", "index", "]", ";", "if", "(", "isLowSurrogate", "(", "c2", ")", "&&", "index", ">", "start", ...
throws ArrayIndexOutOfBoundsException if index-1 out of bounds
[ "throws", "ArrayIndexOutOfBoundsException", "if", "index", "-", "1", "out", "of", "bounds" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L5098-L5107
35,161
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java
Character.getType
public static int getType(int codePoint) { int type = getTypeImpl(codePoint); // The type values returned by ICU are not RI-compatible. The RI skips the value 17. if (type <= Character.FORMAT) { return type; } return (type + 1); }
java
public static int getType(int codePoint) { int type = getTypeImpl(codePoint); // The type values returned by ICU are not RI-compatible. The RI skips the value 17. if (type <= Character.FORMAT) { return type; } return (type + 1); }
[ "public", "static", "int", "getType", "(", "int", "codePoint", ")", "{", "int", "type", "=", "getTypeImpl", "(", "codePoint", ")", ";", "// The type values returned by ICU are not RI-compatible. The RI skips the value 17.", "if", "(", "type", "<=", "Character", ".", "...
Returns a value indicating a character's general category. @param codePoint the character (Unicode code point) to be tested. @return a value of type {@code int} representing the character's general category. @see Character#COMBINING_SPACING_MARK COMBINING_SPACING_MARK @see Character#CONNECTOR_PUNCTUATION CONNECTOR_PUNCTUATION @see Character#CONTROL CONTROL @see Character#CURRENCY_SYMBOL CURRENCY_SYMBOL @see Character#DASH_PUNCTUATION DASH_PUNCTUATION @see Character#DECIMAL_DIGIT_NUMBER DECIMAL_DIGIT_NUMBER @see Character#ENCLOSING_MARK ENCLOSING_MARK @see Character#END_PUNCTUATION END_PUNCTUATION @see Character#FINAL_QUOTE_PUNCTUATION FINAL_QUOTE_PUNCTUATION @see Character#FORMAT FORMAT @see Character#INITIAL_QUOTE_PUNCTUATION INITIAL_QUOTE_PUNCTUATION @see Character#LETTER_NUMBER LETTER_NUMBER @see Character#LINE_SEPARATOR LINE_SEPARATOR @see Character#LOWERCASE_LETTER LOWERCASE_LETTER @see Character#MATH_SYMBOL MATH_SYMBOL @see Character#MODIFIER_LETTER MODIFIER_LETTER @see Character#MODIFIER_SYMBOL MODIFIER_SYMBOL @see Character#NON_SPACING_MARK NON_SPACING_MARK @see Character#OTHER_LETTER OTHER_LETTER @see Character#OTHER_NUMBER OTHER_NUMBER @see Character#OTHER_PUNCTUATION OTHER_PUNCTUATION @see Character#OTHER_SYMBOL OTHER_SYMBOL @see Character#PARAGRAPH_SEPARATOR PARAGRAPH_SEPARATOR @see Character#PRIVATE_USE PRIVATE_USE @see Character#SPACE_SEPARATOR SPACE_SEPARATOR @see Character#START_PUNCTUATION START_PUNCTUATION @see Character#SURROGATE SURROGATE @see Character#TITLECASE_LETTER TITLECASE_LETTER @see Character#UNASSIGNED UNASSIGNED @see Character#UPPERCASE_LETTER UPPERCASE_LETTER @since 1.5
[ "Returns", "a", "value", "indicating", "a", "character", "s", "general", "category", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/lang/Character.java#L7154-L7161
35,162
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarUtil.java
CalendarUtil.getCalendarType
public static String getCalendarType(ULocale loc) { String calType = loc.getKeywordValue(CALKEY); if (calType != null) { return calType; } // Canonicalize, so grandfathered variant will be transformed to keywords ULocale canonical = ULocale.createCanonical(loc.toString()); calType = canonical.getKeywordValue(CALKEY); if (calType != null) { return calType; } // When calendar keyword is not available, use the locale's // region to get the default calendar type String region = ULocale.getRegionForSupplementalData(canonical, true); return CalendarPreferences.INSTANCE.getCalendarTypeForRegion(region); }
java
public static String getCalendarType(ULocale loc) { String calType = loc.getKeywordValue(CALKEY); if (calType != null) { return calType; } // Canonicalize, so grandfathered variant will be transformed to keywords ULocale canonical = ULocale.createCanonical(loc.toString()); calType = canonical.getKeywordValue(CALKEY); if (calType != null) { return calType; } // When calendar keyword is not available, use the locale's // region to get the default calendar type String region = ULocale.getRegionForSupplementalData(canonical, true); return CalendarPreferences.INSTANCE.getCalendarTypeForRegion(region); }
[ "public", "static", "String", "getCalendarType", "(", "ULocale", "loc", ")", "{", "String", "calType", "=", "loc", ".", "getKeywordValue", "(", "CALKEY", ")", ";", "if", "(", "calType", "!=", "null", ")", "{", "return", "calType", ";", "}", "// Canonicaliz...
Returns a calendar type for the given locale. When the given locale has calendar keyword, the value of calendar keyword is returned. Otherwise, the default calendar type for the locale is returned. @param loc The locale @return Calendar type string, such as "gregorian"
[ "Returns", "a", "calendar", "type", "for", "the", "given", "locale", ".", "When", "the", "given", "locale", "has", "calendar", "keyword", "the", "value", "of", "calendar", "keyword", "is", "returned", ".", "Otherwise", "the", "default", "calendar", "type", "...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/CalendarUtil.java#L42-L59
35,163
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java
ZipInputStream.getNextEntry
public ZipEntry getNextEntry() throws IOException { ensureOpen(); if (entry != null) { closeEntry(); } crc.reset(); inf.reset(); if ((entry = readLOC()) == null) { return null; } // ----- BEGIN android ----- // if (entry.method == STORED) { if (entry.method == STORED || entry.method == DEFLATED) { // ----- END android ----- remaining = entry.size; } entryEOF = false; return entry; }
java
public ZipEntry getNextEntry() throws IOException { ensureOpen(); if (entry != null) { closeEntry(); } crc.reset(); inf.reset(); if ((entry = readLOC()) == null) { return null; } // ----- BEGIN android ----- // if (entry.method == STORED) { if (entry.method == STORED || entry.method == DEFLATED) { // ----- END android ----- remaining = entry.size; } entryEOF = false; return entry; }
[ "public", "ZipEntry", "getNextEntry", "(", ")", "throws", "IOException", "{", "ensureOpen", "(", ")", ";", "if", "(", "entry", "!=", "null", ")", "{", "closeEntry", "(", ")", ";", "}", "crc", ".", "reset", "(", ")", ";", "inf", ".", "reset", "(", "...
Reads the next ZIP file entry and positions the stream at the beginning of the entry data. @return the next ZIP file entry, or null if there are no more entries @exception ZipException if a ZIP file error has occurred @exception IOException if an I/O error has occurred
[ "Reads", "the", "next", "ZIP", "file", "entry", "and", "positions", "the", "stream", "at", "the", "beginning", "of", "the", "entry", "data", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java#L114-L132
35,164
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java
ZipInputStream.skip
public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } ensureOpen(); int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; while (total < max) { int len = max - total; if (len > tmpbuf.length) { len = tmpbuf.length; } len = read(tmpbuf, 0, len); if (len == -1) { entryEOF = true; break; } total += len; } return total; }
java
public long skip(long n) throws IOException { if (n < 0) { throw new IllegalArgumentException("negative skip length"); } ensureOpen(); int max = (int)Math.min(n, Integer.MAX_VALUE); int total = 0; while (total < max) { int len = max - total; if (len > tmpbuf.length) { len = tmpbuf.length; } len = read(tmpbuf, 0, len); if (len == -1) { entryEOF = true; break; } total += len; } return total; }
[ "public", "long", "skip", "(", "long", "n", ")", "throws", "IOException", "{", "if", "(", "n", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"negative skip length\"", ")", ";", "}", "ensureOpen", "(", ")", ";", "int", "max", "=",...
Skips specified number of bytes in the current ZIP entry. @param n the number of bytes to skip @return the actual number of bytes skipped @exception ZipException if a ZIP file error has occurred @exception IOException if an I/O error has occurred @exception IllegalArgumentException if n < 0
[ "Skips", "specified", "number", "of", "bytes", "in", "the", "current", "ZIP", "entry", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/java/util/zip/ZipInputStream.java#L245-L265
35,165
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemVariable.java
ElemVariable.appendChild
public ElemTemplateElement appendChild(ElemTemplateElement elem) { // cannot have content and select if (m_selectPattern != null) { error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT, new Object[]{"xsl:" + this.getNodeName()}); return null; } return super.appendChild(elem); }
java
public ElemTemplateElement appendChild(ElemTemplateElement elem) { // cannot have content and select if (m_selectPattern != null) { error(XSLTErrorResources.ER_CANT_HAVE_CONTENT_AND_SELECT, new Object[]{"xsl:" + this.getNodeName()}); return null; } return super.appendChild(elem); }
[ "public", "ElemTemplateElement", "appendChild", "(", "ElemTemplateElement", "elem", ")", "{", "// cannot have content and select", "if", "(", "m_selectPattern", "!=", "null", ")", "{", "error", "(", "XSLTErrorResources", ".", "ER_CANT_HAVE_CONTENT_AND_SELECT", ",", "new",...
Add a child to the child list. If the select attribute is present, an error will be raised. @param elem New element to append to this element's children list @return null if the select attribute was present, otherwise the child just added to the child list
[ "Add", "a", "child", "to", "the", "child", "list", ".", "If", "the", "select", "attribute", "is", "present", "an", "error", "will", "be", "raised", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/ElemVariable.java#L516-L526
35,166
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.toPattern
public String toPattern() { // Return the original, applied pattern string, or else "". // Note: This does not take into account // - changes from setFormat() and similar methods, or // - normalization of apostrophes and arguments, for example, // whether some date/time/number formatter was created via a pattern // but is equivalent to the "medium" default format. if (customFormatArgStarts != null) { throw new IllegalStateException( "toPattern() is not supported after custom Format objects "+ "have been set via setFormat() or similar APIs"); } if (msgPattern == null) { return ""; } String originalPattern = msgPattern.getPatternString(); return originalPattern == null ? "" : originalPattern; }
java
public String toPattern() { // Return the original, applied pattern string, or else "". // Note: This does not take into account // - changes from setFormat() and similar methods, or // - normalization of apostrophes and arguments, for example, // whether some date/time/number formatter was created via a pattern // but is equivalent to the "medium" default format. if (customFormatArgStarts != null) { throw new IllegalStateException( "toPattern() is not supported after custom Format objects "+ "have been set via setFormat() or similar APIs"); } if (msgPattern == null) { return ""; } String originalPattern = msgPattern.getPatternString(); return originalPattern == null ? "" : originalPattern; }
[ "public", "String", "toPattern", "(", ")", "{", "// Return the original, applied pattern string, or else \"\".", "// Note: This does not take into account", "// - changes from setFormat() and similar methods, or", "// - normalization of apostrophes and arguments, for example,", "// whether som...
Returns the applied pattern string. @return the pattern string @throws IllegalStateException after custom Format objects have been set via setFormat() or similar APIs
[ "Returns", "the", "applied", "pattern", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L500-L517
35,167
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.nextTopLevelArgStart
private int nextTopLevelArgStart(int partIndex) { if (partIndex != 0) { partIndex = msgPattern.getLimitPartIndex(partIndex); } for (;;) { MessagePattern.Part.Type type = msgPattern.getPartType(++partIndex); if (type == MessagePattern.Part.Type.ARG_START) { return partIndex; } if (type == MessagePattern.Part.Type.MSG_LIMIT) { return -1; } } }
java
private int nextTopLevelArgStart(int partIndex) { if (partIndex != 0) { partIndex = msgPattern.getLimitPartIndex(partIndex); } for (;;) { MessagePattern.Part.Type type = msgPattern.getPartType(++partIndex); if (type == MessagePattern.Part.Type.ARG_START) { return partIndex; } if (type == MessagePattern.Part.Type.MSG_LIMIT) { return -1; } } }
[ "private", "int", "nextTopLevelArgStart", "(", "int", "partIndex", ")", "{", "if", "(", "partIndex", "!=", "0", ")", "{", "partIndex", "=", "msgPattern", ".", "getLimitPartIndex", "(", "partIndex", ")", ";", "}", "for", "(", ";", ";", ")", "{", "MessageP...
Returns the part index of the next ARG_START after partIndex, or -1 if there is none more. @param partIndex Part index of the previous ARG_START (initially 0).
[ "Returns", "the", "part", "index", "of", "the", "next", "ARG_START", "after", "partIndex", "or", "-", "1", "if", "there", "is", "none", "more", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L523-L536
35,168
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.getLiteralStringUntilNextArgument
private String getLiteralStringUntilNextArgument(int from) { StringBuilder b = new StringBuilder(); String msgString=msgPattern.getPatternString(); int prevIndex=msgPattern.getPart(from).getLimit(); for(int i=from+1;; ++i) { Part part=msgPattern.getPart(i); Part.Type type=part.getType(); int index=part.getIndex(); b.append(msgString, prevIndex, index); if(type==Part.Type.ARG_START || type==Part.Type.MSG_LIMIT) { return b.toString(); } assert type==Part.Type.SKIP_SYNTAX || type==Part.Type.INSERT_CHAR : "Unexpected Part "+part+" in parsed message."; prevIndex=part.getLimit(); } }
java
private String getLiteralStringUntilNextArgument(int from) { StringBuilder b = new StringBuilder(); String msgString=msgPattern.getPatternString(); int prevIndex=msgPattern.getPart(from).getLimit(); for(int i=from+1;; ++i) { Part part=msgPattern.getPart(i); Part.Type type=part.getType(); int index=part.getIndex(); b.append(msgString, prevIndex, index); if(type==Part.Type.ARG_START || type==Part.Type.MSG_LIMIT) { return b.toString(); } assert type==Part.Type.SKIP_SYNTAX || type==Part.Type.INSERT_CHAR : "Unexpected Part "+part+" in parsed message."; prevIndex=part.getLimit(); } }
[ "private", "String", "getLiteralStringUntilNextArgument", "(", "int", "from", ")", "{", "StringBuilder", "b", "=", "new", "StringBuilder", "(", ")", ";", "String", "msgString", "=", "msgPattern", ".", "getPatternString", "(", ")", ";", "int", "prevIndex", "=", ...
Read as much literal string from the pattern string as possible. This stops as soon as it finds an argument, or it reaches the end of the string. @param from Index in the pattern string to start from. @return A substring from the pattern string representing the longest possible substring with no arguments.
[ "Read", "as", "much", "literal", "string", "from", "the", "pattern", "string", "as", "possible", ".", "This", "stops", "as", "soon", "as", "it", "finds", "an", "argument", "or", "it", "reaches", "the", "end", "of", "the", "string", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1791-L1807
35,169
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.findChoiceSubMessage
private static int findChoiceSubMessage(MessagePattern pattern, int partIndex, double number) { int count=pattern.countParts(); int msgStart; // Iterate over (ARG_INT|DOUBLE, ARG_SELECTOR, message) tuples // until ARG_LIMIT or end of choice-only pattern. // Ignore the first number and selector and start the loop on the first message. partIndex+=2; for(;;) { // Skip but remember the current sub-message. msgStart=partIndex; partIndex=pattern.getLimitPartIndex(partIndex); if(++partIndex>=count) { // Reached the end of the choice-only pattern. // Return with the last sub-message. break; } Part part=pattern.getPart(partIndex++); Part.Type type=part.getType(); if(type==Part.Type.ARG_LIMIT) { // Reached the end of the ChoiceFormat style. // Return with the last sub-message. break; } // part is an ARG_INT or ARG_DOUBLE assert type.hasNumericValue(); double boundary=pattern.getNumericValue(part); // Fetch the ARG_SELECTOR character. int selectorIndex=pattern.getPatternIndex(partIndex++); char boundaryChar=pattern.getPatternString().charAt(selectorIndex); if(boundaryChar=='<' ? !(number>boundary) : !(number>=boundary)) { // The number is in the interval between the previous boundary and the current one. // Return with the sub-message between them. // The !(a>b) and !(a>=b) comparisons are equivalent to // (a<=b) and (a<b) except they "catch" NaN. break; } } return msgStart; }
java
private static int findChoiceSubMessage(MessagePattern pattern, int partIndex, double number) { int count=pattern.countParts(); int msgStart; // Iterate over (ARG_INT|DOUBLE, ARG_SELECTOR, message) tuples // until ARG_LIMIT or end of choice-only pattern. // Ignore the first number and selector and start the loop on the first message. partIndex+=2; for(;;) { // Skip but remember the current sub-message. msgStart=partIndex; partIndex=pattern.getLimitPartIndex(partIndex); if(++partIndex>=count) { // Reached the end of the choice-only pattern. // Return with the last sub-message. break; } Part part=pattern.getPart(partIndex++); Part.Type type=part.getType(); if(type==Part.Type.ARG_LIMIT) { // Reached the end of the ChoiceFormat style. // Return with the last sub-message. break; } // part is an ARG_INT or ARG_DOUBLE assert type.hasNumericValue(); double boundary=pattern.getNumericValue(part); // Fetch the ARG_SELECTOR character. int selectorIndex=pattern.getPatternIndex(partIndex++); char boundaryChar=pattern.getPatternString().charAt(selectorIndex); if(boundaryChar=='<' ? !(number>boundary) : !(number>=boundary)) { // The number is in the interval between the previous boundary and the current one. // Return with the sub-message between them. // The !(a>b) and !(a>=b) comparisons are equivalent to // (a<=b) and (a<b) except they "catch" NaN. break; } } return msgStart; }
[ "private", "static", "int", "findChoiceSubMessage", "(", "MessagePattern", "pattern", ",", "int", "partIndex", ",", "double", "number", ")", "{", "int", "count", "=", "pattern", ".", "countParts", "(", ")", ";", "int", "msgStart", ";", "// Iterate over (ARG_INT|...
Finds the ChoiceFormat sub-message for the given number. @param pattern A MessagePattern. @param partIndex the index of the first ChoiceFormat argument style part. @param number a number to be mapped to one of the ChoiceFormat argument's intervals @return the sub-message start part index.
[ "Finds", "the", "ChoiceFormat", "sub", "-", "message", "for", "the", "given", "number", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1830-L1868
35,170
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.matchStringUntilLimitPart
private static int matchStringUntilLimitPart( MessagePattern pattern, int partIndex, int limitPartIndex, String source, int sourceOffset) { int matchingSourceLength = 0; String msgString = pattern.getPatternString(); int prevIndex = pattern.getPart(partIndex).getLimit(); for (;;) { Part part = pattern.getPart(++partIndex); if (partIndex == limitPartIndex || part.getType() == Part.Type.SKIP_SYNTAX) { int index = part.getIndex(); int length = index - prevIndex; if (length != 0 && !source.regionMatches(sourceOffset, msgString, prevIndex, length)) { return -1; // mismatch } matchingSourceLength += length; if (partIndex == limitPartIndex) { return matchingSourceLength; } prevIndex = part.getLimit(); // SKIP_SYNTAX } } }
java
private static int matchStringUntilLimitPart( MessagePattern pattern, int partIndex, int limitPartIndex, String source, int sourceOffset) { int matchingSourceLength = 0; String msgString = pattern.getPatternString(); int prevIndex = pattern.getPart(partIndex).getLimit(); for (;;) { Part part = pattern.getPart(++partIndex); if (partIndex == limitPartIndex || part.getType() == Part.Type.SKIP_SYNTAX) { int index = part.getIndex(); int length = index - prevIndex; if (length != 0 && !source.regionMatches(sourceOffset, msgString, prevIndex, length)) { return -1; // mismatch } matchingSourceLength += length; if (partIndex == limitPartIndex) { return matchingSourceLength; } prevIndex = part.getLimit(); // SKIP_SYNTAX } } }
[ "private", "static", "int", "matchStringUntilLimitPart", "(", "MessagePattern", "pattern", ",", "int", "partIndex", ",", "int", "limitPartIndex", ",", "String", "source", ",", "int", "sourceOffset", ")", "{", "int", "matchingSourceLength", "=", "0", ";", "String",...
Matches the pattern string from the end of the partIndex to the beginning of the limitPartIndex, including all syntax except SKIP_SYNTAX, against the source string starting at sourceOffset. If they match, returns the length of the source string match. Otherwise returns -1.
[ "Matches", "the", "pattern", "string", "from", "the", "end", "of", "the", "partIndex", "to", "the", "beginning", "of", "the", "limitPartIndex", "including", "all", "syntax", "except", "SKIP_SYNTAX", "against", "the", "source", "string", "starting", "at", "source...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1912-L1933
35,171
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.findOtherSubMessage
private int findOtherSubMessage(int partIndex) { int count=msgPattern.countParts(); MessagePattern.Part part=msgPattern.getPart(partIndex); if(part.getType().hasNumericValue()) { ++partIndex; } // Iterate over (ARG_SELECTOR [ARG_INT|ARG_DOUBLE] message) tuples // until ARG_LIMIT or end of plural-only pattern. do { part=msgPattern.getPart(partIndex++); MessagePattern.Part.Type type=part.getType(); if(type==MessagePattern.Part.Type.ARG_LIMIT) { break; } assert type==MessagePattern.Part.Type.ARG_SELECTOR; // part is an ARG_SELECTOR followed by an optional explicit value, and then a message if(msgPattern.partSubstringMatches(part, "other")) { return partIndex; } if(msgPattern.getPartType(partIndex).hasNumericValue()) { ++partIndex; // skip the numeric-value part of "=1" etc. } partIndex=msgPattern.getLimitPartIndex(partIndex); } while(++partIndex<count); return 0; }
java
private int findOtherSubMessage(int partIndex) { int count=msgPattern.countParts(); MessagePattern.Part part=msgPattern.getPart(partIndex); if(part.getType().hasNumericValue()) { ++partIndex; } // Iterate over (ARG_SELECTOR [ARG_INT|ARG_DOUBLE] message) tuples // until ARG_LIMIT or end of plural-only pattern. do { part=msgPattern.getPart(partIndex++); MessagePattern.Part.Type type=part.getType(); if(type==MessagePattern.Part.Type.ARG_LIMIT) { break; } assert type==MessagePattern.Part.Type.ARG_SELECTOR; // part is an ARG_SELECTOR followed by an optional explicit value, and then a message if(msgPattern.partSubstringMatches(part, "other")) { return partIndex; } if(msgPattern.getPartType(partIndex).hasNumericValue()) { ++partIndex; // skip the numeric-value part of "=1" etc. } partIndex=msgPattern.getLimitPartIndex(partIndex); } while(++partIndex<count); return 0; }
[ "private", "int", "findOtherSubMessage", "(", "int", "partIndex", ")", "{", "int", "count", "=", "msgPattern", ".", "countParts", "(", ")", ";", "MessagePattern", ".", "Part", "part", "=", "msgPattern", ".", "getPart", "(", "partIndex", ")", ";", "if", "("...
Finds the "other" sub-message. @param partIndex the index of the first PluralFormat argument style part. @return the "other" sub-message start part index.
[ "Finds", "the", "other", "sub", "-", "message", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1940-L1965
35,172
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.findFirstPluralNumberArg
private int findFirstPluralNumberArg(int msgStart, String argName) { for(int i=msgStart+1;; ++i) { Part part=msgPattern.getPart(i); Part.Type type=part.getType(); if(type==Part.Type.MSG_LIMIT) { return 0; } if(type==Part.Type.REPLACE_NUMBER) { return -1; } if(type==Part.Type.ARG_START) { ArgType argType=part.getArgType(); if(argName.length()!=0 && (argType==ArgType.NONE || argType==ArgType.SIMPLE)) { part=msgPattern.getPart(i+1); // ARG_NUMBER or ARG_NAME if(msgPattern.partSubstringMatches(part, argName)) { return i; } } i=msgPattern.getLimitPartIndex(i); } } }
java
private int findFirstPluralNumberArg(int msgStart, String argName) { for(int i=msgStart+1;; ++i) { Part part=msgPattern.getPart(i); Part.Type type=part.getType(); if(type==Part.Type.MSG_LIMIT) { return 0; } if(type==Part.Type.REPLACE_NUMBER) { return -1; } if(type==Part.Type.ARG_START) { ArgType argType=part.getArgType(); if(argName.length()!=0 && (argType==ArgType.NONE || argType==ArgType.SIMPLE)) { part=msgPattern.getPart(i+1); // ARG_NUMBER or ARG_NAME if(msgPattern.partSubstringMatches(part, argName)) { return i; } } i=msgPattern.getLimitPartIndex(i); } } }
[ "private", "int", "findFirstPluralNumberArg", "(", "int", "msgStart", ",", "String", "argName", ")", "{", "for", "(", "int", "i", "=", "msgStart", "+", "1", ";", ";", "++", "i", ")", "{", "Part", "part", "=", "msgPattern", ".", "getPart", "(", "i", "...
Returns the ARG_START index of the first occurrence of the plural number in a sub-message. Returns -1 if it is a REPLACE_NUMBER. Returns 0 if there is neither.
[ "Returns", "the", "ARG_START", "index", "of", "the", "first", "occurrence", "of", "the", "plural", "number", "in", "a", "sub", "-", "message", ".", "Returns", "-", "1", "if", "it", "is", "a", "REPLACE_NUMBER", ".", "Returns", "0", "if", "there", "is", ...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L1972-L1993
35,173
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.format
private void format(Object[] arguments, Map<String, Object> argsMap, AppendableWrapper dest, FieldPosition fp) { if (arguments != null && msgPattern.hasNamedArguments()) { throw new IllegalArgumentException( "This method is not available in MessageFormat objects " + "that use alphanumeric argument names."); } format(0, null, arguments, argsMap, dest, fp); }
java
private void format(Object[] arguments, Map<String, Object> argsMap, AppendableWrapper dest, FieldPosition fp) { if (arguments != null && msgPattern.hasNamedArguments()) { throw new IllegalArgumentException( "This method is not available in MessageFormat objects " + "that use alphanumeric argument names."); } format(0, null, arguments, argsMap, dest, fp); }
[ "private", "void", "format", "(", "Object", "[", "]", "arguments", ",", "Map", "<", "String", ",", "Object", ">", "argsMap", ",", "AppendableWrapper", "dest", ",", "FieldPosition", "fp", ")", "{", "if", "(", "arguments", "!=", "null", "&&", "msgPattern", ...
Internal routine used by format. @throws IllegalArgumentException if an argument in the <code>arguments</code> map is not of the type expected by the format element(s) that use it.
[ "Internal", "routine", "used", "by", "format", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2096-L2104
35,174
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.findKeyword
private static final int findKeyword(String s, String[] list) { s = PatternProps.trimWhiteSpace(s).toLowerCase(rootLocale); for (int i = 0; i < list.length; ++i) { if (s.equals(list[i])) return i; } return -1; }
java
private static final int findKeyword(String s, String[] list) { s = PatternProps.trimWhiteSpace(s).toLowerCase(rootLocale); for (int i = 0; i < list.length; ++i) { if (s.equals(list[i])) return i; } return -1; }
[ "private", "static", "final", "int", "findKeyword", "(", "String", "s", ",", "String", "[", "]", "list", ")", "{", "s", "=", "PatternProps", ".", "trimWhiteSpace", "(", "s", ")", ".", "toLowerCase", "(", "rootLocale", ")", ";", "for", "(", "int", "i", ...
Locale.ROOT only @since 1.6
[ "Locale", ".", "ROOT", "only" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2271-L2278
35,175
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.writeObject
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); // ICU 4.8 custom serialization. // locale as a BCP 47 language tag out.writeObject(ulocale.toLanguageTag()); // ApostropheMode if (msgPattern == null) { msgPattern = new MessagePattern(); } out.writeObject(msgPattern.getApostropheMode()); // message pattern string out.writeObject(msgPattern.getPatternString()); // custom formatters if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) { out.writeInt(0); } else { out.writeInt(customFormatArgStarts.size()); int formatIndex = 0; for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { if (customFormatArgStarts.contains(partIndex)) { out.writeInt(formatIndex); out.writeObject(cachedFormatters.get(partIndex)); } ++formatIndex; } } // number of future (int, Object) pairs out.writeInt(0); }
java
private void writeObject(java.io.ObjectOutputStream out) throws IOException { out.defaultWriteObject(); // ICU 4.8 custom serialization. // locale as a BCP 47 language tag out.writeObject(ulocale.toLanguageTag()); // ApostropheMode if (msgPattern == null) { msgPattern = new MessagePattern(); } out.writeObject(msgPattern.getApostropheMode()); // message pattern string out.writeObject(msgPattern.getPatternString()); // custom formatters if (customFormatArgStarts == null || customFormatArgStarts.isEmpty()) { out.writeInt(0); } else { out.writeInt(customFormatArgStarts.size()); int formatIndex = 0; for (int partIndex = 0; (partIndex = nextTopLevelArgStart(partIndex)) >= 0;) { if (customFormatArgStarts.contains(partIndex)) { out.writeInt(formatIndex); out.writeObject(cachedFormatters.get(partIndex)); } ++formatIndex; } } // number of future (int, Object) pairs out.writeInt(0); }
[ "private", "void", "writeObject", "(", "java", ".", "io", ".", "ObjectOutputStream", "out", ")", "throws", "IOException", "{", "out", ".", "defaultWriteObject", "(", ")", ";", "// ICU 4.8 custom serialization.", "// locale as a BCP 47 language tag", "out", ".", "write...
Custom serialization, new in ICU 4.8. We do not want to use default serialization because we only have a small amount of persistent state which is better expressed explicitly rather than via writing field objects. @param out The output stream. @serialData Writes the locale as a BCP 47 language tag string, the MessagePattern.ApostropheMode as an object, and the pattern string (null if none was applied). Followed by an int with the number of (int formatIndex, Object formatter) pairs, and that many such pairs, corresponding to previous setFormat() calls for custom formats. Followed by an int with the number of (int, Object) pairs, and that many such pairs, for future (post-ICU 4.8) extension of the serialization format.
[ "Custom", "serialization", "new", "in", "ICU", "4", ".", "8", ".", "We", "do", "not", "want", "to", "use", "default", "serialization", "because", "we", "only", "have", "a", "small", "amount", "of", "persistent", "state", "which", "is", "better", "expressed...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2294-L2322
35,176
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java
MessageFormat.setArgStartFormat
private void setArgStartFormat(int argStart, Format formatter) { if (cachedFormatters == null) { cachedFormatters = new HashMap<Integer, Format>(); } cachedFormatters.put(argStart, formatter); }
java
private void setArgStartFormat(int argStart, Format formatter) { if (cachedFormatters == null) { cachedFormatters = new HashMap<Integer, Format>(); } cachedFormatters.put(argStart, formatter); }
[ "private", "void", "setArgStartFormat", "(", "int", "argStart", ",", "Format", "formatter", ")", "{", "if", "(", "cachedFormatters", "==", "null", ")", "{", "cachedFormatters", "=", "new", "HashMap", "<", "Integer", ",", "Format", ">", "(", ")", ";", "}", ...
Sets a formatter for a MessagePattern ARG_START part index.
[ "Sets", "a", "formatter", "for", "a", "MessagePattern", "ARG_START", "part", "index", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/text/MessageFormat.java#L2389-L2394
35,177
google/j2objc
jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLSocketFactory.java
SSLSocketFactory.getDefault
public static synchronized SocketFactory getDefault() { // Android-changed: Use security version instead of propertyChecked. if (defaultSocketFactory != null && lastVersion == Security.getVersion()) { return defaultSocketFactory; } lastVersion = Security.getVersion(); SSLSocketFactory previousDefaultSocketFactory = defaultSocketFactory; defaultSocketFactory = null; String clsName = getSecurityProperty("ssl.SocketFactory.provider"); if (clsName != null) { // The instance for the default socket factory is checked for updates quite // often (for instance, every time a security provider is added). Which leads // to unnecessary overload and excessive error messages in case of class-loading // errors. Avoid creating a new object if the class name is the same as before. if (previousDefaultSocketFactory != null && clsName.equals(previousDefaultSocketFactory.getClass().getName())) { defaultSocketFactory = previousDefaultSocketFactory; return defaultSocketFactory; } log("setting up default SSLSocketFactory"); try { Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { // Android-changed; Try the contextClassLoader first. ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } if (cl != null) { cls = Class.forName(clsName, true, cl); } } log("class " + clsName + " is loaded"); defaultSocketFactory = (SSLSocketFactory)cls.newInstance(); log("instantiated an instance of class " + clsName); if (defaultSocketFactory != null) { return defaultSocketFactory; } } catch (Exception e) { log("SSLSocketFactory instantiation failed: " + e.toString()); } } // Android-changed: Allow for {@code null} SSLContext.getDefault. try { SSLContext context = SSLContext.getDefault(); if (context != null) { defaultSocketFactory = context.getSocketFactory(); } } catch (NoSuchAlgorithmException e) { } if (defaultSocketFactory == null) { defaultSocketFactory = new DefaultSSLSocketFactory(new IllegalStateException("No factory found.")); } return defaultSocketFactory; }
java
public static synchronized SocketFactory getDefault() { // Android-changed: Use security version instead of propertyChecked. if (defaultSocketFactory != null && lastVersion == Security.getVersion()) { return defaultSocketFactory; } lastVersion = Security.getVersion(); SSLSocketFactory previousDefaultSocketFactory = defaultSocketFactory; defaultSocketFactory = null; String clsName = getSecurityProperty("ssl.SocketFactory.provider"); if (clsName != null) { // The instance for the default socket factory is checked for updates quite // often (for instance, every time a security provider is added). Which leads // to unnecessary overload and excessive error messages in case of class-loading // errors. Avoid creating a new object if the class name is the same as before. if (previousDefaultSocketFactory != null && clsName.equals(previousDefaultSocketFactory.getClass().getName())) { defaultSocketFactory = previousDefaultSocketFactory; return defaultSocketFactory; } log("setting up default SSLSocketFactory"); try { Class cls = null; try { cls = Class.forName(clsName); } catch (ClassNotFoundException e) { // Android-changed; Try the contextClassLoader first. ClassLoader cl = Thread.currentThread().getContextClassLoader(); if (cl == null) { cl = ClassLoader.getSystemClassLoader(); } if (cl != null) { cls = Class.forName(clsName, true, cl); } } log("class " + clsName + " is loaded"); defaultSocketFactory = (SSLSocketFactory)cls.newInstance(); log("instantiated an instance of class " + clsName); if (defaultSocketFactory != null) { return defaultSocketFactory; } } catch (Exception e) { log("SSLSocketFactory instantiation failed: " + e.toString()); } } // Android-changed: Allow for {@code null} SSLContext.getDefault. try { SSLContext context = SSLContext.getDefault(); if (context != null) { defaultSocketFactory = context.getSocketFactory(); } } catch (NoSuchAlgorithmException e) { } if (defaultSocketFactory == null) { defaultSocketFactory = new DefaultSSLSocketFactory(new IllegalStateException("No factory found.")); } return defaultSocketFactory; }
[ "public", "static", "synchronized", "SocketFactory", "getDefault", "(", ")", "{", "// Android-changed: Use security version instead of propertyChecked.", "if", "(", "defaultSocketFactory", "!=", "null", "&&", "lastVersion", "==", "Security", ".", "getVersion", "(", ")", "...
Returns the default SSL socket factory. <p>The first time this method is called, the security property "ssl.SocketFactory.provider" is examined. If it is non-null, a class by that name is loaded and instantiated. If that is successful and the object is an instance of SSLSocketFactory, it is made the default SSL socket factory. <p>Otherwise, this method returns <code>SSLContext.getDefault().getSocketFactory()</code>. If that call fails, an inoperative factory is returned. @return the default <code>SocketFactory</code> @see SSLContext#getDefault
[ "Returns", "the", "default", "SSL", "socket", "factory", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/ojluni/src/main/java/javax/net/ssl/SSLSocketFactory.java#L88-L151
35,178
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.getVisibleIDMap
private Map<String, Factory> getVisibleIDMap() { synchronized (this) { // or idcache-only lock? if (idcache == null) { try { factoryLock.acquireRead(); Map<String, Factory> mutableMap = new HashMap<String, Factory>(); ListIterator<Factory> lIter = factories.listIterator(factories.size()); while (lIter.hasPrevious()) { Factory f = lIter.previous(); f.updateVisibleIDs(mutableMap); } this.idcache = Collections.unmodifiableMap(mutableMap); } finally { factoryLock.releaseRead(); } } } return idcache; }
java
private Map<String, Factory> getVisibleIDMap() { synchronized (this) { // or idcache-only lock? if (idcache == null) { try { factoryLock.acquireRead(); Map<String, Factory> mutableMap = new HashMap<String, Factory>(); ListIterator<Factory> lIter = factories.listIterator(factories.size()); while (lIter.hasPrevious()) { Factory f = lIter.previous(); f.updateVisibleIDs(mutableMap); } this.idcache = Collections.unmodifiableMap(mutableMap); } finally { factoryLock.releaseRead(); } } } return idcache; }
[ "private", "Map", "<", "String", ",", "Factory", ">", "getVisibleIDMap", "(", ")", "{", "synchronized", "(", "this", ")", "{", "// or idcache-only lock?", "if", "(", "idcache", "==", "null", ")", "{", "try", "{", "factoryLock", ".", "acquireRead", "(", ")"...
Return a map from visible ids to factories.
[ "Return", "a", "map", "from", "visible", "ids", "to", "factories", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L586-L604
35,179
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.getDisplayName
public String getDisplayName(String id, ULocale locale) { Map<String, Factory> m = getVisibleIDMap(); Factory f = m.get(id); if (f != null) { return f.getDisplayName(id, locale); } Key key = createKey(id); while (key.fallback()) { f = m.get(key.currentID()); if (f != null) { return f.getDisplayName(id, locale); } } return null; }
java
public String getDisplayName(String id, ULocale locale) { Map<String, Factory> m = getVisibleIDMap(); Factory f = m.get(id); if (f != null) { return f.getDisplayName(id, locale); } Key key = createKey(id); while (key.fallback()) { f = m.get(key.currentID()); if (f != null) { return f.getDisplayName(id, locale); } } return null; }
[ "public", "String", "getDisplayName", "(", "String", "id", ",", "ULocale", "locale", ")", "{", "Map", "<", "String", ",", "Factory", ">", "m", "=", "getVisibleIDMap", "(", ")", ";", "Factory", "f", "=", "m", ".", "get", "(", "id", ")", ";", "if", "...
Given a visible id, return the display name in the requested locale. If there is no directly supported id corresponding to this id, return null.
[ "Given", "a", "visible", "id", "return", "the", "display", "name", "in", "the", "requested", "locale", ".", "If", "there", "is", "no", "directly", "supported", "id", "corresponding", "to", "this", "id", "return", "null", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L620-L636
35,180
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.getDisplayNames
public SortedMap<String, String> getDisplayNames(ULocale locale, Comparator<Object> com, String matchID) { SortedMap<String, String> dncache = null; LocaleRef ref = dnref; if (ref != null) { dncache = ref.get(locale, com); } while (dncache == null) { synchronized (this) { if (ref == dnref || dnref == null) { dncache = new TreeMap<String, String>(com); // sorted Map<String, Factory> m = getVisibleIDMap(); Iterator<Entry<String, Factory>> ei = m.entrySet().iterator(); while (ei.hasNext()) { Entry<String, Factory> e = ei.next(); String id = e.getKey(); Factory f = e.getValue(); dncache.put(f.getDisplayName(id, locale), id); } dncache = Collections.unmodifiableSortedMap(dncache); dnref = new LocaleRef(dncache, locale, com); } else { ref = dnref; dncache = ref.get(locale, com); } } } Key matchKey = createKey(matchID); if (matchKey == null) { return dncache; } SortedMap<String, String> result = new TreeMap<String, String>(dncache); Iterator<Entry<String, String>> iter = result.entrySet().iterator(); while (iter.hasNext()) { Entry<String, String> e = iter.next(); if (!matchKey.isFallbackOf(e.getValue())) { iter.remove(); } } return result; }
java
public SortedMap<String, String> getDisplayNames(ULocale locale, Comparator<Object> com, String matchID) { SortedMap<String, String> dncache = null; LocaleRef ref = dnref; if (ref != null) { dncache = ref.get(locale, com); } while (dncache == null) { synchronized (this) { if (ref == dnref || dnref == null) { dncache = new TreeMap<String, String>(com); // sorted Map<String, Factory> m = getVisibleIDMap(); Iterator<Entry<String, Factory>> ei = m.entrySet().iterator(); while (ei.hasNext()) { Entry<String, Factory> e = ei.next(); String id = e.getKey(); Factory f = e.getValue(); dncache.put(f.getDisplayName(id, locale), id); } dncache = Collections.unmodifiableSortedMap(dncache); dnref = new LocaleRef(dncache, locale, com); } else { ref = dnref; dncache = ref.get(locale, com); } } } Key matchKey = createKey(matchID); if (matchKey == null) { return dncache; } SortedMap<String, String> result = new TreeMap<String, String>(dncache); Iterator<Entry<String, String>> iter = result.entrySet().iterator(); while (iter.hasNext()) { Entry<String, String> e = iter.next(); if (!matchKey.isFallbackOf(e.getValue())) { iter.remove(); } } return result; }
[ "public", "SortedMap", "<", "String", ",", "String", ">", "getDisplayNames", "(", "ULocale", "locale", ",", "Comparator", "<", "Object", ">", "com", ",", "String", "matchID", ")", "{", "SortedMap", "<", "String", ",", "String", ">", "dncache", "=", "null",...
Return a snapshot of the mapping from display names to visible IDs for this service. This set will not change as factories are added or removed, but the supported ids will, so there is no guarantee that all and only the ids in the returned map will be visible and supported by the service in subsequent calls, nor is there any guarantee that the current display names match those in the set. The display names are sorted based on the comparator provided.
[ "Return", "a", "snapshot", "of", "the", "mapping", "from", "display", "names", "to", "visible", "IDs", "for", "this", "service", ".", "This", "set", "will", "not", "change", "as", "factories", "are", "added", "or", "removed", "but", "the", "supported", "id...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L682-L727
35,181
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.factories
public final List<Factory> factories() { try { factoryLock.acquireRead(); return new ArrayList<Factory>(factories); } finally{ factoryLock.releaseRead(); } }
java
public final List<Factory> factories() { try { factoryLock.acquireRead(); return new ArrayList<Factory>(factories); } finally{ factoryLock.releaseRead(); } }
[ "public", "final", "List", "<", "Factory", ">", "factories", "(", ")", "{", "try", "{", "factoryLock", ".", "acquireRead", "(", ")", ";", "return", "new", "ArrayList", "<", "Factory", ">", "(", "factories", ")", ";", "}", "finally", "{", "factoryLock", ...
Return a snapshot of the currently registered factories. There is no guarantee that the list will still match the current factory list of the service subsequent to this call.
[ "Return", "a", "snapshot", "of", "the", "currently", "registered", "factories", ".", "There", "is", "no", "guarantee", "that", "the", "list", "will", "still", "match", "the", "current", "factory", "list", "of", "the", "service", "subsequent", "to", "this", "...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L761-L769
35,182
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.registerObject
public Factory registerObject(Object obj, String id, boolean visible) { String canonicalID = createKey(id).canonicalID(); return registerFactory(new SimpleFactory(obj, canonicalID, visible)); }
java
public Factory registerObject(Object obj, String id, boolean visible) { String canonicalID = createKey(id).canonicalID(); return registerFactory(new SimpleFactory(obj, canonicalID, visible)); }
[ "public", "Factory", "registerObject", "(", "Object", "obj", ",", "String", "id", ",", "boolean", "visible", ")", "{", "String", "canonicalID", "=", "createKey", "(", "id", ")", ".", "canonicalID", "(", ")", ";", "return", "registerFactory", "(", "new", "S...
Register an object with the provided id. The id will be canonicalized. The canonicalized ID will be returned by getVisibleIDs if visible is true.
[ "Register", "an", "object", "with", "the", "provided", "id", ".", "The", "id", "will", "be", "canonicalized", ".", "The", "canonicalized", "ID", "will", "be", "returned", "by", "getVisibleIDs", "if", "visible", "is", "true", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L784-L787
35,183
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.registerFactory
public final Factory registerFactory(Factory factory) { if (factory == null) { throw new NullPointerException(); } try { factoryLock.acquireWrite(); factories.add(0, factory); clearCaches(); } finally { factoryLock.releaseWrite(); } notifyChanged(); return factory; }
java
public final Factory registerFactory(Factory factory) { if (factory == null) { throw new NullPointerException(); } try { factoryLock.acquireWrite(); factories.add(0, factory); clearCaches(); } finally { factoryLock.releaseWrite(); } notifyChanged(); return factory; }
[ "public", "final", "Factory", "registerFactory", "(", "Factory", "factory", ")", "{", "if", "(", "factory", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "try", "{", "factoryLock", ".", "acquireWrite", "(", ")", ";", ...
Register a Factory. Returns the factory if the service accepts the factory, otherwise returns null. The default implementation accepts all factories.
[ "Register", "a", "Factory", ".", "Returns", "the", "factory", "if", "the", "service", "accepts", "the", "factory", "otherwise", "returns", "null", ".", "The", "default", "implementation", "accepts", "all", "factories", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L794-L808
35,184
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.unregisterFactory
public final boolean unregisterFactory(Factory factory) { if (factory == null) { throw new NullPointerException(); } boolean result = false; try { factoryLock.acquireWrite(); if (factories.remove(factory)) { result = true; clearCaches(); } } finally { factoryLock.releaseWrite(); } if (result) { notifyChanged(); } return result; }
java
public final boolean unregisterFactory(Factory factory) { if (factory == null) { throw new NullPointerException(); } boolean result = false; try { factoryLock.acquireWrite(); if (factories.remove(factory)) { result = true; clearCaches(); } } finally { factoryLock.releaseWrite(); } if (result) { notifyChanged(); } return result; }
[ "public", "final", "boolean", "unregisterFactory", "(", "Factory", "factory", ")", "{", "if", "(", "factory", "==", "null", ")", "{", "throw", "new", "NullPointerException", "(", ")", ";", "}", "boolean", "result", "=", "false", ";", "try", "{", "factoryLo...
Unregister a factory. The first matching registered factory will be removed from the list. Returns true if a matching factory was removed.
[ "Unregister", "a", "factory", ".", "The", "first", "matching", "registered", "factory", "will", "be", "removed", "from", "the", "list", ".", "Returns", "true", "if", "a", "matching", "factory", "was", "removed", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L815-L836
35,185
google/j2objc
jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java
ICUService.stats
public String stats() { ICURWLock.Stats stats = factoryLock.resetStats(); if (stats != null) { return stats.toString(); } return "no stats"; }
java
public String stats() { ICURWLock.Stats stats = factoryLock.resetStats(); if (stats != null) { return stats.toString(); } return "no stats"; }
[ "public", "String", "stats", "(", ")", "{", "ICURWLock", ".", "Stats", "stats", "=", "factoryLock", ".", "resetStats", "(", ")", ";", "if", "(", "stats", "!=", "null", ")", "{", "return", "stats", ".", "toString", "(", ")", ";", "}", "return", "\"no ...
When the statistics for this service is already enabled, return the log and resets he statistics. When the statistics is not enabled, this method enable the statistics. Used for debugging purposes.
[ "When", "the", "statistics", "for", "this", "service", "is", "already", "enabled", "return", "the", "log", "and", "resets", "he", "statistics", ".", "When", "the", "statistics", "is", "not", "enabled", "this", "method", "enable", "the", "statistics", ".", "U...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/external/icu/android_icu4j/src/main/java/android/icu/impl/ICUService.java#L952-L958
35,186
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.calcTargetString
public void calcTargetString() { int whatToShow = getWhatToShow(); switch (whatToShow) { case DTMFilter.SHOW_COMMENT : m_targetString = PsuedoNames.PSEUDONAME_COMMENT; break; case DTMFilter.SHOW_TEXT : case DTMFilter.SHOW_CDATA_SECTION : case (DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION) : m_targetString = PsuedoNames.PSEUDONAME_TEXT; break; case DTMFilter.SHOW_ALL : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; case DTMFilter.SHOW_DOCUMENT : case DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT : m_targetString = PsuedoNames.PSEUDONAME_ROOT; break; case DTMFilter.SHOW_ELEMENT : if (this.WILD == m_name) m_targetString = PsuedoNames.PSEUDONAME_ANY; else m_targetString = m_name; break; default : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; } }
java
public void calcTargetString() { int whatToShow = getWhatToShow(); switch (whatToShow) { case DTMFilter.SHOW_COMMENT : m_targetString = PsuedoNames.PSEUDONAME_COMMENT; break; case DTMFilter.SHOW_TEXT : case DTMFilter.SHOW_CDATA_SECTION : case (DTMFilter.SHOW_TEXT | DTMFilter.SHOW_CDATA_SECTION) : m_targetString = PsuedoNames.PSEUDONAME_TEXT; break; case DTMFilter.SHOW_ALL : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; case DTMFilter.SHOW_DOCUMENT : case DTMFilter.SHOW_DOCUMENT | DTMFilter.SHOW_DOCUMENT_FRAGMENT : m_targetString = PsuedoNames.PSEUDONAME_ROOT; break; case DTMFilter.SHOW_ELEMENT : if (this.WILD == m_name) m_targetString = PsuedoNames.PSEUDONAME_ANY; else m_targetString = m_name; break; default : m_targetString = PsuedoNames.PSEUDONAME_ANY; break; } }
[ "public", "void", "calcTargetString", "(", ")", "{", "int", "whatToShow", "=", "getWhatToShow", "(", ")", ";", "switch", "(", "whatToShow", ")", "{", "case", "DTMFilter", ".", "SHOW_COMMENT", ":", "m_targetString", "=", "PsuedoNames", ".", "PSEUDONAME_COMMENT", ...
Calculate the local name or psuedo name of the node that this pattern will test, for hash table lookup optimization. @see org.apache.xpath.compiler.PsuedoNames
[ "Calculate", "the", "local", "name", "or", "psuedo", "name", "of", "the", "node", "that", "this", "pattern", "will", "test", "for", "hash", "table", "lookup", "optimization", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L93-L125
35,187
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.setPredicates
public void setPredicates(Expression[] predicates) { m_predicates = predicates; if(null != predicates) { for(int i = 0; i < predicates.length; i++) { predicates[i].exprSetParent(this); } } calcScore(); }
java
public void setPredicates(Expression[] predicates) { m_predicates = predicates; if(null != predicates) { for(int i = 0; i < predicates.length; i++) { predicates[i].exprSetParent(this); } } calcScore(); }
[ "public", "void", "setPredicates", "(", "Expression", "[", "]", "predicates", ")", "{", "m_predicates", "=", "predicates", ";", "if", "(", "null", "!=", "predicates", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "predicates", ".", "length...
Set the predicates for this match pattern step. @param predicates An array of expressions that define predicates for this step.
[ "Set", "the", "predicates", "for", "this", "match", "pattern", "step", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L283-L296
35,188
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.calcScore
public void calcScore() { if ((getPredicateCount() > 0) || (null != m_relativePathPattern)) { m_score = SCORE_OTHER; } else super.calcScore(); if (null == m_targetString) calcTargetString(); }
java
public void calcScore() { if ((getPredicateCount() > 0) || (null != m_relativePathPattern)) { m_score = SCORE_OTHER; } else super.calcScore(); if (null == m_targetString) calcTargetString(); }
[ "public", "void", "calcScore", "(", ")", "{", "if", "(", "(", "getPredicateCount", "(", ")", ">", "0", ")", "||", "(", "null", "!=", "m_relativePathPattern", ")", ")", "{", "m_score", "=", "SCORE_OTHER", ";", "}", "else", "super", ".", "calcScore", "("...
Static calc of match score.
[ "Static", "calc", "of", "match", "score", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L301-L313
35,189
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.checkProximityPosition
private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); }
java
private final boolean checkProximityPosition(XPathContext xctxt, int predPos, DTM dtm, int context, int pos) { try { DTMAxisTraverser traverser = dtm.getAxisTraverser(Axis.PRECEDINGSIBLING); for (int child = traverser.first(context); DTM.NULL != child; child = traverser.next(context, child)) { try { xctxt.pushCurrentNode(child); if (NodeTest.SCORE_NONE != super.execute(xctxt, child)) { boolean pass = true; try { xctxt.pushSubContextList(this); for (int i = 0; i < predPos; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { throw new Error("Why: Should never have been called"); } else if (!pred.boolWithSideEffects()) { pass = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } if (pass) pos--; if (pos < 1) return false; } } finally { xctxt.popCurrentNode(); } } } catch (javax.xml.transform.TransformerException se) { // TODO: should keep throw sax exception... throw new java.lang.RuntimeException(se.getMessage()); } return (pos == 1); }
[ "private", "final", "boolean", "checkProximityPosition", "(", "XPathContext", "xctxt", ",", "int", "predPos", ",", "DTM", "dtm", ",", "int", "context", ",", "int", "pos", ")", "{", "try", "{", "DTMAxisTraverser", "traverser", "=", "dtm", ".", "getAxisTraverser...
New Method to check whether the current node satisfies a position predicate @param xctxt The XPath runtime context. @param predPos Which predicate we're evaluating of foo[1][2][3]. @param dtm The DTM of the current node. @param context The currentNode. @param pos The position being requested, i.e. the value returned by m_predicates[predPos].execute(xctxt). @return true of the position of the context matches pos, false otherwise.
[ "New", "Method", "to", "check", "whether", "the", "current", "node", "satisfies", "a", "position", "predicate" ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L428-L509
35,190
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.executePredicates
protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
java
protected final boolean executePredicates( XPathContext xctxt, DTM dtm, int currentNode) throws javax.xml.transform.TransformerException { boolean result = true; boolean positionAlreadySeen = false; int n = getPredicateCount(); try { xctxt.pushSubContextList(this); for (int i = 0; i < n; i++) { xctxt.pushPredicatePos(i); try { XObject pred = m_predicates[i].execute(xctxt); try { if (XObject.CLASS_NUMBER == pred.getType()) { int pos = (int) pred.num(); if (positionAlreadySeen) { result = (pos == 1); break; } else { positionAlreadySeen = true; if (!checkProximityPosition(xctxt, i, dtm, currentNode, pos)) { result = false; break; } } } else if (!pred.boolWithSideEffects()) { result = false; break; } } finally { pred.detach(); } } finally { xctxt.popPredicatePos(); } } } finally { xctxt.popSubContextList(); } return result; }
[ "protected", "final", "boolean", "executePredicates", "(", "XPathContext", "xctxt", ",", "DTM", "dtm", ",", "int", "currentNode", ")", "throws", "javax", ".", "xml", ".", "transform", ".", "TransformerException", "{", "boolean", "result", "=", "true", ";", "bo...
Execute the predicates on this step to determine if the current node should be filtered or accepted. @param xctxt The XPath runtime context. @param dtm The DTM of the current node. @param currentNode The current node context. @return true if the node should be accepted, false otherwise. @throws javax.xml.transform.TransformerException
[ "Execute", "the", "predicates", "on", "this", "step", "to", "determine", "if", "the", "current", "node", "should", "be", "filtered", "or", "accepted", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L708-L778
35,191
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java
StepPattern.callSubtreeVisitors
protected void callSubtreeVisitors(XPathVisitor visitor) { if (null != m_predicates) { int n = m_predicates.length; for (int i = 0; i < n; i++) { ExpressionOwner predOwner = new PredOwner(i); if (visitor.visitPredicate(predOwner, m_predicates[i])) { m_predicates[i].callVisitors(predOwner, visitor); } } } if (null != m_relativePathPattern) { m_relativePathPattern.callVisitors(this, visitor); } }
java
protected void callSubtreeVisitors(XPathVisitor visitor) { if (null != m_predicates) { int n = m_predicates.length; for (int i = 0; i < n; i++) { ExpressionOwner predOwner = new PredOwner(i); if (visitor.visitPredicate(predOwner, m_predicates[i])) { m_predicates[i].callVisitors(predOwner, visitor); } } } if (null != m_relativePathPattern) { m_relativePathPattern.callVisitors(this, visitor); } }
[ "protected", "void", "callSubtreeVisitors", "(", "XPathVisitor", "visitor", ")", "{", "if", "(", "null", "!=", "m_predicates", ")", "{", "int", "n", "=", "m_predicates", ".", "length", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n", ";", "...
Call the visitors on the subtree. Factored out from callVisitors so it may be called by derived classes.
[ "Call", "the", "visitors", "on", "the", "subtree", ".", "Factored", "out", "from", "callVisitors", "so", "it", "may", "be", "called", "by", "derived", "classes", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xpath/patterns/StepPattern.java#L979-L997
35,192
google/j2objc
jre_emul/android/platform/libcore/luni/src/main/java/java/nio/NioUtils.java
NioUtils.newFileChannel
public static FileChannel newFileChannel(Closeable ioObject, FileDescriptor fd, int mode) { ChannelFactory factory = ChannelFactory.INSTANCE; if (factory == null) { throw new LibraryNotLinkedError("Channel support", "jre_channels", "JavaNioChannelFactoryImpl"); } return factory.newFileChannel(ioObject, fd, mode); }
java
public static FileChannel newFileChannel(Closeable ioObject, FileDescriptor fd, int mode) { ChannelFactory factory = ChannelFactory.INSTANCE; if (factory == null) { throw new LibraryNotLinkedError("Channel support", "jre_channels", "JavaNioChannelFactoryImpl"); } return factory.newFileChannel(ioObject, fd, mode); }
[ "public", "static", "FileChannel", "newFileChannel", "(", "Closeable", "ioObject", ",", "FileDescriptor", "fd", ",", "int", "mode", ")", "{", "ChannelFactory", "factory", "=", "ChannelFactory", ".", "INSTANCE", ";", "if", "(", "factory", "==", "null", ")", "{"...
Helps bridge between io and nio.
[ "Helps", "bridge", "between", "io", "and", "nio", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/jre_emul/android/platform/libcore/luni/src/main/java/java/nio/NioUtils.java#L61-L68
35,193
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.recompose
public void recompose() throws TransformerException { // Now we make a Vector that is going to hold all of the recomposable elements Vector recomposableElements = new Vector(); // First, we build the global import tree. if (null == m_globalImportList) { Vector importList = new Vector(); addImports(this, true, importList); // Now we create an array and reverse the order of the importList vector. // We built the importList vector backwards so that we could use addElement // to append to the end of the vector instead of constantly pushing new // stylesheets onto the front of the vector and having to shift the rest // of the vector each time. m_globalImportList = new StylesheetComposed[importList.size()]; for (int i = 0, j= importList.size() -1; i < importList.size(); i++) { m_globalImportList[j] = (StylesheetComposed) importList.elementAt(i); // Build the global include list for this stylesheet. // This needs to be done ahead of the recomposeImports // because we need the info from the composed includes. m_globalImportList[j].recomposeIncludes(m_globalImportList[j]); // Calculate the number of this import. m_globalImportList[j--].recomposeImports(); } } // Next, we walk the import tree and add all of the recomposable elements to the vector. int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = getGlobalImport(i); imported.recompose(recomposableElements); } // We sort the elements into ascending order. QuickSort2(recomposableElements, 0, recomposableElements.size() - 1); // We set up the global variables that will hold the recomposed information. m_outputProperties = new OutputProperties(org.apache.xml.serializer.Method.UNKNOWN); // m_outputProperties = new OutputProperties(Method.XML); m_attrSets = new HashMap(); m_decimalFormatSymbols = new Hashtable(); m_keyDecls = new Vector(); m_namespaceAliasComposed = new Hashtable(); m_templateList = new TemplateList(); m_variables = new Vector(); // Now we sequence through the sorted elements, // calling the recompose() function on each one. This will call back into the // appropriate routine here to actually do the recomposition. // Note that we're going backwards, encountering the highest precedence items first. for (int i = recomposableElements.size() - 1; i >= 0; i--) ((ElemTemplateElement) recomposableElements.elementAt(i)).recompose(this); /* * Backing out REE again, as it seems to cause some new failures * which need to be investigated. -is */ // This has to be done before the initialization of the compose state, because // eleminateRedundentGlobals will add variables to the m_variables vector, which // it then copied in the ComposeState constructor. // if(true && org.apache.xalan.processor.TransformerFactoryImpl.m_optimize) // { // RedundentExprEliminator ree = new RedundentExprEliminator(); // callVisitors(ree); // ree.eleminateRedundentGlobals(this); // } initComposeState(); // Need final composition of TemplateList. This adds the wild cards onto the chains. m_templateList.compose(this); // Need to clear check for properties at the same import level. m_outputProperties.compose(this); m_outputProperties.endCompose(this); // Now call the compose() method on every element to give it a chance to adjust // based on composed values. n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = this.getGlobalImport(i); int includedCount = imported.getIncludeCountComposed(); for (int j = -1; j < includedCount; j++) { Stylesheet included = imported.getIncludeComposed(j); composeTemplates(included); } } // Attempt to register any remaining unregistered extension namespaces. if (m_extNsMgr != null) m_extNsMgr.registerUnregisteredNamespaces(); clearComposeState(); }
java
public void recompose() throws TransformerException { // Now we make a Vector that is going to hold all of the recomposable elements Vector recomposableElements = new Vector(); // First, we build the global import tree. if (null == m_globalImportList) { Vector importList = new Vector(); addImports(this, true, importList); // Now we create an array and reverse the order of the importList vector. // We built the importList vector backwards so that we could use addElement // to append to the end of the vector instead of constantly pushing new // stylesheets onto the front of the vector and having to shift the rest // of the vector each time. m_globalImportList = new StylesheetComposed[importList.size()]; for (int i = 0, j= importList.size() -1; i < importList.size(); i++) { m_globalImportList[j] = (StylesheetComposed) importList.elementAt(i); // Build the global include list for this stylesheet. // This needs to be done ahead of the recomposeImports // because we need the info from the composed includes. m_globalImportList[j].recomposeIncludes(m_globalImportList[j]); // Calculate the number of this import. m_globalImportList[j--].recomposeImports(); } } // Next, we walk the import tree and add all of the recomposable elements to the vector. int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = getGlobalImport(i); imported.recompose(recomposableElements); } // We sort the elements into ascending order. QuickSort2(recomposableElements, 0, recomposableElements.size() - 1); // We set up the global variables that will hold the recomposed information. m_outputProperties = new OutputProperties(org.apache.xml.serializer.Method.UNKNOWN); // m_outputProperties = new OutputProperties(Method.XML); m_attrSets = new HashMap(); m_decimalFormatSymbols = new Hashtable(); m_keyDecls = new Vector(); m_namespaceAliasComposed = new Hashtable(); m_templateList = new TemplateList(); m_variables = new Vector(); // Now we sequence through the sorted elements, // calling the recompose() function on each one. This will call back into the // appropriate routine here to actually do the recomposition. // Note that we're going backwards, encountering the highest precedence items first. for (int i = recomposableElements.size() - 1; i >= 0; i--) ((ElemTemplateElement) recomposableElements.elementAt(i)).recompose(this); /* * Backing out REE again, as it seems to cause some new failures * which need to be investigated. -is */ // This has to be done before the initialization of the compose state, because // eleminateRedundentGlobals will add variables to the m_variables vector, which // it then copied in the ComposeState constructor. // if(true && org.apache.xalan.processor.TransformerFactoryImpl.m_optimize) // { // RedundentExprEliminator ree = new RedundentExprEliminator(); // callVisitors(ree); // ree.eleminateRedundentGlobals(this); // } initComposeState(); // Need final composition of TemplateList. This adds the wild cards onto the chains. m_templateList.compose(this); // Need to clear check for properties at the same import level. m_outputProperties.compose(this); m_outputProperties.endCompose(this); // Now call the compose() method on every element to give it a chance to adjust // based on composed values. n = getGlobalImportCount(); for (int i = 0; i < n; i++) { StylesheetComposed imported = this.getGlobalImport(i); int includedCount = imported.getIncludeCountComposed(); for (int j = -1; j < includedCount; j++) { Stylesheet included = imported.getIncludeComposed(j); composeTemplates(included); } } // Attempt to register any remaining unregistered extension namespaces. if (m_extNsMgr != null) m_extNsMgr.registerUnregisteredNamespaces(); clearComposeState(); }
[ "public", "void", "recompose", "(", ")", "throws", "TransformerException", "{", "// Now we make a Vector that is going to hold all of the recomposable elements", "Vector", "recomposableElements", "=", "new", "Vector", "(", ")", ";", "// First, we build the global import tree.", "...
Recompose the values of all "composed" properties, meaning properties that need to be combined or calculated from the combination of imported and included stylesheets. This method determines the proper import precedence of all imported stylesheets. It then iterates through all of the elements and properties in the proper order and triggers the individual recompose methods. @throws TransformerException
[ "Recompose", "the", "values", "of", "all", "composed", "properties", "meaning", "properties", "that", "need", "to", "be", "combined", "or", "calculated", "from", "the", "combination", "of", "imported", "and", "included", "stylesheets", ".", "This", "method", "de...
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L238-L349
35,194
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.composeTemplates
void composeTemplates(ElemTemplateElement templ) throws TransformerException { templ.compose(this); for (ElemTemplateElement child = templ.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { composeTemplates(child); } templ.endCompose(this); }
java
void composeTemplates(ElemTemplateElement templ) throws TransformerException { templ.compose(this); for (ElemTemplateElement child = templ.getFirstChildElem(); child != null; child = child.getNextSiblingElem()) { composeTemplates(child); } templ.endCompose(this); }
[ "void", "composeTemplates", "(", "ElemTemplateElement", "templ", ")", "throws", "TransformerException", "{", "templ", ".", "compose", "(", "this", ")", ";", "for", "(", "ElemTemplateElement", "child", "=", "templ", ".", "getFirstChildElem", "(", ")", ";", "child...
Call the compose function for each ElemTemplateElement. @param templ non-null reference to template element that will have the composed method called on it, and will have it's children's composed methods called.
[ "Call", "the", "compose", "function", "for", "each", "ElemTemplateElement", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L358-L370
35,195
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.getImportNumber
public int getImportNumber(StylesheetComposed sheet) { if (this == sheet) return 0; int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { if (sheet == getGlobalImport(i)) return i; } return -1; }
java
public int getImportNumber(StylesheetComposed sheet) { if (this == sheet) return 0; int n = getGlobalImportCount(); for (int i = 0; i < n; i++) { if (sheet == getGlobalImport(i)) return i; } return -1; }
[ "public", "int", "getImportNumber", "(", "StylesheetComposed", "sheet", ")", "{", "if", "(", "this", "==", "sheet", ")", "return", "0", ";", "int", "n", "=", "getGlobalImportCount", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "n",...
Given a stylesheet, return the number of the stylesheet in the global import list. @param sheet The stylesheet which will be located in the global import list. @return The index into the global import list of the given stylesheet, or -1 if it is not found (which should never happen).
[ "Given", "a", "stylesheet", "return", "the", "number", "of", "the", "stylesheet", "in", "the", "global", "import", "list", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L469-L484
35,196
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.recomposeAttributeSets
void recomposeAttributeSets(ElemAttributeSet attrSet) { ArrayList attrSetList = (ArrayList) m_attrSets.get(attrSet.getName()); if (null == attrSetList) { attrSetList = new ArrayList(); m_attrSets.put(attrSet.getName(), attrSetList); } attrSetList.add(attrSet); }
java
void recomposeAttributeSets(ElemAttributeSet attrSet) { ArrayList attrSetList = (ArrayList) m_attrSets.get(attrSet.getName()); if (null == attrSetList) { attrSetList = new ArrayList(); m_attrSets.put(attrSet.getName(), attrSetList); } attrSetList.add(attrSet); }
[ "void", "recomposeAttributeSets", "(", "ElemAttributeSet", "attrSet", ")", "{", "ArrayList", "attrSetList", "=", "(", "ArrayList", ")", "m_attrSets", ".", "get", "(", "attrSet", ".", "getName", "(", ")", ")", ";", "if", "(", "null", "==", "attrSetList", ")",...
Recompose the attribute-set declarations. @param attrSet An attribute-set to add to the hashtable of attribute sets.
[ "Recompose", "the", "attribute", "-", "set", "declarations", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L551-L563
35,197
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.recomposeDecimalFormats
void recomposeDecimalFormats(DecimalFormatProperties dfp) { DecimalFormatSymbols oldDfs = (DecimalFormatSymbols) m_decimalFormatSymbols.get(dfp.getName()); if (null == oldDfs) { m_decimalFormatSymbols.put(dfp.getName(), dfp.getDecimalFormatSymbols()); } else if (!dfp.getDecimalFormatSymbols().equals(oldDfs)) { String themsg; if (dfp.getName().equals(new QName(""))) { // "Only one default xsl:decimal-format declaration is allowed." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED, new Object[0]); } else { // "xsl:decimal-format names must be unique. Name {0} has been duplicated." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE, new Object[] {dfp.getName()}); } error(themsg); // Should we throw TransformerException instead? } }
java
void recomposeDecimalFormats(DecimalFormatProperties dfp) { DecimalFormatSymbols oldDfs = (DecimalFormatSymbols) m_decimalFormatSymbols.get(dfp.getName()); if (null == oldDfs) { m_decimalFormatSymbols.put(dfp.getName(), dfp.getDecimalFormatSymbols()); } else if (!dfp.getDecimalFormatSymbols().equals(oldDfs)) { String themsg; if (dfp.getName().equals(new QName(""))) { // "Only one default xsl:decimal-format declaration is allowed." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED, new Object[0]); } else { // "xsl:decimal-format names must be unique. Name {0} has been duplicated." themsg = XSLMessages.createWarning( XSLTErrorResources.WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE, new Object[] {dfp.getName()}); } error(themsg); // Should we throw TransformerException instead? } }
[ "void", "recomposeDecimalFormats", "(", "DecimalFormatProperties", "dfp", ")", "{", "DecimalFormatSymbols", "oldDfs", "=", "(", "DecimalFormatSymbols", ")", "m_decimalFormatSymbols", ".", "get", "(", "dfp", ".", "getName", "(", ")", ")", ";", "if", "(", "null", ...
Recompose the decimal-format declarations. @param dfp A DecimalFormatProperties to add to the hashtable of decimal formats.
[ "Recompose", "the", "decimal", "-", "format", "declarations", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L592-L621
35,198
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.recomposeVariables
void recomposeVariables(ElemVariable elemVar) { // Don't overide higher priority variable if (getVariableOrParamComposed(elemVar.getName()) == null) { elemVar.setIsTopLevel(true); // Mark as a top-level variable or param elemVar.setIndex(m_variables.size()); m_variables.addElement(elemVar); } }
java
void recomposeVariables(ElemVariable elemVar) { // Don't overide higher priority variable if (getVariableOrParamComposed(elemVar.getName()) == null) { elemVar.setIsTopLevel(true); // Mark as a top-level variable or param elemVar.setIndex(m_variables.size()); m_variables.addElement(elemVar); } }
[ "void", "recomposeVariables", "(", "ElemVariable", "elemVar", ")", "{", "// Don't overide higher priority variable ", "if", "(", "getVariableOrParamComposed", "(", "elemVar", ".", "getName", "(", ")", ")", "==", "null", ")", "{", "elemVar", ".", "setIsTopLevel"...
Recompose the top level variable and parameter declarations. @param elemVar A top level variable or parameter to be added to the Vector.
[ "Recompose", "the", "top", "level", "variable", "and", "parameter", "declarations", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L827-L836
35,199
google/j2objc
xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java
StylesheetRoot.recomposeWhiteSpaceInfo
void recomposeWhiteSpaceInfo(WhiteSpaceInfo wsi) { if (null == m_whiteSpaceInfoList) m_whiteSpaceInfoList = new TemplateList(); m_whiteSpaceInfoList.setTemplate(wsi); }
java
void recomposeWhiteSpaceInfo(WhiteSpaceInfo wsi) { if (null == m_whiteSpaceInfoList) m_whiteSpaceInfoList = new TemplateList(); m_whiteSpaceInfoList.setTemplate(wsi); }
[ "void", "recomposeWhiteSpaceInfo", "(", "WhiteSpaceInfo", "wsi", ")", "{", "if", "(", "null", "==", "m_whiteSpaceInfoList", ")", "m_whiteSpaceInfoList", "=", "new", "TemplateList", "(", ")", ";", "m_whiteSpaceInfoList", ".", "setTemplate", "(", "wsi", ")", ";", ...
Recompose the strip-space and preserve-space declarations. @param wsi A WhiteSpaceInfo element to add to the list of WhiteSpaceInfo elements.
[ "Recompose", "the", "strip", "-", "space", "and", "preserve", "-", "space", "declarations", "." ]
471504a735b48d5d4ace51afa1542cc4790a921a
https://github.com/google/j2objc/blob/471504a735b48d5d4ace51afa1542cc4790a921a/xalan/third_party/android/platform/external/apache-xml/src/main/java/org/apache/xalan/templates/StylesheetRoot.java#L886-L892